]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/mdi.h
wxMSWUniv build fix.
[wxWidgets.git] / include / wx / motif / mdi.h
CommitLineData
9b6dbb09
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: mdi.h
3// Purpose: MDI (Multiple Document Interface) classes.
9b6dbb09
JS
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
9b6dbb09
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_MDI_H_
13#define _WX_MDI_H_
14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
9b6dbb09
JS
16#pragma interface "mdi.h"
17#endif
18
621793f4
JS
19/*
20New MDI scheme using tabs. We can use a wxNotebook to implement the client
21window. wxMDIChildFrame can be implemented as an XmMainWindow widget
22as before, and is a child of the notebook _and_ of the parent frame...
23but wxMDIChildFrame::GetParent should return the parent frame.
24
25*/
26
9b6dbb09 27#include "wx/frame.h"
621793f4 28#include "wx/notebook.h"
9b6dbb09 29
9b6dbb09
JS
30class WXDLLEXPORT wxMDIClientWindow;
31class WXDLLEXPORT wxMDIChildFrame;
32
33class WXDLLEXPORT wxMDIParentFrame: public wxFrame
34{
83df96d6 35 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
0d97c090 36
83df96d6 37 friend class WXDLLEXPORT wxMDIChildFrame;
9b6dbb09 38public:
0d97c090 39
83df96d6
JS
40 wxMDIParentFrame();
41 inline wxMDIParentFrame(wxWindow *parent,
42 wxWindowID id,
43 const wxString& title,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, // Scrolling refers to client window
47 const wxString& name = wxFrameNameStr)
48 {
49 Create(parent, id, title, pos, size, style, name);
50 }
0d97c090 51
83df96d6 52 ~wxMDIParentFrame();
0d97c090 53
83df96d6
JS
54 bool Create(wxWindow *parent,
55 wxWindowID id,
56 const wxString& title,
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
59 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
60 const wxString& name = wxFrameNameStr);
0d97c090 61
83df96d6
JS
62 void OnSize(wxSizeEvent& event);
63 void OnActivate(wxActivateEvent& event);
64 void OnSysColourChanged(wxSysColourChangedEvent& event);
65 void OnMenuHighlight(wxMenuEvent& event);
0d97c090 66
83df96d6 67 void SetMenuBar(wxMenuBar *menu_bar);
0d97c090 68
83df96d6
JS
69 // Get the active MDI child window
70 wxMDIChildFrame *GetActiveChild() const ;
0d97c090 71
83df96d6
JS
72 // Get the client window
73 wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; };
0d97c090 74
83df96d6
JS
75 // Create the client window class (don't Create the window,
76 // just return a new class)
77 virtual wxMDIClientWindow *OnCreateClient() ;
0d97c090 78
83df96d6
JS
79 // MDI operations
80 virtual void Cascade();
0d97c090 81 virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL);
83df96d6
JS
82 virtual void ArrangeIcons();
83 virtual void ActivateNext();
84 virtual void ActivatePrevious();
0d97c090 85
83df96d6 86 // Implementation
0d97c090 87
83df96d6
JS
88 // Set the active child
89 inline void SetActiveChild(wxMDIChildFrame* child) { m_activeChild = child; }
0d97c090 90
83df96d6
JS
91 // Set the child's menubar into the parent frame
92 void SetChildMenuBar(wxMDIChildFrame* frame);
0d97c090 93
83df96d6 94 inline wxMenuBar* GetActiveMenuBar() const { return m_activeMenuBar; }
0d97c090 95
83df96d6
JS
96 // Redirect events to active child first
97 virtual bool ProcessEvent(wxEvent& event);
0d97c090 98
b23386b2 99protected:
83df96d6
JS
100 virtual void DoSetSize(int x, int y,
101 int width, int height,
102 int sizeFlags = wxSIZE_AUTO);
103 virtual void DoSetClientSize(int width, int height);
0d97c090 104
83df96d6
JS
105 // Gets the size available for subwindows after menu size, toolbar size
106 // and status bar size have been subtracted. If you want to manage your own
107 // toolbar(s), don't call SetToolBar.
108 void DoGetClientSize(int *width, int *height) const;
0d97c090 109
9b6dbb09 110protected:
0d97c090 111
83df96d6
JS
112 wxMDIClientWindow* m_clientWindow;
113 wxMDIChildFrame* m_activeChild;
114 wxMenuBar* m_activeMenuBar;
0d97c090 115
83df96d6 116 DECLARE_EVENT_TABLE()
9b6dbb09
JS
117};
118
119class WXDLLEXPORT wxMDIChildFrame: public wxFrame
120{
83df96d6 121 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
0d97c090 122
bfc6fde4
VZ
123public:
124 wxMDIChildFrame();
125 wxMDIChildFrame(wxMDIParentFrame *parent,
83df96d6
JS
126 wxWindowID id,
127 const wxString& title,
128 const wxPoint& pos = wxDefaultPosition,
129 const wxSize& size = wxDefaultSize,
130 long style = wxDEFAULT_FRAME_STYLE,
131 const wxString& name = wxFrameNameStr)
bfc6fde4
VZ
132 {
133 Create(parent, id, title, pos, size, style, name);
134 }
0d97c090 135
bfc6fde4 136 ~wxMDIChildFrame();
0d97c090 137
bfc6fde4 138 bool Create(wxMDIParentFrame *parent,
83df96d6
JS
139 wxWindowID id,
140 const wxString& title,
141 const wxPoint& pos = wxDefaultPosition,
142 const wxSize& size = wxDefaultSize,
143 long style = wxDEFAULT_FRAME_STYLE,
144 const wxString& name = wxFrameNameStr);
0d97c090 145
bfc6fde4
VZ
146 // Set menu bar
147 void SetMenuBar(wxMenuBar *menu_bar);
148 void SetTitle(const wxString& title);
0d97c090 149
bfc6fde4
VZ
150 // Set icon
151 virtual void SetIcon(const wxIcon& icon);
f618020a
MB
152 virtual void SetIcons(const wxIconBundle& icons );
153
bfc6fde4
VZ
154 // Override wxFrame operations
155 void CaptureMouse();
156 void ReleaseMouse();
157 void Raise();
158 void Lower(void);
571f6981 159 void DoSetSizeHints(int minW = -1, int minH = -1, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1);
0d97c090 160
bfc6fde4
VZ
161 // MDI operations
162 virtual void Maximize();
163 virtual void Maximize(bool WXUNUSED(maximize)) { };
96be256b 164 inline void Minimize() { Iconize(true); };
bfc6fde4
VZ
165 virtual void Iconize(bool iconize);
166 virtual void Restore();
167 virtual void Activate();
168 virtual bool IsIconized() const ;
0d97c090 169
96be256b 170 virtual bool IsTopLevel() const { return false; }
0d97c090 171
96be256b 172 // Is the frame maximized? Returns true for
bfc6fde4
VZ
173 // wxMDIChildFrame due to the tabbed implementation.
174 virtual bool IsMaximized(void) const ;
0d97c090 175
bfc6fde4 176 bool Show(bool show);
0d97c090 177
bfc6fde4
VZ
178 WXWidget GetMainWidget() const { return m_mainWidget; };
179 WXWidget GetTopWidget() const { return m_mainWidget; };
180 WXWidget GetClientWidget() const { return m_mainWidget; };
0d97c090 181
bfc6fde4 182 /*
83df96d6
JS
183 virtual void OnRaise();
184 virtual void OnLower();
185 */
0d97c090 186
bfc6fde4
VZ
187 void SetMDIParentFrame(wxMDIParentFrame* parentFrame) { m_mdiParentFrame = parentFrame; }
188 wxMDIParentFrame* GetMDIParentFrame() const { return m_mdiParentFrame; }
0d97c090 189
8704bf74 190protected:
bfc6fde4 191 wxMDIParentFrame* m_mdiParentFrame;
0d97c090 192
bfc6fde4 193 virtual void DoSetSize(int x, int y,
83df96d6
JS
194 int width, int height,
195 int sizeFlags = wxSIZE_AUTO);
bfc6fde4 196 virtual void DoSetClientSize(int width, int height);
0d97c090 197
449f38b5
JS
198 void DoGetClientSize(int *width, int *height) const;
199 void DoGetSize(int *width, int *height) const;
200 void DoGetPosition(int *x, int *y) const ;
9b6dbb09
JS
201};
202
203/* The client window is a child of the parent MDI frame, and itself
83df96d6
JS
204* contains the child MDI frames.
205* However, you create the MDI children as children of the MDI parent:
206* only in the implementation does the client window become the parent
207* of the children. Phew! So the children are sort of 'adopted'...
208*/
9b6dbb09 209
621793f4 210class WXDLLEXPORT wxMDIClientWindow: public wxNotebook
9b6dbb09 211{
83df96d6 212 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
0d97c090 213
bfc6fde4
VZ
214public:
215 wxMDIClientWindow() ;
216 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
217 {
218 CreateClient(parent, style);
219 }
0d97c090 220
bfc6fde4 221 ~wxMDIClientWindow();
0d97c090 222
bfc6fde4
VZ
223 // Note: this is virtual, to allow overridden behaviour.
224 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
0d97c090 225
bfc6fde4
VZ
226 // Explicitly call default scroll behaviour
227 void OnScroll(wxScrollEvent& event);
0d97c090 228
bfc6fde4
VZ
229 // Implementation
230 void OnPageChanged(wxNotebookEvent& event);
fdfd5d49
MB
231
232 int FindPage(const wxNotebookPage* page);
0d97c090 233
9b6dbb09 234protected:
bfc6fde4 235 virtual void DoSetSize(int x, int y,
83df96d6
JS
236 int width, int height,
237 int sizeFlags = wxSIZE_AUTO);
bfc6fde4 238 virtual void DoSetClientSize(int width, int height);
0d97c090 239
449f38b5
JS
240 void DoGetClientSize(int *width, int *height) const;
241 void DoGetSize(int *width, int *height) const ;
242 void DoGetPosition(int *x, int *y) const ;
0d97c090 243
bfc6fde4
VZ
244private:
245 DECLARE_EVENT_TABLE()
9b6dbb09
JS
246};
247
248#endif
83df96d6 249// _WX_MDI_H_