]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/motif/mdi.h
More Motif changes (colour/font stuff)
[wxWidgets.git] / include / wx / motif / mdi.h
... / ...
CommitLineData
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
23WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
24WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr;
25
26class WXDLLEXPORT wxMDIClientWindow;
27class WXDLLEXPORT wxMDIChildFrame;
28
29class XsMDICanvas;
30class wxXsMDIWindow;
31
32class WXDLLEXPORT wxMDIParentFrame: public wxFrame
33{
34DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
35
36 friend class WXDLLEXPORT wxMDIChildFrame;
37public:
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
92protected:
93
94 wxMDIClientWindow* m_clientWindow;
95 wxMDIChildFrame* m_activeChild;
96
97DECLARE_EVENT_TABLE()
98};
99
100class WXDLLEXPORT wxMDIChildFrame: public wxFrame
101{
102DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
103public:
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 inline wxXsMDIWindow *GetMDIWindow() const { return m_mdiWindow; };
151 virtual void OnRaise();
152 virtual void OnLower();
153
154protected:
155 wxXsMDIWindow* m_mdiWindow ;
156};
157
158/* The client window is a child of the parent MDI frame, and itself
159 * contains the child MDI frames.
160 * However, you create the MDI children as children of the MDI parent:
161 * only in the implementation does the client window become the parent
162 * of the children. Phew! So the children are sort of 'adopted'...
163 */
164
165class WXDLLEXPORT wxMDIClientWindow: public wxWindow
166{
167 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
168 public:
169
170 wxMDIClientWindow() ;
171 inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
172 {
173 CreateClient(parent, style);
174 }
175
176 ~wxMDIClientWindow();
177
178 void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
179 void SetClientSize(int width, int height);
180 void GetClientSize(int *width, int *height) const;
181
182 void GetSize(int *width, int *height) const ;
183 void GetPosition(int *x, int *y) const ;
184
185
186 // Note: this is virtual, to allow overridden behaviour.
187 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
188
189 // Explicitly call default scroll behaviour
190 void OnScroll(wxScrollEvent& event);
191
192 inline XsMDICanvas* GetMDICanvas() const { return m_mdiCanvas; }
193
194 WXWidget GetTopWidget() const { return m_topWidget; }
195
196protected:
197
198 XsMDICanvas* m_mdiCanvas;
199 WXWidget m_topWidget;
200
201DECLARE_EVENT_TABLE()
202};
203
204#endif
205 // _WX_MDI_H_