]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/wince/tbarwce.h
Compile fixes.
[wxWidgets.git] / include / wx / msw / wince / tbarwce.h
CommitLineData
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
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
39d2f9a7
JS
16 #pragma interface "tbarwce.h"
17#endif
18
19#if wxUSE_TOOLBAR
20
21#include "wx/dynarray.h"
22
23class WXDLLEXPORT wxToolBar : public wxToolBarBase
24{
25public:
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 wxMenuBar* menuBar = NULL)
36 {
37 Init();
38
39 Create(parent, id, pos, size, style, name, menuBar);
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 wxMenuBar* menuBar = NULL);
49
50 virtual ~wxToolBar();
51
52 // override/implement base class virtuals
53 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
54
55 virtual bool Realize();
56
57 virtual void SetToolBitmapSize(const wxSize& size);
58 virtual wxSize GetToolSize() const;
59
60 virtual void SetRows(int nRows);
61
62 // implementation only from now on
63 // -------------------------------
64
65 virtual void SetWindowStyleFlag(long style);
66
67 virtual bool MSWCommand(WXUINT param, WXWORD id);
68 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
69
70 void OnMouseEvent(wxMouseEvent& event);
71 void OnSysColourChanged(wxSysColourChangedEvent& event);
72
73 void SetFocus() {}
74
75 static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height);
76
77 // Return HMENU for the menu associated with the commandbar
78 WXHMENU GetHMenu();
79
80 // Set the wxMenuBar associated with this commandbar
81 void SetMenuBar(wxMenuBar* menuBar) { m_menuBar = menuBar; }
82
83 // Returns the wxMenuBar associated with this commandbar
84 wxMenuBar* GetMenuBar() const { return m_menuBar; }
85
86protected:
87 // common part of all ctors
88 void Init();
89
90 // create the native toolbar control
91 bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size, wxMenuBar* menuBar);
92
93 // recreate the control completely
94 void Recreate();
95
96 // implement base class pure virtuals
97 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
98 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
99
100 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
101 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
102 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
103
104 virtual wxToolBarToolBase *CreateTool(int id,
105 const wxString& label,
106 const wxBitmap& bmpNormal,
107 const wxBitmap& bmpDisabled,
108 wxItemKind kind,
109 wxObject *clientData,
110 const wxString& shortHelp,
111 const wxString& longHelp);
112 virtual wxToolBarToolBase *CreateTool(wxControl *control);
113
114 // override WndProc mainly to process WM_SIZE
c140b7e7 115 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
39d2f9a7
JS
116
117 // return the appropriate size and flags for the toolbar control
118 virtual wxSize DoGetBestSize() const;
119 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
120
121 // handlers for various events
122 void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam);
123
124 // should be called whenever the toolbar size changes
125 void UpdateSize();
126
127 // the big bitmap containing all bitmaps of the toolbar buttons
128 WXHBITMAP m_hBitmap;
129
130 // the total number of toolbar elements
131 size_t m_nButtons;
132
133 // the tool the cursor is in
134 wxToolBarToolBase *m_pInTool;
135
136 // The menubar associated with this toolbar
137 wxMenuBar* m_menuBar;
138
139private:
140 DECLARE_EVENT_TABLE()
141 DECLARE_DYNAMIC_CLASS(wxToolBar)
142 DECLARE_NO_COPY_CLASS(wxToolBar)
143};
144
145#endif // wxUSE_TOOLBAR
146
147#endif
148 // _WX_BARWCE_H_