]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mdi.h
allow wxRB_GROUP to be changed after creation (patch 1544686)
[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
2bda0e17
KB
15#include "wx/frame.h"
16
63ec432b 17extern WXDLLEXPORT_DATA(const wxChar) wxStatusLineNameStr[];
2bda0e17
KB
18
19class WXDLLEXPORT wxMDIClientWindow;
20class WXDLLEXPORT wxMDIChildFrame;
21
a23fd0e1
VZ
22// ---------------------------------------------------------------------------
23// wxMDIParentFrame
24// ---------------------------------------------------------------------------
25
26class WXDLLEXPORT wxMDIParentFrame : public wxFrame
2bda0e17 27{
a23fd0e1
VZ
28public:
29 wxMDIParentFrame();
30 wxMDIParentFrame(wxWindow *parent,
31 wxWindowID id,
32 const wxString& title,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
36 const wxString& name = wxFrameNameStr)
37 {
38 Create(parent, id, title, pos, size, style, name);
39 }
40
d3c7fc99 41 virtual ~wxMDIParentFrame();
a23fd0e1
VZ
42
43 bool Create(wxWindow *parent,
44 wxWindowID id,
45 const wxString& title,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
49 const wxString& name = wxFrameNameStr);
50
51 // accessors
52 // ---------
53
a23fd0e1 54 // Get the active MDI child window (Windows only)
42e69d6b 55 wxMDIChildFrame *GetActiveChild() const;
2bda0e17 56
a23fd0e1
VZ
57 // Get the client window
58 wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
2bda0e17 59
a23fd0e1
VZ
60 // Create the client window class (don't Create the window,
61 // just return a new class)
42e69d6b 62 virtual wxMDIClientWindow *OnCreateClient(void);
2bda0e17 63
4e152a23 64 // MDI windows menu
df61c009
JS
65 wxMenu* GetWindowMenu() const { return m_windowMenu; };
66 void SetWindowMenu(wxMenu* menu) ;
6aca4628 67 virtual void DoMenuUpdates(wxMenu* menu = NULL);
ef359b43 68
a23fd0e1
VZ
69 // MDI operations
70 // --------------
71 virtual void Cascade();
0d97c090 72 virtual void Tile(wxOrientation orient = wxHORIZONTAL);
a23fd0e1
VZ
73 virtual void ArrangeIcons();
74 virtual void ActivateNext();
75 virtual void ActivatePrevious();
2bda0e17 76
a23fd0e1
VZ
77 // handlers
78 // --------
2bda0e17 79
a23fd0e1
VZ
80 // Responds to colour changes
81 void OnSysColourChanged(wxSysColourChangedEvent& event);
2bda0e17 82
a23fd0e1 83 void OnSize(wxSizeEvent& event);
6bbe97b7 84 void OnIconized(wxIconizeEvent& event);
2bda0e17 85
42e69d6b
VZ
86 bool HandleActivate(int state, bool minimized, WXHWND activate);
87 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
2bda0e17 88
a23fd0e1 89 // override window proc for MDI-specific message processing
c140b7e7 90 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
2bda0e17 91
c140b7e7 92 virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
a23fd0e1 93 virtual bool MSWTranslateMessage(WXMSG* msg);
cc2b7472 94
a23fd0e1 95protected:
1e6feb95 96#if wxUSE_MENUS_NATIVE
42e69d6b 97 virtual void InternalSetMenuBar();
1e6feb95 98#endif // wxUSE_MENUS_NATIVE
42e69d6b 99
82c9f85c
VZ
100 virtual WXHICON GetDefaultIcon() const;
101
6bbe97b7
VZ
102 // set the size of the MDI client window to match the frame size
103 void UpdateClientSize();
104
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
d3c7fc99 142 virtual ~wxMDIChildFrame();
a23fd0e1
VZ
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; }
6f02a879 185 virtual void DetachMenuBar();
225fe9d6 186
82c9f85c
VZ
187 virtual WXHICON GetDefaultIcon() const;
188
f6bcfd97
BP
189 // common part of all ctors
190 void Init();
191
192private:
2596e9fb 193 bool m_needsInitialShow; // Show must be called in idle time after Creation
f6bcfd97
BP
194 bool m_needsResize; // flag which tells us to artificially resize the frame
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
204class WXDLLEXPORT wxMDIClientWindow : public wxWindow
205{
a23fd0e1 206public:
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
6f02a879 222protected:
ec06b234
JS
223 virtual void DoSetSize(int x, int y,
224 int width, int height,
225 int sizeFlags = wxSIZE_AUTO);
6f02a879 226
42e69d6b
VZ
227 void Init() { m_scrollX = m_scrollY = 0; }
228
a23fd0e1
VZ
229 int m_scrollX, m_scrollY;
230
231private:
232 DECLARE_EVENT_TABLE()
fc7a2a60 233 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow)
2bda0e17
KB
234};
235
236#endif
bbcdf8bc 237 // _WX_MDI_H_