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