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