More Motif additions: mdi and sashtest samples now just about work!
[wxWidgets.git] / include / wx / motif / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mdi.h
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
7 // Modified by:
8 // Created: 17/09/98
9 // RCS-ID: $Id$
10 // Copyright: (c) Julian Smart
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_MDI_H_
15 #define _WX_MDI_H_
16
17 #ifdef __GNUG__
18 #pragma interface "mdi.h"
19 #endif
20
21 #include "wx/frame.h"
22
23 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
24 WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr;
25
26 class WXDLLEXPORT wxMDIClientWindow;
27 class WXDLLEXPORT wxMDIChildFrame;
28
29 class XsMDICanvas;
30 class wxXsMDIWindow;
31
32 class WXDLLEXPORT wxMDIParentFrame: public wxFrame
33 {
34 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
35
36 friend class WXDLLEXPORT wxMDIChildFrame;
37 public:
38
39 wxMDIParentFrame();
40 inline wxMDIParentFrame(wxWindow *parent,
41 wxWindowID id,
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)
47 {
48 Create(parent, id, title, pos, size, style, name);
49 }
50
51 ~wxMDIParentFrame();
52
53 bool Create(wxWindow *parent,
54 wxWindowID id,
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);
60
61 void OnSize(wxSizeEvent& event);
62 void OnActivate(wxActivateEvent& event);
63 void OnSysColourChanged(wxSysColourChangedEvent& event);
64
65 void SetMenuBar(wxMenuBar *menu_bar);
66
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;
71
72 // Get the active MDI child window (Windows only)
73 wxMDIChildFrame *GetActiveChild() const ;
74
75 // Get the client window
76 inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; };
77
78 // Create the client window class (don't Create the window,
79 // just return a new class)
80 virtual wxMDIClientWindow *OnCreateClient() ;
81
82 // MDI operations
83 virtual void Cascade();
84 virtual void Tile();
85 virtual void ArrangeIcons();
86 virtual void ActivateNext();
87 virtual void ActivatePrevious();
88
89 protected:
90
91 wxMDIClientWindow *m_clientWindow;
92
93 DECLARE_EVENT_TABLE()
94 };
95
96 class WXDLLEXPORT wxMDIChildFrame: public wxFrame
97 {
98 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
99 public:
100
101 wxMDIChildFrame();
102 inline wxMDIChildFrame(wxMDIParentFrame *parent,
103 wxWindowID id,
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)
109 {
110 Create(parent, id, title, pos, size, style, name);
111 }
112
113 ~wxMDIChildFrame();
114
115 bool Create(wxMDIParentFrame *parent,
116 wxWindowID id,
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);
122
123 // Set menu bar
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 ;
131
132 // Set icon
133 virtual void SetIcon(const wxIcon& icon);
134
135 // MDI operations
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 ;
142
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; };
147
148 protected:
149 wxXsMDIWindow* m_mdiWindow ;
150 };
151
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'...
157 */
158
159 class WXDLLEXPORT wxMDIClientWindow: public wxWindow
160 {
161 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
162 public:
163
164 wxMDIClientWindow() ;
165 inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
166 {
167 CreateClient(parent, style);
168 }
169
170 ~wxMDIClientWindow();
171
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;
175
176 void GetSize(int *width, int *height) const ;
177 void GetPosition(int *x, int *y) const ;
178
179
180 // Note: this is virtual, to allow overridden behaviour.
181 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
182
183 // Explicitly call default scroll behaviour
184 void OnScroll(wxScrollEvent& event);
185
186 inline XsMDICanvas* GetMDICanvas() const { return m_mdiCanvas; }
187
188 WXWidget GetTopWidget() const { return m_topWidget; }
189
190 protected:
191
192 XsMDICanvas* m_mdiCanvas;
193 WXWidget m_topWidget;
194
195 DECLARE_EVENT_TABLE()
196 };
197
198 #endif
199 // _WX_MDI_H_