]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: tbargtk.h | |
3 | // Purpose: GTK toolbar | |
4 | // Author: Robert Roebling | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Robert Roebling | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __TBARGTKH__ | |
13 | #define __TBARGTKH__ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface | |
17 | #endif | |
18 | ||
19 | #include "wx/defs.h" | |
20 | #include "wx/control.h" | |
21 | ||
22 | //----------------------------------------------------------------------------- | |
23 | // classes | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | class wxToolBarTool; | |
716b7364 | 27 | class wxToolBar; |
c801d85f KB |
28 | |
29 | //----------------------------------------------------------------------------- | |
30 | // constants | |
31 | //----------------------------------------------------------------------------- | |
32 | ||
33 | #define wxTOOL_STYLE_BUTTON 1 | |
34 | #define wxTOOL_STYLE_SEPARATOR 2 | |
35 | ||
36 | //----------------------------------------------------------------------------- | |
37 | // global data | |
38 | //----------------------------------------------------------------------------- | |
39 | ||
40 | extern const char *wxToolBarNameStr; | |
41 | ||
42 | //----------------------------------------------------------------------------- | |
43 | // wxToolBarTool | |
44 | //----------------------------------------------------------------------------- | |
45 | ||
46 | class wxToolBarTool: public wxObject | |
47 | { | |
48 | DECLARE_DYNAMIC_CLASS(wxToolBarTool) | |
49 | ||
50 | public: | |
51 | ||
52 | wxToolBarTool(void) {}; | |
716b7364 | 53 | wxToolBarTool( wxToolBar *owner, int theIndex = 0, |
debe6624 JS |
54 | const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap, |
55 | bool toggle = FALSE, wxObject *clientData = NULL, | |
fc008f25 RR |
56 | const wxString& shortHelpString = "", const wxString& longHelpString = "", |
57 | GtkWidget *item = NULL ); | |
c801d85f KB |
58 | ~wxToolBarTool(void); |
59 | ||
60 | public: | |
61 | ||
62 | int m_toolStyle; | |
63 | wxObject *m_clientData; | |
64 | int m_index; | |
65 | bool m_toggleState; | |
66 | bool m_isToggle; | |
67 | bool m_deleteSecondBitmap; | |
68 | bool m_enabled; | |
69 | wxBitmap m_bitmap1; | |
70 | wxBitmap m_bitmap2; | |
71 | bool m_isMenuCommand; | |
72 | wxString m_shortHelpString; | |
73 | wxString m_longHelpString; | |
716b7364 | 74 | wxToolBar *m_owner; |
fc008f25 | 75 | GtkWidget *m_item; |
c801d85f KB |
76 | }; |
77 | ||
78 | //----------------------------------------------------------------------------- | |
716b7364 | 79 | // wxToolBar |
c801d85f KB |
80 | //----------------------------------------------------------------------------- |
81 | ||
716b7364 | 82 | class wxToolBar: public wxControl |
c801d85f | 83 | { |
716b7364 | 84 | DECLARE_DYNAMIC_CLASS(wxToolBar) |
c801d85f KB |
85 | |
86 | public: | |
87 | ||
716b7364 RR |
88 | wxToolBar(void); |
89 | wxToolBar( wxWindow *parent, wxWindowID id, | |
c801d85f | 90 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
debe6624 | 91 | long style = 0, const wxString& name = wxToolBarNameStr ); |
716b7364 | 92 | ~wxToolBar(void); |
c801d85f | 93 | |
debe6624 | 94 | bool Create( wxWindow *parent, wxWindowID id, |
c801d85f | 95 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
debe6624 | 96 | long style = 0, const wxString& name = wxToolBarNameStr); |
c801d85f KB |
97 | |
98 | // Only allow toggle if returns TRUE. Call when left button up. | |
99 | virtual bool OnLeftClick(int toolIndex, bool toggleDown); | |
100 | ||
101 | // Call when right button down. | |
102 | virtual void OnRightClick(int toolIndex, float x, float y); | |
103 | ||
104 | // Called when the mouse cursor enters a tool bitmap. | |
105 | // Argument is -1 if mouse is exiting the toolbar. | |
106 | virtual void OnMouseEnter(int toolIndex); | |
107 | ||
108 | // If pushedBitmap is NULL, a reversed version of bitmap is | |
109 | // created and used as the pushed/toggled image. | |
110 | // If toggle is TRUE, the button toggles between the two states. | |
debe6624 JS |
111 | virtual wxToolBarTool *AddTool( int toolIndex, const wxBitmap& bitmap, |
112 | const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE, | |
113 | float xPos = -1, float yPos = -1, wxObject *clientData = NULL, | |
c801d85f KB |
114 | const wxString& helpString1 = "", const wxString& helpString2 = ""); |
115 | virtual void AddSeparator(void); | |
116 | virtual void ClearTools(void); | |
46dc76ba | 117 | |
e3e65dac | 118 | virtual void Realize(void); |
c801d85f | 119 | |
debe6624 JS |
120 | virtual void EnableTool(int toolIndex, bool enable); |
121 | virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on | |
debe6624 | 122 | virtual wxObject *GetToolClientData(int index) const; |
c801d85f | 123 | |
debe6624 JS |
124 | virtual bool GetToolState(int toolIndex) const; |
125 | virtual bool GetToolEnabled(int toolIndex) const; | |
c801d85f | 126 | |
debe6624 | 127 | virtual void SetMargins(int x, int y); |
c801d85f | 128 | void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); }; |
debe6624 JS |
129 | virtual void SetToolPacking(int packing); |
130 | virtual void SetToolSeparation(int separation); | |
131 | ||
c801d85f KB |
132 | public: |
133 | ||
134 | GtkToolbar *m_toolbar; | |
135 | wxList m_tools; | |
136 | ||
137 | DECLARE_EVENT_TABLE() | |
138 | }; | |
139 | ||
140 | #endif | |
141 | // __TBARGTKH__ | |
142 |