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