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 (Windows only)
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();
91 wxMDIClientWindow
*m_clientWindow
;
96 class WXDLLEXPORT wxMDIChildFrame
: public wxFrame
98 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
102 inline wxMDIChildFrame(wxMDIParentFrame
*parent
,
104 const wxString
& title
,
105 const wxPoint
& pos
= wxDefaultPosition
,
106 const wxSize
& size
= wxDefaultSize
,
107 long style
= wxDEFAULT_FRAME_STYLE
,
108 const wxString
& name
= wxFrameNameStr
)
110 Create(parent
, id
, title
, pos
, size
, style
, name
);
115 bool Create(wxMDIParentFrame
*parent
,
117 const wxString
& title
,
118 const wxPoint
& pos
= wxDefaultPosition
,
119 const wxSize
& size
= wxDefaultSize
,
120 long style
= wxDEFAULT_FRAME_STYLE
,
121 const wxString
& name
= wxFrameNameStr
);
124 void SetMenuBar(wxMenuBar
*menu_bar
);
125 void SetTitle(const wxString
& title
);
126 void SetClientSize(int width
, int height
);
127 void GetClientSize(int *width
, int *height
) const;
128 void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
129 void GetSize(int *width
, int *height
) const;
130 void GetPosition(int *x
, int *y
) const ;
133 virtual void SetIcon(const wxIcon
& icon
);
136 virtual void Maximize();
137 inline void Minimize() { Iconize(TRUE
); };
138 virtual void Iconize(bool iconize
);
139 virtual void Restore();
140 virtual void Activate();
141 virtual bool IsIconized() const ;
143 bool Show(bool show
);
144 void BuildClientArea(WXWidget parent
);
145 inline WXWidget
GetTopWidget() const { return m_mainWidget
; };
146 inline wxXsMDIWindow
*GetMDIWindow() const { return m_mdiWindow
; };
149 wxXsMDIWindow
* m_mdiWindow
;
152 /* The client window is a child of the parent MDI frame, and itself
153 * contains the child MDI frames.
154 * However, you create the MDI children as children of the MDI parent:
155 * only in the implementation does the client window become the parent
156 * of the children. Phew! So the children are sort of 'adopted'...
159 class WXDLLEXPORT wxMDIClientWindow
: public wxWindow
161 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
164 wxMDIClientWindow() ;
165 inline wxMDIClientWindow(wxMDIParentFrame
*parent
, long style
= 0)
167 CreateClient(parent
, style
);
170 ~wxMDIClientWindow();
172 void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
173 void SetClientSize(int width
, int height
);
174 void GetClientSize(int *width
, int *height
) const;
176 void GetSize(int *width
, int *height
) const ;
177 void GetPosition(int *x
, int *y
) const ;
180 // Note: this is virtual, to allow overridden behaviour.
181 virtual bool CreateClient(wxMDIParentFrame
*parent
, long style
= wxVSCROLL
| wxHSCROLL
);
183 // Explicitly call default scroll behaviour
184 void OnScroll(wxScrollEvent
& event
);
186 inline XsMDICanvas
* GetMDICanvas() const { return m_mdiCanvas
; }
188 WXWidget
GetTopWidget() const { return m_topWidget
; }
192 XsMDICanvas
* m_mdiCanvas
;
193 WXWidget m_topWidget
;
195 DECLARE_EVENT_TABLE()