]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mdi.h
slider link fix 2.
[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
a23fd0e1 71 WXHMENU GetWindowMenu() const { return m_windowMenu; }
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:
42e69d6b
VZ
99 virtual void InternalSetMenuBar();
100
2bda0e17
KB
101 wxMDIClientWindow * m_clientWindow;
102 wxMDIChildFrame * m_currentChild;
103 WXHMENU m_windowMenu;
a23fd0e1
VZ
104
105 // TRUE if MDI Frame is intercepting commands, not child
42e69d6b 106 bool m_parentFrameActive;
a23fd0e1
VZ
107
108private:
109 friend class WXDLLEXPORT wxMDIChildFrame;
110
111 DECLARE_EVENT_TABLE()
2bda0e17
KB
112};
113
a23fd0e1
VZ
114// ---------------------------------------------------------------------------
115// wxMDIChildFrame
116// ---------------------------------------------------------------------------
2bda0e17 117
a23fd0e1 118class WXDLLEXPORT wxMDIChildFrame : public wxFrame
2bda0e17 119{
a23fd0e1
VZ
120 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
121
122public:
123 wxMDIChildFrame();
124 wxMDIChildFrame(wxMDIParentFrame *parent,
125 wxWindowID id,
126 const wxString& title,
127 const wxPoint& pos = wxDefaultPosition,
128 const wxSize& size = wxDefaultSize,
129 long style = wxDEFAULT_FRAME_STYLE,
130 const wxString& name = wxFrameNameStr)
131 {
132 Create(parent, id, title, pos, size, style, name);
133 }
134
135 ~wxMDIChildFrame();
136
137 bool Create(wxMDIParentFrame *parent,
138 wxWindowID id,
139 const wxString& title,
140 const wxPoint& pos = wxDefaultPosition,
141 const wxSize& size = wxDefaultSize,
142 long style = wxDEFAULT_FRAME_STYLE,
143 const wxString& name = wxFrameNameStr);
144
8487f887
RR
145 virtual bool IsTopLevel() const { return FALSE; }
146
a23fd0e1 147 // MDI operations
9b73db3c 148 virtual void Maximize(bool maximize = TRUE);
a23fd0e1
VZ
149 virtual void Restore();
150 virtual void Activate();
151
152 // Handlers
153
42e69d6b
VZ
154 bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
155 bool HandleSize(int x, int y, WXUINT);
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();
2bda0e17
KB
172};
173
a23fd0e1
VZ
174// ---------------------------------------------------------------------------
175// wxMDIClientWindow
176// ---------------------------------------------------------------------------
2bda0e17 177
a23fd0e1
VZ
178class WXDLLEXPORT wxMDIClientWindow : public wxWindow
179{
180 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
2bda0e17 181
a23fd0e1 182public:
42e69d6b 183 wxMDIClientWindow() { Init(); }
a23fd0e1
VZ
184 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
185 {
42e69d6b
VZ
186 Init();
187
a23fd0e1
VZ
188 CreateClient(parent, style);
189 }
2bda0e17 190
a23fd0e1
VZ
191 // Note: this is virtual, to allow overridden behaviour.
192 virtual bool CreateClient(wxMDIParentFrame *parent,
193 long style = wxVSCROLL | wxHSCROLL);
2bda0e17 194
a23fd0e1
VZ
195 // Explicitly call default scroll behaviour
196 void OnScroll(wxScrollEvent& event);
2bda0e17 197
2bda0e17 198protected:
42e69d6b
VZ
199 void Init() { m_scrollX = m_scrollY = 0; }
200
a23fd0e1
VZ
201 int m_scrollX, m_scrollY;
202
203private:
204 DECLARE_EVENT_TABLE()
2bda0e17
KB
205};
206
207#endif
bbcdf8bc 208 // _WX_MDI_H_