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 void SetMenuBar(wxMenuBar
*menu_bar
);
63 // Get the active MDI child window (Windows only)
64 wxMDIChildFrame
*GetActiveChild() const ;
66 // Get the client window
67 wxMDIClientWindow
*GetClientWindow() const { return m_clientWindow
; }
69 // Create the client window class (don't Create the window,
70 // just return a new class)
71 virtual wxMDIClientWindow
*OnCreateClient(void) ;
73 WXHMENU
GetWindowMenu() const { return m_windowMenu
; }
77 virtual void Cascade();
79 virtual void ArrangeIcons();
80 virtual void ActivateNext();
81 virtual void ActivatePrevious();
86 // Responds to colour changes
87 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
89 void OnSize(wxSizeEvent
& event
);
90 void OnActivate(wxActivateEvent
& event
);
92 virtual bool MSWOnActivate(int state
, bool minimized
, WXHWND activate
);
93 virtual bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
95 // override window proc for MDI-specific message processing
96 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
98 virtual long MSWDefWindowProc(WXUINT
, WXWPARAM
, WXLPARAM
);
99 virtual bool MSWProcessMessage(WXMSG
* msg
);
100 virtual bool MSWTranslateMessage(WXMSG
* msg
);
103 wxMDIClientWindow
* m_clientWindow
;
104 wxMDIChildFrame
* m_currentChild
;
105 WXHMENU m_windowMenu
;
107 // TRUE if MDI Frame is intercepting commands, not child
108 bool m_parentFrameActive
;
111 friend class WXDLLEXPORT wxMDIChildFrame
;
113 DECLARE_EVENT_TABLE()
116 // ---------------------------------------------------------------------------
118 // ---------------------------------------------------------------------------
120 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
122 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
126 wxMDIChildFrame(wxMDIParentFrame
*parent
,
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
)
134 Create(parent
, id
, title
, pos
, size
, style
, name
);
139 bool Create(wxMDIParentFrame
*parent
,
141 const wxString
& title
,
142 const wxPoint
& pos
= wxDefaultPosition
,
143 const wxSize
& size
= wxDefaultSize
,
144 long style
= wxDEFAULT_FRAME_STYLE
,
145 const wxString
& name
= wxFrameNameStr
);
148 void SetMenuBar(wxMenuBar
*menu_bar
);
151 virtual void Maximize();
152 virtual void Restore();
153 virtual void Activate();
157 bool MSWOnMDIActivate(long bActivate
, WXHWND
, WXHWND
);
158 bool MSWOnSize(int x
, int y
, WXUINT
);
159 bool MSWOnWindowPosChanging(void *lpPos
);
160 bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
161 long MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
162 bool MSWProcessMessage(WXMSG
*msg
);
163 bool MSWTranslateMessage(WXMSG
*msg
);
164 void MSWDestroyWindow();
167 bool ResetWindowStyle(void *vrect
);
170 virtual void DoGetPosition(int *x
, int *y
) const ;
171 virtual void DoSetClientSize(int width
, int height
);
174 // ---------------------------------------------------------------------------
176 // ---------------------------------------------------------------------------
178 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
180 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
184 wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
186 CreateClient(parent
, style
);
189 ~wxMDIClientWindow();
191 // Note: this is virtual, to allow overridden behaviour.
192 virtual bool CreateClient(wxMDIParentFrame
*parent
,
193 long style
= wxVSCROLL
| wxHSCROLL
);
195 // Explicitly call default scroll behaviour
196 void OnScroll(wxScrollEvent
& event
);
199 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
201 // Calls an appropriate default window procedure
202 virtual long MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
205 int m_scrollX
, m_scrollY
;
208 DECLARE_EVENT_TABLE()