]> git.saurik.com Git - wxWidgets.git/blame - src/generic/statusbr.cpp
Move code removing "-psn_xxx" command line arguments to common code.
[wxWidgets.git] / src / generic / statusbr.cpp
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
a71d815b 2// Name: src/generic/statusbr.cpp
ed791986 3// Purpose: wxStatusBarGeneric class implementation
c801d85f 4// Author: Julian Smart
c94bdf2a 5// Modified by: Francesco Montorsi
c801d85f 6// Created: 01/02/97
6aa89a22 7// Copyright: (c) Julian Smart
65571936 8// Licence: wxWindows licence
c801d85f
KB
9/////////////////////////////////////////////////////////////////////////////
10
c801d85f
KB
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
76b49cf4 15 #pragma hdrstop
c801d85f
KB
16#endif
17
1e6feb95 18#if wxUSE_STATUSBAR
ed791986 19
3304646d
WS
20#include "wx/statusbr.h"
21
c801d85f 22#ifndef WX_PRECOMP
76b49cf4
WS
23 #include "wx/settings.h"
24 #include "wx/dcclient.h"
a0125cfc 25 #include "wx/toplevel.h"
c34d2f35 26 #include "wx/control.h"
c801d85f
KB
27#endif
28
2b5f62a0 29#ifdef __WXGTK20__
53b6d7a2 30 #include <gtk/gtk.h>
c94bdf2a 31 #include "wx/gtk/private.h"
9dc44eff 32 #include "wx/gtk/private/gtk2-compat.h"
2b5f62a0
VZ
33#endif
34
84f68c21
VZ
35// we only have to do it here when we use wxStatusBarGeneric in addition to the
36// standard wxStatusBar class, if wxStatusBarGeneric is the same as
37// wxStatusBar, then the corresponding IMPLEMENT_DYNAMIC_CLASS is already in
38// common/statbar.cpp
39#if defined(__WXMAC__) || \
40 (defined(wxUSE_NATIVE_STATUSBAR) && wxUSE_NATIVE_STATUSBAR)
b64a8473 41 #include "wx/generic/statusbr.h"
c801d85f 42
b64a8473
VZ
43 IMPLEMENT_DYNAMIC_CLASS(wxStatusBarGeneric, wxWindow)
44#endif // wxUSE_NATIVE_STATUSBAR
ed791986 45
7b6fefbe
FM
46// Default status border dimensions
47#define wxTHICK_LINE_BORDER 2
48
78612fa6
FM
49// Margin between the field text and the field rect
50#define wxFIELD_TEXT_MARGIN 2
51
c94bdf2a
FM
52// ----------------------------------------------------------------------------
53// GTK+ signal handler
54// ----------------------------------------------------------------------------
55
2d0a9aa4
FM
56#if defined( __WXGTK20__ )
57#if GTK_CHECK_VERSION(2,12,0)
c94bdf2a
FM
58extern "C" {
59static
c4c178c1 60gboolean statusbar_query_tooltip(GtkWidget* WXUNUSED(widget),
c94bdf2a
FM
61 gint x,
62 gint y,
c4c178c1 63 gboolean WXUNUSED(keyboard_mode),
c94bdf2a
FM
64 GtkTooltip *tooltip,
65 wxStatusBar* statbar)
66{
67 int n = statbar->GetFieldFromPoint(wxPoint(x,y));
68 if (n == wxNOT_FOUND)
69 return FALSE;
70
71 // should we show the tooltip for the n-th pane of the statusbar?
72 if (!statbar->GetField(n).IsEllipsized())
73 return FALSE; // no, it's not useful
74
c4c178c1
FM
75 const wxString& str = statbar->GetStatusText(n);
76 if (str.empty())
77 return FALSE;
03647350 78
c4c178c1 79 gtk_tooltip_set_text(tooltip, wxGTK_CONV_SYS(str));
c94bdf2a
FM
80 return TRUE;
81}
82}
83#endif
2d0a9aa4 84#endif
7b6fefbe
FM
85
86// ----------------------------------------------------------------------------
87// wxStatusBarGeneric
88// ----------------------------------------------------------------------------
89
ed791986
VZ
90BEGIN_EVENT_TABLE(wxStatusBarGeneric, wxWindow)
91 EVT_PAINT(wxStatusBarGeneric::OnPaint)
ba4589db 92 EVT_SIZE(wxStatusBarGeneric::OnSize)
9dc44eff 93#ifdef __WXGTK20__
2b5f62a0
VZ
94 EVT_LEFT_DOWN(wxStatusBarGeneric::OnLeftDown)
95 EVT_RIGHT_DOWN(wxStatusBarGeneric::OnRightDown)
9dc44eff 96#endif
ed791986 97 EVT_SYS_COLOUR_CHANGED(wxStatusBarGeneric::OnSysColourChanged)
c801d85f 98END_EVENT_TABLE()
c801d85f 99
390015c0 100void wxStatusBarGeneric::Init()
c801d85f 101{
48f7ffbe
WS
102 m_borderX = wxTHICK_LINE_BORDER;
103 m_borderY = wxTHICK_LINE_BORDER;
c801d85f
KB
104}
105
ed791986 106wxStatusBarGeneric::~wxStatusBarGeneric()
c801d85f 107{
c801d85f
KB
108}
109
ed791986 110bool wxStatusBarGeneric::Create(wxWindow *parent,
76880b87
RL
111 wxWindowID id,
112 long style,
113 const wxString& name)
c801d85f 114{
53b6d7a2 115 style |= wxTAB_TRAVERSAL | wxFULL_REPAINT_ON_RESIZE;
48f7ffbe
WS
116 if ( !wxWindow::Create(parent, id,
117 wxDefaultPosition, wxDefaultSize,
53b6d7a2 118 style, name) )
48f7ffbe 119 return false;
c801d85f 120
48f7ffbe
WS
121 // The status bar should have a themed background
122 SetThemeEnabled( true );
123
124 InitColours();
f90566f5 125
1ca21594 126#ifdef __WXPM__
48f7ffbe 127 SetFont(*wxSMALL_FONT);
1ca21594 128#endif
c801d85f 129
ba4589db 130 int height = (int)((11*GetCharHeight())/10 + 2*GetBorderY());
48f7ffbe 131 SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height);
71e03035 132
48f7ffbe 133 SetFieldsCount(1);
03647350 134
2d0a9aa4
FM
135#if defined( __WXGTK20__ )
136#if GTK_CHECK_VERSION(2,12,0)
9dc44eff
PC
137 if (HasFlag(wxSTB_SHOW_TIPS)
138#ifndef __WXGTK3__
139 && gtk_check_version(2,12,0) == NULL
140#endif
141 )
c94bdf2a 142 {
03647350
VZ
143 g_object_set(m_widget, "has-tooltip", TRUE, NULL);
144 g_signal_connect(m_widget, "query-tooltip",
145 G_CALLBACK(statusbar_query_tooltip), this);
c94bdf2a 146 }
2d0a9aa4 147#endif
c94bdf2a 148#endif
8aa2cea1 149
48f7ffbe 150 return true;
c801d85f
KB
151}
152
595a9493
RD
153wxSize wxStatusBarGeneric::DoGetBestSize() const
154{
155 int width, height;
156
157 // best width is the width of the parent
ba4589db
FM
158 if (GetParent())
159 GetParent()->GetClientSize(&width, NULL);
160 else
161 width = 80; // a dummy value
595a9493 162
9a6aafe0 163 // best height is as calculated above in Create()
ba4589db 164 height = (int)((11*GetCharHeight())/10 + 2*GetBorderY());
595a9493
RD
165
166 return wxSize(width, height);
ca65c044 167}
595a9493 168
6cf68971 169void wxStatusBarGeneric::DoUpdateStatusText(int number)
c801d85f 170{
6cf68971
VZ
171 wxRect rect;
172 GetFieldRect(number, rect);
76880b87 173
6cf68971 174 Refresh(true, &rect);
e715f4e7 175
6cf68971
VZ
176 // it's common to show some text in the status bar before starting a
177 // relatively lengthy operation, ensure that the text is shown to the
178 // user immediately and not after the lengthy operation end
179 Update();
c801d85f
KB
180}
181
ed791986 182void wxStatusBarGeneric::SetStatusWidths(int n, const int widths_field[])
c801d85f 183{
7b6fefbe 184 // only set status widths when n == number of statuswindows
9a83f860 185 wxCHECK_RET( (size_t)n == m_panes.GetCount(), wxT("status bar field count mismatch") );
633d67bb 186
1f361cdd 187 wxStatusBarBase::SetStatusWidths(n, widths_field);
0cd15959
FM
188
189 // update cache
8e8d9109
VZ
190 DoUpdateFieldWidths();
191}
192
193void wxStatusBarGeneric::DoUpdateFieldWidths()
194{
195 m_lastClientSize = GetClientSize();
196
197 // recompute the cache of the field widths if the status bar width has changed
198 m_widthsAbs = CalculateAbsWidths(m_lastClientSize.x);
c801d85f
KB
199}
200
7422d7c4
VZ
201bool wxStatusBarGeneric::ShowsSizeGrip() const
202{
c4c178c1 203 if ( !HasFlag(wxSTB_SIZEGRIP) )
7422d7c4
VZ
204 return false;
205
206 wxTopLevelWindow * const
207 tlw = wxDynamicCast(wxGetTopLevelParent(GetParent()), wxTopLevelWindow);
208 return tlw && !tlw->IsMaximized() && tlw->HasFlag(wxRESIZE_BORDER);
209}
210
ba4589db 211void wxStatusBarGeneric::DrawFieldText(wxDC& dc, const wxRect& rect, int i, int textHeight)
c801d85f 212{
ba4589db
FM
213 wxString text(GetStatusText(i));
214 if (text.empty())
215 return; // optimization
c801d85f 216
ba4589db
FM
217 int xpos = rect.x + wxFIELD_TEXT_MARGIN,
218 maxWidth = rect.width - 2*wxFIELD_TEXT_MARGIN,
219 ypos = (int) (((rect.height - textHeight) / 2) + rect.y + 0.5);
78612fa6
FM
220
221 if (ShowsSizeGrip())
222 {
223 // don't write text over the size grip:
224 // NOTE: overloading DoGetClientSize() and GetClientAreaOrigin() wouldn't
225 // work because the adjustment needs to be done only when drawing
226 // the field text and not also when drawing the background, the
227 // size grip itself, etc
ba4589db
FM
228 if ((GetLayoutDirection() == wxLayout_RightToLeft && i == 0) ||
229 (GetLayoutDirection() != wxLayout_RightToLeft &&
230 i == (int)m_panes.GetCount()-1))
78612fa6 231 {
ba4589db 232 const wxRect& gripRc = GetSizeGripRect();
78612fa6 233
ba4589db
FM
234 // NOTE: we don't need any special treatment wrt to the layout direction
235 // since DrawText() will automatically adjust the origin of the
236 // text accordingly to the layout in use
78612fa6 237
ba4589db 238 maxWidth -= gripRc.width;
78612fa6
FM
239 }
240 }
241
242 // eventually ellipsize the text so that it fits the field width
03647350 243
c4c178c1
FM
244 wxEllipsizeMode ellmode = (wxEllipsizeMode)-1;
245 if (HasFlag(wxSTB_ELLIPSIZE_START)) ellmode = wxELLIPSIZE_START;
246 else if (HasFlag(wxSTB_ELLIPSIZE_MIDDLE)) ellmode = wxELLIPSIZE_MIDDLE;
247 else if (HasFlag(wxSTB_ELLIPSIZE_END)) ellmode = wxELLIPSIZE_END;
248
249 if (ellmode == (wxEllipsizeMode)-1)
250 {
251 // if we have the wxSTB_SHOW_TIPS we must set the ellipsized flag even if
252 // we don't ellipsize the text but just truncate it
253 if (HasFlag(wxSTB_SHOW_TIPS))
254 SetEllipsizedFlag(i, dc.GetTextExtent(text).GetWidth() > maxWidth);
c801d85f 255
c4c178c1
FM
256 dc.SetClippingRegion(rect);
257 }
258 else
259 {
260 text = wxControl::Ellipsize(text, dc,
261 ellmode,
262 maxWidth,
355ce7ad 263 wxELLIPSIZE_FLAGS_EXPAND_TABS);
c4c178c1
FM
264 // Ellipsize() will do something only if necessary
265
03647350
VZ
266 // update the ellipsization status for this pane; this is used later to
267 // decide whether a tooltip should be shown or not for this pane
c4c178c1
FM
268 // (if we have wxSTB_SHOW_TIPS)
269 SetEllipsizedFlag(i, text != GetStatusText(i));
270 }
c94bdf2a 271
7c74e7fe 272#if defined( __WXGTK__ ) || defined(__WXMAC__)
48f7ffbe
WS
273 xpos++;
274 ypos++;
92976ab6 275#endif
c801d85f 276
78612fa6 277 // draw the text
48f7ffbe 278 dc.DrawText(text, xpos, ypos);
03647350 279
c4c178c1
FM
280 if (ellmode == (wxEllipsizeMode)-1)
281 dc.DestroyClippingRegion();
c801d85f
KB
282}
283
ba4589db 284void wxStatusBarGeneric::DrawField(wxDC& dc, int i, int textHeight)
c801d85f 285{
2b5f62a0
VZ
286 wxRect rect;
287 GetFieldRect(i, rect);
c801d85f 288
ba4589db 289 if (rect.GetWidth() <= 0)
e75e8815 290 return; // happens when the status bar is shrunk in a very small area!
ba4589db 291
b31eaa5c 292 int style = m_panes[i].GetStyle();
98eb2e84 293 if (style == wxSB_RAISED || style == wxSB_SUNKEN)
c2919ab3
VZ
294 {
295 // Draw border
98eb2e84 296 // For wxSB_SUNKEN: paint a grey background, plus 3-d border (one black rectangle)
c94bdf2a 297 // Inside this, left and top sides (dark grey). Bottom and right (white).
c2919ab3
VZ
298 // Reverse it for wxSB_RAISED
299
300 dc.SetPen((style == wxSB_RAISED) ? m_mediumShadowPen : m_hilightPen);
301
9a6aafe0 302#ifndef __WXPM__
c2919ab3
VZ
303
304 // Right and bottom lines
305 dc.DrawLine(rect.x + rect.width, rect.y,
306 rect.x + rect.width, rect.y + rect.height);
307 dc.DrawLine(rect.x + rect.width, rect.y + rect.height,
308 rect.x, rect.y + rect.height);
309
310 dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen);
311
312 // Left and top lines
313 dc.DrawLine(rect.x, rect.y + rect.height,
314 rect.x, rect.y);
315 dc.DrawLine(rect.x, rect.y,
316 rect.x + rect.width, rect.y);
9a6aafe0 317#else
c2919ab3
VZ
318
319 dc.DrawLine(rect.x + rect.width, rect.height + 2,
320 rect.x, rect.height + 2);
321 dc.DrawLine(rect.x + rect.width, rect.y,
322 rect.x + rect.width, rect.y + rect.height);
323
324 dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen);
325 dc.DrawLine(rect.x, rect.y,
326 rect.x + rect.width, rect.y);
327 dc.DrawLine(rect.x, rect.y + rect.height,
c94bdf2a 328 rect.x, rect.y);
b34590eb 329#endif
c2919ab3 330 }
c801d85f 331
ba4589db 332 DrawFieldText(dc, rect, i, textHeight);
c801d85f
KB
333}
334
ed791986 335bool wxStatusBarGeneric::GetFieldRect(int n, wxRect& rect) const
c801d85f 336{
7b6fefbe 337 wxCHECK_MSG( (n >= 0) && ((size_t)n < m_panes.GetCount()), false,
9a83f860 338 wxT("invalid status bar field index") );
c801d85f 339
8e8d9109
VZ
340 // We can be called from the user-defined EVT_SIZE handler in which case
341 // the widths haven't been updated yet and we need to do it now. This is
342 // not very efficient as we keep testing the size but there is no other way
343 // to make the code needing the up-to-date fields sizes in its EVT_SIZE to
344 // work.
345 if ( GetClientSize().x != m_lastClientSize.x )
346 {
347 const_cast<wxStatusBarGeneric*>(this)->DoUpdateFieldWidths();
348 }
349
ba4589db
FM
350 if (m_widthsAbs.IsEmpty())
351 return false;
c801d85f 352
390015c0
VZ
353 rect.x = 0;
354 for ( int i = 0; i < n; i++ )
390015c0 355 rect.x += m_widthsAbs[i];
390015c0 356 rect.x += m_borderX;
c801d85f 357
ba4589db 358 rect.y = m_borderY;
390015c0 359 rect.width = m_widthsAbs[n] - 2*m_borderX;
8e8d9109 360 rect.height = m_lastClientSize.y - 2*m_borderY;
c801d85f 361
ca65c044 362 return true;
c801d85f
KB
363}
364
c94bdf2a
FM
365int wxStatusBarGeneric::GetFieldFromPoint(const wxPoint& pt) const
366{
367 if (m_widthsAbs.IsEmpty())
368 return wxNOT_FOUND;
369
4c51a665 370 // NOTE: we explicitly don't take in count the borders since they are only
c94bdf2a 371 // useful when rendering the status text, not for hit-test computations
03647350 372
8e8d9109 373 if (pt.y <= 0 || pt.y >= m_lastClientSize.y)
c94bdf2a
FM
374 return wxNOT_FOUND;
375
376 int x = 0;
377 for ( size_t i = 0; i < m_panes.GetCount(); i++ )
378 {
379 if (pt.x > x && pt.x < x+m_widthsAbs[i])
380 return i;
03647350 381
c94bdf2a
FM
382 x += m_widthsAbs[i];
383 }
384
385 return wxNOT_FOUND;
386}
387
ed791986 388void wxStatusBarGeneric::InitColours()
c801d85f 389{
ba959d4c 390#if defined(__WXPM__)
c34d2f35 391 m_mediumShadowPen = wxPen(wxColour(127, 127, 127));
b0fa2187 392 m_hilightPen = *wxWHITE_PEN;
dd7d1435 393
b0fa2187
PC
394 SetBackgroundColour(*wxLIGHT_GREY);
395 SetForegroundColour(*wxBLACK);
ba959d4c
VZ
396#else // !__WXPM__
397 m_mediumShadowPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));
398 m_hilightPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHILIGHT));
399#endif // __WXPM__/!__WXPM__
c801d85f
KB
400}
401
ed791986
VZ
402void wxStatusBarGeneric::SetMinHeight(int height)
403{
404 // check that this min height is not less than minimal height for the
ba4589db
FM
405 // current font (min height is as calculated above in Create() except for border)
406 int minHeight = (int)((11*GetCharHeight())/10);
ed791986 407
ba4589db 408 if ( height > minHeight )
422d0ff0 409 SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height + 2*m_borderY);
ed791986
VZ
410}
411
78612fa6
FM
412wxRect wxStatusBarGeneric::GetSizeGripRect() const
413{
414 int width, height;
415 wxWindow::DoGetClientSize(&width, &height);
416
417 if (GetLayoutDirection() == wxLayout_RightToLeft)
418 return wxRect(2, 2, height-2, height-4);
419 else
420 return wxRect(width-height-2, 2, height-2, height-4);
421}
9a6aafe0
FM
422
423// ----------------------------------------------------------------------------
424// wxStatusBarGeneric - event handlers
425// ----------------------------------------------------------------------------
426
427void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
428{
429 wxPaintDC dc(this);
430
431#ifdef __WXGTK20__
432 // Draw grip first
433 if ( ShowsSizeGrip() )
434 {
78612fa6 435 const wxRect& rc = GetSizeGripRect();
9dc44eff
PC
436#ifdef __WXGTK3__
437 GtkWidget* toplevel = gtk_widget_get_toplevel(m_widget);
01283ace
PC
438 GdkRectangle rect;
439 if (toplevel && (!gtk_window_get_resize_grip_area(GTK_WINDOW(toplevel), &rect) ||
440 rect.width == 0 || rect.height == 0))
9dc44eff
PC
441 {
442 GtkStyleContext* sc = gtk_widget_get_style_context(toplevel);
443 gtk_style_context_save(sc);
444 gtk_style_context_add_class(sc, GTK_STYLE_CLASS_GRIP);
445 GtkJunctionSides sides = GTK_JUNCTION_CORNER_BOTTOMRIGHT;
446 if (GetLayoutDirection() == wxLayout_RightToLeft)
447 sides = GTK_JUNCTION_CORNER_BOTTOMLEFT;
448 gtk_style_context_set_junction_sides(sc, sides);
449 gtk_render_handle(sc,
450 static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext()),
451 rc.x, rc.y, rc.width, rc.height);
452 gtk_style_context_restore(sc);
453 }
454#else
78612fa6
FM
455 GdkWindowEdge edge =
456 GetLayoutDirection() == wxLayout_RightToLeft ? GDK_WINDOW_EDGE_SOUTH_WEST :
457 GDK_WINDOW_EDGE_SOUTH_EAST;
385e8575 458 gtk_paint_resize_grip(gtk_widget_get_style(m_widget),
78612fa6 459 GTKGetDrawingWindow(),
fc9ab22a 460 gtk_widget_get_state(m_widget),
78612fa6
FM
461 NULL,
462 m_widget,
463 "statusbar",
464 edge,
465 rc.x, rc.y, rc.width, rc.height );
9dc44eff 466#endif
9a6aafe0
FM
467 }
468#endif // __WXGTK20__
469
470 if (GetFont().IsOk())
471 dc.SetFont(GetFont());
472
ba4589db
FM
473 // compute char height only once for all panes:
474 int textHeight = dc.GetCharHeight();
9a6aafe0 475
ba4589db 476 dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
9a6aafe0 477 for (size_t i = 0; i < m_panes.GetCount(); i ++)
ba4589db 478 DrawField(dc, i, textHeight);
9a6aafe0
FM
479}
480
9a6aafe0
FM
481void wxStatusBarGeneric::OnSysColourChanged(wxSysColourChangedEvent& event)
482{
483 InitColours();
484
485 // Propagate the event to the non-top-level children
486 wxWindow::OnSysColourChanged(event);
487}
488
9dc44eff 489#ifdef __WXGTK20__
2b5f62a0 490void wxStatusBarGeneric::OnLeftDown(wxMouseEvent& event)
390015c0 491{
2b5f62a0
VZ
492 int width, height;
493 GetClientSize(&width, &height);
8aa2cea1 494
9dc44eff
PC
495 GtkWidget* ancestor = gtk_widget_get_toplevel(m_widget);
496#ifdef __WXGTK3__
01283ace
PC
497 GdkRectangle rect;
498 if (ancestor && gtk_window_get_resize_grip_area(GTK_WINDOW(ancestor), &rect) &&
499 rect.width && rect.height)
500 {
9dc44eff 501 ancestor = NULL;
01283ace 502 }
9dc44eff 503#endif
390015c0 504
9dc44eff
PC
505 if (ancestor && ShowsSizeGrip() && event.GetX() > width - height)
506 {
08f53168 507 GdkWindow *source = GTKGetDrawingWindow();
2b5f62a0
VZ
508
509 int org_x = 0;
510 int org_y = 0;
511 gdk_window_get_origin( source, &org_x, &org_y );
512
fc2d4209
RR
513 if (GetLayoutDirection() == wxLayout_RightToLeft)
514 {
515 gtk_window_begin_resize_drag (GTK_WINDOW (ancestor),
516 GDK_WINDOW_EDGE_SOUTH_WEST,
517 1,
518 org_x - event.GetX() + GetSize().x ,
519 org_y + event.GetY(),
520 0);
521 }
522 else
523 {
524 gtk_window_begin_resize_drag (GTK_WINDOW (ancestor),
2b5f62a0
VZ
525 GDK_WINDOW_EDGE_SOUTH_EAST,
526 1,
8aa2cea1
RD
527 org_x + event.GetX(),
528 org_y + event.GetY(),
2b5f62a0 529 0);
fc2d4209 530 }
2b5f62a0
VZ
531 }
532 else
533 {
ca65c044 534 event.Skip( true );
2b5f62a0 535 }
2b5f62a0
VZ
536}
537
538void wxStatusBarGeneric::OnRightDown(wxMouseEvent& event)
539{
2b5f62a0
VZ
540 int width, height;
541 GetClientSize(&width, &height);
8aa2cea1 542
9dc44eff
PC
543 GtkWidget* ancestor = gtk_widget_get_toplevel(m_widget);
544#ifdef __WXGTK3__
01283ace
PC
545 GdkRectangle rect;
546 if (ancestor && gtk_window_get_resize_grip_area(GTK_WINDOW(ancestor), &rect) &&
547 rect.width && rect.height)
548 {
9dc44eff 549 ancestor = NULL;
01283ace 550 }
9dc44eff 551#endif
2b5f62a0 552
9dc44eff
PC
553 if (ancestor && ShowsSizeGrip() && event.GetX() > width - height)
554 {
08f53168 555 GdkWindow *source = GTKGetDrawingWindow();
2b5f62a0
VZ
556
557 int org_x = 0;
558 int org_y = 0;
559 gdk_window_get_origin( source, &org_x, &org_y );
8aa2cea1 560
2b5f62a0
VZ
561 gtk_window_begin_move_drag (GTK_WINDOW (ancestor),
562 2,
8aa2cea1
RD
563 org_x + event.GetX(),
564 org_y + event.GetY(),
2b5f62a0
VZ
565 0);
566 }
567 else
568 {
ca65c044 569 event.Skip( true );
2b5f62a0 570 }
390015c0 571}
9dc44eff 572#endif // __WXGTK20__
390015c0 573
8e8d9109 574void wxStatusBarGeneric::OnSize(wxSizeEvent& event)
ba4589db 575{
8e8d9109 576 DoUpdateFieldWidths();
ba4589db 577
8e8d9109 578 event.Skip();
ba4589db
FM
579}
580
1e6feb95 581#endif // wxUSE_STATUSBAR