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