src/gtk/mdi.cpp
[wxWidgets.git] / include / wx / gtk1 / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gtk/mdi.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10
11 #ifndef __MDIH__
12 #define __MDIH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/defs.h"
19 #include "wx/object.h"
20 #include "wx/list.h"
21 #include "wx/control.h"
22 #include "wx/panel.h"
23 #include "wx/frame.h"
24 #include "wx/toolbar.h"
25
26 //-----------------------------------------------------------------------------
27 // classes
28 //-----------------------------------------------------------------------------
29
30 class wxMDIParentFrame;
31 class wxMDIClientWindow;
32 class wxMDIChildFrame;
33
34 //-----------------------------------------------------------------------------
35 // global data
36 //-----------------------------------------------------------------------------
37
38 extern const wxChar* wxFrameNameStr;
39 extern const wxChar* wxStatusLineNameStr;
40
41 //-----------------------------------------------------------------------------
42 // wxMDIParentFrame
43 //-----------------------------------------------------------------------------
44
45 class wxMDIParentFrame: public wxFrame
46 {
47 public:
48 wxMDIParentFrame() { Init(); }
49 wxMDIParentFrame(wxWindow *parent,
50 wxWindowID id,
51 const wxString& title,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
55 const wxString& name = wxFrameNameStr)
56 {
57 Init();
58
59 (void)Create(parent, id, title, pos, size, style, name);
60 }
61
62 ~wxMDIParentFrame(void);
63 bool Create( wxWindow *parent,
64 wxWindowID id, const wxString& title,
65 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
66 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
67 const wxString& name = wxFrameNameStr );
68
69 wxMDIChildFrame *GetActiveChild() const;
70
71 wxMDIClientWindow *GetClientWindow() const;
72 virtual wxMDIClientWindow *OnCreateClient();
73
74 virtual void Cascade() {}
75 virtual void Tile() {}
76 virtual void ArrangeIcons() {}
77 virtual void ActivateNext();
78 virtual void ActivatePrevious();
79
80 // implementation
81
82 wxMDIClientWindow *m_clientWindow;
83 bool m_justInserted;
84
85 virtual void GtkOnSize( int x, int y, int width, int height );
86 virtual void OnInternalIdle();
87
88 protected:
89 void Init();
90
91 virtual void DoGetClientSize(int *width, int *height) const;
92
93 private:
94 friend class wxMDIChildFrame;
95
96 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
97 };
98
99 //-----------------------------------------------------------------------------
100 // wxMDIChildFrame
101 //-----------------------------------------------------------------------------
102
103 class wxMDIChildFrame: public wxFrame
104 {
105 public:
106 wxMDIChildFrame();
107 wxMDIChildFrame( wxMDIParentFrame *parent,
108 wxWindowID id,
109 const wxString& title,
110 const wxPoint& pos = wxDefaultPosition,
111 const wxSize& size = wxDefaultSize,
112 long style = wxDEFAULT_FRAME_STYLE,
113 const wxString& name = wxFrameNameStr );
114
115 virtual ~wxMDIChildFrame();
116 bool Create( wxMDIParentFrame *parent,
117 wxWindowID id,
118 const wxString& title,
119 const wxPoint& pos = wxDefaultPosition,
120 const wxSize& size = wxDefaultSize,
121 long style = wxDEFAULT_FRAME_STYLE,
122 const wxString& name = wxFrameNameStr );
123
124 virtual void SetMenuBar( wxMenuBar *menu_bar );
125 virtual wxMenuBar *GetMenuBar() const;
126
127 virtual void AddChild( wxWindowBase *child );
128
129 virtual void Activate();
130
131 #if wxUSE_STATUSBAR
132 // no status bars
133 virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1,
134 long WXUNUSED(style) = 1,
135 wxWindowID WXUNUSED(id) = 1,
136 const wxString& WXUNUSED(name) = wxEmptyString)
137 { return (wxStatusBar*)NULL; }
138
139 virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; }
140 virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {}
141 virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {}
142 #endif
143
144 // no size hints
145 virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH),
146 int WXUNUSED(maxW), int WXUNUSED(maxH),
147 int WXUNUSED(incW), int WXUNUSED(incH) ) {}
148
149 #if wxUSE_TOOLBAR
150 // no toolbar bars
151 virtual wxToolBar* CreateToolBar( long WXUNUSED(style),
152 wxWindowID WXUNUSED(id),
153 const wxString& WXUNUSED(name) )
154 { return (wxToolBar*)NULL; }
155 virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
156 #endif
157
158 // no icon
159 void SetIcon( const wxIcon &icon ) { m_icon = icon; }
160
161 // no title
162 void SetTitle( const wxString &title );
163 wxString GetTitle() const { return m_title; }
164
165 // no maximize etc
166 virtual void Maximize( bool WXUNUSED(maximize) ) {}
167 virtual void Restore() {}
168
169 virtual bool IsTopLevel() const { return FALSE; }
170
171 void OnActivate( wxActivateEvent& event );
172 void OnMenuHighlight( wxMenuEvent& event );
173
174 // implementation
175
176 wxMenuBar *m_menuBar;
177 GtkNotebookPage *m_page;
178 bool m_justInserted;
179
180 protected:
181 virtual void DoGetClientSize( int *width, int *height ) const;
182
183 private:
184 DECLARE_EVENT_TABLE()
185 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
186 };
187
188 //-----------------------------------------------------------------------------
189 // wxMDIClientWindow
190 //-----------------------------------------------------------------------------
191
192 class wxMDIClientWindow: public wxWindow
193 {
194 public:
195 wxMDIClientWindow();
196 wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
197 ~wxMDIClientWindow();
198 virtual bool CreateClient( wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL );
199
200 private:
201 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
202 };
203
204 #endif // __MDIH__
205