X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aae0472bf3086707216125e4caa8650caeeeaf97..2296fe5018d42d4e0bf9df07c37d31f60d972b32:/src/motif/toolbar.cpp?ds=sidebyside diff --git a/src/motif/toolbar.cpp b/src/motif/toolbar.cpp index 0841393811..4c685aada7 100644 --- a/src/motif/toolbar.cpp +++ b/src/motif/toolbar.cpp @@ -17,10 +17,13 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "toolbar.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #ifdef __VMS #define XtDisplay XTDISPLAY #endif @@ -52,9 +55,7 @@ // wxWin macros // ---------------------------------------------------------------------------- -#if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase) -#endif +IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl) // ---------------------------------------------------------------------------- // private functions @@ -202,7 +203,7 @@ bool wxToolBar::Create(wxWindow *parent, { if( !wxControl::CreateControl( parent, id, pos, size, style, wxDefaultValidator, name ) ) - return FALSE; + return false; m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); @@ -229,7 +230,7 @@ bool wxToolBar::Create(wxWindow *parent, m_mainWidget = (WXWidget) toolbar; - ChangeFont(FALSE); + ChangeFont(false); wxPoint rPos = pos; wxSize rSize = size; @@ -239,13 +240,12 @@ bool wxToolBar::Create(wxWindow *parent, if( rSize.x == -1 && GetParent() ) rSize.x = GetParent()->GetSize().x; - SetCanAddEventHandler(TRUE); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, rPos.x, rPos.y, rSize.x, rSize.y); ChangeBackgroundColour(); - return TRUE; + return true; } wxToolBar::~wxToolBar() @@ -259,7 +259,7 @@ bool wxToolBar::Realize() if ( m_tools.GetCount() == 0 ) { // nothing to do - return TRUE; + return true; } bool isVertical = GetWindowStyle() & wxTB_VERTICAL; @@ -276,13 +276,11 @@ bool wxToolBar::Realize() int buttonHeight = 0, buttonWidth = 0; - int currentSpacing = 0; - Widget button; Pixmap pixmap, insensPixmap; wxBitmap bmp, insensBmp; - wxToolBarToolsList::Node *node = m_tools.GetFirst(); + wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); while ( node ) { wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); @@ -361,8 +359,8 @@ bool wxToolBar::Realize() if( !tool->GetButtonWidget() ) { - DoChangeBackgroundColour((WXWidget) button, - m_backgroundColour, TRUE); + wxDoChangeBackgroundColour((WXWidget) button, + m_backgroundColour, true); tool->SetWidget(button); } @@ -470,7 +468,6 @@ bool wxToolBar::Realize() XtAddEventHandler (button, EnterWindowMask | LeaveWindowMask, False, wxToolButtonPopupCallback, (XtPointer) this); - currentSpacing = 0; break; } @@ -481,7 +478,7 @@ bool wxToolBar::Realize() isVertical ? buttonWidth + 2 * marginX : -1, isVertical ? -1 : buttonHeight + 2*marginY ); - return TRUE; + return true; } wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x), @@ -496,7 +493,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool) { tool->Attach(this); - return TRUE; + return true; } bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) @@ -508,7 +505,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) int packing = GetToolPacking(); int offset = 0; - for( wxToolBarToolsList::Node *node = m_tools.GetFirst(); + for( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarTool *t = (wxToolBarTool*)node->GetData(); @@ -584,14 +581,18 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) } } - return TRUE; + return true; } void wxToolBar::DoEnableTool(wxToolBarToolBase *toolBase, bool enable) { wxToolBarTool *tool = (wxToolBarTool *)toolBase; - - XtSetSensitive(tool->GetButtonWidget(), (Boolean) enable); + if (tool->GetButtonWidget()){ + XtSetSensitive(tool->GetButtonWidget(), (Boolean) enable); + } else if (wxTOOL_STYLE_CONTROL == tool->GetStyle()){ + // Controls (such as wxChoice) do not have button widgets + tool->GetControl()->Enable(enable); + } } void wxToolBar::DoToggleTool(wxToolBarToolBase *toolBase, bool toggle) @@ -645,7 +646,7 @@ void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags) wxToolBarToolBase *wxToolBar::FindToolByWidget(WXWidget w) const { - wxToolBarToolsList::Node* node = m_tools.GetFirst(); + wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); while ( node ) { wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); @@ -717,7 +718,7 @@ static void wxToolButtonPopupCallback(Widget w, wxToolBarTimer::help_popup = (Widget) 0; // One shot - wxTheToolBarTimer->Start(delayMilli, TRUE); + wxTheToolBarTimer->Start(delayMilli, true); } /************************************************************/