1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: MDI (Multiple Document Interface) classes.
4 // This doesn't have to be implemented just like Windows,
5 // it could be a tabbed design as in wxGTK.
10 // Copyright: (c) AUTHOR
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
18 #pragma interface "mdi.h"
23 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr
;
24 WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr
;
26 class WXDLLEXPORT wxMDIClientWindow
;
27 class WXDLLEXPORT wxMDIChildFrame
;
29 class WXDLLEXPORT wxMDIParentFrame
: public wxFrame
31 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame
)
33 friend class WXDLLEXPORT wxMDIChildFrame
;
37 inline 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
, // Scrolling refers to client window
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
);
58 void OnSize(wxSizeEvent
& event
);
59 void OnActivate(wxActivateEvent
& event
);
60 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
62 void SetMenuBar(wxMenuBar
*menu_bar
);
64 // Gets the size available for subwindows after menu size, toolbar size
65 // and status bar size have been subtracted. If you want to manage your own
66 // toolbar(s), don't call SetToolBar.
67 void DoGetClientSize(int *width
, int *height
) const;
69 // Get the active MDI child window (Windows only)
70 wxMDIChildFrame
*GetActiveChild() const ;
72 // Get the client window
73 inline wxMDIClientWindow
*GetClientWindow() const { return m_clientWindow
; };
75 // Create the client window class (don't Create the window,
76 // just return a new class)
77 virtual wxMDIClientWindow
*OnCreateClient() ;
80 virtual void Cascade();
82 virtual void ArrangeIcons();
83 virtual void ActivateNext();
84 virtual void ActivatePrevious();
88 // TODO maybe have this member
89 wxMDIClientWindow
*m_clientWindow
;
90 wxMDIChildFrame
* m_currentChild
;
93 // TRUE if MDI Frame is intercepting commands, not child
94 bool m_parentFrameActive
;
97 friend class WXDLLEXPORT wxMDIChildFrame
;
101 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
103 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
107 inline wxMDIChildFrame(wxMDIParentFrame
*parent
,
109 const wxString
& title
,
110 const wxPoint
& pos
= wxDefaultPosition
,
111 const wxSize
& size
= wxDefaultSize
,
112 long style
= wxDEFAULT_FRAME_STYLE
,
113 const wxString
& name
= wxFrameNameStr
)
116 Create(parent
, id
, title
, pos
, size
, style
, name
);
121 bool Create(wxMDIParentFrame
*parent
,
123 const wxString
& title
,
124 const wxPoint
& pos
= wxDefaultPosition
,
125 const wxSize
& size
= wxDefaultSize
,
126 long style
= wxDEFAULT_FRAME_STYLE
,
127 const wxString
& name
= wxFrameNameStr
);
130 void SetMenuBar(wxMenuBar
*menu_bar
);
133 virtual void Maximize();
134 virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame
135 virtual void Restore();
136 virtual void Activate();
139 // common part of all ctors
143 /* The client window is a child of the parent MDI frame, and itself
144 * contains the child MDI frames.
145 * However, you create the MDI children as children of the MDI parent:
146 * only in the implementation does the client window become the parent
147 * of the children. Phew! So the children are sort of 'adopted'...
150 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
152 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
155 wxMDIClientWindow() ;
156 inline wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
158 CreateClient(parent
, style
);
161 ~wxMDIClientWindow();
163 // Note: this is virtual, to allow overridden behaviour.
164 virtual bool CreateClient(wxMDIParentFrame
*parent
, long style
= wxVSCROLL
| wxHSCROLL
);
166 // Explicitly call default scroll behaviour
167 void OnScroll(wxScrollEvent
& event
);
171 DECLARE_EVENT_TABLE()