]> git.saurik.com Git - wxWidgets.git/blame - src/motif/mdi.cpp
Motif: made file selector and message box properly take on background colour.
[wxWidgets.git] / src / motif / mdi.cpp
CommitLineData
4bb6408c
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: mdi.cpp
3// Purpose: MDI classes
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
dfe1eee3 9// Licence: wxWindows licence
4bb6408c
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "mdi.h"
14#endif
15
16#include "wx/mdi.h"
17#include "wx/menu.h"
18#include "wx/settings.h"
19
8704bf74
JS
20#include <Xm/Xm.h>
21#include <Xm/BulletinB.h>
22#include <Xm/Form.h>
23#include <Xm/MainW.h>
24#include <Xm/RowColumn.h>
25#include <Xm/CascadeBG.h>
26#include <Xm/Text.h>
27#include <Xm/PushBG.h>
28#include <Xm/AtomMgr.h>
29#include <Xm/Protocols.h>
30
8704bf74
JS
31#include "wx/motif/private.h"
32
4bb6408c
JS
33extern wxList wxModelessWindows;
34
8704bf74 35// Implemented in frame.cpp
dfe1eee3 36extern void wxFrameFocusProc(Widget workArea, XtPointer clientData,
2d120f83 37 XmAnyCallbackStruct *cbs);
8704bf74 38
621793f4
JS
39#define wxID_NOTEBOOK_CLIENT_AREA wxID_HIGHEST + 100
40
4bb6408c
JS
41#if !USE_SHARED_LIBRARY
42IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
43IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
621793f4 44IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxNotebook)
4bb6408c
JS
45
46BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
25b1fc05
VZ
47 EVT_SIZE(wxMDIParentFrame::OnSize)
48 EVT_ACTIVATE(wxMDIParentFrame::OnActivate)
49 EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
4bb6408c
JS
50END_EVENT_TABLE()
51
621793f4 52BEGIN_EVENT_TABLE(wxMDIClientWindow, wxNotebook)
25b1fc05
VZ
53 EVT_SCROLL(wxMDIClientWindow::OnScroll)
54 EVT_NOTEBOOK_PAGE_CHANGED(wxID_NOTEBOOK_CLIENT_AREA, wxMDIClientWindow::OnPageChanged)
4bb6408c
JS
55END_EVENT_TABLE()
56
25b1fc05 57#endif // USE_SHARED_LIBRARY
4bb6408c
JS
58
59// Parent frame
60
61wxMDIParentFrame::wxMDIParentFrame()
62{
0d57be45
JS
63 m_clientWindow = (wxMDIClientWindow*) NULL;
64 m_activeChild = (wxMDIChildFrame*) NULL;
621793f4 65 m_activeMenuBar = (wxMenuBar*) NULL;
4bb6408c
JS
66}
67
68bool wxMDIParentFrame::Create(wxWindow *parent,
2d120f83
JS
69 wxWindowID id,
70 const wxString& title,
71 const wxPoint& pos,
72 const wxSize& size,
73 long style,
74 const wxString& name)
4bb6408c 75{
0d57be45
JS
76 m_clientWindow = (wxMDIClientWindow*) NULL;
77 m_activeChild = (wxMDIChildFrame*) NULL;
621793f4 78 m_activeMenuBar = (wxMenuBar*) NULL;
dfe1eee3 79
8704bf74
JS
80 bool success = wxFrame::Create(parent, id, title, pos, size, style, name);
81 if (success)
82 {
83 // TODO: app cannot override OnCreateClient since
84 // wxMDIParentFrame::OnCreateClient will still be called
85 // (we're in the constructor). How to resolve?
dfe1eee3 86
8704bf74 87 m_clientWindow = OnCreateClient();
dfe1eee3 88
621793f4
JS
89 // Uses own style for client style
90 m_clientWindow->CreateClient(this, GetWindowStyleFlag());
dfe1eee3 91
621793f4
JS
92 int w, h;
93 GetClientSize(& w, & h);
94 m_clientWindow->SetSize(0, 0, w, h);
8704bf74
JS
95 return TRUE;
96 }
4bb6408c 97 else
8704bf74 98 return FALSE;
4bb6408c
JS
99}
100
101wxMDIParentFrame::~wxMDIParentFrame()
102{
621793f4
JS
103 // Make sure we delete the client window last of all
104 RemoveChild(m_clientWindow);
dfe1eee3 105
8704bf74 106 DestroyChildren();
dfe1eee3 107
8704bf74 108 delete m_clientWindow;
621793f4 109 m_clientWindow = NULL;
4bb6408c
JS
110}
111
4bb6408c
JS
112void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
113{
621793f4 114 m_frameMenuBar = menu_bar;
dfe1eee3 115
621793f4 116 SetChildMenuBar((wxMDIChildFrame*) NULL);
4bb6408c
JS
117}
118
af111fc3 119void wxMDIParentFrame::OnSize(wxSizeEvent& WXUNUSED(event))
4bb6408c 120{
47d67540 121#if wxUSE_CONSTRAINTS
4bb6408c 122 if (GetAutoLayout())
2d120f83 123 Layout();
4bb6408c
JS
124#endif
125 int x = 0;
126 int y = 0;
127 int width, height;
128 GetClientSize(&width, &height);
dfe1eee3 129
4bb6408c
JS
130 if ( GetClientWindow() )
131 GetClientWindow()->SetSize(x, y, width, height);
132}
133
25b1fc05
VZ
134void wxMDIParentFrame::GetClientSize(int *width, int *height) const
135{
b69f1bd1 136 wxFrame::GetClientSize(width, height);
25b1fc05
VZ
137}
138
af111fc3 139void wxMDIParentFrame::OnActivate(wxActivateEvent& WXUNUSED(event))
4bb6408c 140{
2d120f83 141 // Do nothing
4bb6408c
JS
142}
143
144// Returns the active MDI child window
145wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
146{
0d57be45 147 return m_activeChild;
4bb6408c
JS
148}
149
150// Create the client window class (don't Create the window,
151// just return a new class)
152wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
153{
2d120f83 154 return new wxMDIClientWindow ;
4bb6408c
JS
155}
156
621793f4
JS
157// Set the child's menu into the parent frame
158void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
159{
160 wxMenuBar* oldMenuBar = m_activeMenuBar;
dfe1eee3 161
621793f4
JS
162 if (child == (wxMDIChildFrame*) NULL) // No child: use parent frame
163 {
164 if (GetMenuBar() && (GetMenuBar() != m_activeMenuBar))
165 {
2d120f83
JS
166 // if (m_activeMenuBar)
167 // m_activeMenuBar->DestroyMenuBar();
dfe1eee3 168
621793f4
JS
169 m_activeMenuBar = GetMenuBar();
170 m_activeMenuBar->CreateMenuBar(this);
2d120f83 171 /*
621793f4 172 if (oldMenuBar && XtIsManaged((Widget) oldMenuBar->GetMainWidget()))
2d120f83
JS
173 XtUnmanageChild((Widget) oldMenuBar->GetMainWidget());
174 */
621793f4 175 if (oldMenuBar && oldMenuBar->GetMainWidget())
2d120f83 176 XtUnmapWidget((Widget) oldMenuBar->GetMainWidget());
dfe1eee3 177
621793f4
JS
178 }
179 }
180 else if (child->GetMenuBar() == (wxMenuBar*) NULL) // No child menu bar: use parent frame
181 {
182 if (GetMenuBar() && (GetMenuBar() != m_activeMenuBar))
183 {
2d120f83
JS
184 // if (m_activeMenuBar)
185 // m_activeMenuBar->DestroyMenuBar();
621793f4
JS
186 m_activeMenuBar = GetMenuBar();
187 m_activeMenuBar->CreateMenuBar(this);
2d120f83 188 /*
621793f4 189 if (oldMenuBar && XtIsManaged((Widget) oldMenuBar->GetMainWidget()))
2d120f83
JS
190 XtUnmanageChild((Widget) oldMenuBar->GetMainWidget());
191 */
621793f4 192 if (oldMenuBar && oldMenuBar->GetMainWidget())
2d120f83 193 XtUnmapWidget((Widget) oldMenuBar->GetMainWidget());
621793f4
JS
194 }
195 }
196 else // The child has a menubar
197 {
198 if (child->GetMenuBar() != m_activeMenuBar)
199 {
2d120f83
JS
200 // if (m_activeMenuBar)
201 // m_activeMenuBar->DestroyMenuBar();
dfe1eee3 202
621793f4
JS
203 m_activeMenuBar = child->GetMenuBar();
204 m_activeMenuBar->CreateMenuBar(this);
2d120f83 205 /*
621793f4 206 if (oldMenuBar && XtIsManaged((Widget) oldMenuBar->GetMainWidget()))
2d120f83
JS
207 XtUnmanageChild((Widget) oldMenuBar->GetMainWidget());
208 */
621793f4 209 if (oldMenuBar && oldMenuBar->GetMainWidget())
2d120f83 210 XtUnmapWidget((Widget) oldMenuBar->GetMainWidget());
621793f4
JS
211 }
212 }
213}
214
215// Redirect events to active child first
216bool wxMDIParentFrame::ProcessEvent(wxEvent& event)
217{
218 // Stops the same event being processed repeatedly
219 static wxEventType inEvent = wxEVT_NULL;
220 if (inEvent == event.GetEventType())
221 return FALSE;
dfe1eee3 222
621793f4 223 inEvent = event.GetEventType();
dfe1eee3 224
621793f4
JS
225 bool res = FALSE;
226 if (m_activeChild && event.IsKindOf(CLASSINFO(wxCommandEvent)))
227 {
2d120f83 228 res = m_activeChild->GetEventHandler()->ProcessEvent(event);
621793f4 229 }
dfe1eee3 230
621793f4 231 if (!res)
2d120f83 232 res = GetEventHandler()->wxEvtHandler::ProcessEvent(event);
dfe1eee3 233
621793f4 234 inEvent = wxEVT_NULL;
dfe1eee3 235
621793f4
JS
236 return res;
237}
238
25b1fc05
VZ
239void wxMDIParentFrame::DoSetSize(int x, int y,
240 int width, int height,
241 int sizeFlags)
242{
b23386b2 243 wxWindow::DoSetSize(x, y, width, height, sizeFlags);
25b1fc05
VZ
244}
245
246void wxMDIParentFrame::DoSetClientSize(int width, int height)
247{
b23386b2 248 wxWindow::DoSetClientSize(width, height);
25b1fc05
VZ
249}
250
4bb6408c
JS
251// Responds to colour changes, and passes event on to children.
252void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
253{
254 // TODO
dfe1eee3 255
4bb6408c
JS
256 // Propagate the event to the non-top-level children
257 wxFrame::OnSysColourChanged(event);
258}
259
260// MDI operations
261void wxMDIParentFrame::Cascade()
262{
263 // TODO
264}
265
266void wxMDIParentFrame::Tile()
267{
268 // TODO
269}
270
271void wxMDIParentFrame::ArrangeIcons()
272{
273 // TODO
274}
275
276void wxMDIParentFrame::ActivateNext()
277{
278 // TODO
279}
280
281void wxMDIParentFrame::ActivatePrevious()
282{
283 // TODO
284}
285
286// Child frame
287
288wxMDIChildFrame::wxMDIChildFrame()
289{
621793f4 290 m_mdiParentFrame = (wxMDIParentFrame*) NULL;
4bb6408c
JS
291}
292
293bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
2d120f83
JS
294 wxWindowID id,
295 const wxString& title,
296 const wxPoint& pos,
297 const wxSize& size,
298 long style,
299 const wxString& name)
4bb6408c
JS
300{
301 SetName(name);
af111fc3 302 SetWindowStyleFlag(style);
dfe1eee3 303
621793f4
JS
304 m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
305 m_foregroundColour = *wxBLACK;
da175b2c 306 m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
dfe1eee3 307
4bb6408c
JS
308 if ( id > -1 )
309 m_windowId = id;
310 else
311 m_windowId = (int)NewControlId();
dfe1eee3 312
621793f4 313 wxMDIClientWindow* clientWindow = parent->GetClientWindow();
dfe1eee3 314
621793f4 315 wxASSERT_MSG( (clientWindow != (wxWindow*) NULL), "Missing MDI client window.");
dfe1eee3 316
621793f4 317 if (clientWindow) clientWindow->AddChild(this);
dfe1eee3 318
621793f4 319 SetMDIParentFrame(parent);
dfe1eee3
VZ
320
321 int width = size.x;
322 int height = size.y;
0d57be45
JS
323 if (width == -1)
324 width = 200; // TODO: give reasonable default
325 if (height == -1)
326 height = 200; // TODO: give reasonable default
dfe1eee3 327
0d57be45
JS
328 // We're deactivating the old child
329 wxMDIChildFrame* oldActiveChild = parent->GetActiveChild();
330 if (oldActiveChild)
331 {
332 wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
333 event.SetEventObject( oldActiveChild );
334 oldActiveChild->GetEventHandler()->ProcessEvent(event);
335 }
dfe1eee3 336
0d57be45
JS
337 // This is the currently active child
338 parent->SetActiveChild((wxMDIChildFrame*) this);
dfe1eee3 339
621793f4
JS
340 // This time we'll try a bog-standard bulletin board for
341 // the 'frame'. A main window doesn't seem to work.
dfe1eee3 342
621793f4 343 m_mainWidget = (WXWidget) XtVaCreateWidget("client",
2d120f83
JS
344 xmBulletinBoardWidgetClass, (Widget) clientWindow->GetTopWidget(),
345 XmNmarginWidth, 0,
346 XmNmarginHeight, 0,
347 /*
348 XmNrightAttachment, XmATTACH_FORM,
349 XmNleftAttachment, XmATTACH_FORM,
350 XmNtopAttachment, XmATTACH_FORM,
351 XmNbottomAttachment, XmATTACH_FORM,
352 */
353 XmNresizePolicy, XmRESIZE_NONE,
354 NULL);
0492c5a0 355
2e35f56f
JS
356 XtAddEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
357 wxUniversalRepaintProc, (XtPointer) this);
dfe1eee3 358
621793f4
JS
359 SetCanAddEventHandler(TRUE);
360 AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
dfe1eee3
VZ
361
362 ChangeBackgroundColour();
363
621793f4 364 XtManageChild((Widget) m_mainWidget);
dfe1eee3 365
621793f4 366 SetTitle(title);
dfe1eee3 367
621793f4
JS
368 clientWindow->AddPage(this, title, TRUE);
369 clientWindow->Refresh();
dfe1eee3 370
621793f4
JS
371 // Positions the toolbar and status bar -- but we don't have any.
372 // PreResize();
dfe1eee3 373
621793f4
JS
374 wxModelessWindows.Append(this);
375 return TRUE;
4bb6408c
JS
376}
377
8704bf74 378
4bb6408c
JS
379wxMDIChildFrame::~wxMDIChildFrame()
380{
2e35f56f
JS
381 if (m_mainWidget)
382 XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
383 wxUniversalRepaintProc, (XtPointer) this);
dfe1eee3 384
621793f4
JS
385 if (GetMDIParentFrame())
386 {
387 wxMDIParentFrame* parentFrame = GetMDIParentFrame();
dfe1eee3 388
621793f4
JS
389 if (parentFrame->GetActiveChild() == this)
390 parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
391 wxMDIClientWindow* clientWindow = parentFrame->GetClientWindow();
dfe1eee3 392
621793f4
JS
393 // Remove page if still there
394 if (clientWindow->RemovePage(this))
2d120f83 395 clientWindow->Refresh();
dfe1eee3 396
621793f4
JS
397 // Set the selection to the first remaining page
398 if (clientWindow->GetPageCount() > 0)
399 {
400 wxMDIChildFrame* child = (wxMDIChildFrame*) clientWindow->GetPage(0);
401 parentFrame->SetActiveChild(child);
402 parentFrame->SetChildMenuBar(child);
403 }
404 else
405 {
406 parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
407 parentFrame->SetChildMenuBar((wxMDIChildFrame*) NULL);
408 }
409 }
4bb6408c
JS
410}
411
621793f4 412#if 0
0d57be45
JS
413// Implementation: intercept and act upon raise and lower commands.
414void wxMDIChildFrame::OnRaise()
415{
416 wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
417 wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
418 parentFrame->SetActiveChild(this);
dfe1eee3 419
0d57be45
JS
420 if (oldActiveChild)
421 {
422 wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
423 event.SetEventObject( oldActiveChild );
424 oldActiveChild->GetEventHandler()->ProcessEvent(event);
425 }
dfe1eee3 426
0d57be45
JS
427 wxActivateEvent event(wxEVT_ACTIVATE, TRUE, this->GetId());
428 event.SetEventObject( this );
429 this->GetEventHandler()->ProcessEvent(event);
430}
431
432void wxMDIChildFrame::OnLower()
433{
434 wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
435 wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
dfe1eee3 436
0d57be45
JS
437 if (oldActiveChild == this)
438 {
439 wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
440 event.SetEventObject( oldActiveChild );
441 oldActiveChild->GetEventHandler()->ProcessEvent(event);
442 }
443 // TODO: unfortunately we don't now know which is the top-most child,
444 // so make the active child NULL.
445 parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
446}
621793f4 447#endif
0d57be45 448
4bb6408c
JS
449// Set the client size (i.e. leave the calculation of borders etc.
450// to wxWindows)
9a05fd8d 451void wxMDIChildFrame::DoSetClientSize(int width, int height)
4bb6408c 452{
bfc6fde4 453 wxWindow::DoSetClientSize(width, height);
8704bf74
JS
454}
455
456void wxMDIChildFrame::GetClientSize(int* width, int* height) const
457{
621793f4 458 wxWindow::GetSize(width, height);
8704bf74
JS
459}
460
bfc6fde4 461void wxMDIChildFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags)
8704bf74 462{
bfc6fde4 463 wxWindow::DoSetSize(x, y, width, height, sizeFlags);
8704bf74
JS
464}
465
466void wxMDIChildFrame::GetSize(int* width, int* height) const
467{
468 wxWindow::GetSize(width, height);
4bb6408c
JS
469}
470
471void wxMDIChildFrame::GetPosition(int *x, int *y) const
472{
8704bf74
JS
473 wxWindow::GetPosition(x, y);
474}
475
476bool wxMDIChildFrame::Show(bool show)
477{
478 m_visibleStatus = show; /* show-&-hide fix */
621793f4 479 return wxWindow::Show(show);
4bb6408c
JS
480}
481
621793f4 482void wxMDIChildFrame::SetMenuBar(wxMenuBar *menuBar)
4bb6408c 483{
621793f4
JS
484 // Don't create the underlying menubar yet; need to recreate
485 // it every time the child is activated.
486 m_frameMenuBar = menuBar;
dfe1eee3 487
621793f4
JS
488 // We make the assumption that if you're setting the menubar,
489 // this is the currently active child.
490 GetMDIParentFrame()->SetChildMenuBar(this);
8704bf74
JS
491}
492
493// Set icon
494void wxMDIChildFrame::SetIcon(const wxIcon& icon)
495{
496 m_icon = icon;
497 if (m_icon.Ok())
4bb6408c 498 {
dfe1eee3 499 // Not appropriate since there are no icons in
2d120f83 500 // a tabbed window
4bb6408c 501 }
8704bf74
JS
502}
503
504void wxMDIChildFrame::SetTitle(const wxString& title)
505{
506 m_title = title;
7fe7d506
JS
507 wxMDIClientWindow* clientWindow = GetMDIParentFrame()->GetClientWindow();
508 int pageNo = clientWindow->FindPagePosition(this);
509 if (pageNo > -1)
510 clientWindow->SetPageText(pageNo, title);
4bb6408c
JS
511}
512
513// MDI operations
514void wxMDIChildFrame::Maximize()
515{
621793f4 516 // TODO
8704bf74
JS
517}
518
af111fc3 519void wxMDIChildFrame::Iconize(bool WXUNUSED(iconize))
8704bf74 520{
2d120f83 521 // TODO
8704bf74
JS
522}
523
524bool wxMDIChildFrame::IsIconized() const
525{
621793f4 526 return FALSE;
4bb6408c
JS
527}
528
6f63ec3f
JS
529// Is it maximized? Always maximized under Motif, using the
530// tabbed MDI implementation.
531bool wxMDIChildFrame::IsMaximized(void) const
532{
533 return TRUE;
534}
535
4bb6408c
JS
536void wxMDIChildFrame::Restore()
537{
621793f4 538 // TODO
4bb6408c
JS
539}
540
541void wxMDIChildFrame::Activate()
542{
621793f4
JS
543 // TODO
544}
545
546void wxMDIChildFrame::CaptureMouse()
547{
2d120f83 548 wxWindow::CaptureMouse();
621793f4
JS
549}
550
551void wxMDIChildFrame::ReleaseMouse()
552{
2d120f83 553 wxWindow::ReleaseMouse();
621793f4
JS
554}
555
556void wxMDIChildFrame::Raise()
557{
2d120f83 558 wxWindow::Raise();
621793f4
JS
559}
560
561void wxMDIChildFrame::Lower(void)
562{
2d120f83 563 wxWindow::Raise();
621793f4
JS
564}
565
566void wxMDIChildFrame::SetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), int WXUNUSED(maxH), int WXUNUSED(incW), int WXUNUSED(incH))
567{
4bb6408c
JS
568}
569
570// Client window
571
572wxMDIClientWindow::wxMDIClientWindow()
573{
574}
575
576wxMDIClientWindow::~wxMDIClientWindow()
577{
621793f4 578 // By the time this destructor is called, the child frames will have been
2d120f83 579 // deleted and removed from the notebook/client window.
8704bf74 580 DestroyChildren();
dfe1eee3 581
8704bf74 582 m_mainWidget = (WXWidget) 0;
4bb6408c
JS
583}
584
585bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
586{
af111fc3
JS
587 SetWindowStyleFlag(style);
588
2d120f83 589 // m_windowParent = parent;
621793f4 590 // m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
dfe1eee3 591
7fe7d506
JS
592 bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0);
593 if (success)
594 {
595 wxFont font(10, wxSWISS, wxNORMAL, wxNORMAL);
596 wxFont selFont(10, wxSWISS, wxNORMAL, wxBOLD);
597 GetTabView()->SetTabFont(font);
598 GetTabView()->SetSelectedTabFont(selFont);
599 GetTabView()->SetTabSize(120, 18);
600 GetTabView()->SetTabSelectionHeight(20);
601 return TRUE;
602 }
603 else
2d120f83 604 return FALSE;
8704bf74
JS
605}
606
bfc6fde4 607void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
8704bf74 608{
bfc6fde4 609 wxWindow::DoSetSize(x, y, width, height, sizeFlags);
8704bf74 610}
4bb6408c 611
bfc6fde4 612void wxMDIClientWindow::DoSetClientSize(int width, int height)
8704bf74 613{
bfc6fde4 614 wxWindow::DoSetClientSize(width, height);
8704bf74
JS
615}
616
617void wxMDIClientWindow::GetClientSize(int *width, int *height) const
618{
619 wxWindow::GetClientSize(width, height);
620}
621
622void wxMDIClientWindow::GetSize(int *width, int *height) const
623{
624 wxWindow::GetSize(width, height);
625}
626
627void wxMDIClientWindow::GetPosition(int *x, int *y) const
628{
629 wxWindow::GetPosition(x, y);
4bb6408c
JS
630}
631
632// Explicitly call default scroll behaviour
af111fc3 633void wxMDIClientWindow::OnScroll(wxScrollEvent& WXUNUSED(event))
4bb6408c
JS
634{
635 Default(); // Default processing
636}
637
621793f4
JS
638void wxMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
639{
640 // Notify child that it has been activated
641 if (event.GetOldSelection() != -1)
642 {
643 wxMDIChildFrame* oldChild = (wxMDIChildFrame*) GetPage(event.GetOldSelection());
644 if (oldChild)
645 {
646 wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldChild->GetId());
647 event.SetEventObject( oldChild );
648 oldChild->GetEventHandler()->ProcessEvent(event);
649 }
650 }
7fe7d506 651 if (event.GetSelection() != -1)
621793f4 652 {
2d120f83
JS
653 wxMDIChildFrame* activeChild = (wxMDIChildFrame*) GetPage(event.GetSelection());
654 if (activeChild)
621793f4 655 {
2d120f83
JS
656 wxActivateEvent event(wxEVT_ACTIVATE, TRUE, activeChild->GetId());
657 event.SetEventObject( activeChild );
658 activeChild->GetEventHandler()->ProcessEvent(event);
dfe1eee3 659
2d120f83
JS
660 if (activeChild->GetMDIParentFrame())
661 {
662 activeChild->GetMDIParentFrame()->SetActiveChild(activeChild);
663 activeChild->GetMDIParentFrame()->SetChildMenuBar(activeChild);
664 }
621793f4
JS
665 }
666 }
667 event.Skip();
668}