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