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.
6 // Author: Stefan Csomor
10 // Copyright: (c) Stefan Csomor
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
17 #if defined(__GNUG__) && !defined(__APPLE__)
18 #pragma interface "mdi.h"
23 WXDLLEXPORT_DATA(extern const wxChar
*) wxFrameNameStr
;
24 WXDLLEXPORT_DATA(extern const wxChar
*) wxStatusLineNameStr
;
26 class WXDLLEXPORT wxMDIClientWindow
;
27 class WXDLLEXPORT wxMDIChildFrame
;
29 class WXDLLEXPORT wxMDIParentFrame
: public wxFrame
31 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame
)
36 inline wxMDIParentFrame(wxWindow
*parent
,
38 const wxString
& title
,
39 const wxPoint
& pos
= wxDefaultPosition
,
40 const wxSize
& size
= wxDefaultSize
,
41 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
, // Scrolling refers to client window
42 const wxString
& name
= wxFrameNameStr
)
44 Create(parent
, id
, title
, pos
, size
, style
, name
);
49 bool Create(wxWindow
*parent
,
51 const wxString
& title
,
52 const wxPoint
& pos
= wxDefaultPosition
,
53 const wxSize
& size
= wxDefaultSize
,
54 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
55 const wxString
& name
= wxFrameNameStr
);
57 void OnActivate(wxActivateEvent
& event
);
58 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
60 void SetMenuBar(wxMenuBar
*menu_bar
);
62 // Get the active MDI child window (Windows only)
63 wxMDIChildFrame
*GetActiveChild() const ;
65 // Get the client window
66 inline wxMDIClientWindow
*GetClientWindow() const { return m_clientWindow
; };
68 // Create the client window class (don't Create the window,
69 // just return a new class)
70 virtual wxMDIClientWindow
*OnCreateClient() ;
73 virtual void Cascade();
75 virtual void ArrangeIcons();
76 virtual void ActivateNext();
77 virtual void ActivatePrevious();
81 // TODO maybe have this member
82 wxMDIClientWindow
*m_clientWindow
;
83 wxMDIChildFrame
* m_currentChild
;
86 // TRUE if MDI Frame is intercepting commands, not child
87 bool m_parentFrameActive
;
90 friend class WXDLLEXPORT wxMDIChildFrame
;
94 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
96 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
100 inline wxMDIChildFrame(wxMDIParentFrame
*parent
,
102 const wxString
& title
,
103 const wxPoint
& pos
= wxDefaultPosition
,
104 const wxSize
& size
= wxDefaultSize
,
105 long style
= wxDEFAULT_FRAME_STYLE
,
106 const wxString
& name
= wxFrameNameStr
)
109 Create(parent
, id
, title
, pos
, size
, style
, name
);
114 bool Create(wxMDIParentFrame
*parent
,
116 const wxString
& title
,
117 const wxPoint
& pos
= wxDefaultPosition
,
118 const wxSize
& size
= wxDefaultSize
,
119 long style
= wxDEFAULT_FRAME_STYLE
,
120 const wxString
& name
= wxFrameNameStr
);
123 void SetMenuBar(wxMenuBar
*menu_bar
);
126 virtual void Maximize();
127 virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame
128 virtual void Restore();
129 virtual void Activate();
132 // common part of all ctors
136 /* The client window is a child of the parent MDI frame, and itself
137 * contains the child MDI frames.
138 * However, you create the MDI children as children of the MDI parent:
139 * only in the implementation does the client window become the parent
140 * of the children. Phew! So the children are sort of 'adopted'...
143 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
145 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
148 wxMDIClientWindow() ;
149 inline wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
151 CreateClient(parent
, style
);
154 ~wxMDIClientWindow();
156 // Note: this is virtual, to allow overridden behaviour.
157 virtual bool CreateClient(wxMDIParentFrame
*parent
, long style
= wxVSCROLL
| wxHSCROLL
);
159 // Gets the size available for subwindows after menu size, toolbar size
160 // and status bar size have been subtracted. If you want to manage your own
161 // toolbar(s), don't call SetToolBar.
162 void DoGetClientSize(int *width
, int *height
) const;
164 // Explicitly call default scroll behaviour
165 void OnScroll(wxScrollEvent
& event
);
169 DECLARE_EVENT_TABLE()