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