]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/mdi.h
Removed erroneous copyright names and corrected licence spelling
[wxWidgets.git] / include / wx / msw / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/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$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MDI_H_
13 #define _WX_MDI_H_
14
15 #ifdef __GNUG__
16 #pragma interface "mdi.h"
17 #endif
18
19 #include "wx/frame.h"
20
21 WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
22 WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
23
24 class WXDLLEXPORT wxMDIClientWindow;
25 class WXDLLEXPORT wxMDIChildFrame;
26
27 // ---------------------------------------------------------------------------
28 // wxMDIParentFrame
29 // ---------------------------------------------------------------------------
30
31 class WXDLLEXPORT wxMDIParentFrame : public wxFrame
32 {
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
59 // Get the active MDI child window (Windows only)
60 wxMDIChildFrame *GetActiveChild() const;
61
62 // Get the client window
63 wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
64
65 // Create the client window class (don't Create the window,
66 // just return a new class)
67 virtual wxMDIClientWindow *OnCreateClient(void);
68
69 // MDI windows menu
70 wxMenu* GetWindowMenu() const { return m_windowMenu; };
71 void SetWindowMenu(wxMenu* menu) ;
72
73 // MDI operations
74 // --------------
75 virtual void Cascade();
76 virtual void Tile();
77 virtual void ArrangeIcons();
78 virtual void ActivateNext();
79 virtual void ActivatePrevious();
80
81 // handlers
82 // --------
83
84 // Responds to colour changes
85 void OnSysColourChanged(wxSysColourChangedEvent& event);
86
87 void OnSize(wxSizeEvent& event);
88
89 bool HandleActivate(int state, bool minimized, WXHWND activate);
90 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
91
92 // override window proc for MDI-specific message processing
93 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
94
95 virtual long MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
96 virtual bool MSWTranslateMessage(WXMSG* msg);
97
98 protected:
99 #if wxUSE_MENUS_NATIVE
100 virtual void InternalSetMenuBar();
101 #endif // wxUSE_MENUS_NATIVE
102
103 virtual WXHICON GetDefaultIcon() const;
104
105 wxMDIClientWindow * m_clientWindow;
106 wxMDIChildFrame * m_currentChild;
107 wxMenu* m_windowMenu;
108
109 // TRUE if MDI Frame is intercepting commands, not child
110 bool m_parentFrameActive;
111
112 private:
113 friend class WXDLLEXPORT wxMDIChildFrame;
114
115 DECLARE_EVENT_TABLE()
116 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
117 DECLARE_NO_COPY_CLASS(wxMDIParentFrame)
118 };
119
120 // ---------------------------------------------------------------------------
121 // wxMDIChildFrame
122 // ---------------------------------------------------------------------------
123
124 class WXDLLEXPORT wxMDIChildFrame : public wxFrame
125 {
126 public:
127 wxMDIChildFrame() { Init(); }
128 wxMDIChildFrame(wxMDIParentFrame *parent,
129 wxWindowID id,
130 const wxString& title,
131 const wxPoint& pos = wxDefaultPosition,
132 const wxSize& size = wxDefaultSize,
133 long style = wxDEFAULT_FRAME_STYLE,
134 const wxString& name = wxFrameNameStr)
135 {
136 Init();
137
138 Create(parent, id, title, pos, size, style, name);
139 }
140
141 ~wxMDIChildFrame();
142
143 bool Create(wxMDIParentFrame *parent,
144 wxWindowID id,
145 const wxString& title,
146 const wxPoint& pos = wxDefaultPosition,
147 const wxSize& size = wxDefaultSize,
148 long style = wxDEFAULT_FRAME_STYLE,
149 const wxString& name = wxFrameNameStr);
150
151 virtual bool IsTopLevel() const { return FALSE; }
152
153 // MDI operations
154 virtual void Maximize(bool maximize = TRUE);
155 virtual void Restore();
156 virtual void Activate();
157
158 // Implementation only from now on
159 // -------------------------------
160
161 // Handlers
162 bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
163 bool HandleWindowPosChanging(void *lpPos);
164 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
165 bool HandleGetMinMaxInfo(void *mmInfo);
166
167 virtual long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
168 virtual long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
169 virtual bool MSWTranslateMessage(WXMSG *msg);
170
171 virtual void MSWDestroyWindow();
172
173 bool ResetWindowStyle(void *vrect);
174
175 void OnIdle(wxIdleEvent& event);
176
177 protected:
178 virtual void DoGetPosition(int *x, int *y) const;
179 virtual void DoSetClientSize(int width, int height);
180 virtual void InternalSetMenuBar();
181 virtual bool IsMDIChild() const { return TRUE; }
182
183 virtual WXHICON GetDefaultIcon() const;
184
185 // common part of all ctors
186 void Init();
187
188 private:
189 bool m_needsResize; // flag which tells us to artificially resize the frame
190
191 DECLARE_EVENT_TABLE()
192 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
193 };
194
195 // ---------------------------------------------------------------------------
196 // wxMDIClientWindow
197 // ---------------------------------------------------------------------------
198
199 class WXDLLEXPORT wxMDIClientWindow : public wxWindow
200 {
201 public:
202 wxMDIClientWindow() { Init(); }
203 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
204 {
205 Init();
206
207 CreateClient(parent, style);
208 }
209
210 // Note: this is virtual, to allow overridden behaviour.
211 virtual bool CreateClient(wxMDIParentFrame *parent,
212 long style = wxVSCROLL | wxHSCROLL);
213
214 // Explicitly call default scroll behaviour
215 void OnScroll(wxScrollEvent& event);
216
217 virtual void DoSetSize(int x, int y,
218 int width, int height,
219 int sizeFlags = wxSIZE_AUTO);
220 protected:
221 void Init() { m_scrollX = m_scrollY = 0; }
222
223 int m_scrollX, m_scrollY;
224
225 private:
226 DECLARE_EVENT_TABLE()
227 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
228 };
229
230 #endif
231 // _WX_MDI_H_