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 char*) wxFrameNameStr
;
22 WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr
;
24 class WXDLLEXPORT wxMDIClientWindow
;
25 class WXDLLEXPORT wxMDIChildFrame
;
32 class WXDLLEXPORT wxMDIParentFrame
: public wxFrame
34 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame
)
36 friend class WXDLLEXPORT wxMDIChildFrame
;
40 inline wxMDIParentFrame(wxWindow
*parent
,
42 const wxString
& title
,
43 const wxPoint
& pos
= wxDefaultPosition
,
44 const wxSize
& size
= wxDefaultSize
,
45 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
, // Scrolling refers to client window
46 const wxString
& name
= wxFrameNameStr
)
48 Create(parent
, id
, title
, pos
, size
, style
, name
);
53 bool Create(wxWindow
*parent
,
55 const wxString
& title
,
56 const wxPoint
& pos
= wxDefaultPosition
,
57 const wxSize
& size
= wxDefaultSize
,
58 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
59 const wxString
& name
= wxFrameNameStr
);
61 void OnSize(wxSizeEvent
& event
);
62 void OnActivate(wxActivateEvent
& event
);
63 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
65 void SetMenuBar(wxMenuBar
*menu_bar
);
67 // Gets the size available for subwindows after menu size, toolbar size
68 // and status bar size have been subtracted. If you want to manage your own
69 // toolbar(s), don't call SetToolBar.
70 void GetClientSize(int *width
, int *height
) const;
72 // Get the active MDI child window
73 wxMDIChildFrame
*GetActiveChild() const ;
75 // Get the client window
76 inline wxMDIClientWindow
*GetClientWindow() const { return m_clientWindow
; };
78 // Create the client window class (don't Create the window,
79 // just return a new class)
80 virtual wxMDIClientWindow
*OnCreateClient() ;
83 virtual void Cascade();
85 virtual void ArrangeIcons();
86 virtual void ActivateNext();
87 virtual void ActivatePrevious();
90 inline void SetActiveChild(wxMDIChildFrame
* child
) { m_activeChild
= child
; }
94 wxMDIClientWindow
* m_clientWindow
;
95 wxMDIChildFrame
* m_activeChild
;
100 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
102 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
106 inline wxMDIChildFrame(wxMDIParentFrame
*parent
,
108 const wxString
& title
,
109 const wxPoint
& pos
= wxDefaultPosition
,
110 const wxSize
& size
= wxDefaultSize
,
111 long style
= wxDEFAULT_FRAME_STYLE
,
112 const wxString
& name
= wxFrameNameStr
)
114 Create(parent
, id
, title
, pos
, size
, style
, name
);
119 bool Create(wxMDIParentFrame
*parent
,
121 const wxString
& title
,
122 const wxPoint
& pos
= wxDefaultPosition
,
123 const wxSize
& size
= wxDefaultSize
,
124 long style
= wxDEFAULT_FRAME_STYLE
,
125 const wxString
& name
= wxFrameNameStr
);
128 void SetMenuBar(wxMenuBar
*menu_bar
);
129 void SetTitle(const wxString
& title
);
130 void SetClientSize(int width
, int height
);
131 void GetClientSize(int *width
, int *height
) const;
132 void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
133 void GetSize(int *width
, int *height
) const;
134 void GetPosition(int *x
, int *y
) const ;
137 virtual void SetIcon(const wxIcon
& icon
);
140 virtual void Maximize();
141 inline void Minimize() { Iconize(TRUE
); };
142 virtual void Iconize(bool iconize
);
143 virtual void Restore();
144 virtual void Activate();
145 virtual bool IsIconized() const ;
147 bool Show(bool show
);
148 void BuildClientArea(WXWidget parent
);
149 inline WXWidget
GetTopWidget() const { return m_mainWidget
; };
150 #if wxUSE_MDI_WIDGETS
151 inline wxXsMDIWindow
*GetMDIWindow() const { return m_mdiWindow
; };
153 virtual void OnRaise();
154 virtual void OnLower();
157 wxXsMDIWindow
* m_mdiWindow
;
160 /* The client window is a child of the parent MDI frame, and itself
161 * contains the child MDI frames.
162 * However, you create the MDI children as children of the MDI parent:
163 * only in the implementation does the client window become the parent
164 * of the children. Phew! So the children are sort of 'adopted'...
167 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
169 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
172 wxMDIClientWindow() ;
173 inline wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
175 CreateClient(parent
, style
);
178 ~wxMDIClientWindow();
180 void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
181 void SetClientSize(int width
, int height
);
182 void GetClientSize(int *width
, int *height
) const;
184 void GetSize(int *width
, int *height
) const ;
185 void GetPosition(int *x
, int *y
) const ;
188 // Note: this is virtual, to allow overridden behaviour.
189 virtual bool CreateClient(wxMDIParentFrame
*parent
, long style
= wxVSCROLL
| wxHSCROLL
);
191 // Explicitly call default scroll behaviour
192 void OnScroll(wxScrollEvent
& event
);
194 #if wxUSE_MDI_WIDGETS
195 inline XsMDICanvas
* GetMDICanvas() const { return m_mdiCanvas
; }
196 WXWidget
GetTopWidget() const { return m_topWidget
; }
201 #if wxUSE_MDI_WIDGETS
202 XsMDICanvas
* m_mdiCanvas
;
203 WXWidget m_topWidget
;
206 DECLARE_EVENT_TABLE()