1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        src/gtk1/frame.cpp
3 // Purpose:
4 // Author:      Robert Roebling
5 // Copyright:   (c) 1998 Robert Roebling
6 // Licence:     wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8 
9 // For compilers that support precompilation, includes "wx.h".
10 #include "wx/wxprec.h"
11 
12 // ============================================================================
13 // declarations
14 // ============================================================================
15 
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19 
20 #include "wx/frame.h"
21 
22 #ifndef WX_PRECOMP
23     #include "wx/app.h"
24     #include "wx/dcclient.h"
25     #include "wx/menu.h"
26     #include "wx/dialog.h"
27     #include "wx/control.h"
28     #include "wx/toolbar.h"
29     #include "wx/statusbr.h"
30 #endif // WX_PRECOMP
31 
32 #include <glib.h>
33 #include "wx/gtk1/private.h"
34 
35 #include <gdk/gdkkeysyms.h>
36 #include <gdk/gdkx.h>
37 
38 #include "wx/gtk1/win_gtk.h"
39 
40 // ----------------------------------------------------------------------------
41 // constants
42 // ----------------------------------------------------------------------------
43 
44 const int wxSTATUS_HEIGHT  = 25;
45 const int wxPLACE_HOLDER   = 0;
46 
47 // ----------------------------------------------------------------------------
48 // idle system
49 // ----------------------------------------------------------------------------
50 
51 extern void wxapp_install_idle_handler();
52 extern bool g_isIdle;
53 
54 // ----------------------------------------------------------------------------
55 // event tables
56 // ----------------------------------------------------------------------------
57 
58 // ============================================================================
59 // implementation
60 // ============================================================================
61 
62 // ----------------------------------------------------------------------------
63 // GTK callbacks
64 // ----------------------------------------------------------------------------
65 
66 #if wxUSE_MENUS_NATIVE
67 
68 //-----------------------------------------------------------------------------
69 // "child_attached" of menu bar
70 //-----------------------------------------------------------------------------
71 
72 extern "C" {
gtk_menu_attached_callback(GtkWidget * WXUNUSED (widget),GtkWidget * WXUNUSED (child),wxFrame * win)73 static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
74 {
75     if (!win->m_hasVMT) return;
76 
77     win->m_menuBarDetached = false;
78     win->GtkUpdateSize();
79 }
80 }
81 
82 //-----------------------------------------------------------------------------
83 // "child_detached" of menu bar
84 //-----------------------------------------------------------------------------
85 
86 extern "C" {
gtk_menu_detached_callback(GtkWidget * WXUNUSED (widget),GtkWidget * WXUNUSED (child),wxFrame * win)87 static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
88 {
89     if (g_isIdle)
90         wxapp_install_idle_handler();
91 
92     if (!win->m_hasVMT) return;
93 
94     // Raise the client area area
95     gdk_window_raise( win->m_wxwindow->window );
96 
97     win->m_menuBarDetached = true;
98     win->GtkUpdateSize();
99 }
100 }
101 
102 #endif // wxUSE_MENUS_NATIVE
103 
104 #if wxUSE_TOOLBAR
105 //-----------------------------------------------------------------------------
106 // "child_attached" of tool bar
107 //-----------------------------------------------------------------------------
108 
109 extern "C" {
gtk_toolbar_attached_callback(GtkWidget * WXUNUSED (widget),GtkWidget * WXUNUSED (child),wxFrame * win)110 static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
111 {
112     if (!win->m_hasVMT) return;
113 
114     win->m_toolBarDetached = false;
115     win->GtkUpdateSize();
116 }
117 }
118 
119 //-----------------------------------------------------------------------------
120 // "child_detached" of tool bar
121 //-----------------------------------------------------------------------------
122 
123 extern "C" {
gtk_toolbar_detached_callback(GtkWidget * WXUNUSED (widget),GtkWidget * WXUNUSED (child),wxFrame * win)124 static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
125 {
126     if (g_isIdle)
127         wxapp_install_idle_handler();
128 
129     if (!win->m_hasVMT) return;
130 
131     // Raise the client area area
132     gdk_window_raise( win->m_wxwindow->window );
133 
134     win->m_toolBarDetached = true;
135     win->GtkUpdateSize();
136 }
137 }
138 #endif // wxUSE_TOOLBAR
139 
140 
141 // ----------------------------------------------------------------------------
142 // wxFrame itself
143 // ----------------------------------------------------------------------------
144 
145 //-----------------------------------------------------------------------------
146 // InsertChild for wxFrame
147 //-----------------------------------------------------------------------------
148 
149 /* Callback for wxFrame. This very strange beast has to be used because
150  * C++ has no virtual methods in a constructor. We have to emulate a
151  * virtual function here as wxWidgets requires different ways to insert
152  * a child in container classes. */
153 
wxInsertChildInFrame(wxFrame * parent,wxWindow * child)154 static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
155 {
156     wxASSERT( GTK_IS_WIDGET(child->m_widget) );
157 
158     if (!parent->m_insertInClientArea)
159     {
160         // These are outside the client area
161         wxFrame* frame = (wxFrame*) parent;
162         gtk_pizza_put( GTK_PIZZA(frame->m_mainWidget),
163                          GTK_WIDGET(child->m_widget),
164                          child->m_x,
165                          child->m_y,
166                          child->m_width,
167                          child->m_height );
168 
169 #if wxUSE_TOOLBAR_NATIVE
170         // We connect to these events for recalculating the client area
171         // space when the toolbar is floating
172         if (wxIS_KIND_OF(child,wxToolBar))
173         {
174             wxToolBar *toolBar = (wxToolBar*) child;
175             if (toolBar->GetWindowStyle() & wxTB_DOCKABLE)
176             {
177                 gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_attached",
178                     GTK_SIGNAL_FUNC(gtk_toolbar_attached_callback), (gpointer)parent );
179 
180                 gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_detached",
181                     GTK_SIGNAL_FUNC(gtk_toolbar_detached_callback), (gpointer)parent );
182             }
183         }
184 #endif // wxUSE_TOOLBAR
185     }
186     else
187     {
188         // These are inside the client area
189         gtk_pizza_put( GTK_PIZZA(parent->m_wxwindow),
190                          GTK_WIDGET(child->m_widget),
191                          child->m_x,
192                          child->m_y,
193                          child->m_width,
194                          child->m_height );
195     }
196 
197     // Resize on OnInternalIdle
198     parent->GtkUpdateSize();
199 }
200 
201 // ----------------------------------------------------------------------------
202 // wxFrame creation
203 // ----------------------------------------------------------------------------
204 
Init()205 void wxFrame::Init()
206 {
207     m_menuBarDetached = false;
208     m_toolBarDetached = false;
209     m_menuBarHeight = 2;
210 }
211 
Create(wxWindow * parent,wxWindowID id,const wxString & title,const wxPoint & pos,const wxSize & sizeOrig,long style,const wxString & name)212 bool wxFrame::Create( wxWindow *parent,
213                       wxWindowID id,
214                       const wxString& title,
215                       const wxPoint& pos,
216                       const wxSize& sizeOrig,
217                       long style,
218                       const wxString &name )
219 {
220     bool rt = wxTopLevelWindow::Create(parent, id, title, pos, sizeOrig,
221                                        style, name);
222     m_insertCallback = (wxInsertChildFunction) wxInsertChildInFrame;
223 
224     return rt;
225 }
226 
227 // ----------------------------------------------------------------------------
228 // overridden wxWindow methods
229 // ----------------------------------------------------------------------------
230 
DoGetClientSize(int * width,int * height) const231 void wxFrame::DoGetClientSize( int *width, int *height ) const
232 {
233     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
234 
235     wxTopLevelWindow::DoGetClientSize( width, height );
236 
237     if (height)
238     {
239 #if wxUSE_MENUS_NATIVE
240         // menu bar
241         if (m_frameMenuBar)
242         {
243             if (!m_menuBarDetached)
244                 (*height) -= m_menuBarHeight;
245             else
246                 (*height) -= wxPLACE_HOLDER;
247         }
248 #endif // wxUSE_MENUS_NATIVE
249 
250 #if wxUSE_STATUSBAR
251         // status bar
252         if (m_frameStatusBar && m_frameStatusBar->IsShown())
253             (*height) -= wxSTATUS_HEIGHT;
254 #endif // wxUSE_STATUSBAR
255 
256 #if wxUSE_TOOLBAR
257         // tool bar
258         if (m_frameToolBar && m_frameToolBar->IsShown())
259         {
260             if (m_toolBarDetached)
261             {
262                 *height -= wxPLACE_HOLDER;
263             }
264             else
265             {
266                 int x, y;
267                 m_frameToolBar->GetSize( &x, &y );
268                 if ( m_frameToolBar->GetWindowStyle() & wxTB_VERTICAL )
269                 {
270                     *width -= x;
271                 }
272                 else
273                 {
274                     *height -= y;
275                 }
276             }
277         }
278 #endif // wxUSE_TOOLBAR
279     }
280 }
281 
DoSetClientSize(int width,int height)282 void wxFrame::DoSetClientSize( int width, int height )
283 {
284     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
285 
286 #if wxUSE_MENUS_NATIVE
287         // menu bar
288         if (m_frameMenuBar)
289         {
290             if (!m_menuBarDetached)
291                 height += m_menuBarHeight;
292             else
293                 height += wxPLACE_HOLDER;
294         }
295 #endif // wxUSE_MENUS_NATIVE
296 
297 #if wxUSE_STATUSBAR
298         // status bar
299         if (m_frameStatusBar && m_frameStatusBar->IsShown()) height += wxSTATUS_HEIGHT;
300 #endif
301 
302 #if wxUSE_TOOLBAR
303         // tool bar
304         if (m_frameToolBar && m_frameToolBar->IsShown())
305         {
306             if (m_toolBarDetached)
307             {
308                 height += wxPLACE_HOLDER;
309             }
310             else
311             {
312                 int x, y;
313                 m_frameToolBar->GetSize( &x, &y );
314                 if ( m_frameToolBar->GetWindowStyle() & wxTB_VERTICAL )
315                 {
316                     width += x;
317                 }
318                 else
319                 {
320                     height += y;
321                 }
322             }
323         }
324 #endif
325 
326     wxTopLevelWindow::DoSetClientSize( width, height );
327 }
328 
GtkOnSize(int WXUNUSED (x),int WXUNUSED (y),int width,int height)329 void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
330                          int width, int height )
331 {
332     // due to a bug in gtk, x,y are always 0
333     // m_x = x;
334     // m_y = y;
335 
336     // avoid recursions
337     if (m_resizing) return;
338     m_resizing = true;
339 
340     // this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow
341     wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
342 
343     m_width = width;
344     m_height = height;
345 
346     // space occupied by m_frameToolBar and m_frameMenuBar
347     int client_area_x_offset = 0,
348         client_area_y_offset = 0;
349 
350     /* wxMDIChildFrame derives from wxFrame but it _is_ a wxWindow as it uses
351        wxWindow::Create to create it's GTK equivalent. m_mainWidget is only
352        set in wxFrame::Create so it is used to check what kind of frame we
353        have here. if m_mainWidget is NULL it is a wxMDIChildFrame and so we
354        skip the part which handles m_frameMenuBar, m_frameToolBar and (most
355        importantly) m_mainWidget */
356 
357     int minWidth = GetMinWidth(),
358         minHeight = GetMinHeight(),
359         maxWidth = GetMaxWidth(),
360         maxHeight = GetMaxHeight();
361 
362     if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
363     if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
364     if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
365     if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
366 
367     if (m_mainWidget)
368     {
369         // set size hints
370         gint flag = 0; // GDK_HINT_POS;
371         if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
372         if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
373         GdkGeometry geom;
374         geom.min_width = minWidth;
375         geom.min_height = minHeight;
376         geom.max_width = maxWidth;
377         geom.max_height = maxHeight;
378         gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
379                                        NULL,
380                                        &geom,
381                                        (GdkWindowHints) flag );
382 
383         // I revert back to wxGTK's original behaviour. m_mainWidget holds
384         // the menubar, the toolbar and the client area, which is represented
385         // by m_wxwindow.
386         // This hurts in the eye, but I don't want to call SetSize()
387         // because I don't want to call any non-native functions here.
388 
389 #if wxUSE_MENUS_NATIVE
390         if (m_frameMenuBar)
391         {
392             int xx = m_miniEdge;
393             int yy = m_miniEdge + m_miniTitle;
394             int ww = m_width  - 2*m_miniEdge;
395             int hh = m_menuBarHeight;
396             if (m_menuBarDetached) hh = wxPLACE_HOLDER;
397             m_frameMenuBar->m_x = xx;
398             m_frameMenuBar->m_y = yy;
399             m_frameMenuBar->m_width = ww;
400             m_frameMenuBar->m_height = hh;
401             gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
402                                   m_frameMenuBar->m_widget,
403                                   xx, yy, ww, hh );
404             client_area_y_offset += hh;
405         }
406 #endif // wxUSE_MENUS_NATIVE
407 
408 #if wxUSE_TOOLBAR
409         if ((m_frameToolBar) && m_frameToolBar->IsShown() &&
410             (m_frameToolBar->m_widget->parent == m_mainWidget))
411         {
412             int xx = m_miniEdge;
413             int yy = m_miniEdge + m_miniTitle;
414 #if wxUSE_MENUS_NATIVE
415             if (m_frameMenuBar)
416             {
417                 if (!m_menuBarDetached)
418                     yy += m_menuBarHeight;
419                 else
420                     yy += wxPLACE_HOLDER;
421             }
422 #endif // wxUSE_MENUS_NATIVE
423 
424             m_frameToolBar->m_x = xx;
425             m_frameToolBar->m_y = yy;
426 
427             // don't change the toolbar's reported height/width
428             int ww, hh;
429             if ( m_frameToolBar->GetWindowStyle() & wxTB_VERTICAL )
430             {
431                 ww = m_toolBarDetached ? wxPLACE_HOLDER
432                                        : m_frameToolBar->m_width;
433                 hh = m_height - 2*m_miniEdge;
434 
435                 client_area_x_offset += ww;
436             }
437             else
438             {
439                 ww = m_width - 2*m_miniEdge;
440                 hh = m_toolBarDetached ? wxPLACE_HOLDER
441                                        : m_frameToolBar->m_height;
442 
443                 client_area_y_offset += hh;
444             }
445 
446             gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
447                                   m_frameToolBar->m_widget,
448                                   xx, yy, ww, hh );
449         }
450 #endif // wxUSE_TOOLBAR
451 
452         int client_x = client_area_x_offset + m_miniEdge;
453         int client_y = client_area_y_offset + m_miniEdge + m_miniTitle;
454         int client_w = m_width - client_area_x_offset - 2*m_miniEdge;
455         int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
456         gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
457                               m_wxwindow,
458                               client_x, client_y, client_w, client_h );
459     }
460     else
461     {
462         // If there is no m_mainWidget between m_widget and m_wxwindow there
463         // is no need to set the size or position of m_wxwindow.
464     }
465 
466 #if wxUSE_STATUSBAR
467     if (m_frameStatusBar && m_frameStatusBar->IsShown())
468     {
469         int xx = 0 + m_miniEdge;
470         int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge - client_area_y_offset;
471         int ww = m_width - 2*m_miniEdge;
472         int hh = wxSTATUS_HEIGHT;
473         m_frameStatusBar->m_x = xx;
474         m_frameStatusBar->m_y = yy;
475         m_frameStatusBar->m_width = ww;
476         m_frameStatusBar->m_height = hh;
477         gtk_pizza_set_size( GTK_PIZZA(m_wxwindow),
478                             m_frameStatusBar->m_widget,
479                             xx, yy, ww, hh );
480         gtk_widget_draw( m_frameStatusBar->m_widget, NULL );
481     }
482 #endif // wxUSE_STATUSBAR
483 
484     m_sizeSet = true;
485 
486     // send size event to frame
487     wxSizeEvent event( wxSize(m_width,m_height), GetId() );
488     event.SetEventObject( this );
489     HandleWindowEvent( event );
490 
491 #if wxUSE_STATUSBAR
492     // send size event to status bar
493     if (m_frameStatusBar)
494     {
495         wxSizeEvent event2( wxSize(m_frameStatusBar->m_width,m_frameStatusBar->m_height), m_frameStatusBar->GetId() );
496         event2.SetEventObject( m_frameStatusBar );
497         m_frameStatusBar->HandleWindowEvent( event2 );
498     }
499 #endif // wxUSE_STATUSBAR
500 
501     m_resizing = false;
502 }
503 
OnInternalIdle()504 void wxFrame::OnInternalIdle()
505 {
506     wxFrameBase::OnInternalIdle();
507 
508 #if wxUSE_MENUS_NATIVE
509     if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();
510 #endif // wxUSE_MENUS_NATIVE
511 #if wxUSE_TOOLBAR
512     if (m_frameToolBar) m_frameToolBar->OnInternalIdle();
513 #endif
514 #if wxUSE_STATUSBAR
515     if (m_frameStatusBar)
516     {
517         m_frameStatusBar->OnInternalIdle();
518 
519         // There may be controls in the status bar that
520         // need to be updated
521         for ( wxWindowList::compatibility_iterator node = m_frameStatusBar->GetChildren().GetFirst();
522           node;
523           node = node->GetNext() )
524         {
525             wxWindow *child = node->GetData();
526             child->OnInternalIdle();
527         }
528     }
529 #endif
530 }
531 
532 // ----------------------------------------------------------------------------
533 // menu/tool/status bar stuff
534 // ----------------------------------------------------------------------------
535 
536 #if wxUSE_MENUS_NATIVE
537 
DetachMenuBar()538 void wxFrame::DetachMenuBar()
539 {
540     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
541     wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
542 
543     if ( m_frameMenuBar )
544     {
545         m_frameMenuBar->Attach( this );
546 
547         if (m_frameMenuBar->GetWindowStyle() & wxMB_DOCKABLE)
548         {
549             gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget),
550                 GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
551 
552             gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget),
553                 GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
554         }
555 
556         gtk_widget_ref( m_frameMenuBar->m_widget );
557 
558         gtk_container_remove( GTK_CONTAINER(m_mainWidget), m_frameMenuBar->m_widget );
559     }
560 
561     wxFrameBase::DetachMenuBar();
562 }
563 
AttachMenuBar(wxMenuBar * menuBar)564 void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
565 {
566     wxFrameBase::AttachMenuBar(menuBar);
567 
568     if (m_frameMenuBar)
569     {
570         m_frameMenuBar->SetParent(this);
571         gtk_pizza_put( GTK_PIZZA(m_mainWidget),
572                 m_frameMenuBar->m_widget,
573                 m_frameMenuBar->m_x,
574                 m_frameMenuBar->m_y,
575                 m_frameMenuBar->m_width,
576                 m_frameMenuBar->m_height );
577 
578         if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
579         {
580             gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
581                 GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
582 
583             gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
584                 GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
585         }
586 
587         gtk_widget_show( m_frameMenuBar->m_widget );
588 
589         UpdateMenuBarSize();
590     }
591     else
592     {
593         m_menuBarHeight = 2;
594         GtkUpdateSize();        // resize window in OnInternalIdle
595     }
596 }
597 
UpdateMenuBarSize()598 void wxFrame::UpdateMenuBarSize()
599 {
600     GtkRequisition  req;
601 
602     req.width = 2;
603     req.height = 2;
604 
605     // this is called after Remove with a NULL m_frameMenuBar
606     if ( m_frameMenuBar )
607         (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request )
608             (m_frameMenuBar->m_widget, &req );
609 
610     m_menuBarHeight = req.height;
611 
612     // resize window in OnInternalIdle
613 
614     GtkUpdateSize();
615 }
616 
617 #endif // wxUSE_MENUS_NATIVE
618 
619 #if wxUSE_TOOLBAR
620 
CreateToolBar(long style,wxWindowID id,const wxString & name)621 wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& name )
622 {
623     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
624 
625     m_insertInClientArea = false;
626 
627     m_frameToolBar = wxFrameBase::CreateToolBar( style, id, name );
628 
629     m_insertInClientArea = true;
630 
631     GtkUpdateSize();
632 
633     return m_frameToolBar;
634 }
635 
SetToolBar(wxToolBar * toolbar)636 void wxFrame::SetToolBar(wxToolBar *toolbar)
637 {
638     bool hadTbar = m_frameToolBar != NULL;
639 
640     wxFrameBase::SetToolBar(toolbar);
641 
642     if ( m_frameToolBar )
643     {
644         // insert into toolbar area if not already there
645         if ((m_frameToolBar->m_widget->parent) &&
646             (m_frameToolBar->m_widget->parent != m_mainWidget))
647         {
648             GetChildren().DeleteObject( m_frameToolBar );
649 
650             gtk_widget_reparent( m_frameToolBar->m_widget, m_mainWidget );
651             GtkUpdateSize();
652         }
653     }
654     else // toolbar unset
655     {
656         // still need to update size if it had been there before
657         if ( hadTbar )
658         {
659             GtkUpdateSize();
660         }
661     }
662 }
663 
664 #endif // wxUSE_TOOLBAR
665 
666 #if wxUSE_STATUSBAR
667 
CreateStatusBar(int number,long style,wxWindowID id,const wxString & name)668 wxStatusBar* wxFrame::CreateStatusBar(int number,
669                                       long style,
670                                       wxWindowID id,
671                                       const wxString& name)
672 {
673     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
674 
675     // because it will change when toolbar is added
676     GtkUpdateSize();
677 
678     return wxFrameBase::CreateStatusBar( number, style, id, name );
679 }
680 
SetStatusBar(wxStatusBar * statbar)681 void wxFrame::SetStatusBar(wxStatusBar *statbar)
682 {
683     bool hadStatBar = m_frameStatusBar != NULL;
684 
685     wxFrameBase::SetStatusBar(statbar);
686 
687     if (hadStatBar && !m_frameStatusBar)
688         GtkUpdateSize();
689 }
690 
PositionStatusBar()691 void wxFrame::PositionStatusBar()
692 {
693     if ( !m_frameStatusBar )
694         return;
695 
696     GtkUpdateSize();
697 }
698 #endif // wxUSE_STATUSBAR
699