]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/gtk1/mdi.cpp
ODBC compile (and link) fixes
[wxWidgets.git] / src / gtk1 / mdi.cpp
... / ...
CommitLineData
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
21static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
22{
23 if ((win->m_x == alloc->x) &&
24 (win->m_y == alloc->y) &&
25 (win->m_width == alloc->width) &&
26 (win->m_height == alloc->height))
27 {
28 return;
29 };
30
31 win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
32};
33
34//-----------------------------------------------------------------------------
35
36IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
37
38wxMDIParentFrame::wxMDIParentFrame(void)
39{
40 m_clientWindow = NULL;
41 m_currentChild = NULL;
42 m_parentFrameActive = TRUE;
43};
44
45wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
46 wxWindowID id, const wxString& title,
47 const wxPoint& pos, const wxSize& size,
48 long style, const wxString& name )
49{
50 m_clientWindow = NULL;
51 m_currentChild = NULL;
52 m_parentFrameActive = TRUE;
53 Create( parent, id, title, pos, size, style, name );
54};
55
56wxMDIParentFrame::~wxMDIParentFrame(void)
57{
58};
59
60bool wxMDIParentFrame::Create( wxWindow *parent,
61 wxWindowID id, const wxString& title,
62 const wxPoint& pos, const wxSize& size,
63 long style, const wxString& name )
64{
65 wxFrame::Create( parent, id, title, pos, size, style, name );
66
67 OnCreateClient();
68
69 return TRUE;
70};
71
72void wxMDIParentFrame::OnSize( wxSizeEvent& event )
73{
74 wxFrame::OnSize( event );
75};
76
77void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
78{
79};
80
81void wxMDIParentFrame::SetMenuBar( wxMenuBar *menu_bar )
82{
83 wxFrame::SetMenuBar( menu_bar );
84};
85
86void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
87{
88 wxFrame::GetClientSize( width, height );
89};
90
91wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
92{
93 return m_currentChild;
94};
95
96wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const
97{
98 return m_clientWindow;
99};
100
101wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void)
102{
103 m_clientWindow = new wxMDIClientWindow( this );
104 return m_clientWindow;
105};
106
107void wxMDIParentFrame::ActivateNext(void)
108{
109};
110
111void wxMDIParentFrame::ActivatePrevious(void)
112{
113};
114
115void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(event) )
116{
117};
118
119//-----------------------------------------------------------------------------
120// wxMDIChildFrame
121//-----------------------------------------------------------------------------
122
123IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
124
125wxMDIChildFrame::wxMDIChildFrame(void)
126{
127};
128
129wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
130 wxWindowID id, const wxString& title,
131 const wxPoint& WXUNUSED(pos), const wxSize& size,
132 long style, const wxString& name )
133{
134 Create( parent, id, title, wxDefaultPosition, size, style, name );
135};
136
137wxMDIChildFrame::~wxMDIChildFrame(void)
138{
139};
140
141bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
142 wxWindowID id, const wxString& title,
143 const wxPoint& WXUNUSED(pos), const wxSize& size,
144 long style, const wxString& name )
145{
146 m_title = title;
147 return wxPanel::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name );
148};
149
150void wxMDIChildFrame::SetMenuBar( wxMenuBar *WXUNUSED(menu_bar) )
151{
152};
153
154void wxMDIChildFrame::Activate(void)
155{
156};
157
158//-----------------------------------------------------------------------------
159// wxMDIClientWindow
160//-----------------------------------------------------------------------------
161
162IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow)
163
164wxMDIClientWindow::wxMDIClientWindow(void)
165{
166};
167
168wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style )
169{
170 CreateClient( parent, style );
171};
172
173wxMDIClientWindow::~wxMDIClientWindow(void)
174{
175};
176
177bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
178{
179 m_needParent = TRUE;
180
181 PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" );
182
183 m_widget = gtk_notebook_new();
184
185 PostCreation();
186
187 Show( TRUE );
188
189 return TRUE;
190};
191
192void wxMDIClientWindow::AddChild( wxWindow *child )
193{
194 m_children.Append( child );
195
196 wxString s;
197
198 if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
199 {
200 wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
201 s = mdi_child->m_title;
202 };
203
204 if (s.IsNull()) s = "MDI child";
205
206 GtkWidget *label_widget;
207 label_widget = gtk_label_new( s );
208 gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
209
210 gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
211 GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
212
213 gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget );
214};
215
216