+public:
+ wxToolBarTool(wxToolBar *tbar,
+ int id,
+ const wxString& label,
+ const wxBitmap& bmpNormal,
+ const wxBitmap& bmpDisabled,
+ wxItemKind kind,
+ wxObject *clientData,
+ const wxString& shortHelp,
+ const wxString& longHelp)
+ : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
+ clientData, shortHelp, longHelp)
+ {
+ // no position yet
+ m_x =
+ m_y = wxDefaultCoord;
+ m_width =
+ m_height = 0;
+
+ // not pressed yet
+ m_isInverted = false;
+
+ // mouse not here yet
+ m_underMouse = false;
+ }
+
+ wxToolBarTool(wxToolBar *tbar, wxControl *control)
+ : wxToolBarToolBase(tbar, control)
+ {
+ // no position yet
+ m_x =
+ m_y = wxDefaultCoord;
+ m_width =
+ m_height = 0;
+
+ // not pressed yet
+ m_isInverted = false;
+
+ // mouse not here yet
+ m_underMouse = false;
+ }
+
+ // is this tool pressed, even temporarily? (this is different from being
+ // permanently toggled which is what IsToggled() returns)
+ bool IsPressed() const
+ { return CanBeToggled() ? IsToggled() != m_isInverted : m_isInverted; }
+
+ // are we temporarily pressed/unpressed?
+ bool IsInverted() const { return m_isInverted; }
+
+ // press the tool temporarily by inverting its toggle state
+ void Invert() { m_isInverted = !m_isInverted; }
+
+ // Set underMouse
+ void SetUnderMouse( bool under = true ) { m_underMouse = under; }
+ bool IsUnderMouse() { return m_underMouse; }
+
+public:
+ // the tool position (for controls)
+ wxCoord m_x;
+ wxCoord m_y;
+ wxCoord m_width;
+ wxCoord m_height;
+
+private:
+ // true if the tool is pressed
+ bool m_isInverted;
+
+ // true if the tool is under the mouse
+ bool m_underMouse;
+};
+
+// ============================================================================
+// wxToolBar implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
+
+// ----------------------------------------------------------------------------
+// wxToolBar creation
+// ----------------------------------------------------------------------------