]>
Commit | Line | Data |
---|---|---|
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: AUTHOR | |
7 | // Modified by: | |
8 | // Created: ??/??/98 | |
9 | // RCS-ID: $Id$ | |
10 | // Copyright: (c) AUTHOR | |
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 | ||
23 | WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr; | |
24 | WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr; | |
25 | ||
26 | class WXDLLEXPORT wxMDIClientWindow; | |
27 | class WXDLLEXPORT wxMDIChildFrame; | |
28 | ||
29 | class WXDLLEXPORT wxMDIParentFrame: public wxFrame | |
30 | { | |
31 | DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) | |
32 | ||
33 | friend class WXDLLEXPORT wxMDIChildFrame; | |
34 | public: | |
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 | ||
62 | void SetMenuBar(wxMenuBar *menu_bar); | |
63 | ||
64 | // Gets the size available for subwindows after menu size, toolbar size | |
65 | // and status bar size have been subtracted. If you want to manage your own | |
66 | // toolbar(s), don't call SetToolBar. | |
67 | void GetClientSize(int *width, int *height) const; | |
68 | ||
69 | // Get the active MDI child window (Windows only) | |
70 | wxMDIChildFrame *GetActiveChild() const ; | |
71 | ||
72 | // Get the client window | |
73 | inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }; | |
74 | ||
75 | // Create the client window class (don't Create the window, | |
76 | // just return a new class) | |
77 | virtual wxMDIClientWindow *OnCreateClient() ; | |
78 | ||
79 | // MDI operations | |
80 | virtual void Cascade(); | |
81 | virtual void Tile(); | |
82 | virtual void ArrangeIcons(); | |
83 | virtual void ActivateNext(); | |
84 | virtual void ActivatePrevious(); | |
85 | ||
86 | protected: | |
87 | ||
88 | // TODO maybe have this member | |
89 | wxMDIClientWindow *m_clientWindow; | |
90 | ||
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 | Create(parent, id, title, pos, size, style, name); | |
109 | } | |
110 | ||
111 | ~wxMDIChildFrame(); | |
112 | ||
113 | bool Create(wxMDIParentFrame *parent, | |
114 | wxWindowID id, | |
115 | const wxString& title, | |
116 | const wxPoint& pos = wxDefaultPosition, | |
117 | const wxSize& size = wxDefaultSize, | |
118 | long style = wxDEFAULT_FRAME_STYLE, | |
119 | const wxString& name = wxFrameNameStr); | |
120 | ||
121 | // Set menu bar | |
122 | void SetMenuBar(wxMenuBar *menu_bar); | |
123 | void SetClientSize(int width, int height); | |
124 | void GetPosition(int *x, int *y) const ; | |
125 | ||
126 | // MDI operations | |
127 | virtual void Maximize(); | |
128 | virtual void Restore(); | |
129 | virtual void Activate(); | |
130 | private: | |
131 | // supress virtual function hiding warning | |
132 | virtual void Maximize(bool maximize) { wxFrame::Maximize(maximize); }; | |
133 | }; | |
134 | ||
135 | /* The client window is a child of the parent MDI frame, and itself | |
136 | * contains the child MDI frames. | |
137 | * However, you create the MDI children as children of the MDI parent: | |
138 | * only in the implementation does the client window become the parent | |
139 | * of the children. Phew! So the children are sort of 'adopted'... | |
140 | */ | |
141 | ||
142 | class WXDLLEXPORT wxMDIClientWindow: public wxWindow | |
143 | { | |
144 | DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) | |
145 | public: | |
146 | ||
147 | wxMDIClientWindow() ; | |
148 | inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) | |
149 | { | |
150 | CreateClient(parent, style); | |
151 | } | |
152 | ||
153 | ~wxMDIClientWindow(); | |
154 | ||
155 | // Note: this is virtual, to allow overridden behaviour. | |
156 | virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); | |
157 | ||
158 | // Explicitly call default scroll behaviour | |
159 | void OnScroll(wxScrollEvent& event); | |
160 | ||
161 | protected: | |
162 | ||
163 | DECLARE_EVENT_TABLE() | |
164 | }; | |
165 | ||
166 | #endif | |
167 | // _WX_MDI_H_ |