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 // Get the active MDI child window (Windows only)
62 wxMDIChildFrame
*GetActiveChild() const;
64 // Get the client window
65 wxMDIClientWindow
*GetClientWindow() const { return m_clientWindow
; }
67 // Create the client window class (don't Create the window,
68 // just return a new class)
69 virtual wxMDIClientWindow
*OnCreateClient(void);
71 // WXHMENU GetWindowHMENU() const { return m_windowMenu; }
72 wxMenu
* GetWindowMenu() const { return m_windowMenu
; };
73 void SetWindowMenu(wxMenu
* menu
) ;
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
);
91 bool HandleActivate(int state
, bool minimized
, WXHWND activate
);
92 bool HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
94 // override window proc for MDI-specific message processing
95 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
97 virtual long MSWDefWindowProc(WXUINT
, WXWPARAM
, WXLPARAM
);
98 virtual bool MSWTranslateMessage(WXMSG
* msg
);
101 #if wxUSE_MENUS_NATIVE
102 virtual void InternalSetMenuBar();
103 #endif // wxUSE_MENUS_NATIVE
105 wxMDIClientWindow
* m_clientWindow
;
106 wxMDIChildFrame
* m_currentChild
;
107 wxMenu
* m_windowMenu
;
109 // TRUE if MDI Frame is intercepting commands, not child
110 bool m_parentFrameActive
;
113 friend class WXDLLEXPORT wxMDIChildFrame
;
115 DECLARE_EVENT_TABLE()
118 // ---------------------------------------------------------------------------
120 // ---------------------------------------------------------------------------
122 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
125 wxMDIChildFrame() { Init(); }
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
)
136 Create(parent
, id
, title
, pos
, size
, style
, name
);
141 bool Create(wxMDIParentFrame
*parent
,
143 const wxString
& title
,
144 const wxPoint
& pos
= wxDefaultPosition
,
145 const wxSize
& size
= wxDefaultSize
,
146 long style
= wxDEFAULT_FRAME_STYLE
,
147 const wxString
& name
= wxFrameNameStr
);
149 virtual bool IsTopLevel() const { return FALSE
; }
152 virtual void Maximize(bool maximize
= TRUE
);
153 virtual void Restore();
154 virtual void Activate();
156 // Implementation only from now on
157 // -------------------------------
160 bool HandleMDIActivate(long bActivate
, WXHWND
, WXHWND
);
161 bool HandleWindowPosChanging(void *lpPos
);
162 bool HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
);
163 bool HandleGetMinMaxInfo(void *mmInfo
);
165 virtual long MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
166 virtual long MSWDefWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
167 virtual bool MSWTranslateMessage(WXMSG
*msg
);
169 virtual void MSWDestroyWindow();
171 bool ResetWindowStyle(void *vrect
);
173 void OnIdle(wxIdleEvent
& event
);
176 virtual void DoGetPosition(int *x
, int *y
) const;
177 virtual void DoSetClientSize(int width
, int height
);
178 virtual void InternalSetMenuBar();
179 virtual bool IsMDIChild() const { return TRUE
; }
181 // common part of all ctors
185 bool m_needsResize
; // flag which tells us to artificially resize the frame
187 DECLARE_EVENT_TABLE()
188 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
191 // ---------------------------------------------------------------------------
193 // ---------------------------------------------------------------------------
195 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
198 wxMDIClientWindow() { Init(); }
199 wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
203 CreateClient(parent
, style
);
206 // Note: this is virtual, to allow overridden behaviour.
207 virtual bool CreateClient(wxMDIParentFrame
*parent
,
208 long style
= wxVSCROLL
| wxHSCROLL
);
210 // Explicitly call default scroll behaviour
211 void OnScroll(wxScrollEvent
& event
);
213 virtual void DoSetSize(int x
, int y
,
214 int width
, int height
,
215 int sizeFlags
= wxSIZE_AUTO
);
217 void Init() { m_scrollX
= m_scrollY
= 0; }
219 int m_scrollX
, m_scrollY
;
222 DECLARE_EVENT_TABLE()
223 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)