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