-#include "wx/validate.h"
-
-//-----------------------------------------------------------------------------
-// wxToolBar
-//-----------------------------------------------------------------------------
-
-BEGIN_EVENT_TABLE(wxToolBar,wxToolBarBase)
- EVT_MOUSE_EVENTS( wxToolBar::OnMouse )
- EVT_PAINT( wxToolBar::OnPaint )
- EVT_SIZE( wxToolBar::OnSize )
-END_EVENT_TABLE()
-
-bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
- const wxPoint& pos, const wxSize& size,
- long style, const wxString& name )
-{
- bool ret = wxToolBarBase::Create( parent, id, pos, size, style, wxDefaultValidator, name );
-
- return ret;
-}
+#include "wx/image.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// value meaning that m_widthSeparator is not initialized
+static const wxCoord INVALID_WIDTH = -1;
+
+// ----------------------------------------------------------------------------
+// wxToolBarTool: our implementation of wxToolBarToolBase
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxToolBarTool : public wxToolBarToolBase
+{
+public:
+ wxToolBarTool( wxToolBarBase *tbar = (wxToolBarBase *)NULL,
+ int id = wxID_SEPARATOR,
+ const wxBitmap& bitmap1 = wxNullBitmap,
+ const wxBitmap& bitmap2 = wxNullBitmap,
+ bool toggle = FALSE,
+ wxObject *clientData = (wxObject *) NULL,
+ const wxString& shortHelpString = wxEmptyString,
+ const wxString& longHelpString = wxEmptyString )
+ : wxToolBarToolBase(tbar, id, bitmap1, bitmap2, toggle, clientData,
+ shortHelpString, longHelpString)
+ {
+ // no position yet
+ m_x =
+ m_y = -1;
+
+ // not pressed yet
+ m_isInverted = 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; }
+
+public:
+ // the tool position (the size is known by the toolbar itself)
+ int m_x,
+ m_y;
+
+private:
+ // TRUE if the tool is pressed
+ bool m_isInverted;
+};
+
+// ============================================================================
+// wxToolBar implementation
+// ============================================================================
+
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl);
+
+// ----------------------------------------------------------------------------
+// wxToolBar creation
+// ----------------------------------------------------------------------------