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