]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/mdi.cpp
Cleared up DEBUG define mess, defines are now called __WXDEBUG__ and WXDEBUG.
[wxWidgets.git] / src / gtk / mdi.cpp
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
21 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
22
23 wxMDIParentFrame::wxMDIParentFrame(void)
24 {
25 m_clientWindow = NULL;
26 m_currentChild = NULL;
27 m_parentFrameActive = TRUE;
28 };
29
30 wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
31 wxWindowID id, const wxString& title,
32 const wxPoint& pos, const wxSize& size,
33 long style, const wxString& name )
34 {
35 m_clientWindow = NULL;
36 m_currentChild = NULL;
37 m_parentFrameActive = TRUE;
38 Create( parent, id, title, pos, size, style, name );
39 };
40
41 wxMDIParentFrame::~wxMDIParentFrame(void)
42 {
43 };
44
45 bool wxMDIParentFrame::Create( wxWindow *parent,
46 wxWindowID id, const wxString& title,
47 const wxPoint& pos, const wxSize& size,
48 long style, const wxString& name )
49 {
50 wxFrame::Create( parent, id, title, pos, size, style, name );
51
52 OnCreateClient();
53
54 return TRUE;
55 };
56
57 void wxMDIParentFrame::OnSize( wxSizeEvent& event )
58 {
59 wxFrame::OnSize( event );
60 };
61
62 void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
63 {
64 };
65
66 void wxMDIParentFrame::SetMenuBar( wxMenuBar *menu_bar )
67 {
68 wxFrame::SetMenuBar( menu_bar );
69 };
70
71 void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
72 {
73 wxFrame::GetClientSize( width, height );
74 };
75
76 wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
77 {
78 return m_currentChild;
79 };
80
81 wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const
82 {
83 return m_clientWindow;
84 };
85
86 wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void)
87 {
88 m_clientWindow = new wxMDIClientWindow( this );
89 return m_clientWindow;
90 };
91
92 void wxMDIParentFrame::ActivateNext(void)
93 {
94 };
95
96 void wxMDIParentFrame::ActivatePrevious(void)
97 {
98 };
99
100 void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(event) )
101 {
102 };
103
104 //-----------------------------------------------------------------------------
105 // wxMDIChildFrame
106 //-----------------------------------------------------------------------------
107
108 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
109
110 wxMDIChildFrame::wxMDIChildFrame(void)
111 {
112 };
113
114 wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
115 wxWindowID id, const wxString& title,
116 const wxPoint& pos, const wxSize& size,
117 long style, const wxString& name )
118 {
119 Create( parent, id, title, pos, size, style, name );
120 };
121
122 wxMDIChildFrame::~wxMDIChildFrame(void)
123 {
124 };
125
126 bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
127 wxWindowID id, const wxString& title,
128 const wxPoint& pos, const wxSize& size,
129 long style, const wxString& name )
130 {
131 m_title = title;
132 return wxPanel::Create( parent->GetClientWindow(), id, pos, size, style, name );
133 };
134
135 void wxMDIChildFrame::SetMenuBar( wxMenuBar *WXUNUSED(menu_bar) )
136 {
137 };
138
139 void wxMDIChildFrame::Activate(void)
140 {
141 };
142
143 //-----------------------------------------------------------------------------
144 // wxMDIClientWindow
145 //-----------------------------------------------------------------------------
146
147 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow)
148
149 wxMDIClientWindow::wxMDIClientWindow(void)
150 {
151 };
152
153 wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style )
154 {
155 CreateClient( parent, style );
156 };
157
158 wxMDIClientWindow::~wxMDIClientWindow(void)
159 {
160 };
161
162 bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
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
177 void 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