-#include "wx/toolbar.h"
-#include "wx/image.h"
-
-//-----------------------------------------------------------------------------
-// wxToolBar
-//-----------------------------------------------------------------------------
-
-BEGIN_EVENT_TABLE(wxToolBar,wxToolBarBase)
- EVT_MOUSE_EVENTS( wxToolBar::OnMouse )
- EVT_PAINT( wxToolBar::OnPaint )
- EVT_SIZE( wxToolBar::OnSize )
- EVT_ENTER_WINDOW( wxToolBar::OnEnter )
- EVT_LEAVE_WINDOW( wxToolBar::OnLeave )
-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/univ/renderer.h"
+
+// ----------------------------------------------------------------------------
+// wxStdToolbarInputHandler: translates SPACE and ENTER keys and the left mouse
+// click into button press/release actions
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdToolbarInputHandler : public wxStdInputHandler
+{
+public:
+ wxStdToolbarInputHandler(wxInputHandler *inphand);
+
+ virtual bool HandleKey(wxInputConsumer *consumer,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxInputConsumer *consumer,
+ const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
+ virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
+ virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
+
+private:
+ wxWindow *m_winCapture;
+ wxToolBarToolBase *m_toolCapture;
+ wxToolBarToolBase *m_toolLast;
+};
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// value meaning that m_widthSeparator is not initialized
+static const wxCoord INVALID_WIDTH = wxDefaultCoord;
+
+// ----------------------------------------------------------------------------
+// wxToolBarTool: our implementation of wxToolBarToolBase
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxToolBarTool : public wxToolBarToolBase
+{
+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
+// ----------------------------------------------------------------------------