]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/osx/toolbar.h | |
3 | // Purpose: wxToolBar class | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
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 | ||
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, | |
31 | long style = wxTB_HORIZONTAL, | |
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, | |
40 | long style = wxTB_HORIZONTAL, | |
41 | const wxString& name = wxToolBarNameStr); | |
42 | ||
43 | virtual void SetWindowStyleFlag(long style); | |
44 | ||
45 | virtual bool Destroy(); | |
46 | ||
47 | // override/implement base class virtuals | |
48 | virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; | |
49 | ||
50 | #ifndef __WXOSX_IPHONE__ | |
51 | virtual bool Show(bool show = true); | |
52 | virtual bool IsShown() const; | |
53 | #endif | |
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 | ||
64 | #ifndef __WXOSX_IPHONE__ | |
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() ; | |
71 | #endif | |
72 | ||
73 | #if wxOSX_USE_NATIVE_TOOLBAR | |
74 | // make all tools selectable | |
75 | void OSXSetSelectableTools(bool set); | |
76 | void OSXSelectTool(int toolId); | |
77 | ||
78 | bool MacInstallNativeToolbar(bool usesNative); | |
79 | void MacUninstallNativeToolbar(); | |
80 | bool MacWantsNativeToolbar(); | |
81 | bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const; | |
82 | #endif | |
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 | ||
95 | protected: | |
96 | // common part of all ctors | |
97 | void Init(); | |
98 | ||
99 | void DoLayout(); | |
100 | ||
101 | void DoSetSize(int x, int y, int width, int height, int sizeFlags); | |
102 | ||
103 | #ifndef __WXOSX_IPHONE__ | |
104 | virtual void DoGetSize(int *width, int *height) const; | |
105 | virtual wxSize DoGetBestSize() const; | |
106 | #endif | |
107 | #ifdef __WXOSX_COCOA__ | |
108 | virtual void DoGetPosition(int*x, int *y) const; | |
109 | #endif | |
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 | ||
117 | DECLARE_EVENT_TABLE() | |
118 | #if wxOSX_USE_NATIVE_TOOLBAR | |
119 | bool m_macUsesNativeToolbar ; | |
120 | void* m_macToolbar ; | |
121 | #endif | |
122 | #ifdef __WXOSX_IPHONE__ | |
123 | WX_UIView m_macToolbar; | |
124 | #endif | |
125 | }; | |
126 | ||
127 | #endif // wxUSE_TOOLBAR | |
128 | ||
129 | #endif | |
130 | // _WX_TOOLBAR_H_ |