]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mdi.h
Some corrections
[wxWidgets.git] / include / wx / msw / mdi.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: mdi.h
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:
42e69d6b
VZ
101 virtual void InternalSetMenuBar();
102
2bda0e17
KB
103 wxMDIClientWindow * m_clientWindow;
104 wxMDIChildFrame * m_currentChild;
df61c009
JS
105// WXHMENU m_windowMenu;
106 wxMenu* m_windowMenu;
a23fd0e1
VZ
107
108 // TRUE if MDI Frame is intercepting commands, not child
42e69d6b 109 bool m_parentFrameActive;
a23fd0e1
VZ
110
111private:
112 friend class WXDLLEXPORT wxMDIChildFrame;
113
114 DECLARE_EVENT_TABLE()
2bda0e17
KB
115};
116
a23fd0e1
VZ
117// ---------------------------------------------------------------------------
118// wxMDIChildFrame
119// ---------------------------------------------------------------------------
2bda0e17 120
a23fd0e1 121class WXDLLEXPORT wxMDIChildFrame : public wxFrame
2bda0e17 122{
a23fd0e1
VZ
123public:
124 wxMDIChildFrame();
125 wxMDIChildFrame(wxMDIParentFrame *parent,
126 wxWindowID id,
127 const wxString& title,
128 const wxPoint& pos = wxDefaultPosition,
129 const wxSize& size = wxDefaultSize,
130 long style = wxDEFAULT_FRAME_STYLE,
131 const wxString& name = wxFrameNameStr)
132 {
133 Create(parent, id, title, pos, size, style, name);
134 }
135
136 ~wxMDIChildFrame();
137
138 bool Create(wxMDIParentFrame *parent,
139 wxWindowID id,
140 const wxString& title,
141 const wxPoint& pos = wxDefaultPosition,
142 const wxSize& size = wxDefaultSize,
143 long style = wxDEFAULT_FRAME_STYLE,
144 const wxString& name = wxFrameNameStr);
145
8487f887 146 virtual bool IsTopLevel() const { return FALSE; }
225fe9d6 147
a23fd0e1 148 // MDI operations
9b73db3c 149 virtual void Maximize(bool maximize = TRUE);
a23fd0e1
VZ
150 virtual void Restore();
151 virtual void Activate();
152
153 // Handlers
154
42e69d6b 155 bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
42e69d6b
VZ
156 bool HandleWindowPosChanging(void *lpPos);
157 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
158
159 virtual long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
160 virtual long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
161 virtual bool MSWTranslateMessage(WXMSG *msg);
162
163 virtual void MSWDestroyWindow();
2bda0e17
KB
164
165 // Implementation
166 bool ResetWindowStyle(void *vrect);
cc2b7472
VZ
167
168protected:
42e69d6b 169 virtual void DoGetPosition(int *x, int *y) const;
a23fd0e1 170 virtual void DoSetClientSize(int width, int height);
42e69d6b 171 virtual void InternalSetMenuBar();
225fe9d6
VZ
172
173 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
2bda0e17
KB
174};
175
a23fd0e1
VZ
176// ---------------------------------------------------------------------------
177// wxMDIClientWindow
178// ---------------------------------------------------------------------------
2bda0e17 179
a23fd0e1
VZ
180class WXDLLEXPORT wxMDIClientWindow : public wxWindow
181{
182 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
2bda0e17 183
a23fd0e1 184public:
42e69d6b 185 wxMDIClientWindow() { Init(); }
a23fd0e1
VZ
186 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
187 {
42e69d6b
VZ
188 Init();
189
a23fd0e1
VZ
190 CreateClient(parent, style);
191 }
2bda0e17 192
a23fd0e1
VZ
193 // Note: this is virtual, to allow overridden behaviour.
194 virtual bool CreateClient(wxMDIParentFrame *parent,
195 long style = wxVSCROLL | wxHSCROLL);
2bda0e17 196
a23fd0e1
VZ
197 // Explicitly call default scroll behaviour
198 void OnScroll(wxScrollEvent& event);
2bda0e17 199
ec06b234
JS
200 virtual void DoSetSize(int x, int y,
201 int width, int height,
202 int sizeFlags = wxSIZE_AUTO);
2bda0e17 203protected:
42e69d6b
VZ
204 void Init() { m_scrollX = m_scrollY = 0; }
205
a23fd0e1
VZ
206 int m_scrollX, m_scrollY;
207
208private:
209 DECLARE_EVENT_TABLE()
2bda0e17
KB
210};
211
212#endif
bbcdf8bc 213 // _WX_MDI_H_