]> git.saurik.com Git - wxWidgets.git/blame - src/motif/mdi.cpp
fixed problem in mimetype database and put a temp. fix for font tags
[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
119void wxMDIParentFrame::OnSize(wxSizeEvent& event)
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
4bb6408c
JS
139void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
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);
dfe1eee3 302
621793f4
JS
303 m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
304 m_foregroundColour = *wxBLACK;
da175b2c 305 m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
dfe1eee3 306
4bb6408c
JS
307 if ( id > -1 )
308 m_windowId = id;
309 else
310 m_windowId = (int)NewControlId();
dfe1eee3 311
621793f4 312 wxMDIClientWindow* clientWindow = parent->GetClientWindow();
dfe1eee3 313
621793f4 314 wxASSERT_MSG( (clientWindow != (wxWindow*) NULL), "Missing MDI client window.");
dfe1eee3 315
621793f4 316 if (clientWindow) clientWindow->AddChild(this);
dfe1eee3 317
621793f4 318 SetMDIParentFrame(parent);
dfe1eee3
VZ
319
320 int width = size.x;
321 int height = size.y;
0d57be45
JS
322 if (width == -1)
323 width = 200; // TODO: give reasonable default
324 if (height == -1)
325 height = 200; // TODO: give reasonable default
dfe1eee3 326
0d57be45
JS
327 // We're deactivating the old child
328 wxMDIChildFrame* oldActiveChild = parent->GetActiveChild();
329 if (oldActiveChild)
330 {
331 wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
332 event.SetEventObject( oldActiveChild );
333 oldActiveChild->GetEventHandler()->ProcessEvent(event);
334 }
dfe1eee3 335
0d57be45
JS
336 // This is the currently active child
337 parent->SetActiveChild((wxMDIChildFrame*) this);
dfe1eee3 338
621793f4
JS
339 // This time we'll try a bog-standard bulletin board for
340 // the 'frame'. A main window doesn't seem to work.
dfe1eee3 341
621793f4 342 m_mainWidget = (WXWidget) XtVaCreateWidget("client",
2d120f83
JS
343 xmBulletinBoardWidgetClass, (Widget) clientWindow->GetTopWidget(),
344 XmNmarginWidth, 0,
345 XmNmarginHeight, 0,
346 /*
347 XmNrightAttachment, XmATTACH_FORM,
348 XmNleftAttachment, XmATTACH_FORM,
349 XmNtopAttachment, XmATTACH_FORM,
350 XmNbottomAttachment, XmATTACH_FORM,
351 */
352 XmNresizePolicy, XmRESIZE_NONE,
353 NULL);
0492c5a0 354
2e35f56f
JS
355 XtAddEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
356 wxUniversalRepaintProc, (XtPointer) this);
dfe1eee3 357
621793f4
JS
358 SetCanAddEventHandler(TRUE);
359 AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
dfe1eee3
VZ
360
361 ChangeBackgroundColour();
362
621793f4 363 XtManageChild((Widget) m_mainWidget);
dfe1eee3 364
621793f4 365 SetTitle(title);
dfe1eee3 366
621793f4
JS
367 clientWindow->AddPage(this, title, TRUE);
368 clientWindow->Refresh();
dfe1eee3 369
621793f4
JS
370 // Positions the toolbar and status bar -- but we don't have any.
371 // PreResize();
dfe1eee3 372
621793f4
JS
373 wxModelessWindows.Append(this);
374 return TRUE;
4bb6408c
JS
375}
376
8704bf74 377
4bb6408c
JS
378wxMDIChildFrame::~wxMDIChildFrame()
379{
2e35f56f
JS
380 if (m_mainWidget)
381 XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
382 wxUniversalRepaintProc, (XtPointer) this);
dfe1eee3 383
621793f4
JS
384 if (GetMDIParentFrame())
385 {
386 wxMDIParentFrame* parentFrame = GetMDIParentFrame();
dfe1eee3 387
621793f4
JS
388 if (parentFrame->GetActiveChild() == this)
389 parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
390 wxMDIClientWindow* clientWindow = parentFrame->GetClientWindow();
dfe1eee3 391
621793f4
JS
392 // Remove page if still there
393 if (clientWindow->RemovePage(this))
2d120f83 394 clientWindow->Refresh();
dfe1eee3 395
621793f4
JS
396 // Set the selection to the first remaining page
397 if (clientWindow->GetPageCount() > 0)
398 {
399 wxMDIChildFrame* child = (wxMDIChildFrame*) clientWindow->GetPage(0);
400 parentFrame->SetActiveChild(child);
401 parentFrame->SetChildMenuBar(child);
402 }
403 else
404 {
405 parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
406 parentFrame->SetChildMenuBar((wxMDIChildFrame*) NULL);
407 }
408 }
4bb6408c
JS
409}
410
621793f4 411#if 0
0d57be45
JS
412// Implementation: intercept and act upon raise and lower commands.
413void wxMDIChildFrame::OnRaise()
414{
415 wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
416 wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
417 parentFrame->SetActiveChild(this);
dfe1eee3 418
0d57be45
JS
419 if (oldActiveChild)
420 {
421 wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
422 event.SetEventObject( oldActiveChild );
423 oldActiveChild->GetEventHandler()->ProcessEvent(event);
424 }
dfe1eee3 425
0d57be45
JS
426 wxActivateEvent event(wxEVT_ACTIVATE, TRUE, this->GetId());
427 event.SetEventObject( this );
428 this->GetEventHandler()->ProcessEvent(event);
429}
430
431void wxMDIChildFrame::OnLower()
432{
433 wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
434 wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
dfe1eee3 435
0d57be45
JS
436 if (oldActiveChild == this)
437 {
438 wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
439 event.SetEventObject( oldActiveChild );
440 oldActiveChild->GetEventHandler()->ProcessEvent(event);
441 }
442 // TODO: unfortunately we don't now know which is the top-most child,
443 // so make the active child NULL.
444 parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
445}
621793f4 446#endif
0d57be45 447
4bb6408c
JS
448// Set the client size (i.e. leave the calculation of borders etc.
449// to wxWindows)
9a05fd8d 450void wxMDIChildFrame::DoSetClientSize(int width, int height)
4bb6408c 451{
bfc6fde4 452 wxWindow::DoSetClientSize(width, height);
8704bf74
JS
453}
454
455void wxMDIChildFrame::GetClientSize(int* width, int* height) const
456{
621793f4 457 wxWindow::GetSize(width, height);
8704bf74
JS
458}
459
bfc6fde4 460void wxMDIChildFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags)
8704bf74 461{
bfc6fde4 462 wxWindow::DoSetSize(x, y, width, height, sizeFlags);
8704bf74
JS
463}
464
465void wxMDIChildFrame::GetSize(int* width, int* height) const
466{
467 wxWindow::GetSize(width, height);
4bb6408c
JS
468}
469
470void wxMDIChildFrame::GetPosition(int *x, int *y) const
471{
8704bf74
JS
472 wxWindow::GetPosition(x, y);
473}
474
475bool wxMDIChildFrame::Show(bool show)
476{
477 m_visibleStatus = show; /* show-&-hide fix */
621793f4 478 return wxWindow::Show(show);
4bb6408c
JS
479}
480
621793f4 481void wxMDIChildFrame::SetMenuBar(wxMenuBar *menuBar)
4bb6408c 482{
621793f4
JS
483 // Don't create the underlying menubar yet; need to recreate
484 // it every time the child is activated.
485 m_frameMenuBar = menuBar;
dfe1eee3 486
621793f4
JS
487 // We make the assumption that if you're setting the menubar,
488 // this is the currently active child.
489 GetMDIParentFrame()->SetChildMenuBar(this);
8704bf74
JS
490}
491
492// Set icon
493void wxMDIChildFrame::SetIcon(const wxIcon& icon)
494{
495 m_icon = icon;
496 if (m_icon.Ok())
4bb6408c 497 {
dfe1eee3 498 // Not appropriate since there are no icons in
2d120f83 499 // a tabbed window
4bb6408c 500 }
8704bf74
JS
501}
502
503void wxMDIChildFrame::SetTitle(const wxString& title)
504{
505 m_title = title;
7fe7d506
JS
506 wxMDIClientWindow* clientWindow = GetMDIParentFrame()->GetClientWindow();
507 int pageNo = clientWindow->FindPagePosition(this);
508 if (pageNo > -1)
509 clientWindow->SetPageText(pageNo, title);
4bb6408c
JS
510}
511
512// MDI operations
513void wxMDIChildFrame::Maximize()
514{
621793f4 515 // TODO
8704bf74
JS
516}
517
518void wxMDIChildFrame::Iconize(bool iconize)
519{
2d120f83 520 // TODO
8704bf74
JS
521}
522
523bool wxMDIChildFrame::IsIconized() const
524{
621793f4 525 return FALSE;
4bb6408c
JS
526}
527
6f63ec3f
JS
528// Is it maximized? Always maximized under Motif, using the
529// tabbed MDI implementation.
530bool wxMDIChildFrame::IsMaximized(void) const
531{
532 return TRUE;
533}
534
4bb6408c
JS
535void wxMDIChildFrame::Restore()
536{
621793f4 537 // TODO
4bb6408c
JS
538}
539
540void wxMDIChildFrame::Activate()
541{
621793f4
JS
542 // TODO
543}
544
545void wxMDIChildFrame::CaptureMouse()
546{
2d120f83 547 wxWindow::CaptureMouse();
621793f4
JS
548}
549
550void wxMDIChildFrame::ReleaseMouse()
551{
2d120f83 552 wxWindow::ReleaseMouse();
621793f4
JS
553}
554
555void wxMDIChildFrame::Raise()
556{
2d120f83 557 wxWindow::Raise();
621793f4
JS
558}
559
560void wxMDIChildFrame::Lower(void)
561{
2d120f83 562 wxWindow::Raise();
621793f4
JS
563}
564
565void wxMDIChildFrame::SetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), int WXUNUSED(maxH), int WXUNUSED(incW), int WXUNUSED(incH))
566{
4bb6408c
JS
567}
568
569// Client window
570
571wxMDIClientWindow::wxMDIClientWindow()
572{
573}
574
575wxMDIClientWindow::~wxMDIClientWindow()
576{
621793f4 577 // By the time this destructor is called, the child frames will have been
2d120f83 578 // deleted and removed from the notebook/client window.
8704bf74 579 DestroyChildren();
dfe1eee3 580
8704bf74 581 m_mainWidget = (WXWidget) 0;
4bb6408c
JS
582}
583
584bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
585{
2d120f83 586 // m_windowParent = parent;
621793f4 587 // m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
dfe1eee3 588
7fe7d506
JS
589 bool success = wxNotebook::Create(parent, wxID_NOTEBOOK_CLIENT_AREA, wxPoint(0, 0), wxSize(100, 100), 0);
590 if (success)
591 {
592 wxFont font(10, wxSWISS, wxNORMAL, wxNORMAL);
593 wxFont selFont(10, wxSWISS, wxNORMAL, wxBOLD);
594 GetTabView()->SetTabFont(font);
595 GetTabView()->SetSelectedTabFont(selFont);
596 GetTabView()->SetTabSize(120, 18);
597 GetTabView()->SetTabSelectionHeight(20);
598 return TRUE;
599 }
600 else
2d120f83 601 return FALSE;
8704bf74
JS
602}
603
bfc6fde4 604void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
8704bf74 605{
bfc6fde4 606 wxWindow::DoSetSize(x, y, width, height, sizeFlags);
8704bf74 607}
4bb6408c 608
bfc6fde4 609void wxMDIClientWindow::DoSetClientSize(int width, int height)
8704bf74 610{
bfc6fde4 611 wxWindow::DoSetClientSize(width, height);
8704bf74
JS
612}
613
614void wxMDIClientWindow::GetClientSize(int *width, int *height) const
615{
616 wxWindow::GetClientSize(width, height);
617}
618
619void wxMDIClientWindow::GetSize(int *width, int *height) const
620{
621 wxWindow::GetSize(width, height);
622}
623
624void wxMDIClientWindow::GetPosition(int *x, int *y) const
625{
626 wxWindow::GetPosition(x, y);
4bb6408c
JS
627}
628
629// Explicitly call default scroll behaviour
630void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
631{
632 Default(); // Default processing
633}
634
621793f4
JS
635void wxMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
636{
637 // Notify child that it has been activated
638 if (event.GetOldSelection() != -1)
639 {
640 wxMDIChildFrame* oldChild = (wxMDIChildFrame*) GetPage(event.GetOldSelection());
641 if (oldChild)
642 {
643 wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldChild->GetId());
644 event.SetEventObject( oldChild );
645 oldChild->GetEventHandler()->ProcessEvent(event);
646 }
647 }
7fe7d506 648 if (event.GetSelection() != -1)
621793f4 649 {
2d120f83
JS
650 wxMDIChildFrame* activeChild = (wxMDIChildFrame*) GetPage(event.GetSelection());
651 if (activeChild)
621793f4 652 {
2d120f83
JS
653 wxActivateEvent event(wxEVT_ACTIVATE, TRUE, activeChild->GetId());
654 event.SetEventObject( activeChild );
655 activeChild->GetEventHandler()->ProcessEvent(event);
dfe1eee3 656
2d120f83
JS
657 if (activeChild->GetMDIParentFrame())
658 {
659 activeChild->GetMDIParentFrame()->SetActiveChild(activeChild);
660 activeChild->GetMDIParentFrame()->SetChildMenuBar(activeChild);
661 }
621793f4
JS
662 }
663 }
664 event.Skip();
665}