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