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