]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/toolbar.h
optimizing for multiple Realize calls in sequence, moving EventHandler push to toolba...
[wxWidgets.git] / include / wx / mac / carbon / toolbar.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "toolbar.h"
17 #endif
18
19 #if wxUSE_TOOLBAR
20
21 #include "wx/tbarbase.h"
22 #include "wx/dynarray.h"
23
24 WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
25
26 class WXDLLEXPORT wxToolBar: public wxToolBarBase
27 {
28 DECLARE_DYNAMIC_CLASS(wxToolBar)
29 public:
30 /*
31 * Public interface
32 */
33
34 wxToolBar() { Init(); }
35
36 inline wxToolBar(wxWindow *parent, wxWindowID id,
37 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
38 long style = wxNO_BORDER|wxTB_HORIZONTAL,
39 const wxString& name = wxToolBarNameStr)
40 {
41 Init();
42 Create(parent, id, pos, size, style, name);
43 }
44 ~wxToolBar();
45
46 bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
47 long style = wxNO_BORDER|wxTB_HORIZONTAL,
48 const wxString& name = wxToolBarNameStr);
49
50 virtual void SetWindowStyleFlag(long style);
51
52 // override/implement base class virtuals
53 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
54
55 virtual bool Show(bool show = true);
56 virtual bool IsShown() const;
57 virtual void DoGetSize(int *width, int *height) const;
58 virtual bool Realize();
59
60 virtual void SetToolBitmapSize(const wxSize& size);
61 virtual wxSize GetToolSize() const;
62
63 virtual void SetRows(int nRows);
64
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
72 #if wxMAC_USE_NATIVE_TOOLBAR
73 bool MacInstallNativeToolbar(bool usesNative);
74 bool MacWantsNativeToolbar();
75 bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const;
76 #endif
77 protected:
78 // common part of all ctors
79 void Init();
80
81 // implement base class pure virtuals
82 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
83 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
84
85 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
86 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
87 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
88
89 virtual wxToolBarToolBase *CreateTool(int id,
90 const wxString& label,
91 const wxBitmap& bmpNormal,
92 const wxBitmap& bmpDisabled,
93 wxItemKind kind,
94 wxObject *clientData,
95 const wxString& shortHelp,
96 const wxString& longHelp);
97 virtual wxToolBarToolBase *CreateTool(wxControl *control);
98
99 DECLARE_EVENT_TABLE()
100 #if wxMAC_USE_NATIVE_TOOLBAR
101 bool m_macUsesNativeToolbar ;
102 void* m_macHIToolbarRef ;
103 #endif
104 };
105
106 #endif // wxUSE_TOOLBAR
107
108 #endif
109 // _WX_TOOLBAR_H_