]>
Commit | Line | Data |
---|---|---|
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 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
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(); | |
63 | bool Create( wxWindow *parent, | |
64 | wxWindowID id, | |
65 | const wxString& title, | |
66 | const wxPoint& pos = wxDefaultPosition, | |
67 | const wxSize& size = wxDefaultSize, | |
68 | long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, | |
69 | const wxString& name = wxFrameNameStr ); | |
70 | ||
71 | wxMDIChildFrame *GetActiveChild() const; | |
72 | ||
73 | wxMDIClientWindow *GetClientWindow() const; | |
74 | virtual wxMDIClientWindow *OnCreateClient(); | |
75 | ||
76 | virtual void Cascade() {} | |
77 | virtual void Tile() {} | |
78 | virtual void ArrangeIcons() {} | |
79 | virtual void ActivateNext(); | |
80 | virtual void ActivatePrevious(); | |
81 | ||
82 | // implementation | |
83 | ||
84 | wxMDIClientWindow *m_clientWindow; | |
85 | bool m_justInserted; | |
86 | ||
87 | virtual void GtkOnSize( int x, int y, int width, int height ); | |
88 | virtual void OnInternalIdle(); | |
89 | ||
90 | protected: | |
91 | void Init(); | |
92 | ||
93 | virtual void DoGetClientSize(int *width, int *height) const; | |
94 | ||
95 | private: | |
96 | friend class wxMDIChildFrame; | |
97 | ||
98 | DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) | |
99 | }; | |
100 | ||
101 | //----------------------------------------------------------------------------- | |
102 | // wxMDIChildFrame | |
103 | //----------------------------------------------------------------------------- | |
104 | ||
105 | class wxMDIChildFrame: public wxFrame | |
106 | { | |
107 | public: | |
108 | wxMDIChildFrame(); | |
109 | wxMDIChildFrame( wxMDIParentFrame *parent, | |
110 | wxWindowID id, | |
111 | const wxString& title, | |
112 | const wxPoint& pos = wxDefaultPosition, | |
113 | const wxSize& size = wxDefaultSize, | |
114 | long style = wxDEFAULT_FRAME_STYLE, | |
115 | const wxString& name = wxFrameNameStr ); | |
116 | ||
117 | virtual ~wxMDIChildFrame(); | |
118 | bool Create( wxMDIParentFrame *parent, | |
119 | wxWindowID id, | |
120 | const wxString& title, | |
121 | const wxPoint& pos = wxDefaultPosition, | |
122 | const wxSize& size = wxDefaultSize, | |
123 | long style = wxDEFAULT_FRAME_STYLE, | |
124 | const wxString& name = wxFrameNameStr ); | |
125 | ||
126 | virtual void SetMenuBar( wxMenuBar *menu_bar ); | |
127 | virtual wxMenuBar *GetMenuBar() const; | |
128 | ||
129 | virtual void AddChild( wxWindowBase *child ); | |
130 | ||
131 | virtual void Activate(); | |
132 | ||
133 | #if wxUSE_STATUSBAR | |
134 | // no status bars | |
135 | virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1, | |
136 | long WXUNUSED(style) = 1, | |
137 | wxWindowID WXUNUSED(id) = 1, | |
138 | const wxString& WXUNUSED(name) = wxEmptyString) | |
139 | { return (wxStatusBar*)NULL; } | |
140 | ||
141 | virtual wxStatusBar *GetStatusBar() const { return (wxStatusBar*)NULL; } | |
142 | virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number)=0 ) {} | |
143 | virtual void SetStatusWidths( int WXUNUSED(n), const int WXUNUSED(widths_field)[] ) {} | |
144 | #endif | |
145 | ||
146 | // no size hints | |
147 | virtual void SetSizeHints( int WXUNUSED(minW), | |
148 | int WXUNUSED(minH), | |
149 | int WXUNUSED(maxW) = -1, | |
150 | int WXUNUSED(maxH) = -1, | |
151 | int WXUNUSED(incW) = -1, | |
152 | int WXUNUSED(incH) = -1) {} | |
153 | ||
154 | #if wxUSE_TOOLBAR | |
155 | // no toolbar bars | |
156 | virtual wxToolBar* CreateToolBar( long WXUNUSED(style), | |
157 | wxWindowID WXUNUSED(id), | |
158 | const wxString& WXUNUSED(name) ) | |
159 | { return (wxToolBar*)NULL; } | |
160 | virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; } | |
161 | #endif | |
162 | ||
163 | // no icon | |
164 | void SetIcon( const wxIcon &icon ) { m_icons = wxIconBundle( icon ); } | |
165 | void SetIcons( const wxIconBundle &icons ) { m_icons = icons; } | |
166 | ||
167 | // no title | |
168 | void SetTitle( const wxString &title ); | |
169 | wxString GetTitle() const { return m_title; } | |
170 | ||
171 | // no maximize etc | |
172 | virtual void Maximize( bool WXUNUSED(maximize) ) {} | |
173 | virtual void Restore() {} | |
174 | ||
175 | virtual bool IsTopLevel() const { return FALSE; } | |
176 | ||
177 | void OnActivate( wxActivateEvent& event ); | |
178 | void OnMenuHighlight( wxMenuEvent& event ); | |
179 | ||
180 | // implementation | |
181 | ||
182 | wxMenuBar *m_menuBar; | |
183 | GtkNotebookPage *m_page; | |
184 | bool m_justInserted; | |
185 | ||
186 | protected: | |
187 | // override wxFrame methods to not do anything | |
188 | virtual void DoSetSize(int x, int y, | |
189 | int width, int height, | |
190 | int sizeFlags = wxSIZE_AUTO); | |
191 | virtual void DoSetClientSize(int width, int height); | |
192 | virtual void DoGetClientSize( int *width, int *height ) const; | |
193 | ||
194 | private: | |
195 | DECLARE_EVENT_TABLE() | |
196 | DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) | |
197 | }; | |
198 | ||
199 | //----------------------------------------------------------------------------- | |
200 | // wxMDIClientWindow | |
201 | //----------------------------------------------------------------------------- | |
202 | ||
203 | class wxMDIClientWindow: public wxWindow | |
204 | { | |
205 | public: | |
206 | wxMDIClientWindow(); | |
207 | wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 ); | |
208 | ~wxMDIClientWindow(); | |
209 | virtual bool CreateClient( wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL ); | |
210 | ||
211 | private: | |
212 | DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) | |
213 | }; | |
214 | ||
215 | #endif // __MDIH__ | |
216 |