]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
a71d815b | 2 | // Name: src/generic/statusbr.cpp |
ed791986 | 3 | // Purpose: wxStatusBarGeneric class implementation |
c801d85f KB |
4 | // Author: Julian Smart |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
6aa89a22 | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
c801d85f KB |
12 | // For compilers that support precompilation, includes "wx.h". |
13 | #include "wx/wxprec.h" | |
14 | ||
15 | #ifdef __BORLANDC__ | |
76b49cf4 | 16 | #pragma hdrstop |
c801d85f KB |
17 | #endif |
18 | ||
1e6feb95 | 19 | #if wxUSE_STATUSBAR |
ed791986 | 20 | |
3304646d WS |
21 | #include "wx/statusbr.h" |
22 | ||
c801d85f | 23 | #ifndef WX_PRECOMP |
76b49cf4 WS |
24 | #include "wx/settings.h" |
25 | #include "wx/dcclient.h" | |
a0125cfc | 26 | #include "wx/toplevel.h" |
c801d85f KB |
27 | #endif |
28 | ||
2b5f62a0 | 29 | #ifdef __WXGTK20__ |
53b6d7a2 | 30 | #include <gtk/gtk.h> |
2b5f62a0 VZ |
31 | #endif |
32 | ||
84f68c21 VZ |
33 | // we only have to do it here when we use wxStatusBarGeneric in addition to the |
34 | // standard wxStatusBar class, if wxStatusBarGeneric is the same as | |
35 | // wxStatusBar, then the corresponding IMPLEMENT_DYNAMIC_CLASS is already in | |
36 | // common/statbar.cpp | |
37 | #if defined(__WXMAC__) || \ | |
38 | (defined(wxUSE_NATIVE_STATUSBAR) && wxUSE_NATIVE_STATUSBAR) | |
b64a8473 | 39 | #include "wx/generic/statusbr.h" |
c801d85f | 40 | |
b64a8473 VZ |
41 | IMPLEMENT_DYNAMIC_CLASS(wxStatusBarGeneric, wxWindow) |
42 | #endif // wxUSE_NATIVE_STATUSBAR | |
ed791986 | 43 | |
ed791986 VZ |
44 | BEGIN_EVENT_TABLE(wxStatusBarGeneric, wxWindow) |
45 | EVT_PAINT(wxStatusBarGeneric::OnPaint) | |
2b5f62a0 VZ |
46 | EVT_LEFT_DOWN(wxStatusBarGeneric::OnLeftDown) |
47 | EVT_RIGHT_DOWN(wxStatusBarGeneric::OnRightDown) | |
ed791986 | 48 | EVT_SYS_COLOUR_CHANGED(wxStatusBarGeneric::OnSysColourChanged) |
c801d85f | 49 | END_EVENT_TABLE() |
c801d85f KB |
50 | |
51 | // Default status border dimensions | |
52 | #define wxTHICK_LINE_BORDER 2 | |
c801d85f | 53 | |
390015c0 | 54 | void wxStatusBarGeneric::Init() |
c801d85f | 55 | { |
48f7ffbe WS |
56 | m_borderX = wxTHICK_LINE_BORDER; |
57 | m_borderY = wxTHICK_LINE_BORDER; | |
c801d85f KB |
58 | } |
59 | ||
ed791986 | 60 | wxStatusBarGeneric::~wxStatusBarGeneric() |
c801d85f | 61 | { |
c801d85f KB |
62 | } |
63 | ||
ed791986 | 64 | bool wxStatusBarGeneric::Create(wxWindow *parent, |
76880b87 RL |
65 | wxWindowID id, |
66 | long style, | |
67 | const wxString& name) | |
c801d85f | 68 | { |
53b6d7a2 | 69 | style |= wxTAB_TRAVERSAL | wxFULL_REPAINT_ON_RESIZE; |
48f7ffbe WS |
70 | if ( !wxWindow::Create(parent, id, |
71 | wxDefaultPosition, wxDefaultSize, | |
53b6d7a2 | 72 | style, name) ) |
48f7ffbe | 73 | return false; |
c801d85f | 74 | |
48f7ffbe WS |
75 | // The status bar should have a themed background |
76 | SetThemeEnabled( true ); | |
77 | ||
78 | InitColours(); | |
f90566f5 | 79 | |
1ca21594 | 80 | #ifdef __WXPM__ |
48f7ffbe | 81 | SetFont(*wxSMALL_FONT); |
1ca21594 | 82 | #endif |
c801d85f | 83 | |
7422d7c4 VZ |
84 | wxCoord y; |
85 | { | |
86 | // Set the height according to the font and the border size | |
87 | wxClientDC dc(this); | |
88 | dc.SetFont(GetFont()); | |
89 | ||
90 | dc.GetTextExtent(_T("X"), NULL, &y ); | |
91 | } | |
48f7ffbe | 92 | int height = (int)( (11*y)/10 + 2*GetBorderY()); |
71e03035 | 93 | |
48f7ffbe | 94 | SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height); |
71e03035 | 95 | |
48f7ffbe | 96 | SetFieldsCount(1); |
8aa2cea1 | 97 | |
48f7ffbe | 98 | return true; |
c801d85f KB |
99 | } |
100 | ||
595a9493 RD |
101 | |
102 | wxSize wxStatusBarGeneric::DoGetBestSize() const | |
103 | { | |
104 | int width, height; | |
105 | ||
106 | // best width is the width of the parent | |
107 | GetParent()->GetClientSize(&width, NULL); | |
108 | ||
109 | // best height is as calculated above in Create | |
110 | wxClientDC dc((wxWindow*)this); | |
111 | dc.SetFont(GetFont()); | |
112 | wxCoord y; | |
113 | dc.GetTextExtent(_T("X"), NULL, &y ); | |
114 | height = (int)( (11*y)/10 + 2*GetBorderY()); | |
115 | ||
116 | return wxSize(width, height); | |
ca65c044 | 117 | } |
595a9493 | 118 | |
cc56206f | 119 | void wxStatusBarGeneric::SetFieldsCount(int number, const int *widths) |
c801d85f | 120 | { |
390015c0 | 121 | wxASSERT_MSG( number >= 0, _T("negative number of fields in wxStatusBar?") ); |
76880b87 | 122 | |
893f25f2 JS |
123 | int i; |
124 | for(i = m_nFields; i < number; ++i) | |
76880b87 RL |
125 | m_statusStrings.Add( wxEmptyString ); |
126 | ||
893f25f2 | 127 | for (i = m_nFields - 1; i >= number; --i) |
390015c0 | 128 | m_statusStrings.RemoveAt(i); |
76880b87 | 129 | |
f9a961e1 DS |
130 | // forget the old cached pixel widths |
131 | m_widthsAbs.Empty(); | |
132 | ||
d64b1c76 DS |
133 | wxStatusBarBase::SetFieldsCount(number, widths); |
134 | ||
76880b87 RL |
135 | wxASSERT_MSG( m_nFields == (int)m_statusStrings.GetCount(), |
136 | _T("This really should never happen, can we do away with m_nFields here?") ); | |
c801d85f KB |
137 | } |
138 | ||
ed791986 | 139 | void wxStatusBarGeneric::SetStatusText(const wxString& text, int number) |
c801d85f | 140 | { |
633d67bb VZ |
141 | wxCHECK_RET( (number >= 0) && (number < m_nFields), |
142 | _T("invalid status bar field index") ); | |
c801d85f | 143 | |
87ff599d JS |
144 | wxString oldText = m_statusStrings[number]; |
145 | if (oldText != text) | |
146 | { | |
147 | m_statusStrings[number] = text; | |
c801d85f | 148 | |
87ff599d JS |
149 | wxRect rect; |
150 | GetFieldRect(number, rect); | |
e715f4e7 | 151 | |
e5e0c727 VZ |
152 | Refresh(true, &rect); |
153 | ||
154 | // it's common to show some text in the status bar before starting a | |
155 | // relatively lengthy operation, ensure that the text is shown to the | |
156 | // user immediately and not after the lengthy operation end | |
157 | Update(); | |
87ff599d | 158 | } |
c801d85f KB |
159 | } |
160 | ||
ed791986 | 161 | wxString wxStatusBarGeneric::GetStatusText(int n) const |
c801d85f | 162 | { |
ed791986 VZ |
163 | wxCHECK_MSG( (n >= 0) && (n < m_nFields), wxEmptyString, |
164 | _T("invalid status bar field index") ); | |
165 | ||
c801d85f KB |
166 | return m_statusStrings[n]; |
167 | } | |
168 | ||
ed791986 | 169 | void wxStatusBarGeneric::SetStatusWidths(int n, const int widths_field[]) |
c801d85f | 170 | { |
633d67bb VZ |
171 | // only set status widths, when n == number of statuswindows |
172 | wxCHECK_RET( n == m_nFields, _T("status bar field count mismatch") ); | |
173 | ||
174 | // delete the old widths in any case - this function may be used to reset | |
175 | // the widths to the default (all equal) | |
1f361cdd MB |
176 | // MBN: this is incompatible with at least wxMSW and wxMAC and not |
177 | // documented, but let's keep it for now | |
178 | ReinitWidths(); | |
633d67bb | 179 | |
390015c0 VZ |
180 | // forget the old cached pixel widths |
181 | m_widthsAbs.Empty(); | |
182 | ||
633d67bb VZ |
183 | if ( !widths_field ) |
184 | { | |
185 | // not an error, see the comment above | |
f8a4fa4c | 186 | Refresh(); |
633d67bb VZ |
187 | return; |
188 | } | |
189 | ||
1f361cdd | 190 | wxStatusBarBase::SetStatusWidths(n, widths_field); |
c801d85f KB |
191 | } |
192 | ||
7422d7c4 VZ |
193 | bool wxStatusBarGeneric::ShowsSizeGrip() const |
194 | { | |
195 | if ( !HasFlag(wxST_SIZEGRIP) ) | |
196 | return false; | |
197 | ||
198 | wxTopLevelWindow * const | |
199 | tlw = wxDynamicCast(wxGetTopLevelParent(GetParent()), wxTopLevelWindow); | |
200 | return tlw && !tlw->IsMaximized() && tlw->HasFlag(wxRESIZE_BORDER); | |
201 | } | |
202 | ||
ed791986 | 203 | void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) ) |
c801d85f | 204 | { |
2b5f62a0 | 205 | wxPaintDC dc(this); |
c801d85f | 206 | |
2b5f62a0 VZ |
207 | #ifdef __WXGTK20__ |
208 | // Draw grip first | |
7422d7c4 | 209 | if ( ShowsSizeGrip() ) |
2b5f62a0 VZ |
210 | { |
211 | int width, height; | |
212 | GetClientSize(&width, &height); | |
7422d7c4 | 213 | |
fc2d4209 RR |
214 | if (GetLayoutDirection() == wxLayout_RightToLeft) |
215 | { | |
216 | gtk_paint_resize_grip( m_widget->style, | |
08f53168 | 217 | GTKGetDrawingWindow(), |
fc2d4209 RR |
218 | (GtkStateType) GTK_WIDGET_STATE (m_widget), |
219 | NULL, | |
220 | m_widget, | |
221 | "statusbar", | |
222 | GDK_WINDOW_EDGE_SOUTH_WEST, | |
223 | 2, 2, height-2, height-4 ); | |
224 | } | |
225 | else | |
226 | { | |
227 | gtk_paint_resize_grip( m_widget->style, | |
08f53168 | 228 | GTKGetDrawingWindow(), |
2b5f62a0 VZ |
229 | (GtkStateType) GTK_WIDGET_STATE (m_widget), |
230 | NULL, | |
231 | m_widget, | |
232 | "statusbar", | |
233 | GDK_WINDOW_EDGE_SOUTH_EAST, | |
fc2d4209 RR |
234 | width-height-2, 2, height-2, height-4 ); |
235 | } | |
2b5f62a0 | 236 | } |
7422d7c4 | 237 | #endif // __WXGTK20__ |
5b3ed311 | 238 | |
48f7ffbe | 239 | if (GetFont().Ok()) |
2b5f62a0 | 240 | dc.SetFont(GetFont()); |
8aa2cea1 | 241 | |
48f7ffbe | 242 | dc.SetBackgroundMode(wxTRANSPARENT); |
c801d85f | 243 | |
28be2e8a | 244 | #ifdef __WXPM__ |
48f7ffbe | 245 | wxColour vColor; |
b34590eb | 246 | |
48f7ffbe WS |
247 | vColor = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR); |
248 | ::WinFillRect(dc.m_hPS, &dc.m_vRclPaint, vColor.GetPixel()); | |
28be2e8a DW |
249 | #endif |
250 | ||
48f7ffbe | 251 | for (int i = 0; i < m_nFields; i ++) |
2b5f62a0 | 252 | DrawField(dc, i); |
c801d85f KB |
253 | } |
254 | ||
ed791986 | 255 | void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i) |
c801d85f | 256 | { |
48f7ffbe | 257 | int leftMargin = 2; |
c801d85f | 258 | |
48f7ffbe WS |
259 | wxRect rect; |
260 | GetFieldRect(i, rect); | |
c801d85f | 261 | |
48f7ffbe | 262 | wxString text(GetStatusText(i)); |
c801d85f | 263 | |
01399dcd | 264 | wxCoord x = 0, y = 0; |
c801d85f | 265 | |
48f7ffbe | 266 | dc.GetTextExtent(text, &x, &y); |
c801d85f | 267 | |
48f7ffbe WS |
268 | int xpos = rect.x + leftMargin; |
269 | int ypos = (int) (((rect.height - y) / 2 ) + rect.y + 0.5) ; | |
ed791986 | 270 | |
7c74e7fe | 271 | #if defined( __WXGTK__ ) || defined(__WXMAC__) |
48f7ffbe WS |
272 | xpos++; |
273 | ypos++; | |
92976ab6 | 274 | #endif |
c801d85f | 275 | |
48f7ffbe | 276 | dc.SetClippingRegion(rect.x, rect.y, rect.width, rect.height); |
c801d85f | 277 | |
48f7ffbe | 278 | dc.DrawText(text, xpos, ypos); |
c801d85f | 279 | |
48f7ffbe | 280 | dc.DestroyClippingRegion(); |
c801d85f KB |
281 | } |
282 | ||
ed791986 | 283 | void wxStatusBarGeneric::DrawField(wxDC& dc, int i) |
c801d85f | 284 | { |
2b5f62a0 VZ |
285 | wxRect rect; |
286 | GetFieldRect(i, rect); | |
c801d85f | 287 | |
c2919ab3 VZ |
288 | int style = wxSB_NORMAL; |
289 | if (m_statusStyles) | |
290 | style = m_statusStyles[i]; | |
c801d85f | 291 | |
c2919ab3 VZ |
292 | if (style != wxSB_FLAT) |
293 | { | |
294 | // Draw border | |
295 | // For wxSB_NORMAL: | |
296 | // Have grey background, plus 3-d border - | |
297 | // One black rectangle. | |
298 | // Inside this, left and top sides - dark grey. Bottom and right - | |
299 | // white. | |
300 | // Reverse it for wxSB_RAISED | |
301 | ||
302 | dc.SetPen((style == wxSB_RAISED) ? m_mediumShadowPen : m_hilightPen); | |
303 | ||
304 | #ifndef __WXPM__ | |
305 | ||
306 | // Right and bottom lines | |
307 | dc.DrawLine(rect.x + rect.width, rect.y, | |
308 | rect.x + rect.width, rect.y + rect.height); | |
309 | dc.DrawLine(rect.x + rect.width, rect.y + rect.height, | |
310 | rect.x, rect.y + rect.height); | |
311 | ||
312 | dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen); | |
313 | ||
314 | // Left and top lines | |
315 | dc.DrawLine(rect.x, rect.y + rect.height, | |
316 | rect.x, rect.y); | |
317 | dc.DrawLine(rect.x, rect.y, | |
318 | rect.x + rect.width, rect.y); | |
319 | #else | |
320 | ||
321 | dc.DrawLine(rect.x + rect.width, rect.height + 2, | |
322 | rect.x, rect.height + 2); | |
323 | dc.DrawLine(rect.x + rect.width, rect.y, | |
324 | rect.x + rect.width, rect.y + rect.height); | |
325 | ||
326 | dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen); | |
327 | dc.DrawLine(rect.x, rect.y, | |
328 | rect.x + rect.width, rect.y); | |
329 | dc.DrawLine(rect.x, rect.y + rect.height, | |
330 | rect.x, rect.y); | |
b34590eb DW |
331 | |
332 | #endif | |
c2919ab3 | 333 | } |
c801d85f | 334 | |
f51f94ea | 335 | DrawFieldText(dc, i); |
c801d85f KB |
336 | } |
337 | ||
338 | // Get the position and size of the field's internal bounding rectangle | |
ed791986 | 339 | bool wxStatusBarGeneric::GetFieldRect(int n, wxRect& rect) const |
c801d85f | 340 | { |
ca65c044 | 341 | wxCHECK_MSG( (n >= 0) && (n < m_nFields), false, |
390015c0 | 342 | _T("invalid status bar field index") ); |
c801d85f | 343 | |
390015c0 VZ |
344 | // FIXME: workarounds for OS/2 bugs have nothing to do here (VZ) |
345 | int width, height; | |
28be2e8a | 346 | #ifdef __WXPM__ |
390015c0 | 347 | GetSize(&width, &height); |
28be2e8a | 348 | #else |
390015c0 | 349 | GetClientSize(&width, &height); |
28be2e8a | 350 | #endif |
c801d85f | 351 | |
2b5f62a0 VZ |
352 | // we cache m_widthsAbs between calls and recompute it if client |
353 | // width has changed (or when it is initially empty) | |
354 | if ( m_widthsAbs.IsEmpty() || (m_lastClientWidth != width) ) | |
c801d85f | 355 | { |
390015c0 VZ |
356 | wxConstCast(this, wxStatusBarGeneric)-> |
357 | m_widthsAbs = CalculateAbsWidths(width); | |
2b5f62a0 VZ |
358 | // remember last width for which we have recomputed the widths in pixels |
359 | wxConstCast(this, wxStatusBarGeneric)-> | |
360 | m_lastClientWidth = width; | |
c801d85f | 361 | } |
c801d85f | 362 | |
390015c0 VZ |
363 | rect.x = 0; |
364 | for ( int i = 0; i < n; i++ ) | |
365 | { | |
366 | rect.x += m_widthsAbs[i]; | |
c801d85f | 367 | } |
c801d85f | 368 | |
390015c0 VZ |
369 | rect.x += m_borderX; |
370 | rect.y = m_borderY; | |
c801d85f | 371 | |
390015c0 VZ |
372 | rect.width = m_widthsAbs[n] - 2*m_borderX; |
373 | rect.height = height - 2*m_borderY; | |
c801d85f | 374 | |
ca65c044 | 375 | return true; |
c801d85f KB |
376 | } |
377 | ||
378 | // Initialize colours | |
ed791986 | 379 | void wxStatusBarGeneric::InitColours() |
c801d85f KB |
380 | { |
381 | // Shadow colours | |
a71d815b | 382 | #if defined(__WXMSW__) || defined(__WXMAC__) |
a756f210 | 383 | wxColour mediumShadowColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)); |
c801d85f KB |
384 | m_mediumShadowPen = wxPen(mediumShadowColour, 1, wxSOLID); |
385 | ||
a756f210 | 386 | wxColour hilightColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHILIGHT)); |
c801d85f | 387 | m_hilightPen = wxPen(hilightColour, 1, wxSOLID); |
b34590eb | 388 | #elif defined(__WXPM__) |
e715f4e7 | 389 | m_mediumShadowPen = wxPen(wxColour(127, 127, 127), 1, wxSOLID); |
b0fa2187 | 390 | m_hilightPen = *wxWHITE_PEN; |
dd7d1435 | 391 | |
b0fa2187 PC |
392 | SetBackgroundColour(*wxLIGHT_GREY); |
393 | SetForegroundColour(*wxBLACK); | |
c801d85f | 394 | #else |
b0fa2187 PC |
395 | m_mediumShadowPen = *wxGREY_PEN; |
396 | m_hilightPen = *wxWHITE_PEN; | |
c801d85f | 397 | #endif |
c801d85f KB |
398 | } |
399 | ||
400 | // Responds to colour changes, and passes event on to children. | |
ed791986 | 401 | void wxStatusBarGeneric::OnSysColourChanged(wxSysColourChangedEvent& event) |
c801d85f KB |
402 | { |
403 | InitColours(); | |
c801d85f KB |
404 | |
405 | // Propagate the event to the non-top-level children | |
406 | wxWindow::OnSysColourChanged(event); | |
407 | } | |
408 | ||
ed791986 VZ |
409 | void wxStatusBarGeneric::SetMinHeight(int height) |
410 | { | |
411 | // check that this min height is not less than minimal height for the | |
412 | // current font | |
413 | wxClientDC dc(this); | |
414 | wxCoord y; | |
2b5f62a0 | 415 | dc.GetTextExtent( wxT("X"), NULL, &y ); |
ed791986 VZ |
416 | |
417 | if ( height > (11*y)/10 ) | |
418 | { | |
422d0ff0 | 419 | SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height + 2*m_borderY); |
ed791986 VZ |
420 | } |
421 | } | |
422 | ||
2b5f62a0 | 423 | void wxStatusBarGeneric::OnLeftDown(wxMouseEvent& event) |
390015c0 | 424 | { |
2b5f62a0 VZ |
425 | #ifdef __WXGTK20__ |
426 | int width, height; | |
427 | GetClientSize(&width, &height); | |
8aa2cea1 | 428 | |
7422d7c4 | 429 | if ( ShowsSizeGrip() && (event.GetX() > width-height) ) |
2b5f62a0 VZ |
430 | { |
431 | GtkWidget *ancestor = gtk_widget_get_toplevel( m_widget ); | |
432 | ||
433 | if (!GTK_IS_WINDOW (ancestor)) | |
434 | return; | |
390015c0 | 435 | |
08f53168 | 436 | GdkWindow *source = GTKGetDrawingWindow(); |
2b5f62a0 VZ |
437 | |
438 | int org_x = 0; | |
439 | int org_y = 0; | |
440 | gdk_window_get_origin( source, &org_x, &org_y ); | |
441 | ||
fc2d4209 RR |
442 | if (GetLayoutDirection() == wxLayout_RightToLeft) |
443 | { | |
444 | gtk_window_begin_resize_drag (GTK_WINDOW (ancestor), | |
445 | GDK_WINDOW_EDGE_SOUTH_WEST, | |
446 | 1, | |
447 | org_x - event.GetX() + GetSize().x , | |
448 | org_y + event.GetY(), | |
449 | 0); | |
450 | } | |
451 | else | |
452 | { | |
453 | gtk_window_begin_resize_drag (GTK_WINDOW (ancestor), | |
2b5f62a0 VZ |
454 | GDK_WINDOW_EDGE_SOUTH_EAST, |
455 | 1, | |
8aa2cea1 RD |
456 | org_x + event.GetX(), |
457 | org_y + event.GetY(), | |
2b5f62a0 | 458 | 0); |
fc2d4209 | 459 | } |
2b5f62a0 VZ |
460 | } |
461 | else | |
462 | { | |
ca65c044 | 463 | event.Skip( true ); |
2b5f62a0 VZ |
464 | } |
465 | #else | |
ca65c044 | 466 | event.Skip( true ); |
2b5f62a0 VZ |
467 | #endif |
468 | } | |
469 | ||
470 | void wxStatusBarGeneric::OnRightDown(wxMouseEvent& event) | |
471 | { | |
472 | #ifdef __WXGTK20__ | |
473 | int width, height; | |
474 | GetClientSize(&width, &height); | |
8aa2cea1 | 475 | |
7422d7c4 | 476 | if ( ShowsSizeGrip() && (event.GetX() > width-height) ) |
2b5f62a0 VZ |
477 | { |
478 | GtkWidget *ancestor = gtk_widget_get_toplevel( m_widget ); | |
479 | ||
480 | if (!GTK_IS_WINDOW (ancestor)) | |
481 | return; | |
482 | ||
08f53168 | 483 | GdkWindow *source = GTKGetDrawingWindow(); |
2b5f62a0 VZ |
484 | |
485 | int org_x = 0; | |
486 | int org_y = 0; | |
487 | gdk_window_get_origin( source, &org_x, &org_y ); | |
8aa2cea1 | 488 | |
2b5f62a0 VZ |
489 | gtk_window_begin_move_drag (GTK_WINDOW (ancestor), |
490 | 2, | |
8aa2cea1 RD |
491 | org_x + event.GetX(), |
492 | org_y + event.GetY(), | |
2b5f62a0 VZ |
493 | 0); |
494 | } | |
495 | else | |
496 | { | |
ca65c044 | 497 | event.Skip( true ); |
2b5f62a0 VZ |
498 | } |
499 | #else | |
ca65c044 | 500 | event.Skip( true ); |
2b5f62a0 | 501 | #endif |
390015c0 VZ |
502 | } |
503 | ||
1e6feb95 | 504 | #endif // wxUSE_STATUSBAR |