]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
f6bcfd97 | 2 | // Name: wx/msw/mdi.h |
2bda0e17 KB |
3 | // Purpose: MDI (Multiple Document Interface) classes |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_MDI_H_ |
13 | #define _WX_MDI_H_ | |
2bda0e17 | 14 | |
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
a23fd0e1 | 16 | #pragma interface "mdi.h" |
2bda0e17 KB |
17 | #endif |
18 | ||
19 | #include "wx/frame.h" | |
20 | ||
39ca6d79 OK |
21 | WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr; |
22 | WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr; | |
2bda0e17 KB |
23 | |
24 | class WXDLLEXPORT wxMDIClientWindow; | |
25 | class WXDLLEXPORT wxMDIChildFrame; | |
26 | ||
a23fd0e1 VZ |
27 | // --------------------------------------------------------------------------- |
28 | // wxMDIParentFrame | |
29 | // --------------------------------------------------------------------------- | |
30 | ||
31 | class WXDLLEXPORT wxMDIParentFrame : public wxFrame | |
2bda0e17 | 32 | { |
a23fd0e1 VZ |
33 | public: |
34 | wxMDIParentFrame(); | |
35 | wxMDIParentFrame(wxWindow *parent, | |
36 | wxWindowID id, | |
37 | const wxString& title, | |
38 | const wxPoint& pos = wxDefaultPosition, | |
39 | const wxSize& size = wxDefaultSize, | |
40 | long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, | |
41 | const wxString& name = wxFrameNameStr) | |
42 | { | |
43 | Create(parent, id, title, pos, size, style, name); | |
44 | } | |
45 | ||
46 | ~wxMDIParentFrame(); | |
47 | ||
48 | bool Create(wxWindow *parent, | |
49 | wxWindowID id, | |
50 | const wxString& title, | |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
53 | long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, | |
54 | const wxString& name = wxFrameNameStr); | |
55 | ||
56 | // accessors | |
57 | // --------- | |
58 | ||
a23fd0e1 | 59 | // Get the active MDI child window (Windows only) |
42e69d6b | 60 | wxMDIChildFrame *GetActiveChild() const; |
2bda0e17 | 61 | |
a23fd0e1 VZ |
62 | // Get the client window |
63 | wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; } | |
2bda0e17 | 64 | |
a23fd0e1 VZ |
65 | // Create the client window class (don't Create the window, |
66 | // just return a new class) | |
42e69d6b | 67 | virtual wxMDIClientWindow *OnCreateClient(void); |
2bda0e17 | 68 | |
4e152a23 | 69 | // MDI windows menu |
df61c009 JS |
70 | wxMenu* GetWindowMenu() const { return m_windowMenu; }; |
71 | void SetWindowMenu(wxMenu* menu) ; | |
6aca4628 CE |
72 | virtual void DoMenuUpdates(wxMenu* menu = NULL); |
73 | ||
a23fd0e1 VZ |
74 | // MDI operations |
75 | // -------------- | |
76 | virtual void Cascade(); | |
77 | virtual void Tile(); | |
78 | virtual void ArrangeIcons(); | |
79 | virtual void ActivateNext(); | |
80 | virtual void ActivatePrevious(); | |
2bda0e17 | 81 | |
a23fd0e1 VZ |
82 | // handlers |
83 | // -------- | |
2bda0e17 | 84 | |
a23fd0e1 VZ |
85 | // Responds to colour changes |
86 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
2bda0e17 | 87 | |
a23fd0e1 | 88 | void OnSize(wxSizeEvent& event); |
2bda0e17 | 89 | |
42e69d6b VZ |
90 | bool HandleActivate(int state, bool minimized, WXHWND activate); |
91 | bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); | |
2bda0e17 | 92 | |
a23fd0e1 | 93 | // override window proc for MDI-specific message processing |
c140b7e7 | 94 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
2bda0e17 | 95 | |
c140b7e7 | 96 | virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM); |
a23fd0e1 | 97 | virtual bool MSWTranslateMessage(WXMSG* msg); |
cc2b7472 | 98 | |
a23fd0e1 | 99 | protected: |
1e6feb95 | 100 | #if wxUSE_MENUS_NATIVE |
42e69d6b | 101 | virtual void InternalSetMenuBar(); |
1e6feb95 | 102 | #endif // wxUSE_MENUS_NATIVE |
42e69d6b | 103 | |
82c9f85c VZ |
104 | virtual WXHICON GetDefaultIcon() const; |
105 | ||
2bda0e17 KB |
106 | wxMDIClientWindow * m_clientWindow; |
107 | wxMDIChildFrame * m_currentChild; | |
df61c009 | 108 | wxMenu* m_windowMenu; |
a23fd0e1 | 109 | |
598ddd96 | 110 | // true if MDI Frame is intercepting commands, not child |
42e69d6b | 111 | bool m_parentFrameActive; |
a23fd0e1 VZ |
112 | |
113 | private: | |
114 | friend class WXDLLEXPORT wxMDIChildFrame; | |
115 | ||
116 | DECLARE_EVENT_TABLE() | |
82c9f85c | 117 | DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) |
22f3361e | 118 | DECLARE_NO_COPY_CLASS(wxMDIParentFrame) |
2bda0e17 KB |
119 | }; |
120 | ||
a23fd0e1 VZ |
121 | // --------------------------------------------------------------------------- |
122 | // wxMDIChildFrame | |
123 | // --------------------------------------------------------------------------- | |
2bda0e17 | 124 | |
a23fd0e1 | 125 | class WXDLLEXPORT wxMDIChildFrame : public wxFrame |
2bda0e17 | 126 | { |
a23fd0e1 | 127 | public: |
f6bcfd97 | 128 | wxMDIChildFrame() { Init(); } |
a23fd0e1 VZ |
129 | wxMDIChildFrame(wxMDIParentFrame *parent, |
130 | wxWindowID id, | |
131 | const wxString& title, | |
132 | const wxPoint& pos = wxDefaultPosition, | |
133 | const wxSize& size = wxDefaultSize, | |
134 | long style = wxDEFAULT_FRAME_STYLE, | |
135 | const wxString& name = wxFrameNameStr) | |
136 | { | |
f6bcfd97 BP |
137 | Init(); |
138 | ||
a23fd0e1 VZ |
139 | Create(parent, id, title, pos, size, style, name); |
140 | } | |
141 | ||
142 | ~wxMDIChildFrame(); | |
143 | ||
144 | bool Create(wxMDIParentFrame *parent, | |
145 | wxWindowID id, | |
146 | const wxString& title, | |
147 | const wxPoint& pos = wxDefaultPosition, | |
148 | const wxSize& size = wxDefaultSize, | |
149 | long style = wxDEFAULT_FRAME_STYLE, | |
150 | const wxString& name = wxFrameNameStr); | |
151 | ||
598ddd96 | 152 | virtual bool IsTopLevel() const { return false; } |
225fe9d6 | 153 | |
a23fd0e1 | 154 | // MDI operations |
598ddd96 | 155 | virtual void Maximize(bool maximize = true); |
a23fd0e1 VZ |
156 | virtual void Restore(); |
157 | virtual void Activate(); | |
158 | ||
f6bcfd97 BP |
159 | // Implementation only from now on |
160 | // ------------------------------- | |
a23fd0e1 | 161 | |
f6bcfd97 | 162 | // Handlers |
42e69d6b | 163 | bool HandleMDIActivate(long bActivate, WXHWND, WXHWND); |
42e69d6b VZ |
164 | bool HandleWindowPosChanging(void *lpPos); |
165 | bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); | |
3ebcfb76 | 166 | bool HandleGetMinMaxInfo(void *mmInfo); |
42e69d6b | 167 | |
c140b7e7 JS |
168 | virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
169 | virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
42e69d6b VZ |
170 | virtual bool MSWTranslateMessage(WXMSG *msg); |
171 | ||
172 | virtual void MSWDestroyWindow(); | |
2bda0e17 | 173 | |
2bda0e17 | 174 | bool ResetWindowStyle(void *vrect); |
cc2b7472 | 175 | |
f6bcfd97 BP |
176 | void OnIdle(wxIdleEvent& event); |
177 | ||
cc2b7472 | 178 | protected: |
42e69d6b | 179 | virtual void DoGetPosition(int *x, int *y) const; |
a23fd0e1 | 180 | virtual void DoSetClientSize(int width, int height); |
42e69d6b | 181 | virtual void InternalSetMenuBar(); |
598ddd96 | 182 | virtual bool IsMDIChild() const { return true; } |
225fe9d6 | 183 | |
82c9f85c VZ |
184 | virtual WXHICON GetDefaultIcon() const; |
185 | ||
f6bcfd97 BP |
186 | // common part of all ctors |
187 | void Init(); | |
188 | ||
189 | private: | |
190 | bool m_needsResize; // flag which tells us to artificially resize the frame | |
191 | ||
192 | DECLARE_EVENT_TABLE() | |
fc7a2a60 | 193 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame) |
2bda0e17 KB |
194 | }; |
195 | ||
a23fd0e1 VZ |
196 | // --------------------------------------------------------------------------- |
197 | // wxMDIClientWindow | |
198 | // --------------------------------------------------------------------------- | |
2bda0e17 | 199 | |
a23fd0e1 VZ |
200 | class WXDLLEXPORT wxMDIClientWindow : public wxWindow |
201 | { | |
a23fd0e1 | 202 | public: |
42e69d6b | 203 | wxMDIClientWindow() { Init(); } |
a23fd0e1 VZ |
204 | wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) |
205 | { | |
42e69d6b VZ |
206 | Init(); |
207 | ||
a23fd0e1 VZ |
208 | CreateClient(parent, style); |
209 | } | |
2bda0e17 | 210 | |
a23fd0e1 VZ |
211 | // Note: this is virtual, to allow overridden behaviour. |
212 | virtual bool CreateClient(wxMDIParentFrame *parent, | |
213 | long style = wxVSCROLL | wxHSCROLL); | |
2bda0e17 | 214 | |
a23fd0e1 VZ |
215 | // Explicitly call default scroll behaviour |
216 | void OnScroll(wxScrollEvent& event); | |
2bda0e17 | 217 | |
ec06b234 JS |
218 | virtual void DoSetSize(int x, int y, |
219 | int width, int height, | |
220 | int sizeFlags = wxSIZE_AUTO); | |
2bda0e17 | 221 | protected: |
42e69d6b VZ |
222 | void Init() { m_scrollX = m_scrollY = 0; } |
223 | ||
a23fd0e1 VZ |
224 | int m_scrollX, m_scrollY; |
225 | ||
226 | private: | |
227 | DECLARE_EVENT_TABLE() | |
fc7a2a60 | 228 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow) |
2bda0e17 KB |
229 | }; |
230 | ||
231 | #endif | |
bbcdf8bc | 232 | // _WX_MDI_H_ |