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