]>
Commit | Line | Data |
---|---|---|
7c78e7c7 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: mdi.h | |
01b2eeec KB |
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 | |
7c78e7c7 RR |
11 | // Licence: wxWindows licence |
12 | ///////////////////////////////////////////////////////////////////////////// | |
13 | ||
01b2eeec KB |
14 | #ifndef _WX_MDI_H_ |
15 | #define _WX_MDI_H_ | |
7c78e7c7 RR |
16 | |
17 | #ifdef __GNUG__ | |
01b2eeec | 18 | #pragma interface "mdi.h" |
7c78e7c7 RR |
19 | #endif |
20 | ||
7c78e7c7 | 21 | #include "wx/frame.h" |
7c78e7c7 | 22 | |
01b2eeec KB |
23 | WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr; |
24 | WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr; | |
7c78e7c7 | 25 | |
01b2eeec KB |
26 | class WXDLLEXPORT wxMDIClientWindow; |
27 | class WXDLLEXPORT wxMDIChildFrame; | |
7c78e7c7 | 28 | |
01b2eeec | 29 | class WXDLLEXPORT wxMDIParentFrame: public wxFrame |
7c78e7c7 | 30 | { |
01b2eeec KB |
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 | ||
61 | void SetMenuBar(wxMenuBar *menu_bar); | |
62 | ||
63 | // Gets the size available for subwindows after menu size, toolbar size | |
64 | // and status bar size have been subtracted. If you want to manage your own | |
65 | // toolbar(s), don't call SetToolBar. | |
66 | void GetClientSize(int *width, int *height) const; | |
67 | ||
68 | // Get the active MDI child window (Windows only) | |
69 | wxMDIChildFrame *GetActiveChild() const ; | |
70 | ||
71 | // Get the client window | |
72 | inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }; | |
73 | ||
74 | // Create the client window class (don't Create the window, | |
75 | // just return a new class) | |
76 | virtual wxMDIClientWindow *OnCreateClient() ; | |
77 | ||
78 | // MDI operations | |
79 | virtual void Cascade(); | |
80 | virtual void Tile(); | |
81 | virtual void ArrangeIcons(); | |
82 | virtual void ActivateNext(); | |
83 | virtual void ActivatePrevious(); | |
84 | ||
85 | protected: | |
86 | ||
87 | DECLARE_EVENT_TABLE() | |
7c78e7c7 RR |
88 | }; |
89 | ||
01b2eeec | 90 | class WXDLLEXPORT wxMDIChildFrame: public wxFrame |
7c78e7c7 | 91 | { |
01b2eeec KB |
92 | DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) |
93 | public: | |
94 | ||
95 | wxMDIChildFrame(); | |
96 | inline wxMDIChildFrame(wxMDIParentFrame *parent, | |
97 | wxWindowID id, | |
98 | const wxString& title, | |
99 | const wxPoint& pos = wxDefaultPosition, | |
100 | const wxSize& size = wxDefaultSize, | |
101 | long style = wxDEFAULT_FRAME_STYLE, | |
102 | const wxString& name = wxFrameNameStr) | |
103 | { | |
104 | Create(parent, id, title, pos, size, style, name); | |
105 | } | |
106 | ||
107 | ~wxMDIChildFrame(); | |
108 | ||
109 | bool Create(wxMDIParentFrame *parent, | |
110 | wxWindowID id, | |
111 | const wxString& title, | |
112 | const wxPoint& pos = wxDefaultPosition, | |
113 | const wxSize& size = wxDefaultSize, | |
114 | long style = wxDEFAULT_FRAME_STYLE, | |
115 | const wxString& name = wxFrameNameStr); | |
116 | ||
117 | // Set menu bar | |
118 | void SetMenuBar(wxMenuBar *menu_bar); | |
119 | void SetClientSize(int width, int height); | |
120 | void GetPosition(int *x, int *y) const ; | |
121 | ||
122 | // MDI operations | |
123 | virtual void Maximize(); | |
124 | virtual void Restore(); | |
125 | virtual void Activate(); | |
7c78e7c7 RR |
126 | }; |
127 | ||
01b2eeec KB |
128 | /* The client window is a child of the parent MDI frame, and itself |
129 | * contains the child MDI frames. | |
130 | * However, you create the MDI children as children of the MDI parent: | |
131 | * only in the implementation does the client window become the parent | |
132 | * of the children. Phew! So the children are sort of 'adopted'... | |
133 | */ | |
7c78e7c7 | 134 | |
01b2eeec | 135 | class WXDLLEXPORT wxMDIClientWindow: public wxWindow |
7c78e7c7 RR |
136 | { |
137 | DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) | |
01b2eeec KB |
138 | public: |
139 | ||
140 | wxMDIClientWindow() ; | |
141 | inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) | |
142 | { | |
143 | CreateClient(parent, style); | |
144 | } | |
7c78e7c7 | 145 | |
01b2eeec | 146 | ~wxMDIClientWindow(); |
7c78e7c7 | 147 | |
01b2eeec KB |
148 | // Note: this is virtual, to allow overridden behaviour. |
149 | virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); | |
150 | ||
151 | // Explicitly call default scroll behaviour | |
152 | void OnScroll(wxScrollEvent& event); | |
153 | ||
154 | protected: | |
155 | ||
156 | DECLARE_EVENT_TABLE() | |
157 | }; | |
158 | ||
159 | #endif | |
160 | // _WX_MDI_H_ |