]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/wince/tbarwce.h
Tweaks for demos on MacOSX
[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 wxUSE_TOOLBAR
16
17 #include "wx/dynarray.h"
18
19 // Smartphones don't have toolbars, so use a dummy class
20 #ifdef __SMARTPHONE__
21
22 class WXDLLEXPORT wxToolBar : public wxToolBarBase
23 {
24 public:
25 // ctors and dtor
26 wxToolBar() { }
27
28 wxToolBar(wxWindow *parent,
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);
66 virtual wxToolBarToolBase *CreateTool(wxControl *control);
67
68 private:
69 DECLARE_EVENT_TABLE()
70 DECLARE_DYNAMIC_CLASS(wxToolBar)
71 DECLARE_NO_COPY_CLASS(wxToolBar)
72 };
73
74 #else
75
76 // For __POCKETPC__
77
78 #include "wx/msw/tbar95.h"
79
80 class WXDLLEXPORT wxToolMenuBar : public wxToolBar
81 {
82 public:
83 // ctors and dtor
84 wxToolMenuBar() { Init(); }
85
86 wxToolMenuBar(wxWindow *parent,
87 wxWindowID id,
88 const wxPoint& pos = wxDefaultPosition,
89 const wxSize& size = wxDefaultSize,
90 long style = wxNO_BORDER | wxTB_HORIZONTAL,
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,
103 long style = wxNO_BORDER | wxTB_HORIZONTAL,
104 const wxString& name = wxToolBarNameStr,
105 wxMenuBar* menuBar = NULL);
106
107 virtual ~wxToolMenuBar();
108
109 // override/implement base class virtuals
110 virtual bool Realize();
111
112 // implementation only from now on
113 // -------------------------------
114
115 // Override in order to bypass wxToolBar's overridden function
116 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
117
118 virtual bool MSWCommand(WXUINT param, WXWORD id);
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
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);
151 virtual wxToolBarToolBase *CreateTool(wxControl *control);
152
153 // The menubar associated with this toolbar
154 wxMenuBar* m_menuBar;
155
156 private:
157 DECLARE_EVENT_TABLE()
158 DECLARE_DYNAMIC_CLASS(wxToolMenuBar)
159 DECLARE_NO_COPY_CLASS(wxToolMenuBar)
160 };
161
162 #endif
163 // __SMARTPHONE__
164
165 #endif // wxUSE_TOOLBAR
166
167 #endif
168 // _WX_BARWCE_H_