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