]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: tbargtk.h | |
3 | // Purpose: GTK toolbar | |
4 | // Author: Robert Roebling | |
c801d85f KB |
5 | // RCS-ID: $Id$ |
6 | // Copyright: (c) Robert Roebling | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef __TBARGTKH__ | |
11 | #define __TBARGTKH__ | |
12 | ||
13 | #ifdef __GNUG__ | |
14 | #pragma interface | |
15 | #endif | |
16 | ||
17 | #include "wx/defs.h" | |
dcf924a3 RR |
18 | |
19 | #if wxUSE_TOOLBAR | |
20 | ||
c801d85f | 21 | #include "wx/control.h" |
ac57418f | 22 | #include "wx/bitmap.h" |
4fcd73bd | 23 | #include "wx/tbarbase.h" |
c801d85f KB |
24 | |
25 | //----------------------------------------------------------------------------- | |
26 | // classes | |
27 | //----------------------------------------------------------------------------- | |
28 | ||
29 | class wxToolBarTool; | |
716b7364 | 30 | class wxToolBar; |
c801d85f KB |
31 | |
32 | //----------------------------------------------------------------------------- | |
33 | // constants | |
34 | //----------------------------------------------------------------------------- | |
35 | ||
36 | #define wxTOOL_STYLE_BUTTON 1 | |
37 | #define wxTOOL_STYLE_SEPARATOR 2 | |
38 | ||
39 | //----------------------------------------------------------------------------- | |
40 | // global data | |
41 | //----------------------------------------------------------------------------- | |
42 | ||
3b90345b | 43 | extern const wxChar *wxToolBarNameStr; |
c801d85f | 44 | |
c801d85f | 45 | //----------------------------------------------------------------------------- |
716b7364 | 46 | // wxToolBar |
c801d85f KB |
47 | //----------------------------------------------------------------------------- |
48 | ||
716b7364 | 49 | class wxToolBar: public wxControl |
c801d85f | 50 | { |
9b7e522a | 51 | public: |
bf9e3e73 | 52 | wxToolBar(); |
716b7364 | 53 | wxToolBar( wxWindow *parent, wxWindowID id, |
c801d85f | 54 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
debe6624 | 55 | long style = 0, const wxString& name = wxToolBarNameStr ); |
bf9e3e73 | 56 | ~wxToolBar(); |
c801d85f | 57 | |
debe6624 | 58 | bool Create( wxWindow *parent, wxWindowID id, |
c801d85f | 59 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
debe6624 | 60 | long style = 0, const wxString& name = wxToolBarNameStr); |
c801d85f KB |
61 | |
62 | // Only allow toggle if returns TRUE. Call when left button up. | |
63 | virtual bool OnLeftClick(int toolIndex, bool toggleDown); | |
64 | ||
65 | // Call when right button down. | |
66 | virtual void OnRightClick(int toolIndex, float x, float y); | |
67 | ||
68 | // Called when the mouse cursor enters a tool bitmap. | |
69 | // Argument is -1 if mouse is exiting the toolbar. | |
70 | virtual void OnMouseEnter(int toolIndex); | |
71 | ||
72 | // If pushedBitmap is NULL, a reversed version of bitmap is | |
73 | // created and used as the pushed/toggled image. | |
74 | // If toggle is TRUE, the button toggles between the two states. | |
debe6624 JS |
75 | virtual wxToolBarTool *AddTool( int toolIndex, const wxBitmap& bitmap, |
76 | const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE, | |
fd69e87d | 77 | wxCoord xPos = -1, wxCoord yPos = -1, wxObject *clientData = (wxObject *)NULL, |
c801d85f | 78 | const wxString& helpString1 = "", const wxString& helpString2 = ""); |
46dc76ba | 79 | |
bf9e3e73 RR |
80 | // Add arbitrary control |
81 | virtual bool AddControl(wxControl *control); | |
82 | ||
83 | // Add space | |
84 | virtual void AddSeparator(); | |
85 | ||
97d7bfb8 RR |
86 | // Delete tool by index (=id) |
87 | virtual bool DeleteTool(int toolIndex); | |
88 | ||
89 | // Delete all tools | |
bf9e3e73 RR |
90 | virtual void ClearTools(); |
91 | ||
97d7bfb8 | 92 | // Has to be called after adding tools or changing something |
bf9e3e73 | 93 | virtual bool Realize(); |
c801d85f | 94 | |
debe6624 JS |
95 | virtual void EnableTool(int toolIndex, bool enable); |
96 | virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on | |
debe6624 | 97 | virtual wxObject *GetToolClientData(int index) const; |
c801d85f | 98 | |
debe6624 JS |
99 | virtual bool GetToolState(int toolIndex) const; |
100 | virtual bool GetToolEnabled(int toolIndex) const; | |
c801d85f | 101 | |
debe6624 | 102 | virtual void SetMargins(int x, int y); |
c801d85f | 103 | void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); }; |
1144d24d RR |
104 | virtual wxSize GetToolMargins(void) { return wxSize(m_xMargin, m_yMargin); } |
105 | ||
debe6624 JS |
106 | virtual void SetToolPacking(int packing); |
107 | virtual void SetToolSeparation(int separation); | |
1144d24d RR |
108 | virtual int GetToolPacking(); |
109 | virtual int GetToolSeparation(); | |
110 | ||
111 | virtual wxString GetToolLongHelp(int toolIndex); | |
112 | virtual wxString GetToolShortHelp(int toolIndex); | |
113 | ||
114 | virtual void SetToolLongHelp(int toolIndex, const wxString& helpString); | |
115 | virtual void SetToolShortHelp(int toolIndex, const wxString& helpString); | |
b1da76e1 RR |
116 | |
117 | void OnIdle( wxIdleEvent &ievent ); | |
debe6624 | 118 | |
b46e8696 | 119 | // implementation |
c801d85f KB |
120 | |
121 | GtkToolbar *m_toolbar; | |
1144d24d | 122 | int m_separation; |
c801d85f | 123 | wxList m_tools; |
1144d24d | 124 | |
83624f79 RR |
125 | GdkColor *m_fg; |
126 | GdkColor *m_bg; | |
1144d24d RR |
127 | int m_xMargin; |
128 | int m_yMargin; | |
129 | bool m_hasToolAlready; | |
59fe1666 | 130 | bool m_blockNextEvent; |
9b7e522a RR |
131 | |
132 | void OnInternalIdle(); | |
133 | ||
134 | private: | |
135 | DECLARE_EVENT_TABLE() | |
136 | DECLARE_DYNAMIC_CLASS(wxToolBar) | |
c801d85f KB |
137 | }; |
138 | ||
dcf924a3 RR |
139 | #endif |
140 | ||
c801d85f KB |
141 | #endif |
142 | // __TBARGTKH__ |