]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mdi.h
remove obsolete file
[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
53a2db12 17extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusLineNameStr[];
2bda0e17 18
b5dbe15d
VS
19class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
20class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
2bda0e17 21
a23fd0e1
VZ
22// ---------------------------------------------------------------------------
23// wxMDIParentFrame
24// ---------------------------------------------------------------------------
25
53a2db12 26class WXDLLIMPEXP_CORE 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
47b378bd 65 wxMenu* GetWindowMenu() const { return m_windowMenu; }
df61c009 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
10816efb
VZ
95 // override wxFrameBase function to also look in the active child menu bar
96 virtual const wxMenuItem *FindItemInMenuBar(int menuId) const;
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
6bbe97b7
VZ
105 // set the size of the MDI client window to match the frame size
106 void UpdateClientSize();
107
108
2bda0e17
KB
109 wxMDIClientWindow * m_clientWindow;
110 wxMDIChildFrame * m_currentChild;
df61c009 111 wxMenu* m_windowMenu;
a23fd0e1 112
598ddd96 113 // true if MDI Frame is intercepting commands, not child
42e69d6b 114 bool m_parentFrameActive;
a23fd0e1
VZ
115
116private:
b5dbe15d 117 friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
a23fd0e1
VZ
118
119 DECLARE_EVENT_TABLE()
82c9f85c 120 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
22f3361e 121 DECLARE_NO_COPY_CLASS(wxMDIParentFrame)
2bda0e17
KB
122};
123
a23fd0e1
VZ
124// ---------------------------------------------------------------------------
125// wxMDIChildFrame
126// ---------------------------------------------------------------------------
2bda0e17 127
53a2db12 128class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxFrame
2bda0e17 129{
a23fd0e1 130public:
f6bcfd97 131 wxMDIChildFrame() { Init(); }
a23fd0e1
VZ
132 wxMDIChildFrame(wxMDIParentFrame *parent,
133 wxWindowID id,
134 const wxString& title,
135 const wxPoint& pos = wxDefaultPosition,
136 const wxSize& size = wxDefaultSize,
137 long style = wxDEFAULT_FRAME_STYLE,
138 const wxString& name = wxFrameNameStr)
139 {
f6bcfd97
BP
140 Init();
141
a23fd0e1
VZ
142 Create(parent, id, title, pos, size, style, name);
143 }
144
d3c7fc99 145 virtual ~wxMDIChildFrame();
a23fd0e1
VZ
146
147 bool Create(wxMDIParentFrame *parent,
148 wxWindowID id,
149 const wxString& title,
150 const wxPoint& pos = wxDefaultPosition,
151 const wxSize& size = wxDefaultSize,
152 long style = wxDEFAULT_FRAME_STYLE,
153 const wxString& name = wxFrameNameStr);
154
598ddd96 155 virtual bool IsTopLevel() const { return false; }
225fe9d6 156
a23fd0e1 157 // MDI operations
598ddd96 158 virtual void Maximize(bool maximize = true);
a23fd0e1
VZ
159 virtual void Restore();
160 virtual void Activate();
161
f6bcfd97
BP
162 // Implementation only from now on
163 // -------------------------------
a23fd0e1 164
55ae1551
VZ
165 wxMDIParentFrame* GetMDIParent() const
166 {
167 return wxStaticCast(wxFrame::GetParent(), wxMDIParentFrame);
168 }
169
f6bcfd97 170 // Handlers
42e69d6b 171 bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
42e69d6b
VZ
172 bool HandleWindowPosChanging(void *lpPos);
173 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
3ebcfb76 174 bool HandleGetMinMaxInfo(void *mmInfo);
42e69d6b 175
c140b7e7
JS
176 virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
177 virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
42e69d6b
VZ
178 virtual bool MSWTranslateMessage(WXMSG *msg);
179
180 virtual void MSWDestroyWindow();
2bda0e17 181
2bda0e17 182 bool ResetWindowStyle(void *vrect);
cc2b7472 183
f6bcfd97 184 void OnIdle(wxIdleEvent& event);
ef359b43 185
2596e9fb 186 virtual bool Show(bool show = true);
f6bcfd97 187
cc2b7472 188protected:
3e85709e 189 virtual void DoGetScreenPosition(int *x, int *y) const;
42e69d6b 190 virtual void DoGetPosition(int *x, int *y) const;
a23fd0e1 191 virtual void DoSetClientSize(int width, int height);
42e69d6b 192 virtual void InternalSetMenuBar();
598ddd96 193 virtual bool IsMDIChild() const { return true; }
6f02a879 194 virtual void DetachMenuBar();
225fe9d6 195
82c9f85c
VZ
196 virtual WXHICON GetDefaultIcon() const;
197
f6bcfd97
BP
198 // common part of all ctors
199 void Init();
200
201private:
2596e9fb 202 bool m_needsInitialShow; // Show must be called in idle time after Creation
f6bcfd97
BP
203 bool m_needsResize; // flag which tells us to artificially resize the frame
204
205 DECLARE_EVENT_TABLE()
fc7a2a60 206 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame)
2bda0e17
KB
207};
208
a23fd0e1
VZ
209// ---------------------------------------------------------------------------
210// wxMDIClientWindow
211// ---------------------------------------------------------------------------
2bda0e17 212
53a2db12 213class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxWindow
a23fd0e1 214{
a23fd0e1 215public:
42e69d6b 216 wxMDIClientWindow() { Init(); }
a23fd0e1
VZ
217 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
218 {
42e69d6b
VZ
219 Init();
220
a23fd0e1
VZ
221 CreateClient(parent, style);
222 }
2bda0e17 223
a23fd0e1
VZ
224 // Note: this is virtual, to allow overridden behaviour.
225 virtual bool CreateClient(wxMDIParentFrame *parent,
226 long style = wxVSCROLL | wxHSCROLL);
2bda0e17 227
a23fd0e1
VZ
228 // Explicitly call default scroll behaviour
229 void OnScroll(wxScrollEvent& event);
2bda0e17 230
6f02a879 231protected:
ec06b234
JS
232 virtual void DoSetSize(int x, int y,
233 int width, int height,
234 int sizeFlags = wxSIZE_AUTO);
6f02a879 235
42e69d6b
VZ
236 void Init() { m_scrollX = m_scrollY = 0; }
237
a23fd0e1
VZ
238 int m_scrollX, m_scrollY;
239
240private:
241 DECLARE_EVENT_TABLE()
fc7a2a60 242 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow)
2bda0e17
KB
243};
244
245#endif
bbcdf8bc 246 // _WX_MDI_H_