]>
Commit | Line | Data |
---|---|---|
39d2f9a7 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/msw/wince/tbarwce.h | |
3 | // Purpose: Windows CE wxToolBar class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 2003-07-12 | |
39d2f9a7 | 7 | // Copyright: (c) Julian Smart |
65571936 | 8 | // Licence: wxWindows licence |
39d2f9a7 JS |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_BARWCE_H_ | |
12 | #define _WX_BARWCE_H_ | |
13 | ||
39d2f9a7 JS |
14 | #if wxUSE_TOOLBAR |
15 | ||
16 | #include "wx/dynarray.h" | |
17 | ||
a9102b36 JS |
18 | // Smartphones don't have toolbars, so use a dummy class |
19 | #ifdef __SMARTPHONE__ | |
20 | ||
53a2db12 | 21 | class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase |
39d2f9a7 JS |
22 | { |
23 | public: | |
24 | // ctors and dtor | |
a9102b36 | 25 | wxToolBar() { } |
39d2f9a7 JS |
26 | |
27 | wxToolBar(wxWindow *parent, | |
a9102b36 JS |
28 | wxWindowID id, |
29 | const wxPoint& pos = wxDefaultPosition, | |
30 | const wxSize& size = wxDefaultSize, | |
f75b1bd3 | 31 | long style = wxTB_HORIZONTAL, |
a9102b36 JS |
32 | const wxString& name = wxToolBarNameStr) |
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, | |
f75b1bd3 | 41 | long style = wxTB_HORIZONTAL, |
a9102b36 JS |
42 | const wxString& name = wxToolBarNameStr); |
43 | ||
44 | // override/implement base class virtuals | |
45 | virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; | |
46 | virtual bool Realize() { return true; } | |
47 | ||
48 | protected: | |
49 | // implement base class pure virtuals | |
50 | virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); | |
51 | virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); | |
52 | ||
53 | virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); | |
54 | virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); | |
55 | virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); | |
56 | ||
57 | virtual wxToolBarToolBase *CreateTool(int id, | |
58 | const wxString& label, | |
59 | const wxBitmap& bmpNormal, | |
60 | const wxBitmap& bmpDisabled, | |
61 | wxItemKind kind, | |
62 | wxObject *clientData, | |
63 | const wxString& shortHelp, | |
64 | const wxString& longHelp); | |
07d02e9e VZ |
65 | virtual wxToolBarToolBase *CreateTool(wxControl *control, |
66 | const wxString& label); | |
a9102b36 JS |
67 | |
68 | private: | |
69 | DECLARE_EVENT_TABLE() | |
70 | DECLARE_DYNAMIC_CLASS(wxToolBar) | |
c0c133e1 | 71 | wxDECLARE_NO_COPY_CLASS(wxToolBar); |
a9102b36 JS |
72 | }; |
73 | ||
74 | #else | |
75 | ||
76 | // For __POCKETPC__ | |
77 | ||
dbb2baae | 78 | #include "wx/msw/toolbar.h" |
a9102b36 | 79 | |
53a2db12 | 80 | class WXDLLIMPEXP_CORE wxToolMenuBar : public wxToolBar |
a9102b36 JS |
81 | { |
82 | public: | |
83 | // ctors and dtor | |
84 | wxToolMenuBar() { Init(); } | |
85 | ||
86 | wxToolMenuBar(wxWindow *parent, | |
39d2f9a7 JS |
87 | wxWindowID id, |
88 | const wxPoint& pos = wxDefaultPosition, | |
89 | const wxSize& size = wxDefaultSize, | |
f75b1bd3 | 90 | long style = wxTB_HORIZONTAL, |
39d2f9a7 JS |
91 | const wxString& name = wxToolBarNameStr, |
92 | wxMenuBar* menuBar = NULL) | |
93 | { | |
94 | Init(); | |
95 | ||
96 | Create(parent, id, pos, size, style, name, menuBar); | |
97 | } | |
98 | ||
99 | bool Create(wxWindow *parent, | |
100 | wxWindowID id, | |
101 | const wxPoint& pos = wxDefaultPosition, | |
102 | const wxSize& size = wxDefaultSize, | |
f75b1bd3 | 103 | long style = wxTB_HORIZONTAL, |
39d2f9a7 JS |
104 | const wxString& name = wxToolBarNameStr, |
105 | wxMenuBar* menuBar = NULL); | |
106 | ||
a9102b36 | 107 | virtual ~wxToolMenuBar(); |
39d2f9a7 JS |
108 | |
109 | // override/implement base class virtuals | |
39d2f9a7 JS |
110 | virtual bool Realize(); |
111 | ||
39d2f9a7 JS |
112 | // implementation only from now on |
113 | // ------------------------------- | |
114 | ||
ea9aa80e JS |
115 | // Override in order to bypass wxToolBar's overridden function |
116 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); | |
117 | ||
39d2f9a7 | 118 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
39d2f9a7 JS |
119 | |
120 | // Return HMENU for the menu associated with the commandbar | |
121 | WXHMENU GetHMenu(); | |
122 | ||
123 | // Set the wxMenuBar associated with this commandbar | |
124 | void SetMenuBar(wxMenuBar* menuBar) { m_menuBar = menuBar; } | |
125 | ||
126 | // Returns the wxMenuBar associated with this commandbar | |
127 | wxMenuBar* GetMenuBar() const { return m_menuBar; } | |
128 | ||
129 | protected: | |
130 | // common part of all ctors | |
131 | void Init(); | |
132 | ||
133 | // create the native toolbar control | |
134 | bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size, wxMenuBar* menuBar); | |
135 | ||
136 | // recreate the control completely | |
137 | void Recreate(); | |
138 | ||
139 | // implement base class pure virtuals | |
140 | virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); | |
141 | virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); | |
142 | ||
39d2f9a7 JS |
143 | virtual wxToolBarToolBase *CreateTool(int id, |
144 | const wxString& label, | |
145 | const wxBitmap& bmpNormal, | |
146 | const wxBitmap& bmpDisabled, | |
147 | wxItemKind kind, | |
148 | wxObject *clientData, | |
149 | const wxString& shortHelp, | |
150 | const wxString& longHelp); | |
d6f2a891 VZ |
151 | virtual wxToolBarToolBase *CreateTool(wxControl *control, |
152 | const wxString& label); | |
39d2f9a7 | 153 | |
39d2f9a7 JS |
154 | // The menubar associated with this toolbar |
155 | wxMenuBar* m_menuBar; | |
156 | ||
157 | private: | |
158 | DECLARE_EVENT_TABLE() | |
a9102b36 | 159 | DECLARE_DYNAMIC_CLASS(wxToolMenuBar) |
c0c133e1 | 160 | wxDECLARE_NO_COPY_CLASS(wxToolMenuBar); |
39d2f9a7 JS |
161 | }; |
162 | ||
a9102b36 JS |
163 | #endif |
164 | // __SMARTPHONE__ | |
165 | ||
39d2f9a7 JS |
166 | #endif // wxUSE_TOOLBAR |
167 | ||
168 | #endif | |
169 | // _WX_BARWCE_H_ |