| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: toolbar.h |
| 3 | // Purpose: wxToolBar class |
| 4 | // Author: AUTHOR |
| 5 | // Modified by: |
| 6 | // Created: ??/??/98 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) AUTHOR |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_TOOLBAR_H_ |
| 13 | #define _WX_TOOLBAR_H_ |
| 14 | |
| 15 | #ifdef __GNUG__ |
| 16 | #pragma interface "toolbar.h" |
| 17 | #endif |
| 18 | |
| 19 | #include "wx/tbarbase.h" |
| 20 | |
| 21 | WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr; |
| 22 | |
| 23 | class WXDLLEXPORT wxToolBar: public wxToolBarBase |
| 24 | { |
| 25 | DECLARE_DYNAMIC_CLASS(wxToolBar) |
| 26 | public: |
| 27 | /* |
| 28 | * Public interface |
| 29 | */ |
| 30 | |
| 31 | wxToolBar(); |
| 32 | |
| 33 | inline wxToolBar(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
| 34 | long style = wxNO_BORDER|wxTB_HORIZONTAL, |
| 35 | const wxString& name = wxToolBarNameStr) |
| 36 | { |
| 37 | Create(parent, id, pos, size, style, name); |
| 38 | } |
| 39 | ~wxToolBar(); |
| 40 | |
| 41 | bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
| 42 | long style = wxNO_BORDER|wxTB_HORIZONTAL, |
| 43 | const wxString& name = wxToolBarNameStr); |
| 44 | |
| 45 | // If pushedBitmap is NULL, a reversed version of bitmap is |
| 46 | // created and used as the pushed/toggled image. |
| 47 | // If toggle is TRUE, the button toggles between the two states. |
| 48 | wxToolBarTool *AddTool(int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap, |
| 49 | bool toggle = FALSE, long xPos = -1, long yPos = -1, wxObject *clientData = NULL, |
| 50 | const wxString& helpString1 = "", const wxString& helpString2 = ""); |
| 51 | |
| 52 | // Set default bitmap size |
| 53 | void SetToolBitmapSize(const wxSize& size); |
| 54 | void EnableTool(int toolIndex, bool enable); // additional drawing on enabling |
| 55 | void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on |
| 56 | void ClearTools(); |
| 57 | |
| 58 | // The button size is bigger than the bitmap size |
| 59 | wxSize GetToolSize() const; |
| 60 | |
| 61 | wxSize GetMaxSize() const; |
| 62 | |
| 63 | // Add all the buttons |
| 64 | virtual bool CreateTools(); |
| 65 | virtual void Layout() {} |
| 66 | |
| 67 | // The post-tool-addition call. TODO: do here whatever's |
| 68 | // necessary for completing the toolbar construction. |
| 69 | bool Realize() { return CreateTools(); }; |
| 70 | |
| 71 | protected: |
| 72 | |
| 73 | DECLARE_EVENT_TABLE() |
| 74 | }; |
| 75 | |
| 76 | #endif |
| 77 | // _WX_TOOLBAR_H_ |