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: Julian Smart
10 // Copyright: (c) Julian Smart
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
;
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 inline wxXsMDIWindow
*GetMDIWindow() const { return m_mdiWindow
; };
151 virtual void OnRaise();
152 virtual void OnLower();
155 wxXsMDIWindow
* m_mdiWindow
;
158 /* The client window is a child of the parent MDI frame, and itself
159 * contains the child MDI frames.
160 * However, you create the MDI children as children of the MDI parent:
161 * only in the implementation does the client window become the parent
162 * of the children. Phew! So the children are sort of 'adopted'...
165 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
167 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
170 wxMDIClientWindow() ;
171 inline wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
173 CreateClient(parent
, style
);
176 ~wxMDIClientWindow();
178 void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
179 void SetClientSize(int width
, int height
);
180 void GetClientSize(int *width
, int *height
) const;
182 void GetSize(int *width
, int *height
) const ;
183 void GetPosition(int *x
, int *y
) const ;
186 // Note: this is virtual, to allow overridden behaviour.
187 virtual bool CreateClient(wxMDIParentFrame
*parent
, long style
= wxVSCROLL
| wxHSCROLL
);
189 // Explicitly call default scroll behaviour
190 void OnScroll(wxScrollEvent
& event
);
192 inline XsMDICanvas
* GetMDICanvas() const { return m_mdiCanvas
; }
194 WXWidget
GetTopWidget() const { return m_topWidget
; }
198 XsMDICanvas
* m_mdiCanvas
;
199 WXWidget m_topWidget
;
201 DECLARE_EVENT_TABLE()