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