]>
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 | ||
ef359b43 WS |
21 | extern WXDLLEXPORT_DATA(const wxChar*) wxFrameNameStr; |
22 | extern WXDLLEXPORT_DATA(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 | 72 | virtual void DoMenuUpdates(wxMenu* menu = NULL); |
ef359b43 | 73 | |
a23fd0e1 VZ |
74 | // MDI operations |
75 | // -------------- | |
76 | virtual void Cascade(); | |
0d97c090 | 77 | virtual void Tile(wxOrientation orient = wxHORIZONTAL); |
a23fd0e1 VZ |
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 | 176 | void OnIdle(wxIdleEvent& event); |
ef359b43 | 177 | |
2596e9fb | 178 | virtual bool Show(bool show = true); |
f6bcfd97 | 179 | |
cc2b7472 | 180 | protected: |
42e69d6b | 181 | virtual void DoGetPosition(int *x, int *y) const; |
a23fd0e1 | 182 | virtual void DoSetClientSize(int width, int height); |
42e69d6b | 183 | virtual void InternalSetMenuBar(); |
598ddd96 | 184 | virtual bool IsMDIChild() const { return true; } |
225fe9d6 | 185 | |
82c9f85c VZ |
186 | virtual WXHICON GetDefaultIcon() const; |
187 | ||
f6bcfd97 BP |
188 | // common part of all ctors |
189 | void Init(); | |
190 | ||
191 | private: | |
2596e9fb | 192 | bool m_needsInitialShow; // Show must be called in idle time after Creation |
f6bcfd97 | 193 | bool m_needsResize; // flag which tells us to artificially resize the frame |
e3307ddd | 194 | virtual void DetachMenuBar() ; |
f6bcfd97 BP |
195 | |
196 | DECLARE_EVENT_TABLE() | |
fc7a2a60 | 197 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame) |
2bda0e17 KB |
198 | }; |
199 | ||
a23fd0e1 VZ |
200 | // --------------------------------------------------------------------------- |
201 | // wxMDIClientWindow | |
202 | // --------------------------------------------------------------------------- | |
2bda0e17 | 203 | |
a23fd0e1 VZ |
204 | class WXDLLEXPORT wxMDIClientWindow : public wxWindow |
205 | { | |
a23fd0e1 | 206 | public: |
42e69d6b | 207 | wxMDIClientWindow() { Init(); } |
a23fd0e1 VZ |
208 | wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) |
209 | { | |
42e69d6b VZ |
210 | Init(); |
211 | ||
a23fd0e1 VZ |
212 | CreateClient(parent, style); |
213 | } | |
2bda0e17 | 214 | |
a23fd0e1 VZ |
215 | // Note: this is virtual, to allow overridden behaviour. |
216 | virtual bool CreateClient(wxMDIParentFrame *parent, | |
217 | long style = wxVSCROLL | wxHSCROLL); | |
2bda0e17 | 218 | |
a23fd0e1 VZ |
219 | // Explicitly call default scroll behaviour |
220 | void OnScroll(wxScrollEvent& event); | |
2bda0e17 | 221 | |
ec06b234 JS |
222 | virtual void DoSetSize(int x, int y, |
223 | int width, int height, | |
224 | int sizeFlags = wxSIZE_AUTO); | |
2bda0e17 | 225 | protected: |
42e69d6b VZ |
226 | void Init() { m_scrollX = m_scrollY = 0; } |
227 | ||
a23fd0e1 VZ |
228 | int m_scrollX, m_scrollY; |
229 | ||
230 | private: | |
231 | DECLARE_EVENT_TABLE() | |
fc7a2a60 | 232 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow) |
2bda0e17 KB |
233 | }; |
234 | ||
235 | #endif | |
bbcdf8bc | 236 | // _WX_MDI_H_ |