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