1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/buttonbar.h
3 // Purpose: wxButtonToolBar declaration
4 // Author: Julian Smart, after Robert Roebling, Vadim Zeitlin, SciTech
7 // Copyright: (c) Julian Smart, Robert Roebling, Vadim Zeitlin,
8 // SciTech Software, Inc.
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_BUTTONBAR_H_
13 #define _WX_BUTTONBAR_H_
15 #include "wx/bmpbuttn.h"
16 #include "wx/toolbar.h"
18 class WXDLLIMPEXP_FWD_CORE wxButtonToolBarTool
;
20 // ----------------------------------------------------------------------------
22 // ----------------------------------------------------------------------------
24 class WXDLLIMPEXP_CORE wxButtonToolBar
: public wxToolBarBase
27 // construction/destruction
28 wxButtonToolBar() { Init(); }
29 wxButtonToolBar(wxWindow
*parent
,
31 const wxPoint
& pos
= wxDefaultPosition
,
32 const wxSize
& size
= wxDefaultSize
,
34 const wxString
& name
= wxToolBarNameStr
)
38 Create(parent
, id
, pos
, size
, style
, name
);
41 bool Create( wxWindow
*parent
,
43 const wxPoint
& pos
= wxDefaultPosition
,
44 const wxSize
& size
= wxDefaultSize
,
46 const wxString
& name
= wxToolBarNameStr
);
48 virtual ~wxButtonToolBar();
50 virtual bool Realize();
52 virtual void SetToolShortHelp(int id
, const wxString
& helpString
);
53 virtual wxToolBarToolBase
*FindToolForPosition(wxCoord x
, wxCoord y
) const;
56 // common part of all ctors
59 // implement base class pure virtuals
60 virtual bool DoInsertTool(size_t pos
, wxToolBarToolBase
*tool
);
61 virtual bool DoDeleteTool(size_t pos
, wxToolBarToolBase
*tool
);
63 virtual void DoEnableTool(wxToolBarToolBase
*tool
, bool enable
);
64 virtual void DoToggleTool(wxToolBarToolBase
*tool
, bool toggle
);
65 virtual void DoSetToggle(wxToolBarToolBase
*tool
, bool toggle
);
67 virtual wxToolBarToolBase
*CreateTool(int id
,
68 const wxString
& label
,
69 const wxBitmap
& bmpNormal
,
70 const wxBitmap
& bmpDisabled
,
73 const wxString
& shortHelp
,
74 const wxString
& longHelp
);
75 virtual wxToolBarToolBase
*CreateTool(wxControl
*control
,
76 const wxString
& label
);
78 virtual wxSize
DoGetBestClientSize() const;
83 // get the bounding rect for the given tool
84 wxRect
GetToolRect(wxToolBarToolBase
*tool
) const;
86 // get the rect limits depending on the orientation: top/bottom for a
87 // vertical toolbar, left/right for a horizontal one
88 void GetRectLimits(const wxRect
& rect
, wxCoord
*start
, wxCoord
*end
) const;
90 // receives button commands
91 void OnCommand(wxCommandEvent
& event
);
94 void OnPaint(wxPaintEvent
& event
);
96 // detects mouse clicks outside buttons
97 void OnLeftUp(wxMouseEvent
& event
);
100 // have we calculated the positions of our tools?
103 // the width of a separator
104 wxCoord m_widthSeparator
;
106 // the total size of all toolbar elements
110 // the height of a label
113 // the space above the label
117 DECLARE_DYNAMIC_CLASS(wxButtonToolBar
)
118 DECLARE_EVENT_TABLE()