]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/mdi.cpp
In splitter sample, forwarded OnIdle events to wxFrame, else UI updates don't
[wxWidgets.git] / src / gtk / mdi.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: mdi.cpp
3// Purpose:
4// Author: Robert Roebling
5// Created: 01/02/97
6// Id:
7// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifdef __GNUG__
12#pragma implementation "mdi.h"
13#endif
14
15#include "wx/mdi.h"
16
17//-----------------------------------------------------------------------------
18// wxMDIParentFrame
19//-----------------------------------------------------------------------------
20
21IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
22
23wxMDIParentFrame::wxMDIParentFrame(void)
24{
25 m_clientWindow = NULL;
26 m_currentChild = NULL;
27 m_parentFrameActive = TRUE;
28};
29
30wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
debe6624 31 wxWindowID id, const wxString& title,
c801d85f 32 const wxPoint& pos, const wxSize& size,
debe6624 33 long style, const wxString& name )
c801d85f
KB
34{
35 m_clientWindow = NULL;
36 m_currentChild = NULL;
37 m_parentFrameActive = TRUE;
38 Create( parent, id, title, pos, size, style, name );
39};
40
41wxMDIParentFrame::~wxMDIParentFrame(void)
42{
43};
44
45bool wxMDIParentFrame::Create( wxWindow *parent,
debe6624 46 wxWindowID id, const wxString& title,
c801d85f 47 const wxPoint& pos, const wxSize& size,
debe6624 48 long style, const wxString& name )
c801d85f
KB
49{
50 wxFrame::Create( parent, id, title, pos, size, style, name );
51
52 OnCreateClient();
53
54 return TRUE;
55};
56
57void wxMDIParentFrame::OnSize( wxSizeEvent& event )
58{
59 wxFrame::OnSize( event );
60};
61
62void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
63{
64};
65
66void wxMDIParentFrame::SetMenuBar( wxMenuBar *menu_bar )
67{
68 wxFrame::SetMenuBar( menu_bar );
69};
70
71void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
72{
73 wxFrame::GetClientSize( width, height );
74};
75
76wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
77{
78 return m_currentChild;
79};
80
81wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const
82{
83 return m_clientWindow;
84};
85
86wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void)
87{
88 m_clientWindow = new wxMDIClientWindow( this );
89 return m_clientWindow;
90};
91
92void wxMDIParentFrame::ActivateNext(void)
93{
94};
95
96void wxMDIParentFrame::ActivatePrevious(void)
97{
98};
99
100void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(event) )
101{
102};
103
104//-----------------------------------------------------------------------------
105// wxMDIChildFrame
106//-----------------------------------------------------------------------------
107
108IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
109
110wxMDIChildFrame::wxMDIChildFrame(void)
111{
112};
113
114wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
debe6624 115 wxWindowID id, const wxString& title,
c801d85f 116 const wxPoint& pos, const wxSize& size,
debe6624 117 long style, const wxString& name )
c801d85f
KB
118{
119 Create( parent, id, title, pos, size, style, name );
120};
121
122wxMDIChildFrame::~wxMDIChildFrame(void)
123{
124};
125
126bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
debe6624 127 wxWindowID id, const wxString& title,
c801d85f 128 const wxPoint& pos, const wxSize& size,
debe6624 129 long style, const wxString& name )
c801d85f
KB
130{
131 m_title = title;
132 return wxPanel::Create( parent->GetClientWindow(), id, pos, size, style, name );
133};
134
135void wxMDIChildFrame::SetMenuBar( wxMenuBar *WXUNUSED(menu_bar) )
136{
137};
138
139void wxMDIChildFrame::Activate(void)
140{
141};
142
143//-----------------------------------------------------------------------------
144// wxMDIClientWindow
145//-----------------------------------------------------------------------------
146
147IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow)
148
149wxMDIClientWindow::wxMDIClientWindow(void)
150{
151};
152
debe6624 153wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style )
c801d85f
KB
154{
155 CreateClient( parent, style );
156};
157
158wxMDIClientWindow::~wxMDIClientWindow(void)
159{
160};
161
debe6624 162bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
c801d85f
KB
163{
164 m_needParent = TRUE;
165
166 PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" );
167
168 m_widget = gtk_notebook_new();
169
170 PostCreation();
171
172 Show( TRUE );
173
174 return TRUE;
175};
176
177void wxMDIClientWindow::AddChild( wxWindow *child )
178{
179 m_children.Append( child );
180
181 wxString s;
182
183 if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
184 {
185 wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
186 s = mdi_child->m_title;
187 };
188
189 if (s.IsNull()) s = "MDI child";
190
191 GtkWidget *label_widget;
192 label_widget = gtk_label_new( s );
193 gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
194
195 gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget );
196};
197
198