]>
Commit | Line | Data |
---|---|---|
ffecfa5a JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/palmos/toolbar.h | |
3 | // Purpose: wxToolBar class | |
e1d63b79 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
ffecfa5a JS |
5 | // Modified by: |
6 | // Created: 10/13/04 | |
e1d63b79 | 7 | // RCS-ID: $Id$ |
ffecfa5a JS |
8 | // Copyright: (c) William Osborne |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_TBAR95_H_ | |
13 | #define _WX_TBAR95_H_ | |
14 | ||
ffecfa5a JS |
15 | #if wxUSE_TOOLBAR |
16 | ||
17 | #include "wx/dynarray.h" | |
18 | ||
19 | class WXDLLEXPORT wxToolBar : public wxToolBarBase | |
20 | { | |
21 | public: | |
22 | // ctors and dtor | |
23 | wxToolBar() { Init(); } | |
24 | ||
25 | wxToolBar(wxWindow *parent, | |
26 | wxWindowID id, | |
27 | const wxPoint& pos = wxDefaultPosition, | |
28 | const wxSize& size = wxDefaultSize, | |
29 | long style = wxNO_BORDER | wxTB_HORIZONTAL, | |
30 | const wxString& name = wxToolBarNameStr) | |
31 | { | |
32 | Init(); | |
33 | ||
34 | Create(parent, id, pos, size, style, name); | |
35 | } | |
36 | ||
37 | bool Create(wxWindow *parent, | |
38 | wxWindowID id, | |
39 | const wxPoint& pos = wxDefaultPosition, | |
40 | const wxSize& size = wxDefaultSize, | |
41 | long style = wxNO_BORDER | wxTB_HORIZONTAL, | |
42 | const wxString& name = wxToolBarNameStr); | |
43 | ||
44 | virtual ~wxToolBar(); | |
45 | ||
46 | // override/implement base class virtuals | |
47 | virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; | |
48 | ||
49 | virtual bool Realize(); | |
50 | ||
51 | virtual void SetToolBitmapSize(const wxSize& size); | |
52 | virtual wxSize GetToolSize() const; | |
53 | ||
54 | virtual void SetRows(int nRows); | |
55 | ||
56 | // implementation only from now on | |
57 | // ------------------------------- | |
58 | ||
ffecfa5a | 59 | void OnMouseEvent(wxMouseEvent& event); |
ffecfa5a JS |
60 | |
61 | void SetFocus() {} | |
62 | ||
63 | protected: | |
64 | // common part of all ctors | |
65 | void Init(); | |
66 | ||
67 | // recreate the control completely | |
68 | void Recreate(); | |
69 | ||
70 | // implement base class pure virtuals | |
71 | virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); | |
72 | virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); | |
73 | ||
74 | virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); | |
75 | virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); | |
76 | virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); | |
77 | ||
78 | virtual wxToolBarToolBase *CreateTool(int id, | |
79 | const wxString& label, | |
80 | const wxBitmap& bmpNormal, | |
81 | const wxBitmap& bmpDisabled, | |
82 | wxItemKind kind, | |
83 | wxObject *clientData, | |
84 | const wxString& shortHelp, | |
85 | const wxString& longHelp); | |
86 | virtual wxToolBarToolBase *CreateTool(wxControl *control); | |
87 | ||
88 | // return the appropriate size and flags for the toolbar control | |
89 | virtual wxSize DoGetBestSize() const; | |
90 | ||
91 | // should be called whenever the toolbar size changes | |
92 | void UpdateSize(); | |
93 | ||
94 | // the big bitmap containing all bitmaps of the toolbar buttons | |
95 | WXHBITMAP m_hBitmap; | |
96 | ||
97 | // the total number of toolbar elements | |
98 | size_t m_nButtons; | |
99 | ||
100 | // the tool the cursor is in | |
101 | wxToolBarToolBase *m_pInTool; | |
102 | ||
103 | private: | |
104 | DECLARE_EVENT_TABLE() | |
105 | DECLARE_DYNAMIC_CLASS(wxToolBar) | |
106 | DECLARE_NO_COPY_CLASS(wxToolBar) | |
107 | }; | |
108 | ||
109 | #endif // wxUSE_TOOLBAR | |
110 | ||
111 | #endif | |
112 | // _WX_TBAR95_H_ |