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