]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mdi.h
Compile fix (VC++ 6 doesn't like wxString::Format with only 1 arg: gives several...
[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 18
b5dbe15d
VS
19class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
20class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
2bda0e17 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
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
a23fd0e1 128class WXDLLEXPORT 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
f6bcfd97 165 // Handlers
42e69d6b 166 bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
42e69d6b
VZ
167 bool HandleWindowPosChanging(void *lpPos);
168 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
3ebcfb76 169 bool HandleGetMinMaxInfo(void *mmInfo);
42e69d6b 170
c140b7e7
JS
171 virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
172 virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
42e69d6b
VZ
173 virtual bool MSWTranslateMessage(WXMSG *msg);
174
175 virtual void MSWDestroyWindow();
2bda0e17 176
2bda0e17 177 bool ResetWindowStyle(void *vrect);
cc2b7472 178
f6bcfd97 179 void OnIdle(wxIdleEvent& event);
ef359b43 180
2596e9fb 181 virtual bool Show(bool show = true);
f6bcfd97 182
cc2b7472 183protected:
3e85709e 184 virtual void DoGetScreenPosition(int *x, int *y) const;
42e69d6b 185 virtual void DoGetPosition(int *x, int *y) const;
a23fd0e1 186 virtual void DoSetClientSize(int width, int height);
42e69d6b 187 virtual void InternalSetMenuBar();
598ddd96 188 virtual bool IsMDIChild() const { return true; }
6f02a879 189 virtual void DetachMenuBar();
225fe9d6 190
82c9f85c
VZ
191 virtual WXHICON GetDefaultIcon() const;
192
f6bcfd97
BP
193 // common part of all ctors
194 void Init();
195
196private:
2596e9fb 197 bool m_needsInitialShow; // Show must be called in idle time after Creation
f6bcfd97
BP
198 bool m_needsResize; // flag which tells us to artificially resize the frame
199
200 DECLARE_EVENT_TABLE()
fc7a2a60 201 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame)
2bda0e17
KB
202};
203
a23fd0e1
VZ
204// ---------------------------------------------------------------------------
205// wxMDIClientWindow
206// ---------------------------------------------------------------------------
2bda0e17 207
a23fd0e1
VZ
208class WXDLLEXPORT wxMDIClientWindow : public wxWindow
209{
a23fd0e1 210public:
42e69d6b 211 wxMDIClientWindow() { Init(); }
a23fd0e1
VZ
212 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
213 {
42e69d6b
VZ
214 Init();
215
a23fd0e1
VZ
216 CreateClient(parent, style);
217 }
2bda0e17 218
a23fd0e1
VZ
219 // Note: this is virtual, to allow overridden behaviour.
220 virtual bool CreateClient(wxMDIParentFrame *parent,
221 long style = wxVSCROLL | wxHSCROLL);
2bda0e17 222
a23fd0e1
VZ
223 // Explicitly call default scroll behaviour
224 void OnScroll(wxScrollEvent& event);
2bda0e17 225
6f02a879 226protected:
ec06b234
JS
227 virtual void DoSetSize(int x, int y,
228 int width, int height,
229 int sizeFlags = wxSIZE_AUTO);
6f02a879 230
42e69d6b
VZ
231 void Init() { m_scrollX = m_scrollY = 0; }
232
a23fd0e1
VZ
233 int m_scrollX, m_scrollY;
234
235private:
236 DECLARE_EVENT_TABLE()
fc7a2a60 237 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow)
2bda0e17
KB
238};
239
240#endif
bbcdf8bc 241 // _WX_MDI_H_