]>
Commit | Line | Data |
---|---|---|
6762286d | 1 | ///////////////////////////////////////////////////////////////////////////// |
233f5738 | 2 | // Name: wx/osx/toolbar.h |
6762286d SC |
3 | // Purpose: wxToolBar class |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
6762286d SC |
7 | // Copyright: (c) Stefan Csomor |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_TOOLBAR_H_ | |
12 | #define _WX_TOOLBAR_H_ | |
13 | ||
14 | #if wxUSE_TOOLBAR | |
15 | ||
16 | #include "wx/tbarbase.h" | |
17 | #include "wx/dynarray.h" | |
18 | ||
6762286d SC |
19 | class WXDLLIMPEXP_CORE wxToolBar: public wxToolBarBase |
20 | { | |
21 | DECLARE_DYNAMIC_CLASS(wxToolBar) | |
22 | public: | |
23 | /* | |
24 | * Public interface | |
25 | */ | |
26 | ||
27 | wxToolBar() { Init(); } | |
28 | ||
29 | inline wxToolBar(wxWindow *parent, wxWindowID id, | |
30 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
f75b1bd3 | 31 | long style = wxTB_HORIZONTAL, |
6762286d SC |
32 | const wxString& name = wxToolBarNameStr) |
33 | { | |
34 | Init(); | |
35 | Create(parent, id, pos, size, style, name); | |
36 | } | |
37 | virtual ~wxToolBar(); | |
38 | ||
39 | bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
f75b1bd3 | 40 | long style = wxTB_HORIZONTAL, |
6762286d SC |
41 | const wxString& name = wxToolBarNameStr); |
42 | ||
43 | virtual void SetWindowStyleFlag(long style); | |
ce00f59b | 44 | |
1665389a | 45 | virtual bool Destroy(); |
6762286d SC |
46 | |
47 | // override/implement base class virtuals | |
48 | virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; | |
49 | ||
a0b48f26 | 50 | #ifndef __WXOSX_IPHONE__ |
6762286d SC |
51 | virtual bool Show(bool show = true); |
52 | virtual bool IsShown() const; | |
a0b48f26 | 53 | #endif |
6762286d SC |
54 | virtual bool Realize(); |
55 | ||
56 | virtual void SetToolBitmapSize(const wxSize& size); | |
57 | virtual wxSize GetToolSize() const; | |
58 | ||
59 | virtual void SetRows(int nRows); | |
60 | ||
61 | virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap); | |
62 | virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); | |
63 | ||
a0b48f26 | 64 | #ifndef __WXOSX_IPHONE__ |
6762286d SC |
65 | // Add all the buttons |
66 | ||
67 | virtual wxString MacGetToolTipString( wxPoint &where ) ; | |
68 | void OnPaint(wxPaintEvent& event) ; | |
69 | void OnMouse(wxMouseEvent& event) ; | |
70 | virtual void MacSuperChangedPosition() ; | |
a0b48f26 | 71 | #endif |
ce00f59b | 72 | |
6762286d | 73 | #if wxOSX_USE_NATIVE_TOOLBAR |
d52a1aba VS |
74 | // make all tools selectable |
75 | void OSXSetSelectableTools(bool set); | |
76 | void OSXSelectTool(int toolId); | |
77 | ||
6762286d | 78 | bool MacInstallNativeToolbar(bool usesNative); |
1665389a | 79 | void MacUninstallNativeToolbar(); |
6762286d SC |
80 | bool MacWantsNativeToolbar(); |
81 | bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const; | |
5c6eb3a8 | 82 | #endif |
f2b6dd8c RD |
83 | |
84 | virtual wxToolBarToolBase *CreateTool(int id, | |
85 | const wxString& label, | |
86 | const wxBitmap& bmpNormal, | |
87 | const wxBitmap& bmpDisabled = wxNullBitmap, | |
88 | wxItemKind kind = wxITEM_NORMAL, | |
89 | wxObject *clientData = NULL, | |
90 | const wxString& shortHelp = wxEmptyString, | |
91 | const wxString& longHelp = wxEmptyString); | |
92 | virtual wxToolBarToolBase *CreateTool(wxControl *control, | |
93 | const wxString& label); | |
94 | ||
6762286d SC |
95 | protected: |
96 | // common part of all ctors | |
97 | void Init(); | |
f1f5ddd7 SC |
98 | |
99 | void DoLayout(); | |
100 | ||
101 | void DoSetSize(int x, int y, int width, int height, int sizeFlags); | |
6762286d | 102 | |
a0b48f26 | 103 | #ifndef __WXOSX_IPHONE__ |
14919c70 | 104 | virtual void DoGetSize(int *width, int *height) const; |
6762286d | 105 | virtual wxSize DoGetBestSize() const; |
14919c70 SC |
106 | #endif |
107 | #ifdef __WXOSX_COCOA__ | |
108 | virtual void DoGetPosition(int*x, int *y) const; | |
a0b48f26 | 109 | #endif |
6762286d SC |
110 | virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); |
111 | virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); | |
112 | ||
113 | virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); | |
114 | virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); | |
115 | virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); | |
116 | ||
6762286d SC |
117 | DECLARE_EVENT_TABLE() |
118 | #if wxOSX_USE_NATIVE_TOOLBAR | |
119 | bool m_macUsesNativeToolbar ; | |
120 | void* m_macToolbar ; | |
121 | #endif | |
a0b48f26 | 122 | #ifdef __WXOSX_IPHONE__ |
ce00f59b | 123 | WX_UIView m_macToolbar; |
a0b48f26 | 124 | #endif |
6762286d SC |
125 | }; |
126 | ||
127 | #endif // wxUSE_TOOLBAR | |
128 | ||
129 | #endif | |
130 | // _WX_TOOLBAR_H_ |