]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/mdi.cpp
Include wx/toolbar.h according to precompiled headers of wx/wx.h (with other minor...
[wxWidgets.git] / src / palmos / mdi.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/mdi.cpp
3 // Purpose: MDI classes for wx
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ===========================================================================
13 // declarations
14 // ===========================================================================
15
16 // ---------------------------------------------------------------------------
17 // headers
18 // ---------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #if wxUSE_MDI && !defined(__WXUNIVERSAL__)
28
29 #ifndef WX_PRECOMP
30 #include "wx/frame.h"
31 #include "wx/menu.h"
32 #include "wx/app.h"
33 #include "wx/utils.h"
34 #include "wx/dialog.h"
35 #if wxUSE_STATUSBAR
36 #include "wx/statusbr.h"
37 #endif
38 #include "wx/settings.h"
39 #include "wx/intl.h"
40 #include "wx/log.h"
41 #include "wx/toolbar.h"
42 #endif
43
44 #include "wx/mdi.h"
45 #include "wx/palmos/private.h"
46
47 #if wxUSE_STATUSBAR && wxUSE_NATIVE_STATUSBAR
48 #include "wx/palmos/statbr95.h"
49 #endif
50
51 #include <string.h>
52
53 // ---------------------------------------------------------------------------
54 // global variables
55 // ---------------------------------------------------------------------------
56
57 extern wxMenu *wxCurrentPopupMenu;
58
59 extern const wxChar *wxMDIFrameClassName; // from app.cpp
60 extern const wxChar *wxMDIChildFrameClassName;
61 extern const wxChar *wxMDIChildFrameClassNameNoRedraw;
62 extern void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win);
63 extern void wxRemoveHandleAssociation(wxWindow *win);
64
65
66 // ---------------------------------------------------------------------------
67 // constants
68 // ---------------------------------------------------------------------------
69
70 static const int IDM_WINDOWTILE = 4001;
71 static const int IDM_WINDOWTILEHOR = 4001;
72 static const int IDM_WINDOWCASCADE = 4002;
73 static const int IDM_WINDOWICONS = 4003;
74 static const int IDM_WINDOWNEXT = 4004;
75 static const int IDM_WINDOWTILEVERT = 4005;
76 static const int IDM_WINDOWPREV = 4006;
77
78 // This range gives a maximum of 500 MDI children. Should be enough :-)
79 static const int wxFIRST_MDI_CHILD = 4100;
80 static const int wxLAST_MDI_CHILD = 4600;
81
82 // Status border dimensions
83 static const int wxTHICK_LINE_BORDER = 3;
84 static const int wxTHICK_LINE_WIDTH = 1;
85
86 // ---------------------------------------------------------------------------
87 // private functions
88 // ---------------------------------------------------------------------------
89
90 // set the MDI menus (by sending the WM_MDISETMENU message) and update the menu
91 // of the parent of win (which is supposed to be the MDI client window)
92 static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow);
93
94 // insert the window menu (subMenu) into menu just before "Help" submenu or at
95 // the very end if not found
96 static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu);
97
98 // Remove the window menu
99 static void RemoveWindowMenu(wxWindow *win, WXHMENU menu);
100
101 // is this an id of an MDI child?
102 inline bool IsMdiCommandId(int id)
103 {
104 return (id >= wxFIRST_MDI_CHILD) && (id <= wxLAST_MDI_CHILD);
105 }
106
107 // unpack the parameters of WM_MDIACTIVATE message
108 static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam,
109 WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact);
110
111 // return the HMENU of the MDI menu
112 static inline HMENU GetMDIWindowMenu(wxMDIParentFrame *frame)
113 {
114 wxMenu *menu = frame->GetWindowMenu();
115 return menu ? GetHmenuOf(menu) : 0;
116 }
117
118 // ===========================================================================
119 // implementation
120 // ===========================================================================
121
122 // ---------------------------------------------------------------------------
123 // wxWin macros
124 // ---------------------------------------------------------------------------
125
126 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
127 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
128 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
129
130 BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
131 EVT_SIZE(wxMDIParentFrame::OnSize)
132 END_EVENT_TABLE()
133
134 BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame)
135 EVT_IDLE(wxMDIChildFrame::OnIdle)
136 END_EVENT_TABLE()
137
138 BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
139 EVT_SCROLL(wxMDIClientWindow::OnScroll)
140 END_EVENT_TABLE()
141
142 // ===========================================================================
143 // wxMDIParentFrame: the frame which contains the client window which manages
144 // the children
145 // ===========================================================================
146
147 wxMDIParentFrame::wxMDIParentFrame()
148 {
149 }
150
151 bool wxMDIParentFrame::Create(wxWindow *parent,
152 wxWindowID id,
153 const wxString& title,
154 const wxPoint& pos,
155 const wxSize& size,
156 long style,
157 const wxString& name)
158 {
159 return false;
160 }
161
162 wxMDIParentFrame::~wxMDIParentFrame()
163 {
164 }
165
166 #if wxUSE_MENUS_NATIVE
167
168 void wxMDIParentFrame::InternalSetMenuBar()
169 {
170 }
171
172 #endif // wxUSE_MENUS_NATIVE
173
174 void wxMDIParentFrame::SetWindowMenu(wxMenu* menu)
175 {
176 }
177
178 void wxMDIParentFrame::OnSize(wxSizeEvent&)
179 {
180 }
181
182 // Returns the active MDI child window
183 wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
184 {
185 return NULL;
186 }
187
188 // Create the client window class (don't Create the window, just return a new
189 // class)
190 wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
191 {
192 return new wxMDIClientWindow;
193 }
194
195 WXHICON wxMDIParentFrame::GetDefaultIcon() const
196 {
197 // we don't have any standard icons (any more)
198 return (WXHICON)0;
199 }
200
201 // ---------------------------------------------------------------------------
202 // MDI operations
203 // ---------------------------------------------------------------------------
204
205 void wxMDIParentFrame::Cascade()
206 {
207 }
208
209 void wxMDIParentFrame::Tile()
210 {
211 }
212
213 void wxMDIParentFrame::ArrangeIcons()
214 {
215 }
216
217 void wxMDIParentFrame::ActivateNext()
218 {
219 }
220
221 void wxMDIParentFrame::ActivatePrevious()
222 {
223 }
224
225 // ---------------------------------------------------------------------------
226 // the MDI parent frame window proc
227 // ---------------------------------------------------------------------------
228
229 WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message,
230 WXWPARAM wParam,
231 WXLPARAM lParam)
232 {
233 return 0;
234 }
235
236 WXLRESULT wxMDIParentFrame::MSWDefWindowProc(WXUINT message,
237 WXWPARAM wParam,
238 WXLPARAM lParam)
239 {
240 return 0;
241 }
242
243 bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
244 {
245 return false;
246 }
247
248 // ===========================================================================
249 // wxMDIChildFrame
250 // ===========================================================================
251
252 void wxMDIChildFrame::Init()
253 {
254 }
255
256 bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
257 wxWindowID id,
258 const wxString& title,
259 const wxPoint& pos,
260 const wxSize& size,
261 long style,
262 const wxString& name)
263 {
264 return false;
265 }
266
267 wxMDIChildFrame::~wxMDIChildFrame()
268 {
269 }
270
271 // Set the client size (i.e. leave the calculation of borders etc.
272 // to wxWidgets)
273 void wxMDIChildFrame::DoSetClientSize(int width, int height)
274 {
275 }
276
277 void wxMDIChildFrame::DoGetPosition(int *x, int *y) const
278 {
279 }
280
281 void wxMDIChildFrame::InternalSetMenuBar()
282 {
283 }
284
285 WXHICON wxMDIChildFrame::GetDefaultIcon() const
286 {
287 // we don't have any standard icons (any more)
288 return (WXHICON)0;
289 }
290
291 // ---------------------------------------------------------------------------
292 // MDI operations
293 // ---------------------------------------------------------------------------
294
295 void wxMDIChildFrame::Maximize(bool maximize)
296 {
297 }
298
299 void wxMDIChildFrame::Restore()
300 {
301 }
302
303 void wxMDIChildFrame::Activate()
304 {
305 }
306
307 // ---------------------------------------------------------------------------
308 // MDI window proc and message handlers
309 // ---------------------------------------------------------------------------
310
311 WXLRESULT wxMDIChildFrame::MSWWindowProc(WXUINT message,
312 WXWPARAM wParam,
313 WXLPARAM lParam)
314 {
315 return 0;
316 }
317
318 bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate),
319 WXHWND hwndAct,
320 WXHWND hwndDeact)
321 {
322 return false;
323 }
324
325 bool wxMDIChildFrame::HandleWindowPosChanging(void *pos)
326 {
327 return false;
328 }
329
330 // ---------------------------------------------------------------------------
331 // MDI specific message translation/preprocessing
332 // ---------------------------------------------------------------------------
333
334 WXLRESULT wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
335 {
336 return 0;
337 }
338
339 bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
340 {
341 return false;
342 }
343
344 // ---------------------------------------------------------------------------
345 // misc
346 // ---------------------------------------------------------------------------
347
348 void wxMDIChildFrame::MSWDestroyWindow()
349 {
350 }
351
352 // Change the client window's extended style so we don't get a client edge
353 // style when a child is maximised (a double border looks silly.)
354 bool wxMDIChildFrame::ResetWindowStyle(void *vrect)
355 {
356 return false;
357 }
358
359 // ===========================================================================
360 // wxMDIClientWindow: the window of predefined (by Windows) class which
361 // contains the child frames
362 // ===========================================================================
363
364 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
365 {
366 return false;
367 }
368
369 // Explicitly call default scroll behaviour
370 void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
371 {
372 event.Skip();
373 }
374
375 void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
376 {
377 }
378
379 void wxMDIChildFrame::OnIdle(wxIdleEvent& event)
380 {
381 event.Skip();
382 }
383
384 // ---------------------------------------------------------------------------
385 // non member functions
386 // ---------------------------------------------------------------------------
387
388 static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow)
389 {
390 }
391
392 static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu)
393 {
394 }
395
396 static void RemoveWindowMenu(wxWindow *win, WXHMENU menu)
397 {
398 }
399
400 static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam,
401 WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact)
402 {
403 }
404
405 #endif // wxUSE_MDI && !defined(__WXUNIVERSAL__)