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 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;
73 // Get the active MDI child window (Windows only)
74 wxMDIChildFrame
*GetActiveChild(void) const ;
76 // Get the client window
77 inline wxMDIClientWindow
*GetClientWindow(void) const ;
79 // Create the client window class (don't Create the window,
80 // just return a new class)
81 virtual wxMDIClientWindow
*OnCreateClient(void) ;
83 inline WXHMENU
GetWindowMenu(void) const ;
86 virtual void Cascade(void);
87 virtual void Tile(void);
88 virtual void ArrangeIcons(void);
89 virtual void ActivateNext(void);
90 virtual void ActivatePrevious(void);
93 void MSWOnSize(int x
, int y
, WXUINT flag
);
94 bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
95 void MSWOnMenuHighlight(WXWORD item
, WXWORD flags
, WXHMENU sysmenu
);
96 bool MSWProcessMessage(WXMSG
*msg
);
97 bool MSWTranslateMessage(WXMSG
*msg
);
98 void MSWOnCreate(WXLPCREATESTRUCT cs
);
99 long MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
100 bool MSWOnEraseBkgnd(WXHDC pDC
);
101 bool MSWOnDestroy(void);
102 bool MSWOnActivate(int state
, bool minimized
, WXHWND activate
);
104 // Responds to colour changes
105 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
108 wxMDIClientWindow
* m_clientWindow
;
109 wxMDIChildFrame
* m_currentChild
;
110 WXHMENU m_windowMenu
;
111 bool m_parentFrameActive
; // TRUE if MDI Frame is intercepting
112 // commands, not child
113 DECLARE_EVENT_TABLE()
117 inline wxMDIClientWindow
*wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow
; }
118 inline WXHMENU
wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu
; }
120 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
122 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
125 wxMDIChildFrame(void);
126 inline 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
);
137 ~wxMDIChildFrame(void);
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
);
149 void SetClientSize(int width
, int height
);
150 void GetPosition(int *x
, int *y
) const ;
153 virtual void Maximize(void);
154 virtual void Restore(void);
155 virtual void Activate(void);
159 long MSWOnMDIActivate(long bActivate
, WXHWND
, WXHWND
);
160 void MSWOnSize(int x
, int y
, WXUINT
);
161 void MSWOnWindowPosChanging(void *lpPos
);
162 bool MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
163 long MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
164 bool MSWProcessMessage(WXMSG
*msg
);
165 bool MSWTranslateMessage(WXMSG
*msg
);
166 void MSWDestroyWindow(void);
169 bool ResetWindowStyle(void *vrect
);
174 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
176 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
179 wxMDIClientWindow(void) ;
180 inline wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
182 CreateClient(parent
, style
);
185 ~wxMDIClientWindow(void);
187 // Note: this is virtual, to allow overridden behaviour.
188 virtual bool CreateClient(wxMDIParentFrame
*parent
, long style
= wxVSCROLL
| wxHSCROLL
);
190 // Explicitly call default scroll behaviour
191 void OnScroll(wxScrollEvent
& event
);
194 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
196 // Calls an appropriate default window procedure
197 virtual long MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
199 // Should hand the message to the default proc
200 long MSWOnMDIActivate(long bActivate
, WXHWND
, WXHWND
);
205 DECLARE_EVENT_TABLE()