-// Keep a list of all toolbars created, so you can tell whether a toolbar
-// is still valid: a tool may have quit the toolbar.
-static wxList gs_ToolBars;
-
-#ifdef __WXGTK__
-wxToolBarTool::wxToolBarTool(wxToolBar *owner, int theIndex,
- const wxBitmap& theBitmap1, const wxBitmap& theBitmap2,
- bool toggle, wxObject *clientData,
- const wxString& helpS1, const wxString& helpS2,
- GtkWidget *pixmap )
-#else
-wxToolBarTool::wxToolBarTool(int theIndex,
- const wxBitmap& theBitmap1, const wxBitmap& theBitmap2, bool toggle,
- long xPos, long yPos, const wxString& helpS1, const wxString& helpS2)
-#endif
-{
- m_toolStyle = wxTOOL_STYLE_BUTTON;
-#ifdef __WXGTK__
- m_owner = owner;
- m_pixmap = pixmap;
- m_item = (GtkWidget*) NULL;
- m_clientData = clientData;
- m_x = 0;
- m_y = 0;
-#else
- m_clientData = NULL;
- m_x = xPos;
- m_y = yPos;
-#endif
- m_index = theIndex;
- m_isToggle = toggle;
- m_toggleState = FALSE;
- m_enabled = TRUE;
- m_bitmap1 = theBitmap1;
- m_bitmap2 = theBitmap2;
- m_width = m_height = 0;
- m_deleteSecondBitmap = FALSE;
- if (m_bitmap1.Ok())
- {
- m_width = m_bitmap1.GetWidth()+2;
- m_height = m_bitmap1.GetHeight()+2;
- }
- m_shortHelpString = helpS1;
- m_longHelpString = helpS2;
-}
-
-wxToolBarTool::~wxToolBarTool()
-{
-/*
- if (m_deleteSecondBitmap && m_bitmap2)
- delete m_bitmap2;
-*/
-}
-
-
-// class wxToolBar
-
-wxToolBarBase::wxToolBarBase(void) : m_tools(wxKEY_INTEGER)
-{
- gs_ToolBars.Append(this);
-
- m_maxRows = 1;
- m_maxCols = 32000;
- m_maxWidth = 0;
- m_maxHeight = 0;
- m_defaultWidth = 16;
- m_defaultHeight = 15;
- m_xMargin = 0;
- m_yMargin = 0;
- m_toolPacking = 1;
- m_toolSeparation = 5;
- m_currentTool = -1;
-
- m_xScrollPixelsPerLine = 0;
- m_yScrollPixelsPerLine = 0;
- m_xScrollingEnabled = TRUE;
- m_yScrollingEnabled = TRUE;
- m_xScrollPosition = 0;
- m_yScrollPosition = 0;
- m_calcScrolledOffset = TRUE;
- m_xScrollLines = 0;
- m_yScrollLines = 0;
- m_xScrollLinesPerPage = 0;
- m_yScrollLinesPerPage = 0;
-}
-
-wxToolBarBase::~wxToolBarBase ()
-{
- gs_ToolBars.DeleteObject(this);
-
- for ( wxNode *node = m_tools.First(); node; node = node->Next() )
- {
- wxToolBarTool *tool = (wxToolBarTool *)node->Data();
- delete tool;
- }
-}
-
-// Only allow toggle if returns TRUE
-bool wxToolBarBase::OnLeftClick(int toolIndex, bool toggleDown)
-{
- wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, toolIndex);
- event.SetEventObject(this);
- event.SetExtraLong((long) toggleDown);