]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/mdi.h
GTK's dnd is broken, not mine
[wxWidgets.git] / include / wx / motif / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mdi.h
3 // Purpose: MDI (Multiple Document Interface) classes.
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MDI_H_
13 #define _WX_MDI_H_
14
15 #ifdef __GNUG__
16 #pragma interface "mdi.h"
17 #endif
18
19 #include "wx/frame.h"
20
21 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
22 WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr;
23
24 class WXDLLEXPORT wxMDIClientWindow;
25 class WXDLLEXPORT wxMDIChildFrame;
26
27 #if wxUSE_MDI_WIDGETS
28 class XsMDICanvas;
29 class wxXsMDIWindow;
30 #endif
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
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 // Implementation
90 inline void SetActiveChild(wxMDIChildFrame* child) { m_activeChild = child; }
91
92 protected:
93
94 wxMDIClientWindow* m_clientWindow;
95 wxMDIChildFrame* m_activeChild;
96
97 DECLARE_EVENT_TABLE()
98 };
99
100 class WXDLLEXPORT wxMDIChildFrame: public wxFrame
101 {
102 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
103 public:
104
105 wxMDIChildFrame();
106 inline wxMDIChildFrame(wxMDIParentFrame *parent,
107 wxWindowID id,
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)
113 {
114 Create(parent, id, title, pos, size, style, name);
115 }
116
117 ~wxMDIChildFrame();
118
119 bool Create(wxMDIParentFrame *parent,
120 wxWindowID id,
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);
126
127 // Set menu bar
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 ;
135
136 // Set icon
137 virtual void SetIcon(const wxIcon& icon);
138
139 // MDI operations
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 ;
146
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; };
152 #endif
153 virtual void OnRaise();
154 virtual void OnLower();
155
156 protected:
157 wxXsMDIWindow* m_mdiWindow ;
158 };
159
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'...
165 */
166
167 class WXDLLEXPORT wxMDIClientWindow: public wxWindow
168 {
169 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
170 public:
171
172 wxMDIClientWindow() ;
173 inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
174 {
175 CreateClient(parent, style);
176 }
177
178 ~wxMDIClientWindow();
179
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;
183
184 void GetSize(int *width, int *height) const ;
185 void GetPosition(int *x, int *y) const ;
186
187
188 // Note: this is virtual, to allow overridden behaviour.
189 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
190
191 // Explicitly call default scroll behaviour
192 void OnScroll(wxScrollEvent& event);
193
194 #if wxUSE_MDI_WIDGETS
195 inline XsMDICanvas* GetMDICanvas() const { return m_mdiCanvas; }
196 WXWidget GetTopWidget() const { return m_topWidget; }
197 #endif
198
199 protected:
200
201 #if wxUSE_MDI_WIDGETS
202 XsMDICanvas* m_mdiCanvas;
203 WXWidget m_topWidget;
204 #endif
205
206 DECLARE_EVENT_TABLE()
207 };
208
209 #endif
210 // _WX_MDI_H_