- DECLARE_DYNAMIC_CLASS(wxToolBarSimple)
-
- public:
-
- wxToolBarSimple(void);
- inline wxToolBarSimple(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxNO_BORDER|wxTB_HORIZONTAL,
- const wxString& name = wxToolBarNameStr)
- {
- Create(parent, id, pos, size, style, name);
- }
- ~wxToolBarSimple(void);
-
- bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxToolBarNameStr);
-
- void OnPaint(wxPaintEvent& event);
- void OnSize(wxSizeEvent& event);
- void OnMouseEvent(wxMouseEvent& event);
- void OnKillFocus(wxFocusEvent& event);
-
- // Handle wxToolBar events
-
- virtual void DrawTool(wxDC& dc, wxMemoryDC& memDC, wxToolBarTool *tool);
- virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
-
- virtual void SpringUpButton(int index);
-
- void Layout(void);
-
- // The post-tool-addition call
- bool Realize() { Layout(); return TRUE; };
+public:
+ // ctors and dtor
+ wxToolBarSimple() { Init(); }
+
+ wxToolBarSimple(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER | wxTB_HORIZONTAL,
+ const wxString& name = wxToolBarNameStr)
+ {
+ Init();
+
+ Create(parent, id, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxNO_BORDER | wxTB_HORIZONTAL,
+ const wxString& name = wxToolBarNameStr);
+
+ virtual ~wxToolBarSimple();
+
+ // override/implement base class virtuals
+ virtual wxToolBarToolBase *AddTool
+ (
+ int id,
+ const wxBitmap& bitmap,
+ const wxBitmap& pushedBitmap,
+ bool toggle,
+ wxCoord xPos,
+ wxCoord yPos = -1,
+ wxObject *clientData = NULL,
+ const wxString& helpString1 = wxEmptyString,
+ const wxString& helpString2 = wxEmptyString
+ );
+
+ virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
+
+ virtual bool Realize();
+
+ virtual void SetRows(int nRows);
+
+ // implementation from now on
+ // --------------------------
+
+ // SCROLLING: this has to be copied from wxScrolledWindow since
+ // wxToolBarBase inherits from wxControl. This could have been put into
+ // wxToolBarSimple, but we might want any derived toolbar class to be
+ // scrollable.
+
+ // Number of pixels per user unit (0 or -1 for no scrollbar)
+ // Length of virtual canvas in user units
+ virtual void SetScrollbars(int horizontal, int vertical,
+ int x_length, int y_length,
+ int x_pos = 0, int y_pos = 0);
+
+ // Physically scroll the window
+ virtual void Scroll(int x_pos, int y_pos);
+ virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
+ virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
+ virtual void AdjustScrollbars();
+
+ // Prepare the DC by translating it according to the current scroll position
+ virtual void PrepareDC(wxDC& dc);
+
+ int GetScrollPageSize(int orient) const ;
+ void SetScrollPageSize(int orient, int pageSize);
+
+ // Get the view start
+ virtual void ViewStart(int *x, int *y) const;
+
+ // Actual size in pixels when scrolling is taken into account
+ virtual void GetVirtualSize(int *x, int *y) const;
+
+ int CalcScrollInc(wxScrollEvent& event);
+
+ // event handlers
+ void OnPaint(wxPaintEvent& event);
+ void OnSize(wxSizeEvent& event);
+ void OnMouseEvent(wxMouseEvent& event);
+ void OnKillFocus(wxFocusEvent& event);
+ void OnScroll(wxScrollEvent& event);