]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/wince/tbarwce.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/wince/tbarwce.h
3 // Purpose: Windows CE wxToolBar class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "tbarwce.h"
21 #include "wx/dynarray.h"
23 class WXDLLEXPORT wxToolBar
: public wxToolBarBase
27 wxToolBar() { Init(); }
29 wxToolBar(wxWindow
*parent
,
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
)
39 Create(parent
, id
, pos
, size
, style
, name
, menuBar
);
42 bool Create(wxWindow
*parent
,
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
);
52 // override/implement base class virtuals
53 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
55 virtual bool Realize();
57 virtual void SetToolBitmapSize(const wxSize
& size
);
58 virtual wxSize
GetToolSize() const;
60 virtual void SetRows(int nRows
);
62 // implementation only from now on
63 // -------------------------------
65 virtual void SetWindowStyleFlag(long style
);
67 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
68 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
70 void OnMouseEvent(wxMouseEvent
& event
);
71 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
75 static WXHBITMAP
MapBitmap(WXHBITMAP bitmap
, int width
, int height
);
77 // Return HMENU for the menu associated with the commandbar
80 // Set the wxMenuBar associated with this commandbar
81 void SetMenuBar(wxMenuBar
* menuBar
) { m_menuBar
= menuBar
; }
83 // Returns the wxMenuBar associated with this commandbar
84 wxMenuBar
* GetMenuBar() const { return m_menuBar
; }
87 // common part of all ctors
90 // create the native toolbar control
91 bool MSWCreateToolbar(const wxPoint
& pos
, const wxSize
& size
, wxMenuBar
* menuBar
);
93 // recreate the control completely
96 // implement base class pure virtuals
97 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
98 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
100 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
101 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
102 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
104 virtual wxToolBarToolBase
*CreateTool(int id
,
105 const wxString
& label
,
106 const wxBitmap
& bmpNormal
,
107 const wxBitmap
& bmpDisabled
,
109 wxObject
*clientData
,
110 const wxString
& shortHelp
,
111 const wxString
& longHelp
);
112 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
);
114 // override WndProc mainly to process WM_SIZE
115 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
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;
121 // handlers for various events
122 void HandleMouseMove(WXWPARAM wParam
, WXLPARAM lParam
);
124 // should be called whenever the toolbar size changes
127 // the big bitmap containing all bitmaps of the toolbar buttons
130 // the total number of toolbar elements
133 // the tool the cursor is in
134 wxToolBarToolBase
*m_pInTool
;
136 // The menubar associated with this toolbar
137 wxMenuBar
* m_menuBar
;
140 DECLARE_EVENT_TABLE()
141 DECLARE_DYNAMIC_CLASS(wxToolBar
)
142 DECLARE_NO_COPY_CLASS(wxToolBar
)
145 #endif // wxUSE_TOOLBAR