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 WXDLLIMPEXP_DATA_CORE(extern const char) wxToolBarNameStr
[];
22 class WXDLLIMPEXP_CORE wxToolBar
: public wxToolBarBase
24 DECLARE_DYNAMIC_CLASS(wxToolBar
)
30 wxToolBar() { Init(); }
32 inline wxToolBar(wxWindow
*parent
, wxWindowID id
,
33 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
34 long style
= wxNO_BORDER
|wxTB_HORIZONTAL
,
35 const wxString
& name
= wxToolBarNameStr
)
38 Create(parent
, id
, pos
, size
, style
, name
);
42 bool Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
43 long style
= wxNO_BORDER
|wxTB_HORIZONTAL
,
44 const wxString
& name
= wxToolBarNameStr
);
46 virtual void SetWindowStyleFlag(long style
);
48 virtual bool Destroy();
50 // override/implement base class virtuals
51 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
53 #ifndef __WXOSX_IPHONE__
54 virtual bool Show(bool show
= true);
55 virtual bool IsShown() const;
57 virtual bool Realize();
59 virtual void SetToolBitmapSize(const wxSize
& size
);
60 virtual wxSize
GetToolSize() const;
62 virtual void SetRows(int nRows
);
64 virtual void SetToolNormalBitmap(int id
, const wxBitmap
& bitmap
);
65 virtual void SetToolDisabledBitmap(int id
, const wxBitmap
& bitmap
);
67 #ifndef __WXOSX_IPHONE__
68 // Add all the buttons
70 virtual wxString
MacGetToolTipString( wxPoint
&where
) ;
71 void OnPaint(wxPaintEvent
& event
) ;
72 void OnMouse(wxMouseEvent
& event
) ;
73 virtual void MacSuperChangedPosition() ;
76 #if wxOSX_USE_NATIVE_TOOLBAR
77 bool MacInstallNativeToolbar(bool usesNative
);
78 void MacUninstallNativeToolbar();
79 bool MacWantsNativeToolbar();
80 bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled
) const;
83 // common part of all ctors
88 void DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
);
90 #ifndef __WXOSX_IPHONE__
91 virtual void DoGetSize(int *width
, int *height
) const;
92 virtual wxSize
DoGetBestSize() const;
94 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
95 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
97 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
98 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
99 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
101 virtual wxToolBarToolBase
*CreateTool(int id
,
102 const wxString
& label
,
103 const wxBitmap
& bmpNormal
,
104 const wxBitmap
& bmpDisabled
,
106 wxObject
*clientData
,
107 const wxString
& shortHelp
,
108 const wxString
& longHelp
);
109 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
,
110 const wxString
& label
);
112 DECLARE_EVENT_TABLE()
113 #if wxOSX_USE_NATIVE_TOOLBAR
114 bool m_macUsesNativeToolbar
;
117 #ifdef __WXOSX_IPHONE__
118 WX_UIView m_macToolbar
;
122 #endif // wxUSE_TOOLBAR