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