]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: mdi.h | |
3 | // Purpose: MDI (Multiple Document Interface) classes | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc JS |
8 | // Copyright: (c) Julian Smart |
9 | // Licence: wxWindows licence | |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_MDI_H_ |
13 | #define _WX_MDI_H_ | |
2bda0e17 KB |
14 | |
15 | #ifdef __GNUG__ | |
16 | #pragma interface "mdi.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/frame.h" | |
20 | ||
21 | WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr; | |
22 | WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr; | |
23 | ||
24 | class WXDLLEXPORT wxMDIClientWindow; | |
25 | class WXDLLEXPORT wxMDIChildFrame; | |
26 | ||
27 | class WXDLLEXPORT wxMDIParentFrame: public wxFrame | |
28 | { | |
29 | DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) | |
30 | ||
31 | friend class WXDLLEXPORT wxMDIChildFrame; | |
32 | public: | |
33 | ||
34 | wxMDIParentFrame(void); | |
35 | inline wxMDIParentFrame(wxWindow *parent, | |
debe6624 | 36 | wxWindowID id, |
2bda0e17 KB |
37 | const wxString& title, |
38 | const wxPoint& pos = wxDefaultPosition, | |
39 | const wxSize& size = wxDefaultSize, | |
debe6624 | 40 | long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
2bda0e17 KB |
41 | const wxString& name = wxFrameNameStr) |
42 | { | |
43 | Create(parent, id, title, pos, size, style, name); | |
44 | } | |
45 | ||
46 | ~wxMDIParentFrame(void); | |
47 | ||
48 | bool Create(wxWindow *parent, | |
debe6624 | 49 | wxWindowID id, |
2bda0e17 KB |
50 | const wxString& title, |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
debe6624 | 53 | long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, |
2bda0e17 KB |
54 | const wxString& name = wxFrameNameStr); |
55 | ||
debe6624 | 56 | /* |
2bda0e17 KB |
57 | #if WXWIN_COMPATIBILITY |
58 | virtual void OldOnActivate(bool flag); | |
59 | virtual void OldOnSize(int x, int y); | |
60 | #endif | |
debe6624 | 61 | */ |
2bda0e17 KB |
62 | |
63 | void OnSize(wxSizeEvent& event); | |
64 | void OnActivate(wxActivateEvent& event); | |
65 | ||
2bda0e17 KB |
66 | void SetMenuBar(wxMenuBar *menu_bar); |
67 | ||
68 | // Gets the size available for subwindows after menu size, toolbar size | |
69 | // and status bar size have been subtracted. If you want to manage your own | |
70 | // toolbar(s), don't call SetToolBar. | |
71 | void GetClientSize(int *width, int *height) const; | |
4fabb575 | 72 | wxSize GetClientSize() const { return wxWindow::GetClientSize(); } |
2bda0e17 KB |
73 | |
74 | // Get the active MDI child window (Windows only) | |
75 | wxMDIChildFrame *GetActiveChild(void) const ; | |
76 | ||
77 | // Get the client window | |
78 | inline wxMDIClientWindow *GetClientWindow(void) const ; | |
79 | ||
80 | // Create the client window class (don't Create the window, | |
81 | // just return a new class) | |
82 | virtual wxMDIClientWindow *OnCreateClient(void) ; | |
83 | ||
84 | inline WXHMENU GetWindowMenu(void) const ; | |
85 | ||
86 | // MDI operations | |
87 | virtual void Cascade(void); | |
88 | virtual void Tile(void); | |
89 | virtual void ArrangeIcons(void); | |
90 | virtual void ActivateNext(void); | |
91 | virtual void ActivatePrevious(void); | |
92 | ||
93 | // Handlers | |
debe6624 JS |
94 | void MSWOnSize(int x, int y, WXUINT flag); |
95 | bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control); | |
96 | void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu); | |
2bda0e17 | 97 | bool MSWProcessMessage(WXMSG *msg); |
57a7b7c1 | 98 | bool MSWTranslateMessage(WXMSG *msg); |
2bda0e17 KB |
99 | void MSWOnCreate(WXLPCREATESTRUCT cs); |
100 | long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
debe6624 | 101 | bool MSWOnEraseBkgnd(WXHDC pDC); |
2bda0e17 | 102 | bool MSWOnDestroy(void); |
debe6624 | 103 | bool MSWOnActivate(int state, bool minimized, WXHWND activate); |
2bda0e17 KB |
104 | |
105 | // Responds to colour changes | |
106 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
107 | ||
108 | protected: | |
109 | wxMDIClientWindow * m_clientWindow; | |
110 | wxMDIChildFrame * m_currentChild; | |
111 | WXHMENU m_windowMenu; | |
112 | bool m_parentFrameActive; // TRUE if MDI Frame is intercepting | |
113 | // commands, not child | |
2bda0e17 KB |
114 | DECLARE_EVENT_TABLE() |
115 | }; | |
116 | ||
117 | // Inlines | |
118 | inline wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow; } | |
119 | inline WXHMENU wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu; } | |
120 | ||
121 | class WXDLLEXPORT wxMDIChildFrame: public wxFrame | |
122 | { | |
123 | DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) | |
124 | public: | |
125 | ||
126 | wxMDIChildFrame(void); | |
127 | inline wxMDIChildFrame(wxMDIParentFrame *parent, | |
debe6624 | 128 | wxWindowID id, |
2bda0e17 KB |
129 | const wxString& title, |
130 | const wxPoint& pos = wxDefaultPosition, | |
131 | const wxSize& size = wxDefaultSize, | |
debe6624 | 132 | long style = wxDEFAULT_FRAME_STYLE, |
2bda0e17 KB |
133 | const wxString& name = wxFrameNameStr) |
134 | { | |
135 | Create(parent, id, title, pos, size, style, name); | |
136 | } | |
137 | ||
138 | ~wxMDIChildFrame(void); | |
139 | ||
140 | bool Create(wxMDIParentFrame *parent, | |
debe6624 | 141 | wxWindowID id, |
2bda0e17 KB |
142 | const wxString& title, |
143 | const wxPoint& pos = wxDefaultPosition, | |
144 | const wxSize& size = wxDefaultSize, | |
debe6624 | 145 | long style = wxDEFAULT_FRAME_STYLE, |
2bda0e17 KB |
146 | const wxString& name = wxFrameNameStr); |
147 | ||
148 | // Set menu bar | |
149 | void SetMenuBar(wxMenuBar *menu_bar); | |
4fabb575 | 150 | |
debe6624 | 151 | void SetClientSize(int width, int height); |
4fabb575 JS |
152 | void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); } |
153 | ||
2bda0e17 | 154 | void GetPosition(int *x, int *y) const ; |
4fabb575 | 155 | wxPoint GetPosition() const { return wxWindow::GetPosition(); } |
2bda0e17 KB |
156 | |
157 | // MDI operations | |
158 | virtual void Maximize(void); | |
159 | virtual void Restore(void); | |
160 | virtual void Activate(void); | |
161 | ||
162 | // Handlers | |
163 | ||
debe6624 JS |
164 | long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND); |
165 | void MSWOnSize(int x, int y, WXUINT); | |
2bda0e17 | 166 | void MSWOnWindowPosChanging(void *lpPos); |
debe6624 | 167 | bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control); |
2bda0e17 KB |
168 | long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
169 | bool MSWProcessMessage(WXMSG *msg); | |
57a7b7c1 | 170 | bool MSWTranslateMessage(WXMSG *msg); |
2bda0e17 KB |
171 | void MSWDestroyWindow(void); |
172 | ||
173 | // Implementation | |
174 | bool ResetWindowStyle(void *vrect); | |
175 | protected: | |
176 | // bool m_active; | |
177 | }; | |
178 | ||
179 | class WXDLLEXPORT wxMDIClientWindow: public wxWindow | |
180 | { | |
181 | DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) | |
182 | public: | |
183 | ||
184 | wxMDIClientWindow(void) ; | |
debe6624 | 185 | inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) |
2bda0e17 KB |
186 | { |
187 | CreateClient(parent, style); | |
188 | } | |
189 | ||
190 | ~wxMDIClientWindow(void); | |
191 | ||
192 | // Note: this is virtual, to allow overridden behaviour. | |
debe6624 | 193 | virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); |
2bda0e17 KB |
194 | |
195 | // Explicitly call default scroll behaviour | |
196 | void OnScroll(wxScrollEvent& event); | |
197 | ||
198 | // Window procedure | |
199 | virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); | |
200 | ||
201 | // Calls an appropriate default window procedure | |
202 | virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); | |
203 | ||
204 | // Should hand the message to the default proc | |
debe6624 | 205 | long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND); |
2bda0e17 KB |
206 | |
207 | protected: | |
208 | int m_scrollX; | |
209 | int m_scrollY; | |
210 | DECLARE_EVENT_TABLE() | |
211 | }; | |
212 | ||
213 | #endif | |
bbcdf8bc | 214 | // _WX_MDI_H_ |