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