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