]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/toolbar.h
0b6ec16033a3072f07ff8fa775eed48e90ff5208
[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 wxSize DoGetBestSize() const ;
59 virtual bool Realize();
60
61 virtual void SetToolBitmapSize(const wxSize& size);
62 virtual wxSize GetToolSize() const;
63
64 virtual void SetRows(int nRows);
65
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
73 #if wxMAC_USE_NATIVE_TOOLBAR
74 bool MacInstallNativeToolbar(bool usesNative);
75 bool MacWantsNativeToolbar();
76 bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const;
77 #endif
78 protected:
79 // common part of all ctors
80 void Init();
81
82 // implement base class pure virtuals
83 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
84 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
85
86 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
87 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
88 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
89
90 virtual wxToolBarToolBase *CreateTool(int id,
91 const wxString& label,
92 const wxBitmap& bmpNormal,
93 const wxBitmap& bmpDisabled,
94 wxItemKind kind,
95 wxObject *clientData,
96 const wxString& shortHelp,
97 const wxString& longHelp);
98 virtual wxToolBarToolBase *CreateTool(wxControl *control);
99
100 DECLARE_EVENT_TABLE()
101 #if wxMAC_USE_NATIVE_TOOLBAR
102 bool m_macUsesNativeToolbar ;
103 void* m_macHIToolbarRef ;
104 #endif
105 };
106
107 #endif // wxUSE_TOOLBAR
108
109 #endif
110 // _WX_TOOLBAR_H_