+
+ if (tool->IsSeparator() && !HasFlag(wxTB_FLAT))
+ {
+ // Draw separators only in flat mode
+ continue;
+ }
+
+ // deal with the flags
+ int flags = 0;
+
+ if ( tool->IsEnabled() )
+ {
+ // The toolbars without wxTB_FLAT don't react to the mouse hovering
+ if ( !HasFlag(wxTB_FLAT) || tool->IsUnderMouse() )
+ flags |= wxCONTROL_CURRENT;
+ }
+ else // disabled tool
+ {
+ flags |= wxCONTROL_DISABLED;
+ }
+
+ //if ( tool == m_toolCaptured )
+ // flags |= wxCONTROL_FOCUSED;
+
+ if ( tool->IsPressed() )
+ flags = wxCONTROL_PRESSED;
+
+ wxString label;
+ wxBitmap bitmap;
+ if ( !tool->IsSeparator() )
+ {
+ // label = tool->GetLabel();
+ bitmap = tool->GetBitmap();
+ }
+ //else: leave both the label and the bitmap invalid to draw a separator
+
+ if ( !tool->IsControl() )
+ {
+ rend->DrawToolBarButton(dc, label, bitmap, rectTool, flags, tool->GetStyle());
+ }
+ else // control
+ {
+ wxControl *control = tool->GetControl();
+ control->Move(tool->m_x, tool->m_y);
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar actions
+// ----------------------------------------------------------------------------
+
+bool wxToolBar::PerformAction(const wxControlAction& action,
+ long numArg,
+ const wxString& strArg)
+{
+ wxToolBarTool *tool = (wxToolBarTool*) FindById(numArg);
+ if (!tool)
+ return false;
+
+ if ( action == wxACTION_TOOLBAR_TOGGLE )
+ {
+ PerformAction( wxACTION_BUTTON_RELEASE, numArg );
+
+ PerformAction( wxACTION_BUTTON_CLICK, numArg );
+ }
+ else if ( action == wxACTION_TOOLBAR_PRESS )
+ {
+ wxLogTrace(_T("toolbar"), _T("Button '%s' pressed."), tool->GetShortHelp().c_str());
+
+ tool->Invert();
+
+ RefreshTool( tool );
+ }
+ else if ( action == wxACTION_TOOLBAR_RELEASE )
+ {
+ wxLogTrace(_T("toolbar"), _T("Button '%s' released."), tool->GetShortHelp().c_str());
+
+ wxASSERT_MSG( tool->IsInverted(), _T("release unpressed button?") );
+
+ tool->Invert();
+
+ RefreshTool( tool );
+ }
+ else if ( action == wxACTION_TOOLBAR_CLICK )
+ {
+ bool isToggled;
+ if ( tool->CanBeToggled() )
+ {
+ tool->Toggle();
+
+ RefreshTool( tool );
+
+ isToggled = tool->IsToggled();
+ }
+ else // simple non-checkable tool
+ {
+ isToggled = false;
+ }
+ OnLeftClick( tool->GetId(), isToggled );