]> git.saurik.com Git - wxWidgets.git/blob - src/qt/tbargtk.cpp
fixed (rare but fatal) bug in wxWindowDisabler
[wxWidgets.git] / src / qt / tbargtk.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tbargtk.cpp
3 // Purpose: GTK toolbar
4 // Author: Robert Roebling
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID:
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "tbargtk.h"
14 #endif
15
16 #include "wx/toolbar.h"
17
18 //-----------------------------------------------------------------------------
19 // wxToolBarTool
20 //-----------------------------------------------------------------------------
21
22 IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
23
24 wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
25 const wxBitmap& bitmap1, const wxBitmap& bitmap2,
26 bool toggle, wxObject *clientData,
27 const wxString& shortHelpString, const wxString& longHelpString )
28 {
29 m_owner = owner;
30 m_index = theIndex;
31 m_bitmap1 = bitmap1;
32 m_bitmap2 = bitmap2;
33 m_isToggle = toggle;
34 m_enabled = TRUE;
35 m_toggleState = FALSE;
36 m_shortHelpString = shortHelpString;
37 m_longHelpString = longHelpString;
38 m_isMenuCommand = TRUE;
39 m_clientData = clientData;
40 m_deleteSecondBitmap = FALSE;
41 };
42
43 wxToolBarTool::~wxToolBarTool(void)
44 {
45 };
46
47 //-----------------------------------------------------------------------------
48 // wxToolBar
49 //-----------------------------------------------------------------------------
50
51 IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
52
53 BEGIN_EVENT_TABLE(wxToolBar, wxControl)
54 END_EVENT_TABLE()
55
56 wxToolBar::wxToolBar(void)
57 {
58 };
59
60 wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
61 const wxPoint& pos, const wxSize& size,
62 long style, const wxString& name )
63 {
64 Create( parent, id, pos, size, style, name );
65 };
66
67 wxToolBar::~wxToolBar(void)
68 {
69 };
70
71 bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
72 const wxPoint& pos, const wxSize& size,
73 long style, const wxString& name )
74 {
75 return TRUE;
76 };
77
78 bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
79 {
80 wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, toolIndex );
81 event.SetEventObject(this);
82 event.SetInt( toolIndex );
83 event.SetExtraLong((long) toggleDown);
84
85 GetEventHandler()->ProcessEvent(event);
86
87 return TRUE;
88 };
89
90 void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
91 {
92 wxCommandEvent event( wxEVT_COMMAND_TOOL_RCLICKED, toolIndex );
93 event.SetEventObject( this );
94 event.SetInt( toolIndex );
95
96 GetEventHandler()->ProcessEvent(event);
97 };
98
99 void wxToolBar::OnMouseEnter( int toolIndex )
100 {
101 wxCommandEvent event( wxEVT_COMMAND_TOOL_ENTER, toolIndex );
102 event.SetEventObject(this);
103 event.SetInt( toolIndex );
104
105 GetEventHandler()->ProcessEvent(event);
106 };
107
108 wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
109 const wxBitmap& pushedBitmap, bool toggle,
110 float WXUNUSED(xPos), float WXUNUSED(yPos), wxObject *clientData,
111 const wxString& helpString1, const wxString& helpString2 )
112 {
113 };
114
115 void wxToolBar::AddSeparator(void)
116 {
117 };
118
119 void wxToolBar::ClearTools(void)
120 {
121 };
122
123 void wxToolBar::Realize(void)
124 {
125 };
126
127 void wxToolBar::EnableTool(int toolIndex, bool enable)
128 {
129 wxNode *node = m_tools.First();
130 while (node)
131 {
132 wxToolBarTool *tool = (wxToolBarTool*)node->Data();
133 if (tool->m_index == toolIndex)
134 {
135 tool->m_enabled = enable;
136 return;
137 }
138 node = node->Next();
139 };
140 };
141
142 void wxToolBar::ToggleTool(int WXUNUSED(toolIndex), bool WXUNUSED(toggle) )
143 {
144 };
145
146 wxObject *wxToolBar::GetToolClientData(int index) const
147 {
148 wxNode *node = m_tools.First();
149 while (node)
150 {
151 wxToolBarTool *tool = (wxToolBarTool*)node->Data();
152 if (tool->m_index == index) return tool->m_clientData;;
153 node = node->Next();
154 };
155 return (wxObject*)NULL;
156 };
157
158 bool wxToolBar::GetToolState(int toolIndex) const
159 {
160 wxNode *node = m_tools.First();
161 while (node)
162 {
163 wxToolBarTool *tool = (wxToolBarTool*)node->Data();
164 if (tool->m_index == toolIndex) return tool->m_toggleState;
165 node = node->Next();
166 };
167 return FALSE;
168 };
169
170 bool wxToolBar::GetToolEnabled(int toolIndex) const
171 {
172 wxNode *node = m_tools.First();
173 while (node)
174 {
175 wxToolBarTool *tool = (wxToolBarTool*)node->Data();
176 if (tool->m_index == toolIndex) return tool->m_enabled;
177 node = node->Next();
178 };
179 return FALSE;
180 };
181
182 void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) )
183 {
184 };
185
186 void wxToolBar::SetToolPacking( int WXUNUSED(packing) )
187 {
188 };
189
190 void wxToolBar::SetToolSeparation( int separation )
191 {
192 };
193