]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/frame.cpp
regenerated configure from new configure.in
[wxWidgets.git] / src / gtk1 / frame.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: frame.cpp
3// Purpose:
4// Author: Robert Roebling
a81258be 5// Id: $Id$
01111366 6// Copyright: (c) 1998 Robert Roebling
19717c50 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
10#ifdef __GNUG__
11#pragma implementation "frame.h"
12#endif
13
14#include "wx/frame.h"
15#include "wx/dialog.h"
16#include "wx/control.h"
17#include "wx/app.h"
cf4219e7
RR
18#include "wx/menu.h"
19#include "wx/toolbar.h"
20#include "wx/statusbr.h"
d4c99d6f 21#include "wx/mdi.h"
362c6693 22#include "wx/dcclient.h"
c801d85f
KB
23#include "wx/gtk/win_gtk.h"
24
2f2aa628
RR
25//-----------------------------------------------------------------------------
26// constants
27//-----------------------------------------------------------------------------
28
dbf858b5 29const int wxMENU_HEIGHT = 30;
c67daf87 30const int wxSTATUS_HEIGHT = 25;
c801d85f 31
2f2aa628
RR
32//-----------------------------------------------------------------------------
33// data
34//-----------------------------------------------------------------------------
35
c801d85f
KB
36extern wxList wxTopLevelWindows;
37extern wxList wxPendingDelete;
38
39//-----------------------------------------------------------------------------
2f2aa628 40// "size_allocate"
c801d85f 41//-----------------------------------------------------------------------------
c801d85f 42
2f2aa628 43static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
ed7a557b 44{
c801d85f
KB
45 if (!win->HasVMT()) return;
46
47/*
48 printf( "OnFrameResize from " );
49 if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
50 printf( win->GetClassInfo()->GetClassName() );
51 printf( ".\n" );
52*/
ed7a557b 53
219f895a 54 win->GtkOnSize( alloc->x, alloc->y, alloc->width, alloc->height );
362c6693 55}
c801d85f
KB
56
57//-----------------------------------------------------------------------------
2f2aa628
RR
58// "delete_event"
59//-----------------------------------------------------------------------------
c801d85f 60
2f2aa628 61static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrame *win )
ed7a557b 62{
c801d85f
KB
63/*
64 printf( "OnDelete from " );
65 if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
66 printf( win->GetClassInfo()->GetClassName() );
67 printf( ".\n" );
68*/
ed7a557b 69
c801d85f
KB
70 win->Close();
71
72 return TRUE;
362c6693 73}
c801d85f 74
47908e25 75//-----------------------------------------------------------------------------
2f2aa628
RR
76// "configure_event"
77//-----------------------------------------------------------------------------
47908e25 78
2f2aa628 79static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
47908e25
RR
80{
81 if (!win->HasVMT()) return FALSE;
82
83 win->m_x = event->x;
84 win->m_y = event->y;
85
86 return FALSE;
362c6693 87}
47908e25 88
2f2aa628
RR
89//-----------------------------------------------------------------------------
90// wxFrame
c801d85f
KB
91//-----------------------------------------------------------------------------
92
93BEGIN_EVENT_TABLE(wxFrame, wxWindow)
c801d85f 94 EVT_SIZE(wxFrame::OnSize)
716b7364 95 EVT_CLOSE(wxFrame::OnCloseWindow)
e2414cbe 96 EVT_IDLE(wxFrame::OnIdle)
c801d85f
KB
97END_EVENT_TABLE()
98
99IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
100
19717c50 101wxFrame::wxFrame()
c801d85f 102{
c67daf87
UR
103 m_frameMenuBar = (wxMenuBar *) NULL;
104 m_frameStatusBar = (wxStatusBar *) NULL;
105 m_frameToolBar = (wxToolBar *) NULL;
c801d85f 106 m_sizeSet = FALSE;
46dc76ba 107 m_addPrivateChild = FALSE;
c67daf87
UR
108 m_wxwindow = (GtkWidget *) NULL;
109 m_mainWindow = (GtkWidget *) NULL;
c801d85f 110 wxTopLevelWindows.Insert( this );
362c6693 111}
c801d85f 112
ed7a557b 113wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
debe6624
JS
114 const wxPoint &pos, const wxSize &size,
115 long style, const wxString &name )
c801d85f 116{
c67daf87
UR
117 m_frameMenuBar = (wxMenuBar *) NULL;
118 m_frameStatusBar = (wxStatusBar *) NULL;
119 m_frameToolBar = (wxToolBar *) NULL;
c801d85f 120 m_sizeSet = FALSE;
46dc76ba 121 m_addPrivateChild = FALSE;
c67daf87
UR
122 m_wxwindow = (GtkWidget *) NULL;
123 m_mainWindow = (GtkWidget *) NULL;
c801d85f
KB
124 Create( parent, id, title, pos, size, style, name );
125 wxTopLevelWindows.Insert( this );
362c6693 126}
c801d85f 127
debe6624 128bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
c801d85f 129 const wxPoint &pos, const wxSize &size,
debe6624 130 long style, const wxString &name )
c801d85f
KB
131{
132 m_needParent = FALSE;
ed7a557b 133
c801d85f
KB
134 PreCreation( parent, id, pos, size, style, name );
135
c801d85f 136 m_title = title;
ed7a557b 137
32e9da8b
RR
138 GtkWindowType win_type = GTK_WINDOW_TOPLEVEL;
139 if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP;
140
141 m_widget = gtk_window_new( win_type );
ed7a557b 142 if ((size.x != -1) && (size.y != -1))
c801d85f 143 gtk_widget_set_usize( m_widget, m_width, m_height );
ed7a557b 144 if ((pos.x != -1) && (pos.y != -1))
c801d85f 145 gtk_widget_set_uposition( m_widget, m_x, m_y );
ed7a557b 146
c801d85f
KB
147 gtk_window_set_title( GTK_WINDOW(m_widget), title );
148 GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
ed7a557b 149
c801d85f 150 gtk_widget_set( m_widget, "GtkWindow::allow_shrink", TRUE, NULL);
ed7a557b
VZ
151
152 gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
c801d85f 153 GTK_SIGNAL_FUNC(gtk_frame_delete_callback), (gpointer)this );
ed7a557b 154
c801d85f
KB
155 m_mainWindow = gtk_myfixed_new();
156 gtk_widget_show( m_mainWindow );
157 GTK_WIDGET_UNSET_FLAGS( m_mainWindow, GTK_CAN_FOCUS );
ed7a557b 158
c801d85f
KB
159 gtk_container_add( GTK_CONTAINER(m_widget), m_mainWindow );
160 gtk_widget_set_uposition( m_mainWindow, 0, 0 );
ed7a557b 161
c801d85f
KB
162 m_wxwindow = gtk_myfixed_new();
163 gtk_widget_show( m_wxwindow );
164 GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
ed7a557b 165
c801d85f 166 gtk_container_add( GTK_CONTAINER(m_mainWindow), m_wxwindow );
ed7a557b 167
ed7a557b 168 gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
c801d85f 169 GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
ed7a557b 170
47908e25
RR
171 gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
172 GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
173
c801d85f 174 PostCreation();
ed7a557b 175
c801d85f 176 gtk_widget_realize( m_mainWindow );
ed7a557b 177
c801d85f 178 return TRUE;
362c6693 179}
c801d85f 180
19717c50 181wxFrame::~wxFrame()
c801d85f
KB
182{
183 if (m_frameMenuBar) delete m_frameMenuBar;
184 if (m_frameStatusBar) delete m_frameStatusBar;
ff7b1510 185 if (m_frameToolBar) delete m_frameToolBar;
ed7a557b 186
c801d85f
KB
187// if (m_mainWindow) gtk_widget_destroy( m_mainWindow );
188
189 wxTopLevelWindows.DeleteObject( this );
190 if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop();
362c6693 191}
ed7a557b 192
debe6624 193bool wxFrame::Show( bool show )
c801d85f 194{
e55ad60e
RR
195 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
196
c801d85f
KB
197 if (show)
198 {
199 wxSizeEvent event( wxSize(m_width,m_height), GetId() );
200 m_sizeSet = FALSE;
201 ProcessEvent( event );
362c6693 202 }
c801d85f 203 return wxWindow::Show( show );
362c6693 204}
c801d85f 205
debe6624 206void wxFrame::Enable( bool enable )
c801d85f 207{
e55ad60e
RR
208 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
209
210 if (!m_mainWindow) return;
211
c801d85f
KB
212 wxWindow::Enable( enable );
213 gtk_widget_set_sensitive( m_mainWindow, enable );
362c6693 214}
c801d85f 215
716b7364 216void wxFrame::OnCloseWindow( wxCloseEvent &event )
c801d85f 217{
e55ad60e 218 if (GetEventHandler()->OnClose() || event.GetForce()) this->Destroy();
362c6693 219}
c801d85f 220
19717c50 221bool wxFrame::Destroy()
c801d85f 222{
e55ad60e
RR
223 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
224
c801d85f
KB
225 if (!wxPendingDelete.Member(this))
226 wxPendingDelete.Append(this);
ed7a557b 227
c801d85f
KB
228 return TRUE;
229}
230
903f689b
RR
231void wxFrame::ImplementSetPosition(void)
232{
233 if ((m_x != -1) || (m_y != -1))
234 gtk_widget_set_uposition( m_widget, m_x, m_y );
235}
236
237void wxFrame::Centre( int direction )
238{
e55ad60e
RR
239 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
240
903f689b
RR
241 if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
242 if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;
243 ImplementSetPosition();
244}
245
c801d85f
KB
246void wxFrame::GetClientSize( int *width, int *height ) const
247{
e55ad60e
RR
248 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
249
c801d85f
KB
250 wxWindow::GetClientSize( width, height );
251 if (height)
252 {
253 if (m_frameMenuBar) (*height) -= wxMENU_HEIGHT;
254 if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
46dc76ba
RR
255 if (m_frameToolBar)
256 {
257 int y = 0;
c67daf87 258 m_frameToolBar->GetSize( (int *) NULL, &y );
46dc76ba
RR
259 (*height) -= y;
260 }
362c6693
RR
261 }
262}
c801d85f 263
b593568e
RR
264void wxFrame::SetClientSize( int const width, int const height )
265{
e55ad60e
RR
266 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
267
b593568e
RR
268 int h = height;
269 if (m_frameMenuBar) h += wxMENU_HEIGHT;
270 if (m_frameStatusBar) h += wxSTATUS_HEIGHT;
271 if (m_frameToolBar)
272 {
273 int y = 0;
c67daf87 274 m_frameToolBar->GetSize( (int *) NULL, &y );
b593568e
RR
275 h += y;
276 }
277 wxWindow::SetClientSize( width, h );
362c6693 278}
b593568e 279
47908e25 280void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
c801d85f 281{
47908e25
RR
282 // due to a bug in gtk, x,y are always 0
283 // m_x = x;
284 // m_y = y;
219f895a 285
c801d85f
KB
286 if ((m_height == height) && (m_width == width) &&
287 (m_sizeSet)) return;
288 if (!m_mainWindow) return;
289 if (!m_wxwindow) return;
290
291 m_width = width;
292 m_height = height;
2f2aa628
RR
293 if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
294 if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
295 if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
296 if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
ed7a557b 297
2f2aa628 298 gtk_widget_set_usize( m_widget, width, height );
ed7a557b 299
c801d85f
KB
300 int main_x = 0;
301 int main_y = 0;
302 int main_height = height;
303 int main_width = width;
ed7a557b 304
c801d85f
KB
305 // This emulates Windows behaviour:
306 // The menu bar is part of the main window, but the status bar
307 // is on the implementation side in the client area. The
308 // function GetClientSize returns the size of the client area
309 // minus the status bar height. Under wxGTK, the main window
310 // is represented by m_mainWindow. The menubar is inserted
311 // into m_mainWindow whereas the statusbar is insertes into
312 // m_wxwindow just like any other window.
ed7a557b 313
c801d85f 314// not really needed
47908e25 315// gtk_widget_set_usize( m_mainWindow, width, height );
ed7a557b 316
c801d85f
KB
317 if (m_frameMenuBar)
318 {
319 main_y = wxMENU_HEIGHT;
320 main_height -= wxMENU_HEIGHT;
362c6693 321 }
ed7a557b 322
46dc76ba 323 int toolbar_height = 0;
c67daf87 324 if (m_frameToolBar) m_frameToolBar->GetSize( (int *) NULL, &toolbar_height );
46dc76ba
RR
325
326 main_y += toolbar_height;
327 main_height -= toolbar_height;
328
d4c99d6f
RR
329 gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_wxwindow, main_x, main_y );
330 gtk_widget_set_usize( m_wxwindow, main_width, main_height );
ed7a557b 331
c801d85f
KB
332 if (m_frameMenuBar)
333 {
d4c99d6f 334 gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameMenuBar->m_widget, 1, 1 );
c801d85f 335 gtk_widget_set_usize( m_frameMenuBar->m_widget, width-2, wxMENU_HEIGHT-2 );
362c6693 336 }
ed7a557b 337
46dc76ba
RR
338 if (m_frameToolBar)
339 {
d4c99d6f 340 gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameToolBar->m_widget, 1, wxMENU_HEIGHT );
46dc76ba 341 gtk_widget_set_usize( m_frameToolBar->m_widget, width-2, toolbar_height );
362c6693 342 }
46dc76ba 343
c801d85f
KB
344 if (m_frameStatusBar)
345 {
346 m_frameStatusBar->SetSize( 0, main_height-wxSTATUS_HEIGHT, width, wxSTATUS_HEIGHT );
362c6693 347 }
c801d85f
KB
348
349 m_sizeSet = TRUE;
ed7a557b 350
c801d85f
KB
351 wxSizeEvent event( wxSize(m_width,m_height), GetId() );
352 event.SetEventObject( this );
353 ProcessEvent( event );
362c6693 354}
c801d85f
KB
355
356void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
357{
e55ad60e
RR
358 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
359
ed7a557b
VZ
360 if ( GetAutoLayout() )
361 Layout();
362 else {
cf5f9c9c
GL
363 // no child: go out !
364 if (!GetChildren()->First())
365 return;
46dc76ba 366
ed7a557b 367 // do we have exactly one child?
c67daf87 368 wxWindow *child = (wxWindow *) NULL;
ed7a557b 369 for(wxNode *node = GetChildren()->First(); node; node = node->Next())
c801d85f 370 {
ed7a557b 371 wxWindow *win = (wxWindow *)node->Data();
e3e65dac 372 if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog)
46dc76ba 373#if 0 // not in m_children anyway
ed7a557b 374 && (win != m_frameMenuBar) &&
46dc76ba 375 (win != m_frameToolBar) &&
ed7a557b
VZ
376 (win != m_frameStatusBar)
377#endif
378 )
379 {
380 if ( child ) // it's the second one: do nothing
381 return;
382
383 child = win;
362c6693
RR
384 }
385 }
c801d85f 386
ed7a557b 387 // yes: set it's size to fill all the frame
c801d85f 388 int client_x, client_y;
c801d85f 389 GetClientSize(&client_x, &client_y);
c801d85f
KB
390 child->SetSize( 1, 1, client_x-2, client_y);
391 }
362c6693 392}
c801d85f 393
46dc76ba
RR
394void wxFrame::AddChild( wxWindow *child )
395{
e55ad60e
RR
396 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
397 wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" );
398 wxASSERT_MSG( (m_mainWindow != NULL), "invalid frame" );
399 wxASSERT_MSG( (child != NULL), "invalid child" );
400 wxASSERT_MSG( (child->m_widget != NULL), "invalid child" );
401
e3e65dac
RR
402 // wxFrame and wxDialog as children aren't placed into the parents
403
2f2aa628 404 if (IS_KIND_OF(child,wxMDIChildFrame)) wxFAIL_MSG( "wxFrame::AddChild error.\n" );
d4c99d6f
RR
405
406 if ( IS_KIND_OF(child,wxFrame) || IS_KIND_OF(child,wxDialog))
e3e65dac
RR
407 {
408 m_children.Append( child );
409
410 if ((child->m_x != -1) && (child->m_y != -1))
411 gtk_widget_set_uposition( child->m_widget, child->m_x, child->m_y );
412
413 return;
414 }
415
46dc76ba
RR
416 if (m_addPrivateChild)
417 {
418 gtk_myfixed_put( GTK_MYFIXED(m_mainWindow), child->m_widget, child->m_x, child->m_y );
419
420 gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
421 }
422 else
423 {
424 m_children.Append( child );
425
426 if (m_wxwindow)
427 gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y );
428
429 gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height );
430 }
362c6693 431}
46dc76ba 432
716b7364 433static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
c801d85f
KB
434{
435 menu->SetInvokingWindow( win );
436 wxNode *node = menu->m_items.First();
437 while (node)
438 {
439 wxMenuItem *menuitem = (wxMenuItem*)node->Data();
19717c50
VZ
440 if (menuitem->IsSubMenu())
441 SetInvokingWindow( menuitem->GetSubMenu(), win );
c801d85f 442 node = node->Next();
362c6693
RR
443 }
444}
c801d85f
KB
445
446void wxFrame::SetMenuBar( wxMenuBar *menuBar )
447{
e55ad60e
RR
448 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
449 wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" );
450 wxASSERT_MSG( (m_mainWindow != NULL), "invalid frame" );
451
c801d85f 452 m_frameMenuBar = menuBar;
716b7364
RR
453
454 if (m_frameMenuBar)
c801d85f 455 {
30dea054
RR
456 wxNode *node = m_frameMenuBar->m_menus.First();
457 while (node)
458 {
459 wxMenu *menu = (wxMenu*)node->Data();
460 SetInvokingWindow( menu, this );
461 node = node->Next();
362c6693 462 }
30dea054 463
716b7364
RR
464 if (m_frameMenuBar->m_parent != this)
465 {
716b7364
RR
466 m_frameMenuBar->m_parent = this;
467 gtk_myfixed_put( GTK_MYFIXED(m_mainWindow),
468 m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
469 }
470 }
362c6693 471}
c801d85f 472
362c6693 473wxMenuBar *wxFrame::GetMenuBar(void) const
46dc76ba
RR
474{
475 return m_frameMenuBar;
362c6693 476}
46dc76ba 477
362c6693 478wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
46dc76ba 479{
e55ad60e
RR
480 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
481
362c6693
RR
482 wxCHECK_MSG( m_frameToolBar == NULL, FALSE, "recreating toolbar in wxFrame" );
483
46dc76ba 484 m_addPrivateChild = TRUE;
362c6693 485 m_frameToolBar = OnCreateToolBar( style, id, name );
46dc76ba
RR
486 m_addPrivateChild = FALSE;
487
488 return m_frameToolBar;
362c6693 489}
46dc76ba 490
362c6693 491wxToolBar* wxFrame::OnCreateToolBar( long style, wxWindowID id, const wxString& name )
46dc76ba 492{
362c6693
RR
493 return new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
494}
495
496wxToolBar *wxFrame::GetToolBar(void) const
497{
498 return m_frameToolBar;
499}
46dc76ba 500
e3e65dac 501wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
c801d85f 502{
e55ad60e
RR
503 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
504
362c6693 505 wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, "recreating status bar in wxFrame" );
c801d85f 506
362c6693 507 m_frameStatusBar = OnCreateStatusBar( number, style, id, name );
e3e65dac
RR
508
509 return m_frameStatusBar;
362c6693
RR
510}
511
512wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
513{
c67daf87 514 wxStatusBar *statusBar = (wxStatusBar *) NULL;
362c6693
RR
515
516 statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20), style, name);
517
518 // Set the height according to the font and the border size
519 wxClientDC dc(statusBar);
520 dc.SetFont( *statusBar->GetFont() );
521
522 long x, y;
523 dc.GetTextExtent( "X", &x, &y );
524
525 int height = (int)( (y * 1.1) + 2* statusBar->GetBorderY());
526
527 statusBar->SetSize( -1, -1, 100, height );
528
529 statusBar->SetFieldsCount( number );
530 return statusBar;
531}
c801d85f 532
362c6693 533void wxFrame::SetStatusText(const wxString& text, int number)
c801d85f 534{
e55ad60e
RR
535 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
536
362c6693 537 wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
c801d85f 538
362c6693
RR
539 m_frameStatusBar->SetStatusText(text, number);
540}
541
542void wxFrame::SetStatusWidths(int n, const int widths_field[] )
c801d85f 543{
e55ad60e
RR
544 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
545
362c6693
RR
546 wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
547
548 m_frameStatusBar->SetStatusWidths(n, widths_field);
549}
c801d85f 550
362c6693 551wxStatusBar *wxFrame::GetStatusBar(void) const
c801d85f
KB
552{
553 return m_frameStatusBar;
362c6693 554}
c801d85f 555
c801d85f
KB
556void wxFrame::SetTitle( const wxString &title )
557{
e55ad60e
RR
558 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
559
c801d85f 560 m_title = title;
362c6693 561 if (m_title.IsNull()) m_title = "";
c801d85f 562 gtk_window_set_title( GTK_WINDOW(m_widget), title );
362c6693 563}
c801d85f 564
d355d3fe
RR
565void wxFrame::SetIcon( const wxIcon &icon )
566{
e55ad60e
RR
567 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
568
d355d3fe
RR
569 m_icon = icon;
570 if (!icon.Ok()) return;
571
572 wxMask *mask = icon.GetMask();
c67daf87 573 GdkBitmap *bm = (GdkBitmap *) NULL;
d355d3fe
RR
574 if (mask) bm = mask->GetBitmap();
575
c67daf87 576 gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
d355d3fe 577}