1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: MDI (Multiple Document Interface) classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "mdi.h"
21 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameNameStr
;
22 WXDLLEXPORT_DATA(extern const wxChar
*) wxStatusLineNameStr
;
24 class WXDLLEXPORT wxMDIClientWindow
;
25 class WXDLLEXPORT wxMDIChildFrame
;
27 // ---------------------------------------------------------------------------
29 // ---------------------------------------------------------------------------
31 class WXDLLEXPORT wxMDIParentFrame
: public wxFrame
33 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame
)
37 wxMDIParentFrame(wxWindow
*parent
,
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
)
45 Create(parent
, id
, title
, pos
, size
, style
, name
);
50 bool Create(wxWindow
*parent
,
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
);
61 // Get the active MDI child window (Windows only)
62 wxMDIChildFrame
*GetActiveChild() const;
64 // Get the client window
65 wxMDIClientWindow
*GetClientWindow() const { return m_clientWindow
; }
67 // Create the client window class (don't Create the window,
68 // just return a new class)
69 virtual wxMDIClientWindow
*OnCreateClient(void);
71 WXHMENU
GetWindowMenu() const { return m_windowMenu
; }
75 virtual void Cascade();
77 virtual void ArrangeIcons();
78 virtual void ActivateNext();
79 virtual void ActivatePrevious();
84 // Responds to colour changes
85 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
87 void OnSize(wxSizeEvent
& event
);
89 bool HandleActivate(int state
, bool minimized
, WXHWND activate
);
90 bool HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
92 // override window proc for MDI-specific message processing
93 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
95 virtual long MSWDefWindowProc(WXUINT
, WXWPARAM
, WXLPARAM
);
96 virtual bool MSWTranslateMessage(WXMSG
* msg
);
99 virtual void InternalSetMenuBar();
101 wxMDIClientWindow
* m_clientWindow
;
102 wxMDIChildFrame
* m_currentChild
;
103 WXHMENU m_windowMenu
;
105 // TRUE if MDI Frame is intercepting commands, not child
106 bool m_parentFrameActive
;
109 friend class WXDLLEXPORT wxMDIChildFrame
;
111 DECLARE_EVENT_TABLE()
114 // ---------------------------------------------------------------------------
116 // ---------------------------------------------------------------------------
118 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
120 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
124 wxMDIChildFrame(wxMDIParentFrame
*parent
,
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
)
132 Create(parent
, id
, title
, pos
, size
, style
, name
);
137 bool Create(wxMDIParentFrame
*parent
,
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
);
146 virtual void Maximize(bool maximize
= TRUE
);
147 virtual void Restore();
148 virtual void Activate();
152 bool HandleMDIActivate(long bActivate
, WXHWND
, WXHWND
);
153 bool HandleSize(int x
, int y
, WXUINT
);
154 bool HandleWindowPosChanging(void *lpPos
);
155 bool HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
157 virtual long MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
158 virtual long MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
159 virtual bool MSWTranslateMessage(WXMSG
*msg
);
161 virtual void MSWDestroyWindow();
164 bool ResetWindowStyle(void *vrect
);
167 virtual void DoGetPosition(int *x
, int *y
) const;
168 virtual void DoSetClientSize(int width
, int height
);
169 virtual void InternalSetMenuBar();
172 // ---------------------------------------------------------------------------
174 // ---------------------------------------------------------------------------
176 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
178 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
181 wxMDIClientWindow() { Init(); }
182 wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
186 CreateClient(parent
, style
);
189 // Note: this is virtual, to allow overridden behaviour.
190 virtual bool CreateClient(wxMDIParentFrame
*parent
,
191 long style
= wxVSCROLL
| wxHSCROLL
);
193 // Explicitly call default scroll behaviour
194 void OnScroll(wxScrollEvent
& event
);
197 void Init() { m_scrollX
= m_scrollY
= 0; }
199 int m_scrollX
, m_scrollY
;
202 DECLARE_EVENT_TABLE()