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 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 void SetMenuBar(wxMenuBar
*menu_bar
);
68 // Gets the size available for subwindows after menu size, toolbar size
69 // and status bar size have been subtracted. If you want to manage your own
70 // toolbar(s), don't call SetToolBar.
71 void GetClientSize(int *width
, int *height
) const;
72 wxSize
GetClientSize() const { return wxWindow::GetClientSize(); }
74 // Get the active MDI child window (Windows only)
75 wxMDIChildFrame
*GetActiveChild(void) const ;
77 // Get the client window
78 inline wxMDIClientWindow
*GetClientWindow(void) const ;
80 // Create the client window class (don't Create the window,
81 // just return a new class)
82 virtual wxMDIClientWindow
*OnCreateClient(void) ;
84 inline WXHMENU
GetWindowMenu(void) const ;
87 virtual void Cascade(void);
88 virtual void Tile(void);
89 virtual void ArrangeIcons(void);
90 virtual void ActivateNext(void);
91 virtual void ActivatePrevious(void);
94 void MSWOnSize(int x
, int y
, WXUINT flag
);
95 bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
96 void MSWOnMenuHighlight(WXWORD item
, WXWORD flags
, WXHMENU sysmenu
);
97 bool MSWProcessMessage(WXMSG
*msg
);
98 bool MSWTranslateMessage(WXMSG
*msg
);
99 void MSWOnCreate(WXLPCREATESTRUCT cs
);
100 long MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
101 bool MSWOnEraseBkgnd(WXHDC pDC
);
102 bool MSWOnDestroy(void);
103 bool MSWOnActivate(int state
, bool minimized
, 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 DECLARE_EVENT_TABLE()
118 inline wxMDIClientWindow
*wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow
; }
119 inline WXHMENU
wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu
; }
121 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
123 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
126 wxMDIChildFrame(void);
127 inline wxMDIChildFrame(wxMDIParentFrame
*parent
,
129 const wxString
& title
,
130 const wxPoint
& pos
= wxDefaultPosition
,
131 const wxSize
& size
= wxDefaultSize
,
132 long style
= wxDEFAULT_FRAME_STYLE
,
133 const wxString
& name
= wxFrameNameStr
)
135 Create(parent
, id
, title
, pos
, size
, style
, name
);
138 ~wxMDIChildFrame(void);
140 bool Create(wxMDIParentFrame
*parent
,
142 const wxString
& title
,
143 const wxPoint
& pos
= wxDefaultPosition
,
144 const wxSize
& size
= wxDefaultSize
,
145 long style
= wxDEFAULT_FRAME_STYLE
,
146 const wxString
& name
= wxFrameNameStr
);
149 void SetMenuBar(wxMenuBar
*menu_bar
);
151 void SetClientSize(int width
, int height
);
152 void SetClientSize(const wxSize
& sz
) { wxWindow::SetClientSize(sz
); }
154 void GetPosition(int *x
, int *y
) const ;
155 wxPoint
GetPosition() const { return wxWindow::GetPosition(); }
158 virtual void Maximize(void);
159 virtual void Restore(void);
160 virtual void Activate(void);
164 long MSWOnMDIActivate(long bActivate
, WXHWND
, WXHWND
);
165 void MSWOnSize(int x
, int y
, WXUINT
);
166 void MSWOnWindowPosChanging(void *lpPos
);
167 bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
168 long MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
169 bool MSWProcessMessage(WXMSG
*msg
);
170 bool MSWTranslateMessage(WXMSG
*msg
);
171 void MSWDestroyWindow(void);
174 bool ResetWindowStyle(void *vrect
);
179 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
181 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
184 wxMDIClientWindow(void) ;
185 inline wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
187 CreateClient(parent
, style
);
190 ~wxMDIClientWindow(void);
192 // Note: this is virtual, to allow overridden behaviour.
193 virtual bool CreateClient(wxMDIParentFrame
*parent
, 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
);
204 // Should hand the message to the default proc
205 long MSWOnMDIActivate(long bActivate
, WXHWND
, WXHWND
);
210 DECLARE_EVENT_TABLE()