]> git.saurik.com Git - wxWidgets.git/blame - src/motif/frame.cpp
Change wxNotebook selection before sending page changed event in wxMSW.
[wxWidgets.git] / src / motif / frame.cpp
CommitLineData
4bb6408c 1/////////////////////////////////////////////////////////////////////////////
355b4d3d 2// Name: src/motif/frame.cpp
4bb6408c
JS
3// Purpose: wxFrame
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
4bb6408c
JS
10/////////////////////////////////////////////////////////////////////////////
11
1c4f8f8d
VZ
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
1248b41f
MB
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
4dff3400 22
798a4529 23#include "wx/frame.h"
e4db172a
WS
24
25#ifndef WX_PRECOMP
26 #include "wx/log.h"
670f9935 27 #include "wx/app.h"
de6185e2 28 #include "wx/utils.h"
3b3dc801 29 #include "wx/menu.h"
923d28da 30 #include "wx/icon.h"
9eddec69 31 #include "wx/settings.h"
4e3e485b 32 #include "wx/toolbar.h"
3304646d 33 #include "wx/statusbr.h"
e4db172a
WS
34#endif
35
338dd992 36#ifdef __VMS__
1c4f8f8d 37 #pragma message disable nosimpint
338dd992 38#endif
1c4f8f8d 39
4bb6408c 40#if defined(__ultrix) || defined(__sgi)
1c4f8f8d 41 #include <Xm/Frame.h>
4bb6408c
JS
42#endif
43
44#include <Xm/Xm.h>
45#include <X11/Shell.h>
f618020a 46#include <X11/Core.h>
4bb6408c 47#if XmVersion >= 1002
1c4f8f8d 48 #include <Xm/XmAll.h>
4bb6408c 49#else
1c4f8f8d 50 #include <Xm/Frame.h>
4bb6408c
JS
51#endif
52#include <Xm/MwmUtil.h>
53#include <Xm/BulletinB.h>
54#include <Xm/Form.h>
55#include <Xm/MainW.h>
56#include <Xm/RowColumn.h>
57#include <Xm/Label.h>
58#include <Xm/AtomMgr.h>
59#include <Xm/LabelG.h>
60#include <Xm/Frame.h>
61#if XmVersion > 1000
1c4f8f8d 62 #include <Xm/Protocols.h>
4bb6408c 63#endif
1c4f8f8d 64
338dd992 65#ifdef __VMS__
1c4f8f8d 66 #pragma message enable nosimpint
338dd992 67#endif
4bb6408c
JS
68
69#include "wx/motif/private.h"
f618020a 70#include "wx/unix/utilsx11.h"
4bb6408c 71
1c4f8f8d
VZ
72// ----------------------------------------------------------------------------
73// private functions
74// ----------------------------------------------------------------------------
75
dfe1eee3 76static void wxFrameMapProc(Widget frameShell, XtPointer clientData,
798a4529 77 XCrossingEvent* event);
4bb6408c 78
1c4f8f8d
VZ
79// ----------------------------------------------------------------------------
80// globals
81// ----------------------------------------------------------------------------
82
4bb6408c 83extern wxList wxModelessWindows;
4bb6408c 84
1c4f8f8d
VZ
85// ----------------------------------------------------------------------------
86// wxWin macros
87// ----------------------------------------------------------------------------
88
1c4f8f8d
VZ
89BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
90 EVT_ACTIVATE(wxFrame::OnActivate)
91 EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
4bb6408c
JS
92END_EVENT_TABLE()
93
1c4f8f8d
VZ
94// ============================================================================
95// implementation
96// ============================================================================
1ccbb61a 97
1c4f8f8d
VZ
98// ----------------------------------------------------------------------------
99// frame construction
100// ----------------------------------------------------------------------------
dfe1eee3 101
1c4f8f8d
VZ
102void wxFrame::Init()
103{
96be256b 104 m_iconized = false;
dfe1eee3 105
4bb6408c
JS
106 //// Motif-specific
107 m_frameShell = (WXWidget) NULL;
d0ee33f5
WS
108 m_mainWidget = (WXWidget) NULL;
109 m_workArea = (WXWidget) NULL;
110 m_clientArea = (WXWidget) NULL;
4bb6408c
JS
111}
112
113bool wxFrame::Create(wxWindow *parent,
2d120f83
JS
114 wxWindowID id,
115 const wxString& title,
116 const wxPoint& pos,
117 const wxSize& size,
118 long style,
119 const wxString& name)
4bb6408c 120{
798a4529
MB
121 if( !wxTopLevelWindow::Create( parent, id, title, pos, size, style,
122 name ) )
96be256b 123 return false;
dfe1eee3 124
447a039f
MB
125 int x = pos.x, y = pos.y;
126 int width = size.x, height = size.y;
da8bed9b
VZ
127
128 // Set reasonable values for position and size if defaults have been
129 // requested
447a039f 130 //
da8bed9b
VZ
131 // MB TODO: something better than these arbitrary values ?
132 // VZ should use X resources for this...
133 if ( width == -1 )
134 width = 400;
135 if ( height == -1 )
136 height = 400;
447a039f
MB
137
138 int displayW, displayH;
139 wxDisplaySize( &displayW, &displayH );
140
141 if ( x == -1 )
142 {
143 x = (displayW - width) / 2;
144 if (x < 10) x = 10;
145 }
146 if ( y == -1 )
147 {
148 y = (displayH - height) / 2;
da8bed9b 149 if (y < 10) y = 10;
447a039f 150 }
da8bed9b 151
798a4529
MB
152 SetTitle( title );
153
154 wxLogTrace(wxTRACE_Messages,
1bc822df
MB
155 "Created frame (0x%p) with work area 0x%p and client "
156 "area 0x%p", m_mainWidget, m_workArea, m_clientArea);
798a4529 157
96be256b 158 XtAddEventHandler((Widget) m_clientArea, ExposureMask,False,
798a4529
MB
159 wxUniversalRepaintProc, (XtPointer) this);
160
161 if (x > -1)
162 XtVaSetValues((Widget) m_frameShell, XmNx, x, NULL);
163 if (y > -1)
164 XtVaSetValues((Widget) m_frameShell, XmNy, y, NULL);
165 if (width > -1)
166 XtVaSetValues((Widget) m_frameShell, XmNwidth, width, NULL);
167 if (height > -1)
168 XtVaSetValues((Widget) m_frameShell, XmNheight, height, NULL);
169
105fbe1f 170 PostCreation();
798a4529
MB
171 PreResize();
172
355b4d3d
WS
173 wxSize newSize(width, height);
174 wxSizeEvent sizeEvent(newSize, GetId());
798a4529
MB
175 sizeEvent.SetEventObject(this);
176
937013e0 177 HandleWindowEvent(sizeEvent);
798a4529 178
96be256b 179 return true;
798a4529
MB
180}
181
355b4d3d
WS
182bool wxFrame::XmDoCreateTLW(wxWindow* WXUNUSED(parent),
183 wxWindowID WXUNUSED(id),
184 const wxString& WXUNUSED(title),
185 const wxPoint& WXUNUSED(pos),
186 const wxSize& WXUNUSED(size),
f58585c0
VZ
187 long style,
188 const wxString& name)
798a4529 189{
eb6fa4b4 190 Widget frameShell;
798a4529 191
eb6fa4b4
MB
192 frameShell = XtCreatePopupShell( name, topLevelShellWidgetClass,
193 (Widget)wxTheApp->GetTopLevelWidget(),
194 NULL, 0 );
dfe1eee3 195
eb6fa4b4 196 XtVaSetValues(frameShell,
2d120f83
JS
197 // Allows menu to resize
198 XmNallowShellResize, True,
199 XmNdeleteResponse, XmDO_NOTHING,
200 XmNmappedWhenManaged, False,
96be256b 201 XmNiconic, (style & wxICONIZE) ? True : False,
2d120f83 202 NULL);
dfe1eee3 203
eb6fa4b4 204 m_frameShell = (WXWidget)frameShell;
dfe1eee3 205
798a4529 206 m_mainWidget = (WXWidget) XtVaCreateManagedWidget("main_window",
eb6fa4b4 207 xmMainWindowWidgetClass, frameShell,
2d120f83
JS
208 XmNresizePolicy, XmRESIZE_NONE,
209 NULL);
dfe1eee3 210
2d120f83 211 m_workArea = (WXWidget) XtVaCreateWidget("form",
798a4529 212 xmFormWidgetClass, (Widget) m_mainWidget,
2d120f83
JS
213 XmNresizePolicy, XmRESIZE_NONE,
214 NULL);
dfe1eee3 215
2d120f83
JS
216 m_clientArea = (WXWidget) XtVaCreateWidget("client",
217 xmBulletinBoardWidgetClass, (Widget) m_workArea,
218 XmNmarginWidth, 0,
219 XmNmarginHeight, 0,
220 XmNrightAttachment, XmATTACH_FORM,
221 XmNleftAttachment, XmATTACH_FORM,
222 XmNtopAttachment, XmATTACH_FORM,
223 XmNbottomAttachment, XmATTACH_FORM,
2d120f83 224 NULL);
0492c5a0 225
798a4529 226 XtVaSetValues((Widget) m_mainWidget,
2d120f83
JS
227 XmNworkWindow, (Widget) m_workArea,
228 NULL);
dfe1eee3 229
2d120f83
JS
230 XtManageChild((Widget) m_clientArea);
231 XtManageChild((Widget) m_workArea);
dfe1eee3 232
798a4529
MB
233 XtTranslations ptr = XtParseTranslationTable( "<Configure>: resize()" );
234 XtOverrideTranslations( (Widget) m_workArea, ptr );
235 XtFree( (char *)ptr );
dfe1eee3 236
2d120f83 237 /* Part of show-&-hide fix */
eb6fa4b4 238 XtAddEventHandler( frameShell, StructureNotifyMask,
798a4529
MB
239 False, (XtEventHandler)wxFrameMapProc,
240 (XtPointer)this );
dfe1eee3 241
eb6fa4b4 242 XtRealizeWidget(frameShell);
dfe1eee3 243
798a4529
MB
244 wxAddWindowToTable( (Widget)m_workArea, this);
245 wxAddWindowToTable( (Widget)m_clientArea, this);
dfe1eee3 246
798a4529 247 wxModelessWindows.Append( this );
dfe1eee3 248
96be256b 249 return true;
4bb6408c
JS
250}
251
252wxFrame::~wxFrame()
253{
c6212a0c 254 SendDestroyEvent();
da8bed9b 255
2e35f56f 256 if (m_clientArea)
dc1efb1d 257 {
96be256b 258 XtRemoveEventHandler((Widget) m_clientArea, ExposureMask, False,
2e35f56f 259 wxUniversalRepaintProc, (XtPointer) this);
dc1efb1d 260 }
2e35f56f 261
2d120f83 262 if (GetMainWidget())
96be256b 263 Show(false);
0492c5a0 264
2d120f83
JS
265 if (m_frameMenuBar)
266 {
267 m_frameMenuBar->DestroyMenuBar();
5276b0a5 268 wxDELETE(m_frameMenuBar);
2d120f83 269 }
dfe1eee3 270
5276b0a5 271 wxDELETE(m_frameStatusBar);
2187eef5
MB
272
273 PreDestroy();
dfe1eee3 274
798a4529 275 Widget frameShell = (Widget)GetShellWidget();
2b5f62a0 276
2187eef5
MB
277 if( frameShell )
278 XtRemoveEventHandler( frameShell, StructureNotifyMask,
279 False, (XtEventHandler)wxFrameMapProc,
280 (XtPointer)this );
dfe1eee3 281
798a4529 282 if( m_clientArea )
4bb6408c 283 {
798a4529
MB
284 wxDeleteWindowFromTable( (Widget)m_clientArea );
285 XtDestroyWidget( (Widget)m_clientArea );
4bb6408c 286 }
dfe1eee3 287
798a4529 288 if( m_workArea )
2d120f83 289 {
798a4529
MB
290 XtVaSetValues( (Widget)m_mainWidget,
291 XmNworkWindow, (Widget)NULL,
292 NULL );
dfe1eee3 293
798a4529
MB
294 wxDeleteWindowFromTable( (Widget)m_workArea );
295 XtDestroyWidget( (Widget)m_workArea );
296 }
dfe1eee3 297
798a4529
MB
298 if( m_mainWidget )
299 XtDestroyWidget( (Widget)m_mainWidget );
dfe1eee3 300
798a4529
MB
301 if( frameShell )
302 XtDestroyWidget( frameShell );
4bb6408c
JS
303}
304
305// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
449f38b5 306void wxFrame::DoGetClientSize(int *x, int *y) const
4bb6408c 307{
2d120f83
JS
308 Dimension xx, yy;
309 XtVaGetValues((Widget) m_workArea, XmNwidth, &xx, XmNheight, &yy, NULL);
dfe1eee3 310
2d120f83
JS
311 if (m_frameStatusBar)
312 {
313 int sbw, sbh;
314 m_frameStatusBar->GetSize(& sbw, & sbh);
355b4d3d 315 yy = (Dimension)(yy - sbh);
2d120f83 316 }
1ccbb61a 317#if wxUSE_TOOLBAR
2d120f83
JS
318 if (m_frameToolBar)
319 {
320 int tbw, tbh;
321 m_frameToolBar->GetSize(& tbw, & tbh);
322 if (m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL)
355b4d3d 323 xx = (Dimension)(xx - tbw);
2d120f83 324 else
355b4d3d 325 yy = (Dimension)(yy - tbh);
2d120f83 326 }
1ccbb61a 327#endif // wxUSE_TOOLBAR
34e8f097
CE
328
329//CE found a call here with NULL y pointer
330 if (x)
d0ee33f5 331 *x = xx;
34e8f097
CE
332 if (y)
333 *y = yy;
4bb6408c
JS
334}
335
336// Set the client size (i.e. leave the calculation of borders etc.
77ffb593 337// to wxWidgets)
bfc6fde4 338void wxFrame::DoSetClientSize(int width, int height)
4bb6408c 339{
2d120f83
JS
340 // Calculate how large the new main window should be
341 // by finding the difference between the client area and the
342 // main window area, and adding on to the new client area
343 if (width > -1)
344 XtVaSetValues((Widget) m_workArea, XmNwidth, width, NULL);
dfe1eee3 345
2d120f83 346 if (height > -1)
a4294b78 347 {
2d120f83
JS
348 if (m_frameStatusBar)
349 {
350 int sbw, sbh;
351 m_frameStatusBar->GetSize(& sbw, & sbh);
352 height += sbh;
353 }
1ccbb61a 354#if wxUSE_TOOLBAR
2d120f83
JS
355 if (m_frameToolBar)
356 {
357 int tbw, tbh;
358 m_frameToolBar->GetSize(& tbw, & tbh);
359 if (m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL)
360 width += tbw;
361 else
362 height += tbh;
363 }
1ccbb61a 364#endif // wxUSE_TOOLBAR
dfe1eee3 365
2d120f83 366 XtVaSetValues((Widget) m_workArea, XmNheight, height, NULL);
a4294b78 367 }
2d120f83 368 PreResize();
dfe1eee3 369
355b4d3d
WS
370 wxSize newSize(width, height);
371 wxSizeEvent sizeEvent(newSize, GetId());
2d120f83 372 sizeEvent.SetEventObject(this);
dfe1eee3 373
937013e0 374 HandleWindowEvent(sizeEvent);
dfe1eee3 375
4bb6408c
JS
376}
377
449f38b5 378void wxFrame::DoGetSize(int *width, int *height) const
4bb6408c 379{
105fbe1f
MB
380 if (!m_frameShell)
381 {
382 *width = -1; *height = -1;
383 return;
384 }
385
2d120f83
JS
386 Dimension xx, yy;
387 XtVaGetValues((Widget) m_frameShell, XmNwidth, &xx, XmNheight, &yy, NULL);
388 *width = xx; *height = yy;
4bb6408c
JS
389}
390
af111fc3 391void wxFrame::DoSetSize(int x, int y, int width, int height, int WXUNUSED(sizeFlags))
4bb6408c 392{
2d120f83
JS
393 if (x > -1)
394 XtVaSetValues((Widget) m_frameShell, XmNx, x, NULL);
395 if (y > -1)
396 XtVaSetValues((Widget) m_frameShell, XmNy, y, NULL);
397 if (width > -1)
798a4529 398 XtVaSetValues((Widget) m_mainWidget, XmNwidth, width, NULL);
2d120f83 399 if (height > -1)
798a4529 400 XtVaSetValues((Widget) m_mainWidget, XmNheight, height, NULL);
dfe1eee3 401
2d120f83
JS
402 if (!(height == -1 && width == -1))
403 {
404 PreResize();
2d120f83 405 }
4bb6408c
JS
406}
407
798a4529 408bool wxFrame::Show( bool show )
4bb6408c 409{
5a2e3d8c
MB
410 if( !wxWindowBase::Show( show ) )
411 return false;
dfe1eee3 412
2d120f83 413 m_isShown = show;
1c4f8f8d 414
798a4529
MB
415 Widget shell = (Widget)GetShellWidget();
416 if (!shell)
417 return wxWindow::Show(show);
dfe1eee3 418
798a4529
MB
419 SetVisibleStatus(show);
420 if (show)
421 {
5a2e3d8c 422 XtPopup(shell, XtGrabNone);
798a4529
MB
423 }
424 else
425 {
5a2e3d8c 426 XtPopdown(shell);
798a4529 427 }
4bb6408c 428
5a2e3d8c 429 return true;
6f63ec3f
JS
430}
431
4bb6408c
JS
432void wxFrame::SetTitle(const wxString& title)
433{
798a4529
MB
434 wxString oldTitle = GetTitle();
435 if( title == oldTitle )
2d120f83 436 return;
dfe1eee3 437
798a4529 438 wxTopLevelWindow::SetTitle( title );
dfe1eee3 439
798a4529
MB
440 if( !title.empty() )
441 XtVaSetValues( (Widget)m_frameShell,
6991087b
VS
442 XmNtitle, (const char*)title.mb_str(),
443 XmNiconName, (const char*)title.mb_str(),
798a4529 444 NULL );
4bb6408c
JS
445}
446
f618020a 447void wxFrame::DoSetIcon(const wxIcon& icon)
4bb6408c 448{
2d120f83
JS
449 if (!m_frameShell)
450 return;
dfe1eee3 451
aae0472b 452 if (!icon.Ok() || !icon.GetDrawable())
2d120f83 453 return;
dfe1eee3 454
aae0472b
MB
455 XtVaSetValues((Widget) m_frameShell,
456 XtNiconPixmap, icon.GetDrawable(),
457 NULL);
4bb6408c
JS
458}
459
f618020a
MB
460void wxFrame::SetIcons(const wxIconBundle& icons)
461{
462 wxFrameBase::SetIcons( icons );
463
464 if (!m_frameShell)
465 return;
466
467 DoSetIcon( m_icons.GetIcon( -1 ) );
468 wxSetIconsX11(GetXDisplay(),
469 (WXWindow) XtWindow( (Widget) m_frameShell ), icons);
470}
471
4bb6408c
JS
472void wxFrame::PositionStatusBar()
473{
50414e24 474 if (!m_frameStatusBar)
2d120f83 475 return;
dfe1eee3 476
4bb6408c
JS
477 int w, h;
478 GetClientSize(&w, &h);
479 int sw, sh;
480 m_frameStatusBar->GetSize(&sw, &sh);
dfe1eee3 481
4bb6408c
JS
482 // Since we wish the status bar to be directly under the client area,
483 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
89c7e962 484 m_frameStatusBar->SetSize(0, h, w, sh);
4bb6408c
JS
485}
486
487WXWidget wxFrame::GetMenuBarWidget() const
488{
2d120f83
JS
489 if (GetMenuBar())
490 return GetMenuBar()->GetMainWidget();
491 else
492 return (WXWidget) NULL;
4bb6408c
JS
493}
494
495void wxFrame::SetMenuBar(wxMenuBar *menuBar)
496{
497 if (!menuBar)
498 {
499 m_frameMenuBar = NULL;
500 return;
501 }
dfe1eee3 502
4bb6408c 503 // Currently can't set it twice
d3b9f782 504 // wxASSERT_MSG( (m_frameMenuBar == NULL), "Cannot set the menubar more than once");
dfe1eee3 505
621793f4 506 if (m_frameMenuBar)
4bb6408c 507 {
621793f4
JS
508 m_frameMenuBar->DestroyMenuBar();
509 delete m_frameMenuBar;
4bb6408c 510 }
dfe1eee3 511
621793f4
JS
512 m_frameMenuBar = menuBar;
513 m_frameMenuBar->CreateMenuBar(this);
4bb6408c
JS
514}
515
4bb6408c
JS
516// Responds to colour changes, and passes event on to children.
517void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
518{
a756f210 519 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
4bb6408c 520 Refresh();
dfe1eee3 521
4bb6408c
JS
522 if ( m_frameStatusBar )
523 {
524 wxSysColourChangedEvent event2;
525 event2.SetEventObject( m_frameStatusBar );
937013e0 526 m_frameStatusBar->HandleWindowEvent(event2);
4bb6408c 527 }
dfe1eee3 528
4bb6408c
JS
529 // Propagate the event to the non-top-level children
530 wxWindow::OnSysColourChanged(event);
531}
532
4bb6408c
JS
533// Default activation behaviour - set the focus for the first child
534// subwindow found.
535void wxFrame::OnActivate(wxActivateEvent& event)
536{
af111fc3
JS
537 if (!event.GetActive())
538 return;
539
ac32ba44 540 for(wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node;
fd304d98 541 node = node->GetNext())
4bb6408c 542 {
2d120f83 543 // Find a child that's a subwindow, but not a dialog box.
fd304d98 544 wxWindow *child = node->GetData();
798a4529 545 if (!child->IsTopLevel())
2d120f83
JS
546 {
547 child->SetFocus();
548 return;
549 }
4bb6408c 550 }
4bb6408c
JS
551}
552
1ccbb61a 553#if wxUSE_TOOLBAR
dfe1eee3 554
1c4f8f8d
VZ
555wxToolBar* wxFrame::CreateToolBar(long style,
556 wxWindowID id,
557 const wxString& name)
4bb6408c 558{
1c4f8f8d 559 if ( wxFrameBase::CreateToolBar(style, id, name) )
4bb6408c 560 {
4bb6408c 561 PositionToolBar();
4bb6408c 562 }
4bb6408c 563
1ccbb61a
VZ
564 return m_frameToolBar;
565}
566
46675b46
MB
567void wxFrame::SetToolBar(wxToolBar *toolbar)
568{
569 wxFrameBase::SetToolBar(toolbar);
570 SendSizeEvent();
571}
572
4bb6408c
JS
573void wxFrame::PositionToolBar()
574{
798a4529
MB
575 wxToolBar* tb = GetToolBar();
576 if (tb)
4bb6408c 577 {
1c4f8f8d
VZ
578 int cw, ch;
579 GetClientSize(& cw, &ch);
580
4bb6408c 581 int tw, th;
798a4529 582 tb->GetSize(& tw, & th);
dfe1eee3 583
798a4529 584 if (tb->GetWindowStyleFlag() & wxTB_VERTICAL)
4bb6408c
JS
585 {
586 // Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
587 // means, pretend we don't have toolbar/status bar, so we
588 // have the original client size.
798a4529 589 th = ch + th;
4bb6408c
JS
590 }
591 else
592 {
593 // Use the 'real' position
798a4529 594 tw = cw;
4bb6408c 595 }
4bb6408c 596
aae91497 597 tb->SetSize(0, 0, -1, -1, wxSIZE_NO_ADJUSTMENTS);
4bb6408c 598 }
4bb6408c 599}
798a4529 600#endif // wxUSE_TOOLBAR
4bb6408c
JS
601
602//// Motif-specific
603bool wxFrame::PreResize()
604{
1ccbb61a 605#if wxUSE_TOOLBAR
2d120f83 606 PositionToolBar();
1ccbb61a 607#endif // wxUSE_TOOLBAR
1c4f8f8d
VZ
608
609#if wxUSE_STATUSBAR
2d120f83 610 PositionStatusBar();
1c4f8f8d
VZ
611#endif // wxUSE_STATUSBAR
612
96be256b 613 return true;
4bb6408c
JS
614}
615
50414e24
JS
616WXWidget wxFrame::GetClientWidget() const
617{
2d120f83 618 return m_clientArea;
50414e24
JS
619}
620
af111fc3 621void wxFrame::ChangeFont(bool WXUNUSED(keepOriginalSize))
0d57be45
JS
622{
623 // TODO
624}
625
626void wxFrame::ChangeBackgroundColour()
627{
621793f4 628 if (GetClientWidget())
a8680e3e 629 wxDoChangeBackgroundColour(GetClientWidget(), m_backgroundColour);
0d57be45
JS
630}
631
632void wxFrame::ChangeForegroundColour()
633{
621793f4 634 if (GetClientWidget())
a8680e3e 635 wxDoChangeForegroundColour(GetClientWidget(), m_foregroundColour);
0d57be45
JS
636}
637
798a4529
MB
638/* MATTEW: Used to insure that hide-&-show within an event cycle works */
639static void wxFrameMapProc( Widget frameShell, XtPointer clientData,
640 XCrossingEvent* event )
4bb6408c 641{
798a4529 642 wxFrame *tli = (wxFrame*)clientData;
dfe1eee3 643
798a4529 644 XEvent *e = (XEvent *)event;
dfe1eee3 645
798a4529 646 if( e->xany.type == MapNotify )
dc1efb1d 647 {
798a4529
MB
648 // Iconize fix
649 XtVaSetValues( frameShell, XmNiconic, (Boolean)False, NULL );
650 if( !tli->GetVisibleStatus() )
dc1efb1d 651 {
798a4529
MB
652 /* We really wanted this to be hidden! */
653 XtUnmapWidget( frameShell );
dc1efb1d
JS
654 }
655 }
798a4529
MB
656 else if( e->xany.type == UnmapNotify )
657 // Iconize fix
658 XtVaSetValues( frameShell, XmNiconic, (Boolean)True, NULL );
dc1efb1d 659}