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 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 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
54 const wxString
& name
= wxFrameNameStr
);
57 #if WXWIN_COMPATIBILITY
58 virtual void OldOnActivate(bool flag);
59 virtual void OldOnSize(int x, int y);
63 void OnSize(wxSizeEvent
& event
);
64 void OnActivate(wxActivateEvent
& event
);
66 // Toolbar (currently, for use by Windows MDI parent frames ONLY)
67 virtual inline void SetToolBar(wxWindow
*toolbar
) { m_frameToolBar
= toolbar
; }
68 virtual inline wxWindow
*GetToolBar(void) const { return m_frameToolBar
; }
70 void SetMenuBar(wxMenuBar
*menu_bar
);
72 // Gets the size available for subwindows after menu size, toolbar size
73 // and status bar size have been subtracted. If you want to manage your own
74 // toolbar(s), don't call SetToolBar.
75 void GetClientSize(int *width
, int *height
) const;
77 // Get the active MDI child window (Windows only)
78 wxMDIChildFrame
*GetActiveChild(void) const ;
80 // Get the client window
81 inline wxMDIClientWindow
*GetClientWindow(void) const ;
83 // Create the client window class (don't Create the window,
84 // just return a new class)
85 virtual wxMDIClientWindow
*OnCreateClient(void) ;
87 inline WXHMENU
GetWindowMenu(void) const ;
90 virtual void Cascade(void);
91 virtual void Tile(void);
92 virtual void ArrangeIcons(void);
93 virtual void ActivateNext(void);
94 virtual void ActivatePrevious(void);
97 void MSWOnSize(int x
, int y
, WXUINT flag
);
98 bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
99 void MSWOnMenuHighlight(WXWORD item
, WXWORD flags
, WXHMENU sysmenu
);
100 bool MSWProcessMessage(WXMSG
*msg
);
101 void MSWOnCreate(WXLPCREATESTRUCT cs
);
102 long MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
103 bool MSWOnEraseBkgnd(WXHDC pDC
);
104 bool MSWOnDestroy(void);
105 bool MSWOnActivate(int state
, bool minimized
, WXHWND activate
);
107 // Responds to colour changes
108 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
111 wxMDIClientWindow
* m_clientWindow
;
112 wxMDIChildFrame
* m_currentChild
;
113 WXHMENU m_windowMenu
;
114 bool m_parentFrameActive
; // TRUE if MDI Frame is intercepting
115 // commands, not child
116 wxWindow
* m_frameToolBar
;
117 DECLARE_EVENT_TABLE()
121 inline wxMDIClientWindow
*wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow
; }
122 inline WXHMENU
wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu
; }
124 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
126 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
129 wxMDIChildFrame(void);
130 inline wxMDIChildFrame(wxMDIParentFrame
*parent
,
132 const wxString
& title
,
133 const wxPoint
& pos
= wxDefaultPosition
,
134 const wxSize
& size
= wxDefaultSize
,
135 long style
= wxDEFAULT_FRAME_STYLE
,
136 const wxString
& name
= wxFrameNameStr
)
138 Create(parent
, id
, title
, pos
, size
, style
, name
);
141 ~wxMDIChildFrame(void);
143 bool Create(wxMDIParentFrame
*parent
,
145 const wxString
& title
,
146 const wxPoint
& pos
= wxDefaultPosition
,
147 const wxSize
& size
= wxDefaultSize
,
148 long style
= wxDEFAULT_FRAME_STYLE
,
149 const wxString
& name
= wxFrameNameStr
);
152 void SetMenuBar(wxMenuBar
*menu_bar
);
153 void SetClientSize(int width
, int height
);
154 void GetPosition(int *x
, int *y
) const ;
157 virtual void Maximize(void);
158 virtual void Restore(void);
159 virtual void Activate(void);
163 long MSWOnMDIActivate(long bActivate
, WXHWND
, WXHWND
);
164 void MSWOnSize(int x
, int y
, WXUINT
);
165 void MSWOnWindowPosChanging(void *lpPos
);
166 bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
167 long MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
168 bool MSWProcessMessage(WXMSG
*msg
);
169 void MSWDestroyWindow(void);
172 bool ResetWindowStyle(void *vrect
);
177 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
179 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
182 wxMDIClientWindow(void) ;
183 inline wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
185 CreateClient(parent
, style
);
188 ~wxMDIClientWindow(void);
190 // Note: this is virtual, to allow overridden behaviour.
191 virtual bool CreateClient(wxMDIParentFrame
*parent
, long style
= wxVSCROLL
| wxHSCROLL
);
193 // Explicitly call default scroll behaviour
194 void OnScroll(wxScrollEvent
& event
);
197 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
199 // Calls an appropriate default window procedure
200 virtual long MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
202 // Should hand the message to the default proc
203 long MSWOnMDIActivate(long bActivate
, WXHWND
, WXHWND
);
208 DECLARE_EVENT_TABLE()