1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/toolbar.h
3 // Purpose: wxToolBar class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TOOLBAR_H_
13 #define _WX_TOOLBAR_H_
17 #include "wx/tbarbase.h"
18 #include "wx/dynarray.h"
20 class WXDLLIMPEXP_CORE wxToolBar
: public wxToolBarBase
22 DECLARE_DYNAMIC_CLASS(wxToolBar
)
28 wxToolBar() { Init(); }
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
)
36 Create(parent
, id
, pos
, size
, style
, name
);
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
);
44 virtual void SetWindowStyleFlag(long style
);
46 virtual bool Destroy();
48 // override/implement base class virtuals
49 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
51 #ifndef __WXOSX_IPHONE__
52 virtual bool Show(bool show
= true);
53 virtual bool IsShown() const;
55 virtual bool Realize();
57 virtual void SetToolBitmapSize(const wxSize
& size
);
58 virtual wxSize
GetToolSize() const;
60 virtual void SetRows(int nRows
);
62 virtual void SetToolNormalBitmap(int id
, const wxBitmap
& bitmap
);
63 virtual void SetToolDisabledBitmap(int id
, const wxBitmap
& bitmap
);
65 #ifndef __WXOSX_IPHONE__
66 // Add all the buttons
68 virtual wxString
MacGetToolTipString( wxPoint
&where
) ;
69 void OnPaint(wxPaintEvent
& event
) ;
70 void OnMouse(wxMouseEvent
& event
) ;
71 virtual void MacSuperChangedPosition() ;
74 #if wxOSX_USE_NATIVE_TOOLBAR
75 bool MacInstallNativeToolbar(bool usesNative
);
76 void MacUninstallNativeToolbar();
77 bool MacWantsNativeToolbar();
78 bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled
) const;
81 virtual wxToolBarToolBase
*CreateTool(int id
,
82 const wxString
& label
,
83 const wxBitmap
& bmpNormal
,
84 const wxBitmap
& bmpDisabled
= wxNullBitmap
,
85 wxItemKind kind
= wxITEM_NORMAL
,
86 wxObject
*clientData
= NULL
,
87 const wxString
& shortHelp
= wxEmptyString
,
88 const wxString
& longHelp
= wxEmptyString
);
89 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
,
90 const wxString
& label
);
93 // common part of all ctors
98 void DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
);
100 #ifndef __WXOSX_IPHONE__
101 virtual void DoGetSize(int *width
, int *height
) const;
102 virtual wxSize
DoGetBestSize() const;
104 #ifdef __WXOSX_COCOA__
105 virtual void DoGetPosition(int*x
, int *y
) const;
107 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
108 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
110 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
111 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
112 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
114 DECLARE_EVENT_TABLE()
115 #if wxOSX_USE_NATIVE_TOOLBAR
116 bool m_macUsesNativeToolbar
;
119 #ifdef __WXOSX_IPHONE__
120 WX_UIView m_macToolbar
;
124 #endif // wxUSE_TOOLBAR