]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mdi.h
Fixed resource leak for wxListItem
[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
33 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
34
35public:
36 wxMDIParentFrame();
37 wxMDIParentFrame(wxWindow *parent,
38 wxWindowID id,
39 const wxString& title,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
43 const wxString& name = wxFrameNameStr)
44 {
45 Create(parent, id, title, pos, size, style, name);
46 }
47
48 ~wxMDIParentFrame();
49
50 bool Create(wxWindow *parent,
51 wxWindowID id,
52 const wxString& title,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
56 const wxString& name = wxFrameNameStr);
57
58 // accessors
59 // ---------
60
a23fd0e1 61 // Get the active MDI child window (Windows only)
42e69d6b 62 wxMDIChildFrame *GetActiveChild() const;
2bda0e17 63
a23fd0e1
VZ
64 // Get the client window
65 wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
2bda0e17 66
a23fd0e1
VZ
67 // Create the client window class (don't Create the window,
68 // just return a new class)
42e69d6b 69 virtual wxMDIClientWindow *OnCreateClient(void);
2bda0e17 70
df61c009
JS
71// WXHMENU GetWindowHMENU() const { return m_windowMenu; }
72 wxMenu* GetWindowMenu() const { return m_windowMenu; };
73 void SetWindowMenu(wxMenu* menu) ;
2bda0e17 74
a23fd0e1
VZ
75 // MDI operations
76 // --------------
77 virtual void Cascade();
78 virtual void Tile();
79 virtual void ArrangeIcons();
80 virtual void ActivateNext();
81 virtual void ActivatePrevious();
2bda0e17 82
a23fd0e1
VZ
83 // handlers
84 // --------
2bda0e17 85
a23fd0e1
VZ
86 // Responds to colour changes
87 void OnSysColourChanged(wxSysColourChangedEvent& event);
2bda0e17 88
a23fd0e1 89 void OnSize(wxSizeEvent& event);
2bda0e17 90
42e69d6b
VZ
91 bool HandleActivate(int state, bool minimized, WXHWND activate);
92 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
2bda0e17 93
a23fd0e1
VZ
94 // override window proc for MDI-specific message processing
95 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
2bda0e17 96
a23fd0e1 97 virtual long MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
a23fd0e1 98 virtual bool MSWTranslateMessage(WXMSG* msg);
cc2b7472 99
a23fd0e1 100protected:
1e6feb95 101#if wxUSE_MENUS_NATIVE
42e69d6b 102 virtual void InternalSetMenuBar();
1e6feb95 103#endif // wxUSE_MENUS_NATIVE
42e69d6b 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()
2bda0e17
KB
116};
117
a23fd0e1
VZ
118// ---------------------------------------------------------------------------
119// wxMDIChildFrame
120// ---------------------------------------------------------------------------
2bda0e17 121
a23fd0e1 122class WXDLLEXPORT wxMDIChildFrame : public wxFrame
2bda0e17 123{
a23fd0e1 124public:
f6bcfd97 125 wxMDIChildFrame() { Init(); }
a23fd0e1
VZ
126 wxMDIChildFrame(wxMDIParentFrame *parent,
127 wxWindowID id,
128 const wxString& title,
129 const wxPoint& pos = wxDefaultPosition,
130 const wxSize& size = wxDefaultSize,
131 long style = wxDEFAULT_FRAME_STYLE,
132 const wxString& name = wxFrameNameStr)
133 {
f6bcfd97
BP
134 Init();
135
a23fd0e1
VZ
136 Create(parent, id, title, pos, size, style, name);
137 }
138
139 ~wxMDIChildFrame();
140
141 bool Create(wxMDIParentFrame *parent,
142 wxWindowID id,
143 const wxString& title,
144 const wxPoint& pos = wxDefaultPosition,
145 const wxSize& size = wxDefaultSize,
146 long style = wxDEFAULT_FRAME_STYLE,
147 const wxString& name = wxFrameNameStr);
148
8487f887 149 virtual bool IsTopLevel() const { return FALSE; }
225fe9d6 150
a23fd0e1 151 // MDI operations
9b73db3c 152 virtual void Maximize(bool maximize = TRUE);
a23fd0e1
VZ
153 virtual void Restore();
154 virtual void Activate();
155
f6bcfd97
BP
156 // Implementation only from now on
157 // -------------------------------
a23fd0e1 158
f6bcfd97 159 // Handlers
42e69d6b 160 bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
42e69d6b
VZ
161 bool HandleWindowPosChanging(void *lpPos);
162 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
3ebcfb76 163 bool HandleGetMinMaxInfo(void *mmInfo);
42e69d6b
VZ
164
165 virtual long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
166 virtual long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
167 virtual bool MSWTranslateMessage(WXMSG *msg);
168
169 virtual void MSWDestroyWindow();
2bda0e17 170
2bda0e17 171 bool ResetWindowStyle(void *vrect);
cc2b7472 172
f6bcfd97
BP
173 void OnIdle(wxIdleEvent& event);
174
cc2b7472 175protected:
42e69d6b 176 virtual void DoGetPosition(int *x, int *y) const;
a23fd0e1 177 virtual void DoSetClientSize(int width, int height);
42e69d6b 178 virtual void InternalSetMenuBar();
91dd52fe 179 virtual bool IsMDIChild() const { return TRUE; }
225fe9d6 180
f6bcfd97
BP
181 // common part of all ctors
182 void Init();
183
184private:
185 bool m_needsResize; // flag which tells us to artificially resize the frame
186
187 DECLARE_EVENT_TABLE()
225fe9d6 188 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
2bda0e17
KB
189};
190
a23fd0e1
VZ
191// ---------------------------------------------------------------------------
192// wxMDIClientWindow
193// ---------------------------------------------------------------------------
2bda0e17 194
a23fd0e1
VZ
195class WXDLLEXPORT wxMDIClientWindow : public wxWindow
196{
a23fd0e1 197public:
42e69d6b 198 wxMDIClientWindow() { Init(); }
a23fd0e1
VZ
199 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
200 {
42e69d6b
VZ
201 Init();
202
a23fd0e1
VZ
203 CreateClient(parent, style);
204 }
2bda0e17 205
a23fd0e1
VZ
206 // Note: this is virtual, to allow overridden behaviour.
207 virtual bool CreateClient(wxMDIParentFrame *parent,
208 long style = wxVSCROLL | wxHSCROLL);
2bda0e17 209
a23fd0e1
VZ
210 // Explicitly call default scroll behaviour
211 void OnScroll(wxScrollEvent& event);
2bda0e17 212
ec06b234
JS
213 virtual void DoSetSize(int x, int y,
214 int width, int height,
215 int sizeFlags = wxSIZE_AUTO);
2bda0e17 216protected:
42e69d6b
VZ
217 void Init() { m_scrollX = m_scrollY = 0; }
218
a23fd0e1
VZ
219 int m_scrollX, m_scrollY;
220
221private:
222 DECLARE_EVENT_TABLE()
f6bcfd97 223 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
2bda0e17
KB
224};
225
226#endif
bbcdf8bc 227 // _WX_MDI_H_