]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/mdi.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "mdi.h"
17 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
21 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame
,wxFrame
)
23 wxMDIParentFrame::wxMDIParentFrame(void)
25 m_clientWindow
= NULL
;
26 m_currentChild
= NULL
;
27 m_parentFrameActive
= TRUE
;
30 wxMDIParentFrame::wxMDIParentFrame( wxWindow
*parent
,
31 wxWindowID id
, const wxString
& title
,
32 const wxPoint
& pos
, const wxSize
& size
,
33 long style
, const wxString
& name
)
35 m_clientWindow
= NULL
;
36 m_currentChild
= NULL
;
37 m_parentFrameActive
= TRUE
;
38 Create( parent
, id
, title
, pos
, size
, style
, name
);
41 wxMDIParentFrame::~wxMDIParentFrame(void)
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
)
50 wxFrame::Create( parent
, id
, title
, pos
, size
, style
, name
);
57 void wxMDIParentFrame::OnSize( wxSizeEvent
& event
)
59 wxFrame::OnSize( event
);
62 void wxMDIParentFrame::OnActivate( wxActivateEvent
& WXUNUSED(event
) )
66 void wxMDIParentFrame::SetMenuBar( wxMenuBar
*menu_bar
)
68 wxFrame::SetMenuBar( menu_bar
);
71 void wxMDIParentFrame::GetClientSize(int *width
, int *height
) const
73 wxFrame::GetClientSize( width
, height
);
76 wxMDIChildFrame
*wxMDIParentFrame::GetActiveChild(void) const
78 return m_currentChild
;
81 wxMDIClientWindow
*wxMDIParentFrame::GetClientWindow(void) const
83 return m_clientWindow
;
86 wxMDIClientWindow
*wxMDIParentFrame::OnCreateClient(void)
88 m_clientWindow
= new wxMDIClientWindow( this );
89 return m_clientWindow
;
92 void wxMDIParentFrame::ActivateNext(void)
96 void wxMDIParentFrame::ActivatePrevious(void)
100 void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent
& WXUNUSED(event
) )
104 //-----------------------------------------------------------------------------
106 //-----------------------------------------------------------------------------
108 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame
,wxPanel
)
110 wxMDIChildFrame::wxMDIChildFrame(void)
114 wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame
*parent
,
115 wxWindowID id
, const wxString
& title
,
116 const wxPoint
& pos
, const wxSize
& size
,
117 long style
, const wxString
& name
)
119 Create( parent
, id
, title
, pos
, size
, style
, name
);
122 wxMDIChildFrame::~wxMDIChildFrame(void)
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
)
132 return wxPanel::Create( parent
->GetClientWindow(), id
, pos
, size
, style
, name
);
135 void wxMDIChildFrame::SetMenuBar( wxMenuBar
*WXUNUSED(menu_bar
) )
139 void wxMDIChildFrame::Activate(void)
143 //-----------------------------------------------------------------------------
145 //-----------------------------------------------------------------------------
147 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow
,wxWindow
)
149 wxMDIClientWindow::wxMDIClientWindow(void)
153 wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame
*parent
, long style
)
155 CreateClient( parent
, style
);
158 wxMDIClientWindow::~wxMDIClientWindow(void)
162 bool wxMDIClientWindow::CreateClient( wxMDIParentFrame
*parent
, long style
)
166 PreCreation( parent
, -1, wxPoint(10,10), wxSize(100,100), style
, "wxMDIClientWindow" );
168 m_widget
= gtk_notebook_new();
177 void wxMDIClientWindow::AddChild( wxWindow
*child
)
179 m_children
.Append( child
);
183 if (child
->IsKindOf(CLASSINFO(wxMDIChildFrame
)))
185 wxMDIChildFrame
* mdi_child
= (wxMDIChildFrame
*) child
;
186 s
= mdi_child
->m_title
;
189 if (s
.IsNull()) s
= "MDI child";
191 GtkWidget
*label_widget
;
192 label_widget
= gtk_label_new( s
);
193 gtk_misc_set_alignment( GTK_MISC(label_widget
), 0.0, 0.5 );
195 gtk_notebook_append_page( GTK_NOTEBOOK(m_widget
), child
->m_widget
, label_widget
);