]> git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/toolbar.h
removed the SetMargins call
[wxWidgets.git] / include / wx / univ / toolbar.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/toolbar.h
3 // Purpose: wxToolBar declaration
4 // Author: Robert Roebling
5 // Modified by:
6 // Created: 10.09.00
7 // RCS-ID: $Id$
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_UNIV_TOOLBAR_H_
13 #define _WX_UNIV_TOOLBAR_H_
14
15 #ifdef __GNUG__
16 #pragma interface "univtoolbar.h"
17 #endif
18
19 #include "wx/window.h"
20
21 // ----------------------------------------------------------------------------
22 // wxToolbar
23 // ----------------------------------------------------------------------------
24
25 class WXDLLEXPORT wxToolBarTool : public wxToolBarToolBase
26 {
27 public:
28 wxToolBarTool( wxToolBarBase *tbar = (wxToolBarBase *)NULL,
29 int id = wxID_SEPARATOR,
30 const wxBitmap& bitmap1 = wxNullBitmap,
31 const wxBitmap& bitmap2 = wxNullBitmap,
32 bool toggle = FALSE,
33 wxObject *clientData = (wxObject *) NULL,
34 const wxString& shortHelpString = wxEmptyString,
35 const wxString& longHelpString = wxEmptyString ) :
36 wxToolBarToolBase( tbar, id, bitmap1, bitmap2, toggle, clientData,
37 shortHelpString, longHelpString )
38 {
39 m_isDown = FALSE;
40 m_x = -1;
41 m_y = -1;
42 }
43
44 public:
45 bool m_isDown;
46 int m_x;
47 int m_y;
48 };
49
50 class WXDLLEXPORT wxToolBar: public wxToolBarBase
51 {
52 public:
53 // construction/destruction
54 wxToolBar() { Init(); }
55 wxToolBar( wxWindow *parent,
56 wxWindowID id,
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
59 long style = 0,
60 const wxString& name = wxToolBarNameStr )
61 {
62 Init();
63
64 Create(parent, id, pos, size, style, name);
65 }
66
67 bool Create( wxWindow *parent,
68 wxWindowID id,
69 const wxPoint& pos = wxDefaultPosition,
70 const wxSize& size = wxDefaultSize,
71 long style = 0,
72 const wxString& name = wxToolBarNameStr );
73
74 #ifdef __DARWIN__
75 virtual ~wxToolBar() { }
76 #endif
77
78 virtual bool Realize();
79
80 virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
81
82 virtual void SetToolShortHelp(int id, const wxString& helpString);
83
84 protected:
85 // common part of all ctors
86 void Init();
87
88 // implement base class pure virtuals
89 virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
90 virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
91
92 virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
93 virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
94 virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
95
96 virtual wxToolBarToolBase *CreateTool(int id,
97 const wxBitmap& bitmap1,
98 const wxBitmap& bitmap2,
99 bool toggle,
100 wxObject *clientData,
101 const wxString& shortHelpString,
102 const wxString& longHelpString);
103 virtual wxToolBarToolBase *CreateTool(wxControl *control);
104
105 private:
106 wxToolBarTool *m_captured;
107 wxToolBarTool *m_underMouse;
108 wxCoord m_maxWidth, m_maxHeight;
109
110 private:
111 void OnMouse( wxMouseEvent &event );
112 void OnEnter( wxMouseEvent &event );
113 void OnLeave( wxMouseEvent &event );
114 void RefreshTool( wxToolBarTool *tool );
115 void DrawToolBarTool( wxToolBarTool *tool, wxDC &dc, bool down );
116 void OnPaint( wxPaintEvent &event );
117
118 private:
119 DECLARE_EVENT_TABLE()
120 };
121
122 #endif // _WX_UNIV_TOOLBAR_H_