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