1///////////////////////////////////////////////////////////////////////////// 2// Name: wx/mac/carbon/toolbar.h 3// Purpose: wxToolBar class 4// Author: Stefan Csomor 5// Modified by: 6// Created: 1998-01-01 7// RCS-ID: $Id: toolbar.h 44317 2007-01-25 23:35:07Z RD $ 8// Copyright: (c) Stefan Csomor 9// Licence: wxWindows licence 10///////////////////////////////////////////////////////////////////////////// 11 12#ifndef _WX_TOOLBAR_H_ 13#define _WX_TOOLBAR_H_ 14 15#if wxUSE_TOOLBAR 16 17#include "wx/tbarbase.h" 18#include "wx/dynarray.h" 19 20WXDLLEXPORT_DATA(extern const wxChar) wxToolBarNameStr[]; 21 22class WXDLLEXPORT wxToolBar: public wxToolBarBase 23{ 24 DECLARE_DYNAMIC_CLASS(wxToolBar) 25 public: 26 /* 27 * Public interface 28 */ 29 30 wxToolBar() { Init(); } 31 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) 36 { 37 Init(); 38 Create(parent, id, pos, size, style, name); 39 } 40 virtual ~wxToolBar(); 41 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); 45 46 virtual void SetWindowStyleFlag(long style); 47 48 // override/implement base class virtuals 49 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; 50 51 virtual bool Show(bool show = true); 52 virtual bool IsShown() const; 53 virtual bool Realize(); 54 55 virtual void SetToolBitmapSize(const wxSize& size); 56 virtual wxSize GetToolSize() const; 57 58 virtual void SetRows(int nRows); 59 60#if wxABI_VERSION >= 20802 61 // TODO: In 2.9 these should probably be virtual, and declared in the base class... 62 void SetToolNormalBitmap(int id, const wxBitmap& bitmap); 63 void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); 64#endif 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 78protected: 79 // common part of all ctors 80 void Init(); 81 82 virtual void DoGetSize(int *width, int *height) const; 83 virtual wxSize DoGetBestSize() const; 84 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); 85 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); 86 87 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); 88 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); 89 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); 90 91 virtual wxToolBarToolBase *CreateTool(int id, 92 const wxString& label, 93 const wxBitmap& bmpNormal, 94 const wxBitmap& bmpDisabled, 95 wxItemKind kind, 96 wxObject *clientData, 97 const wxString& shortHelp, 98 const wxString& longHelp); 99 virtual wxToolBarToolBase *CreateTool(wxControl *control); 100 101 DECLARE_EVENT_TABLE() 102#if wxMAC_USE_NATIVE_TOOLBAR 103 bool m_macUsesNativeToolbar ; 104 void* m_macHIToolbarRef ; 105#endif 106}; 107 108#endif // wxUSE_TOOLBAR 109 110#endif 111 // _WX_TOOLBAR_H_ 112