]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/palmos/toolbar.h | |
3 | // Purpose: wxToolBar class | |
4 | // Author: William Osborne - minimal working wxPalmOS port | |
5 | // Modified by: | |
6 | // Created: 10/13/04 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) William Osborne | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_TBAR95_H_ | |
13 | #define _WX_TBAR95_H_ | |
14 | ||
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 | ||
59 | void OnMouseEvent(wxMouseEvent& event); | |
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 | const wxString& label); | |
88 | ||
89 | // return the appropriate size and flags for the toolbar control | |
90 | virtual wxSize DoGetBestSize() const; | |
91 | ||
92 | // should be called whenever the toolbar size changes | |
93 | void UpdateSize(); | |
94 | ||
95 | // the big bitmap containing all bitmaps of the toolbar buttons | |
96 | WXHBITMAP m_hBitmap; | |
97 | ||
98 | // the total number of toolbar elements | |
99 | size_t m_nButtons; | |
100 | ||
101 | // the tool the cursor is in | |
102 | wxToolBarToolBase *m_pInTool; | |
103 | ||
104 | private: | |
105 | DECLARE_EVENT_TABLE() | |
106 | DECLARE_DYNAMIC_CLASS(wxToolBar) | |
107 | DECLARE_NO_COPY_CLASS(wxToolBar) | |
108 | }; | |
109 | ||
110 | #endif // wxUSE_TOOLBAR | |
111 | ||
112 | #endif | |
113 | // _WX_TBAR95_H_ |