]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/mdi.h
shows different SetCursor() calls
[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 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 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 // Gets the size available for subwindows after menu size, toolbar size
69 // and status bar size have been subtracted. If you want to manage your own
70 // toolbar(s), don't call SetToolBar.
71 void GetClientSize(int *width, int *height) const;
72 wxSize GetClientSize() const { return wxWindow::GetClientSize(); }
73
74 // Get the active MDI child window (Windows only)
75 wxMDIChildFrame *GetActiveChild(void) const ;
76
77 // Get the client window
78 inline wxMDIClientWindow *GetClientWindow(void) const ;
79
80 // Create the client window class (don't Create the window,
81 // just return a new class)
82 virtual wxMDIClientWindow *OnCreateClient(void) ;
83
84 inline WXHMENU GetWindowMenu(void) const ;
85
86 // MDI operations
87 virtual void Cascade(void);
88 virtual void Tile(void);
89 virtual void ArrangeIcons(void);
90 virtual void ActivateNext(void);
91 virtual void ActivatePrevious(void);
92
93 // Handlers
94 void MSWOnSize(int x, int y, WXUINT flag);
95 bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
96 void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
97 bool MSWProcessMessage(WXMSG *msg);
98 bool MSWTranslateMessage(WXMSG *msg);
99 void MSWOnCreate(WXLPCREATESTRUCT cs);
100 long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
101 bool MSWOnEraseBkgnd(WXHDC pDC);
102 bool MSWOnDestroy(void);
103 bool MSWOnActivate(int state, bool minimized, 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 DECLARE_EVENT_TABLE()
115 };
116
117 // Inlines
118 inline wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow; }
119 inline WXHMENU wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu; }
120
121 class WXDLLEXPORT wxMDIChildFrame: public wxFrame
122 {
123 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
124 public:
125
126 wxMDIChildFrame(void);
127 inline wxMDIChildFrame(wxMDIParentFrame *parent,
128 wxWindowID id,
129 const wxString& title,
130 const wxPoint& pos = wxDefaultPosition,
131 const wxSize& size = wxDefaultSize,
132 long style = wxDEFAULT_FRAME_STYLE,
133 const wxString& name = wxFrameNameStr)
134 {
135 Create(parent, id, title, pos, size, style, name);
136 }
137
138 ~wxMDIChildFrame(void);
139
140 bool Create(wxMDIParentFrame *parent,
141 wxWindowID id,
142 const wxString& title,
143 const wxPoint& pos = wxDefaultPosition,
144 const wxSize& size = wxDefaultSize,
145 long style = wxDEFAULT_FRAME_STYLE,
146 const wxString& name = wxFrameNameStr);
147
148 // Set menu bar
149 void SetMenuBar(wxMenuBar *menu_bar);
150
151 void SetClientSize(int width, int height);
152 void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); }
153
154 void GetPosition(int *x, int *y) const ;
155 wxPoint GetPosition() const { return wxWindow::GetPosition(); }
156
157 // MDI operations
158 virtual void Maximize(void);
159 virtual void Restore(void);
160 virtual void Activate(void);
161
162 // Handlers
163
164 long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
165 void MSWOnSize(int x, int y, WXUINT);
166 void MSWOnWindowPosChanging(void *lpPos);
167 bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
168 long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
169 bool MSWProcessMessage(WXMSG *msg);
170 bool MSWTranslateMessage(WXMSG *msg);
171 void MSWDestroyWindow(void);
172
173 // Implementation
174 bool ResetWindowStyle(void *vrect);
175 protected:
176 // bool m_active;
177 };
178
179 class WXDLLEXPORT wxMDIClientWindow: public wxWindow
180 {
181 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
182 public:
183
184 wxMDIClientWindow(void) ;
185 inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
186 {
187 CreateClient(parent, style);
188 }
189
190 ~wxMDIClientWindow(void);
191
192 // Note: this is virtual, to allow overridden behaviour.
193 virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
194
195 // Explicitly call default scroll behaviour
196 void OnScroll(wxScrollEvent& event);
197
198 // Window procedure
199 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
200
201 // Calls an appropriate default window procedure
202 virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
203
204 // Should hand the message to the default proc
205 long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
206
207 protected:
208 int m_scrollX;
209 int m_scrollY;
210 DECLARE_EVENT_TABLE()
211 };
212
213 #endif
214 // _WX_MDI_H_