]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/toolbar.h
Added functionality for disabling the vertical scrollbar.
[wxWidgets.git] / include / wx / osx / toolbar.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/toolbar.h
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
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,
32 long style = wxNO_BORDER|wxTB_HORIZONTAL,
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,
41 long style = wxNO_BORDER|wxTB_HORIZONTAL,
42 const wxString& name = wxToolBarNameStr);
43
44 virtual void SetWindowStyleFlag(long style);
45
46 virtual bool Destroy();
47
48 // override/implement base class virtuals
49 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
50
51 #ifndef __WXOSX_IPHONE__
52 virtual bool Show(bool show = true);
53 virtual bool IsShown() const;
54 #endif
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
65 #ifndef __WXOSX_IPHONE__
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() ;
72 #endif
73
74 #if wxOSX_USE_NATIVE_TOOLBAR
75 bool MacInstallNativeToolbar(bool usesNative);
76 void MacUninstallNativeToolbar();
77 bool MacWantsNativeToolbar();
78 bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const;
79 #endif
80 protected:
81 // common part of all ctors
82 void Init();
83
84 void DoLayout();
85
86 void DoSetSize(int x, int y, int width, int height, int sizeFlags);
87
88 #ifndef __WXOSX_IPHONE__
89 virtual void DoGetSize(int *width, int *height) const;
90 virtual wxSize DoGetBestSize() const;
91 #endif
92 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
93 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
94
95 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
96 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
97 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
98
99 virtual wxToolBarToolBase *CreateTool(int id,
100 const wxString& label,
101 const wxBitmap& bmpNormal,
102 const wxBitmap& bmpDisabled,
103 wxItemKind kind,
104 wxObject *clientData,
105 const wxString& shortHelp,
106 const wxString& longHelp);
107 virtual wxToolBarToolBase *CreateTool(wxControl *control,
108 const wxString& label);
109
110 DECLARE_EVENT_TABLE()
111 #if wxOSX_USE_NATIVE_TOOLBAR
112 bool m_macUsesNativeToolbar ;
113 void* m_macToolbar ;
114 #endif
115 #ifdef __WXOSX_IPHONE__
116 WX_UIView m_macToolbar;
117 #endif
118 };
119
120 #endif // wxUSE_TOOLBAR
121
122 #endif
123 // _WX_TOOLBAR_H_