]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mdi.h
added ClassRegistrar (wraps Register/UnregisterClass Win32 API calls)
[wxWidgets.git] / include / wx / msw / mdi.h
CommitLineData
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
21extern WXDLLEXPORT_DATA(const wxChar*) wxFrameNameStr;
22extern WXDLLEXPORT_DATA(const wxChar*) wxStatusLineNameStr;
2bda0e17
KB
23
24class WXDLLEXPORT wxMDIClientWindow;
25class WXDLLEXPORT wxMDIChildFrame;
26
a23fd0e1
VZ
27// ---------------------------------------------------------------------------
28// wxMDIParentFrame
29// ---------------------------------------------------------------------------
30
31class WXDLLEXPORT wxMDIParentFrame : public wxFrame
2bda0e17 32{
a23fd0e1
VZ
33public:
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();
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 99protected:
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
113private:
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 125class WXDLLEXPORT wxMDIChildFrame : public wxFrame
2bda0e17 126{
a23fd0e1 127public:
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 180protected:
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
191private:
2596e9fb 192 bool m_needsInitialShow; // Show must be called in idle time after Creation
f6bcfd97
BP
193 bool m_needsResize; // flag which tells us to artificially resize the frame
194
195 DECLARE_EVENT_TABLE()
fc7a2a60 196 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame)
2bda0e17
KB
197};
198
a23fd0e1
VZ
199// ---------------------------------------------------------------------------
200// wxMDIClientWindow
201// ---------------------------------------------------------------------------
2bda0e17 202
a23fd0e1
VZ
203class WXDLLEXPORT wxMDIClientWindow : public wxWindow
204{
a23fd0e1 205public:
42e69d6b 206 wxMDIClientWindow() { Init(); }
a23fd0e1
VZ
207 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
208 {
42e69d6b
VZ
209 Init();
210
a23fd0e1
VZ
211 CreateClient(parent, style);
212 }
2bda0e17 213
a23fd0e1
VZ
214 // Note: this is virtual, to allow overridden behaviour.
215 virtual bool CreateClient(wxMDIParentFrame *parent,
216 long style = wxVSCROLL | wxHSCROLL);
2bda0e17 217
a23fd0e1
VZ
218 // Explicitly call default scroll behaviour
219 void OnScroll(wxScrollEvent& event);
2bda0e17 220
ec06b234
JS
221 virtual void DoSetSize(int x, int y,
222 int width, int height,
223 int sizeFlags = wxSIZE_AUTO);
2bda0e17 224protected:
42e69d6b
VZ
225 void Init() { m_scrollX = m_scrollY = 0; }
226
a23fd0e1
VZ
227 int m_scrollX, m_scrollY;
228
229private:
230 DECLARE_EVENT_TABLE()
fc7a2a60 231 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow)
2bda0e17
KB
232};
233
234#endif
bbcdf8bc 235 // _WX_MDI_H_