]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
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. | |
a31a5f85 | 6 | // Author: Stefan Csomor |
0dbd6262 | 7 | // Modified by: |
a31a5f85 | 8 | // Created: 1998-01-01 |
0dbd6262 | 9 | // RCS-ID: $Id$ |
a31a5f85 | 10 | // Copyright: (c) Stefan Csomor |
e40298d5 | 11 | // Licence: wxWindows licence |
0dbd6262 SC |
12 | ///////////////////////////////////////////////////////////////////////////// |
13 | ||
14 | #ifndef _WX_MDI_H_ | |
15 | #define _WX_MDI_H_ | |
16 | ||
af49c4b8 | 17 | #if defined(__GNUG__) && !defined(__APPLE__) |
0dbd6262 SC |
18 | #pragma interface "mdi.h" |
19 | #endif | |
20 | ||
21 | #include "wx/frame.h" | |
22 | ||
c4e41ce3 SC |
23 | WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr; |
24 | WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr; | |
0dbd6262 SC |
25 | |
26 | class WXDLLEXPORT wxMDIClientWindow; | |
27 | class WXDLLEXPORT wxMDIChildFrame; | |
28 | ||
29 | class WXDLLEXPORT wxMDIParentFrame: public wxFrame | |
30 | { | |
10d3680f | 31 | DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) |
0dbd6262 | 32 | |
0dbd6262 SC |
33 | public: |
34 | ||
35 | wxMDIParentFrame(); | |
36 | inline wxMDIParentFrame(wxWindow *parent, | |
37 | wxWindowID id, | |
38 | const wxString& title, | |
39 | const wxPoint& pos = wxDefaultPosition, | |
40 | const wxSize& size = wxDefaultSize, | |
41 | long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, // Scrolling refers to client window | |
42 | const wxString& name = wxFrameNameStr) | |
43 | { | |
44 | Create(parent, id, title, pos, size, style, name); | |
45 | } | |
46 | ||
47 | ~wxMDIParentFrame(); | |
48 | ||
49 | bool Create(wxWindow *parent, | |
50 | wxWindowID id, | |
51 | const wxString& title, | |
52 | const wxPoint& pos = wxDefaultPosition, | |
53 | const wxSize& size = wxDefaultSize, | |
54 | long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, | |
55 | const wxString& name = wxFrameNameStr); | |
56 | ||
70024cfb DE |
57 | // Mac OS activate event |
58 | virtual void MacActivate(long timestamp, bool activating); | |
59 | ||
60 | // wxWindows activate event | |
0dbd6262 SC |
61 | void OnActivate(wxActivateEvent& event); |
62 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
63 | ||
64 | void SetMenuBar(wxMenuBar *menu_bar); | |
65 | ||
0dbd6262 SC |
66 | // Get the active MDI child window (Windows only) |
67 | wxMDIChildFrame *GetActiveChild() const ; | |
68 | ||
69 | // Get the client window | |
70 | inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }; | |
71 | ||
72 | // Create the client window class (don't Create the window, | |
73 | // just return a new class) | |
74 | virtual wxMDIClientWindow *OnCreateClient() ; | |
75 | ||
76 | // MDI operations | |
77 | virtual void Cascade(); | |
78 | virtual void Tile(); | |
79 | virtual void ArrangeIcons(); | |
80 | virtual void ActivateNext(); | |
81 | virtual void ActivatePrevious(); | |
82 | ||
83 | protected: | |
84 | ||
85 | // TODO maybe have this member | |
86 | wxMDIClientWindow *m_clientWindow; | |
0a67a93b SC |
87 | wxMDIChildFrame * m_currentChild; |
88 | wxMenu* m_windowMenu; | |
0dbd6262 | 89 | |
0a67a93b SC |
90 | // TRUE if MDI Frame is intercepting commands, not child |
91 | bool m_parentFrameActive; | |
92 | ||
93 | private: | |
94 | friend class WXDLLEXPORT wxMDIChildFrame; | |
0dbd6262 SC |
95 | DECLARE_EVENT_TABLE() |
96 | }; | |
97 | ||
98 | class WXDLLEXPORT wxMDIChildFrame: public wxFrame | |
99 | { | |
100 | DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) | |
101 | public: | |
102 | ||
103 | wxMDIChildFrame(); | |
104 | inline wxMDIChildFrame(wxMDIParentFrame *parent, | |
105 | wxWindowID id, | |
106 | const wxString& title, | |
107 | const wxPoint& pos = wxDefaultPosition, | |
108 | const wxSize& size = wxDefaultSize, | |
109 | long style = wxDEFAULT_FRAME_STYLE, | |
110 | const wxString& name = wxFrameNameStr) | |
111 | { | |
0a67a93b | 112 | Init() ; |
0dbd6262 SC |
113 | Create(parent, id, title, pos, size, style, name); |
114 | } | |
115 | ||
116 | ~wxMDIChildFrame(); | |
117 | ||
118 | bool Create(wxMDIParentFrame *parent, | |
119 | wxWindowID id, | |
120 | const wxString& title, | |
121 | const wxPoint& pos = wxDefaultPosition, | |
122 | const wxSize& size = wxDefaultSize, | |
123 | long style = wxDEFAULT_FRAME_STYLE, | |
124 | const wxString& name = wxFrameNameStr); | |
125 | ||
70024cfb DE |
126 | // Mac OS activate event |
127 | virtual void MacActivate(long timestamp, bool activating); | |
128 | ||
0dbd6262 SC |
129 | // Set menu bar |
130 | void SetMenuBar(wxMenuBar *menu_bar); | |
0dbd6262 SC |
131 | |
132 | // MDI operations | |
133 | virtual void Maximize(); | |
519cb848 | 134 | virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame |
0dbd6262 SC |
135 | virtual void Restore(); |
136 | virtual void Activate(); | |
0a67a93b SC |
137 | protected: |
138 | ||
139 | // common part of all ctors | |
140 | void Init(); | |
0dbd6262 SC |
141 | }; |
142 | ||
143 | /* The client window is a child of the parent MDI frame, and itself | |
144 | * contains the child MDI frames. | |
145 | * However, you create the MDI children as children of the MDI parent: | |
146 | * only in the implementation does the client window become the parent | |
147 | * of the children. Phew! So the children are sort of 'adopted'... | |
148 | */ | |
149 | ||
150 | class WXDLLEXPORT wxMDIClientWindow: public wxWindow | |
151 | { | |
152 | DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) | |
153 | public: | |
154 | ||
155 | wxMDIClientWindow() ; | |
156 | inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) | |
157 | { | |
158 | CreateClient(parent, style); | |
159 | } | |
160 | ||
161 | ~wxMDIClientWindow(); | |
162 | ||
163 | // Note: this is virtual, to allow overridden behaviour. | |
164 | virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); | |
165 | ||
be7a1013 DE |
166 | // Gets the size available for subwindows after menu size, toolbar size |
167 | // and status bar size have been subtracted. If you want to manage your own | |
168 | // toolbar(s), don't call SetToolBar. | |
169 | void DoGetClientSize(int *width, int *height) const; | |
170 | ||
0dbd6262 SC |
171 | // Explicitly call default scroll behaviour |
172 | void OnScroll(wxScrollEvent& event); | |
173 | ||
174 | protected: | |
175 | ||
176 | DECLARE_EVENT_TABLE() | |
177 | }; | |
178 | ||
179 | #endif | |
180 | // _WX_MDI_H_ |