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(NO_GCC_PRAGMA)
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 // Mac OS activate event
58 virtual void MacActivate(long timestamp
, bool activating
);
60 // wxWidgets activate event
61 void OnActivate(wxActivateEvent
& event
);
62 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
64 void SetMenuBar(wxMenuBar
*menu_bar
);
66 // Get the active MDI child window (Windows only)
67 wxMDIChildFrame
*GetActiveChild() const ;
69 // Get the client window
70 inline wxMDIClientWindow
*GetClientWindow() const { return m_clientWindow
; };
71 // Get rect to be used to center top-level children
72 virtual void GetRectForTopLevelChildren(int *x
, int *y
, int *w
, int *h
);
74 // Create the client window class (don't Create the window,
75 // just return a new class)
76 virtual wxMDIClientWindow
*OnCreateClient() ;
79 virtual void Cascade();
81 virtual void ArrangeIcons();
82 virtual void ActivateNext();
83 virtual void ActivatePrevious();
85 virtual bool Show( bool show
= true );
89 // TODO maybe have this member
90 wxMDIClientWindow
*m_clientWindow
;
91 wxMDIChildFrame
* m_currentChild
;
94 // TRUE if MDI Frame is intercepting commands, not child
95 bool m_parentFrameActive
;
98 friend class WXDLLEXPORT wxMDIChildFrame
;
102 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
104 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
108 inline wxMDIChildFrame(wxMDIParentFrame
*parent
,
110 const wxString
& title
,
111 const wxPoint
& pos
= wxDefaultPosition
,
112 const wxSize
& size
= wxDefaultSize
,
113 long style
= wxDEFAULT_FRAME_STYLE
,
114 const wxString
& name
= wxFrameNameStr
)
117 Create(parent
, id
, title
, pos
, size
, style
, name
);
122 bool Create(wxMDIParentFrame
*parent
,
124 const wxString
& title
,
125 const wxPoint
& pos
= wxDefaultPosition
,
126 const wxSize
& size
= wxDefaultSize
,
127 long style
= wxDEFAULT_FRAME_STYLE
,
128 const wxString
& name
= wxFrameNameStr
);
130 // Mac OS activate event
131 virtual void MacActivate(long timestamp
, bool activating
);
134 void SetMenuBar(wxMenuBar
*menu_bar
);
137 virtual void Maximize();
138 virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame
139 virtual void Restore();
140 virtual void Activate();
143 // common part of all ctors
147 /* The client window is a child of the parent MDI frame, and itself
148 * contains the child MDI frames.
149 * However, you create the MDI children as children of the MDI parent:
150 * only in the implementation does the client window become the parent
151 * of the children. Phew! So the children are sort of 'adopted'...
154 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
156 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
159 wxMDIClientWindow() ;
160 inline wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
162 CreateClient(parent
, style
);
165 ~wxMDIClientWindow();
167 // Note: this is virtual, to allow overridden behaviour.
168 virtual bool CreateClient(wxMDIParentFrame
*parent
, long style
= wxVSCROLL
| wxHSCROLL
);
170 // Gets the size available for subwindows after menu size, toolbar size
171 // and status bar size have been subtracted. If you want to manage your own
172 // toolbar(s), don't call SetToolBar.
173 void DoGetClientSize(int *width
, int *height
) const;
175 // Explicitly call default scroll behaviour
176 void OnScroll(wxScrollEvent
& event
);
180 DECLARE_EVENT_TABLE()