1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/toolbar.h
3 // Purpose: wxToolBar class
4 // Author: Stefan Csomor
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_TOOLBAR_H_
12 #define _WX_TOOLBAR_H_
16 #include "wx/tbarbase.h"
17 #include "wx/dynarray.h"
19 class WXDLLIMPEXP_CORE wxToolBar
: public wxToolBarBase
21 DECLARE_DYNAMIC_CLASS(wxToolBar
)
27 wxToolBar() { Init(); }
29 inline wxToolBar(wxWindow
*parent
, wxWindowID id
,
30 const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
31 long style
= wxTB_HORIZONTAL
,
32 const wxString
& name
= wxToolBarNameStr
)
35 Create(parent
, id
, pos
, size
, style
, name
);
39 bool Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
40 long style
= wxTB_HORIZONTAL
,
41 const wxString
& name
= wxToolBarNameStr
);
43 virtual void SetWindowStyleFlag(long style
);
45 virtual bool Destroy();
47 // override/implement base class virtuals
48 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
50 #ifndef __WXOSX_IPHONE__
51 virtual bool Show(bool show
= true);
52 virtual bool IsShown() const;
54 virtual bool Realize();
56 virtual void SetToolBitmapSize(const wxSize
& size
);
57 virtual wxSize
GetToolSize() const;
59 virtual void SetRows(int nRows
);
61 virtual void SetToolNormalBitmap(int id
, const wxBitmap
& bitmap
);
62 virtual void SetToolDisabledBitmap(int id
, const wxBitmap
& bitmap
);
64 #ifndef __WXOSX_IPHONE__
65 // Add all the buttons
67 virtual wxString
MacGetToolTipString( wxPoint
&where
) ;
68 void OnPaint(wxPaintEvent
& event
) ;
69 void OnMouse(wxMouseEvent
& event
) ;
70 virtual void MacSuperChangedPosition() ;
73 #if wxOSX_USE_NATIVE_TOOLBAR
74 // make all tools selectable
75 void OSXSetSelectableTools(bool set
);
76 void OSXSelectTool(int toolId
);
78 bool MacInstallNativeToolbar(bool usesNative
);
79 void MacUninstallNativeToolbar();
80 bool MacWantsNativeToolbar();
81 bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled
) const;
84 virtual wxToolBarToolBase
*CreateTool(int id
,
85 const wxString
& label
,
86 const wxBitmap
& bmpNormal
,
87 const wxBitmap
& bmpDisabled
= wxNullBitmap
,
88 wxItemKind kind
= wxITEM_NORMAL
,
89 wxObject
*clientData
= NULL
,
90 const wxString
& shortHelp
= wxEmptyString
,
91 const wxString
& longHelp
= wxEmptyString
);
92 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
,
93 const wxString
& label
);
96 // common part of all ctors
101 void DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
);
103 #ifndef __WXOSX_IPHONE__
104 virtual void DoGetSize(int *width
, int *height
) const;
105 virtual wxSize
DoGetBestSize() const;
107 #ifdef __WXOSX_COCOA__
108 virtual void DoGetPosition(int*x
, int *y
) const;
110 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
111 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
113 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
114 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
115 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
117 DECLARE_EVENT_TABLE()
118 #if wxOSX_USE_NATIVE_TOOLBAR
119 bool m_macUsesNativeToolbar
;
122 #ifdef __WXOSX_IPHONE__
123 WX_UIView m_macToolbar
;
127 #endif // wxUSE_TOOLBAR