]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mdi.h
added wxIsDebuggerRunning() (which is going to replace the mess in log.cpp)
[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)
22f3361e 117 DECLARE_NO_COPY_CLASS(wxMDIParentFrame)
2bda0e17
KB
118};
119
a23fd0e1
VZ
120// ---------------------------------------------------------------------------
121// wxMDIChildFrame
122// ---------------------------------------------------------------------------
2bda0e17 123
a23fd0e1 124class WXDLLEXPORT wxMDIChildFrame : public wxFrame
2bda0e17 125{
a23fd0e1 126public:
f6bcfd97 127 wxMDIChildFrame() { Init(); }
a23fd0e1
VZ
128 wxMDIChildFrame(wxMDIParentFrame *parent,
129 wxWindowID id,
130 const wxString& title,
131 const wxPoint& pos = wxDefaultPosition,
132 const wxSize& size = wxDefaultSize,
133 long style = wxDEFAULT_FRAME_STYLE,
134 const wxString& name = wxFrameNameStr)
135 {
f6bcfd97
BP
136 Init();
137
a23fd0e1
VZ
138 Create(parent, id, title, pos, size, style, name);
139 }
140
141 ~wxMDIChildFrame();
142
143 bool Create(wxMDIParentFrame *parent,
144 wxWindowID id,
145 const wxString& title,
146 const wxPoint& pos = wxDefaultPosition,
147 const wxSize& size = wxDefaultSize,
148 long style = wxDEFAULT_FRAME_STYLE,
149 const wxString& name = wxFrameNameStr);
150
8487f887 151 virtual bool IsTopLevel() const { return FALSE; }
225fe9d6 152
a23fd0e1 153 // MDI operations
9b73db3c 154 virtual void Maximize(bool maximize = TRUE);
a23fd0e1
VZ
155 virtual void Restore();
156 virtual void Activate();
157
f6bcfd97
BP
158 // Implementation only from now on
159 // -------------------------------
a23fd0e1 160
f6bcfd97 161 // Handlers
42e69d6b 162 bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
42e69d6b
VZ
163 bool HandleWindowPosChanging(void *lpPos);
164 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
3ebcfb76 165 bool HandleGetMinMaxInfo(void *mmInfo);
42e69d6b
VZ
166
167 virtual long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
168 virtual long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
169 virtual bool MSWTranslateMessage(WXMSG *msg);
170
171 virtual void MSWDestroyWindow();
2bda0e17 172
2bda0e17 173 bool ResetWindowStyle(void *vrect);
cc2b7472 174
f6bcfd97
BP
175 void OnIdle(wxIdleEvent& event);
176
cc2b7472 177protected:
42e69d6b 178 virtual void DoGetPosition(int *x, int *y) const;
a23fd0e1 179 virtual void DoSetClientSize(int width, int height);
42e69d6b 180 virtual void InternalSetMenuBar();
91dd52fe 181 virtual bool IsMDIChild() const { return TRUE; }
225fe9d6 182
82c9f85c
VZ
183 virtual WXHICON GetDefaultIcon() const;
184
f6bcfd97
BP
185 // common part of all ctors
186 void Init();
187
188private:
189 bool m_needsResize; // flag which tells us to artificially resize the frame
190
191 DECLARE_EVENT_TABLE()
225fe9d6 192 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
2bda0e17
KB
193};
194
a23fd0e1
VZ
195// ---------------------------------------------------------------------------
196// wxMDIClientWindow
197// ---------------------------------------------------------------------------
2bda0e17 198
a23fd0e1
VZ
199class WXDLLEXPORT wxMDIClientWindow : public wxWindow
200{
a23fd0e1 201public:
42e69d6b 202 wxMDIClientWindow() { Init(); }
a23fd0e1
VZ
203 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
204 {
42e69d6b
VZ
205 Init();
206
a23fd0e1
VZ
207 CreateClient(parent, style);
208 }
2bda0e17 209
a23fd0e1
VZ
210 // Note: this is virtual, to allow overridden behaviour.
211 virtual bool CreateClient(wxMDIParentFrame *parent,
212 long style = wxVSCROLL | wxHSCROLL);
2bda0e17 213
a23fd0e1
VZ
214 // Explicitly call default scroll behaviour
215 void OnScroll(wxScrollEvent& event);
2bda0e17 216
ec06b234
JS
217 virtual void DoSetSize(int x, int y,
218 int width, int height,
219 int sizeFlags = wxSIZE_AUTO);
2bda0e17 220protected:
42e69d6b
VZ
221 void Init() { m_scrollX = m_scrollY = 0; }
222
a23fd0e1
VZ
223 int m_scrollX, m_scrollY;
224
225private:
226 DECLARE_EVENT_TABLE()
f6bcfd97 227 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
2bda0e17
KB
228};
229
230#endif
bbcdf8bc 231 // _WX_MDI_H_