1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: MDI (Multiple Document Interface) classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "mdi.h"
21 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr
;
22 WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr
;
24 class WXDLLEXPORT wxMDIClientWindow
;
25 class WXDLLEXPORT wxMDIChildFrame
;
27 class WXDLLEXPORT wxMDIParentFrame
: public wxFrame
29 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame
)
31 friend class WXDLLEXPORT wxMDIChildFrame
;
34 wxMDIParentFrame(void);
35 inline wxMDIParentFrame(wxWindow
*parent
,
37 const wxString
& title
,
38 const wxPoint
& pos
= wxDefaultPosition
,
39 const wxSize
& size
= wxDefaultSize
,
40 const long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
41 const wxString
& name
= wxFrameNameStr
)
43 Create(parent
, id
, title
, pos
, size
, style
, name
);
46 ~wxMDIParentFrame(void);
48 bool Create(wxWindow
*parent
,
50 const wxString
& title
,
51 const wxPoint
& pos
= wxDefaultPosition
,
52 const wxSize
& size
= wxDefaultSize
,
53 const long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
54 const wxString
& name
= wxFrameNameStr
);
56 #if WXWIN_COMPATIBILITY
57 virtual void OldOnActivate(bool flag
);
58 virtual void OldOnSize(int x
, int y
);
61 void OnSize(wxSizeEvent
& event
);
62 void OnActivate(wxActivateEvent
& event
);
64 // Toolbar (currently, for use by Windows MDI parent frames ONLY)
65 virtual inline void SetToolBar(wxWindow
*toolbar
) { m_frameToolBar
= toolbar
; }
66 virtual inline wxWindow
*GetToolBar(void) const { return m_frameToolBar
; }
68 void SetMenuBar(wxMenuBar
*menu_bar
);
70 // Gets the size available for subwindows after menu size, toolbar size
71 // and status bar size have been subtracted. If you want to manage your own
72 // toolbar(s), don't call SetToolBar.
73 void GetClientSize(int *width
, int *height
) const;
75 // Get the active MDI child window (Windows only)
76 wxMDIChildFrame
*GetActiveChild(void) const ;
78 // Get the client window
79 inline wxMDIClientWindow
*GetClientWindow(void) const ;
81 // Create the client window class (don't Create the window,
82 // just return a new class)
83 virtual wxMDIClientWindow
*OnCreateClient(void) ;
85 inline WXHMENU
GetWindowMenu(void) const ;
88 virtual void Cascade(void);
89 virtual void Tile(void);
90 virtual void ArrangeIcons(void);
91 virtual void ActivateNext(void);
92 virtual void ActivatePrevious(void);
95 void MSWOnSize(const int x
, const int y
, const WXUINT flag
);
96 bool MSWOnCommand(const WXWORD id
, const WXWORD cmd
, const WXHWND control
);
97 void MSWOnMenuHighlight(const WXWORD item
, const WXWORD flags
, const WXHMENU sysmenu
);
98 bool MSWProcessMessage(WXMSG
*msg
);
99 void MSWOnCreate(WXLPCREATESTRUCT cs
);
100 long MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
101 bool MSWOnEraseBkgnd(const WXHDC pDC
);
102 bool MSWOnDestroy(void);
103 bool MSWOnActivate(const int state
, const bool minimized
, const WXHWND activate
);
105 // Responds to colour changes
106 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
109 wxMDIClientWindow
* m_clientWindow
;
110 wxMDIChildFrame
* m_currentChild
;
111 WXHMENU m_windowMenu
;
112 bool m_parentFrameActive
; // TRUE if MDI Frame is intercepting
113 // commands, not child
114 wxWindow
* m_frameToolBar
;
115 DECLARE_EVENT_TABLE()
119 inline wxMDIClientWindow
*wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow
; }
120 inline WXHMENU
wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu
; }
122 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
124 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
127 wxMDIChildFrame(void);
128 inline wxMDIChildFrame(wxMDIParentFrame
*parent
,
130 const wxString
& title
,
131 const wxPoint
& pos
= wxDefaultPosition
,
132 const wxSize
& size
= wxDefaultSize
,
133 const long style
= wxDEFAULT_FRAME_STYLE
,
134 const wxString
& name
= wxFrameNameStr
)
136 Create(parent
, id
, title
, pos
, size
, style
, name
);
139 ~wxMDIChildFrame(void);
141 bool Create(wxMDIParentFrame
*parent
,
143 const wxString
& title
,
144 const wxPoint
& pos
= wxDefaultPosition
,
145 const wxSize
& size
= wxDefaultSize
,
146 const long style
= wxDEFAULT_FRAME_STYLE
,
147 const wxString
& name
= wxFrameNameStr
);
150 void SetMenuBar(wxMenuBar
*menu_bar
);
151 void SetClientSize(const int width
, const int height
);
152 void GetPosition(int *x
, int *y
) const ;
155 virtual void Maximize(void);
156 virtual void Restore(void);
157 virtual void Activate(void);
161 long MSWOnMDIActivate(const long bActivate
, const WXHWND
, const WXHWND
);
162 void MSWOnSize(const int x
, const int y
, const WXUINT
);
163 void MSWOnWindowPosChanging(void *lpPos
);
164 bool MSWOnCommand(const WXWORD id
, const WXWORD cmd
, const WXHWND control
);
165 long MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
166 bool MSWProcessMessage(WXMSG
*msg
);
167 void MSWDestroyWindow(void);
170 bool ResetWindowStyle(void *vrect
);
175 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
177 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
180 wxMDIClientWindow(void) ;
181 inline wxMDIClientWindow(wxMDIParentFrame
*parent
, const long style
= 0)
183 CreateClient(parent
, style
);
186 ~wxMDIClientWindow(void);
188 // Note: this is virtual, to allow overridden behaviour.
189 virtual bool CreateClient(wxMDIParentFrame
*parent
, const long style
= wxVSCROLL
| wxHSCROLL
);
191 // Explicitly call default scroll behaviour
192 void OnScroll(wxScrollEvent
& event
);
195 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
197 // Calls an appropriate default window procedure
198 virtual long MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
200 // Should hand the message to the default proc
201 long MSWOnMDIActivate(const long bActivate
, const WXHWND
, const WXHWND
);
206 DECLARE_EVENT_TABLE()