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