]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/mdi.h
Fixed return code of GetSelectionCount()
[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
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
21WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
22WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr;
23
24class WXDLLEXPORT wxMDIClientWindow;
25class WXDLLEXPORT wxMDIChildFrame;
26
f57fe24c 27#if wxUSE_MDI_WIDGETS
8704bf74
JS
28class XsMDICanvas;
29class wxXsMDIWindow;
f57fe24c 30#endif
8704bf74 31
9b6dbb09
JS
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
0d57be45 72 // Get the active MDI child window
9b6dbb09
JS
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
0d57be45
JS
89// Implementation
90 inline void SetActiveChild(wxMDIChildFrame* child) { m_activeChild = child; }
91
9b6dbb09
JS
92protected:
93
0d57be45
JS
94 wxMDIClientWindow* m_clientWindow;
95 wxMDIChildFrame* m_activeChild;
9b6dbb09
JS
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);
8704bf74 129 void SetTitle(const wxString& title);
9b6dbb09 130 void SetClientSize(int width, int height);
8704bf74
JS
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;
9b6dbb09
JS
134 void GetPosition(int *x, int *y) const ;
135
8704bf74
JS
136 // Set icon
137 virtual void SetIcon(const wxIcon& icon);
138
9b6dbb09
JS
139 // MDI operations
140 virtual void Maximize();
8704bf74
JS
141 inline void Minimize() { Iconize(TRUE); };
142 virtual void Iconize(bool iconize);
9b6dbb09
JS
143 virtual void Restore();
144 virtual void Activate();
8704bf74
JS
145 virtual bool IsIconized() const ;
146
147 bool Show(bool show);
148 void BuildClientArea(WXWidget parent);
149 inline WXWidget GetTopWidget() const { return m_mainWidget; };
f57fe24c 150#if wxUSE_MDI_WIDGETS
8704bf74 151 inline wxXsMDIWindow *GetMDIWindow() const { return m_mdiWindow; };
f57fe24c 152#endif
0d57be45
JS
153 virtual void OnRaise();
154 virtual void OnLower();
8704bf74
JS
155
156protected:
157 wxXsMDIWindow* m_mdiWindow ;
9b6dbb09
JS
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
167class 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
8704bf74
JS
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
9b6dbb09
JS
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
f57fe24c 194#if wxUSE_MDI_WIDGETS
8704bf74 195 inline XsMDICanvas* GetMDICanvas() const { return m_mdiCanvas; }
8704bf74 196 WXWidget GetTopWidget() const { return m_topWidget; }
f57fe24c 197#endif
8704bf74 198
9b6dbb09
JS
199protected:
200
f57fe24c 201#if wxUSE_MDI_WIDGETS
8704bf74
JS
202 XsMDICanvas* m_mdiCanvas;
203 WXWidget m_topWidget;
f57fe24c 204#endif
8704bf74 205
9b6dbb09
JS
206DECLARE_EVENT_TABLE()
207};
208
209#endif
210 // _WX_MDI_H_