]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/mdi.h
fa1f382db5112317d143bcb61d52cc56843e308e
[wxWidgets.git] / include / wx / msw / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mdi.h
3 // Purpose: MDI (Multiple Document Interface) classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
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
21 WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
22 WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
23
24 class WXDLLEXPORT wxMDIClientWindow;
25 class WXDLLEXPORT wxMDIChildFrame;
26
27 class WXDLLEXPORT wxMDIParentFrame: public wxFrame
28 {
29 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
30
31 friend class WXDLLEXPORT wxMDIChildFrame;
32 public:
33
34 wxMDIParentFrame(void);
35 inline wxMDIParentFrame(wxWindow *parent,
36 wxWindowID id,
37 const wxString& title,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
40 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
41 const wxString& name = wxFrameNameStr)
42 {
43 Create(parent, id, title, pos, size, style, name);
44 }
45
46 ~wxMDIParentFrame(void);
47
48 bool Create(wxWindow *parent,
49 wxWindowID id,
50 const wxString& title,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
54 const wxString& name = wxFrameNameStr);
55
56 /*
57 #if WXWIN_COMPATIBILITY
58 virtual void OldOnActivate(bool flag);
59 virtual void OldOnSize(int x, int y);
60 #endif
61 */
62
63 void OnSize(wxSizeEvent& event);
64 void OnActivate(wxActivateEvent& event);
65
66 void SetMenuBar(wxMenuBar *menu_bar);
67
68 // Get the active MDI child window (Windows only)
69 wxMDIChildFrame *GetActiveChild(void) const ;
70
71 // Get the client window
72 inline wxMDIClientWindow *GetClientWindow(void) const ;
73
74 // Create the client window class (don't Create the window,
75 // just return a new class)
76 virtual wxMDIClientWindow *OnCreateClient(void) ;
77
78 inline WXHMENU GetWindowMenu(void) const ;
79
80 // MDI operations
81 virtual void Cascade(void);
82 virtual void Tile(void);
83 virtual void ArrangeIcons(void);
84 virtual void ActivateNext(void);
85 virtual void ActivatePrevious(void);
86
87 // Handlers
88 void MSWOnSize(int x, int y, WXUINT flag);
89 bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
90 void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
91 bool MSWProcessMessage(WXMSG *msg);
92 bool MSWTranslateMessage(WXMSG *msg);
93 void MSWOnCreate(WXLPCREATESTRUCT cs);
94 long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
95 bool MSWOnEraseBkgnd(WXHDC pDC);
96 bool MSWOnDestroy(void);
97 bool MSWOnActivate(int state, bool minimized, WXHWND activate);
98
99 // Responds to colour changes
100 void OnSysColourChanged(wxSysColourChangedEvent& event);
101
102 protected:
103 // Gets the size available for subwindows after menu size, toolbar size
104 // and status bar size have been subtracted. If you want to manage your own
105 // toolbar(s), don't call SetToolBar.
106 void DoGetClientSize(int *width, int *height) const;
107
108 wxMDIClientWindow * m_clientWindow;
109 wxMDIChildFrame * m_currentChild;
110 WXHMENU m_windowMenu;
111 bool m_parentFrameActive; // TRUE if MDI Frame is intercepting
112 // commands, not child
113 DECLARE_EVENT_TABLE()
114 };
115
116 // Inlines
117 inline wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow; }
118 inline WXHMENU wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu; }
119
120 class WXDLLEXPORT wxMDIChildFrame: public wxFrame
121 {
122 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
123 public:
124
125 wxMDIChildFrame(void);
126 inline wxMDIChildFrame(wxMDIParentFrame *parent,
127 wxWindowID id,
128 const wxString& title,
129 const wxPoint& pos = wxDefaultPosition,
130 const wxSize& size = wxDefaultSize,
131 long style = wxDEFAULT_FRAME_STYLE,
132 const wxString& name = wxFrameNameStr)
133 {
134 Create(parent, id, title, pos, size, style, name);
135 }
136
137 ~wxMDIChildFrame(void);
138
139 bool Create(wxMDIParentFrame *parent,
140 wxWindowID id,
141 const wxString& title,
142 const wxPoint& pos = wxDefaultPosition,
143 const wxSize& size = wxDefaultSize,
144 long style = wxDEFAULT_FRAME_STYLE,
145 const wxString& name = wxFrameNameStr);
146
147 // Set menu bar
148 void SetMenuBar(wxMenuBar *menu_bar);
149
150 // MDI operations
151 virtual void Maximize(void);
152 virtual void Restore(void);
153 virtual void Activate(void);
154
155 // Handlers
156
157 long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
158 void MSWOnSize(int x, int y, WXUINT);
159 void MSWOnWindowPosChanging(void *lpPos);
160 bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
161 long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
162 bool MSWProcessMessage(WXMSG *msg);
163 bool MSWTranslateMessage(WXMSG *msg);
164 void MSWDestroyWindow(void);
165
166 // Implementation
167 bool ResetWindowStyle(void *vrect);
168
169 protected:
170 void DoGetPosition(int *x, int *y) const ;
171 void DoSetClientSize(int width, int height);
172 };
173
174 class WXDLLEXPORT wxMDIClientWindow: public wxWindow
175 {
176 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
177 public:
178
179 wxMDIClientWindow(void) ;
180 inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
181 {
182 CreateClient(parent, style);
183 }
184
185 ~wxMDIClientWindow(void);
186
187 // Note: this is virtual, to allow overridden behaviour.
188 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
189
190 // Explicitly call default scroll behaviour
191 void OnScroll(wxScrollEvent& event);
192
193 // Window procedure
194 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
195
196 // Calls an appropriate default window procedure
197 virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
198
199 // Should hand the message to the default proc
200 long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
201
202 protected:
203 int m_scrollX;
204 int m_scrollY;
205 DECLARE_EVENT_TABLE()
206 };
207
208 #endif
209 // _WX_MDI_H_