]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/mdi.cpp
no real change: just rename "near" into "onNearPart" (MSVC doesn't like 'near' as...
[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
28
29 #include "wx/mdi.h"
30
31 #ifndef WX_PRECOMP
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"
37 #include "wx/statusbr.h"
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/palmos/private.h"
45
46 #if wxUSE_STATUSBAR && wxUSE_NATIVE_STATUSBAR
47 #include "wx/palmos/statbr95.h"
48 #endif
49
50 #include <string.h>
51
52 // ---------------------------------------------------------------------------
53 // global variables
54 // ---------------------------------------------------------------------------
55
56 extern wxMenu *wxCurrentPopupMenu;
57
58 extern const wxChar *wxMDIFrameClassName; // from app.cpp
59 extern const wxChar *wxMDIChildFrameClassName;
60 extern const wxChar *wxMDIChildFrameClassNameNoRedraw;
61 extern void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win);
62 extern void wxRemoveHandleAssociation(wxWindow *win);
63
64
65 // ---------------------------------------------------------------------------
66 // constants
67 // ---------------------------------------------------------------------------
68
69 static const int IDM_WINDOWTILE = 4001;
70 static const int IDM_WINDOWTILEHOR = 4001;
71 static const int IDM_WINDOWCASCADE = 4002;
72 static const int IDM_WINDOWICONS = 4003;
73 static const int IDM_WINDOWNEXT = 4004;
74 static const int IDM_WINDOWTILEVERT = 4005;
75 static const int IDM_WINDOWPREV = 4006;
76
77 // This range gives a maximum of 500 MDI children. Should be enough :-)
78 static const int wxFIRST_MDI_CHILD = 4100;
79 static const int wxLAST_MDI_CHILD = 4600;
80
81 // Status border dimensions
82 static const int wxTHICK_LINE_BORDER = 3;
83 static 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)
91 static 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
95 static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu);
96
97 // Remove the window menu
98 static void RemoveWindowMenu(wxWindow *win, WXHMENU menu);
99
100 // is this an id of an MDI child?
101 inline 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
107 static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam,
108 WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact);
109
110 // return the HMENU of the MDI menu
111 static 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
125 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
126 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
127 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
128
129 BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
130 EVT_SIZE(wxMDIParentFrame::OnSize)
131 END_EVENT_TABLE()
132
133 BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame)
134 EVT_IDLE(wxMDIChildFrame::OnIdle)
135 END_EVENT_TABLE()
136
137 BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
138 EVT_SCROLL(wxMDIClientWindow::OnScroll)
139 END_EVENT_TABLE()
140
141 // ===========================================================================
142 // wxMDIParentFrame: the frame which contains the client window which manages
143 // the children
144 // ===========================================================================
145
146 wxMDIParentFrame::wxMDIParentFrame()
147 {
148 }
149
150 bool 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
161 wxMDIParentFrame::~wxMDIParentFrame()
162 {
163 }
164
165 #if wxUSE_MENUS_NATIVE
166
167 void wxMDIParentFrame::InternalSetMenuBar()
168 {
169 }
170
171 #endif // wxUSE_MENUS_NATIVE
172
173 void wxMDIParentFrame::SetWindowMenu(wxMenu* menu)
174 {
175 }
176
177 void wxMDIParentFrame::OnSize(wxSizeEvent&)
178 {
179 }
180
181 // Returns the active MDI child window
182 wxMDIChildFrame *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)
189 wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
190 {
191 return new wxMDIClientWindow;
192 }
193
194 WXHICON 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
204 void wxMDIParentFrame::Cascade()
205 {
206 }
207
208 void wxMDIParentFrame::Tile()
209 {
210 }
211
212 void wxMDIParentFrame::ArrangeIcons()
213 {
214 }
215
216 void wxMDIParentFrame::ActivateNext()
217 {
218 }
219
220 void wxMDIParentFrame::ActivatePrevious()
221 {
222 }
223
224 // ---------------------------------------------------------------------------
225 // the MDI parent frame window proc
226 // ---------------------------------------------------------------------------
227
228 WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message,
229 WXWPARAM wParam,
230 WXLPARAM lParam)
231 {
232 return 0;
233 }
234
235 WXLRESULT wxMDIParentFrame::MSWDefWindowProc(WXUINT message,
236 WXWPARAM wParam,
237 WXLPARAM lParam)
238 {
239 return 0;
240 }
241
242 bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
243 {
244 return false;
245 }
246
247 // ===========================================================================
248 // wxMDIChildFrame
249 // ===========================================================================
250
251 void wxMDIChildFrame::Init()
252 {
253 }
254
255 bool 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
266 wxMDIChildFrame::~wxMDIChildFrame()
267 {
268 }
269
270 // Set the client size (i.e. leave the calculation of borders etc.
271 // to wxWidgets)
272 void wxMDIChildFrame::DoSetClientSize(int width, int height)
273 {
274 }
275
276 void wxMDIChildFrame::DoGetPosition(int *x, int *y) const
277 {
278 }
279
280 void wxMDIChildFrame::InternalSetMenuBar()
281 {
282 }
283
284 WXHICON 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
294 void wxMDIChildFrame::Maximize(bool maximize)
295 {
296 }
297
298 void wxMDIChildFrame::Restore()
299 {
300 }
301
302 void wxMDIChildFrame::Activate()
303 {
304 }
305
306 // ---------------------------------------------------------------------------
307 // MDI window proc and message handlers
308 // ---------------------------------------------------------------------------
309
310 WXLRESULT wxMDIChildFrame::MSWWindowProc(WXUINT message,
311 WXWPARAM wParam,
312 WXLPARAM lParam)
313 {
314 return 0;
315 }
316
317 bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate),
318 WXHWND hwndAct,
319 WXHWND hwndDeact)
320 {
321 return false;
322 }
323
324 bool wxMDIChildFrame::HandleWindowPosChanging(void *pos)
325 {
326 return false;
327 }
328
329 // ---------------------------------------------------------------------------
330 // MDI specific message translation/preprocessing
331 // ---------------------------------------------------------------------------
332
333 WXLRESULT wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
334 {
335 return 0;
336 }
337
338 bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
339 {
340 return false;
341 }
342
343 // ---------------------------------------------------------------------------
344 // misc
345 // ---------------------------------------------------------------------------
346
347 void 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.)
353 bool 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
363 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
364 {
365 return false;
366 }
367
368 // Explicitly call default scroll behaviour
369 void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
370 {
371 event.Skip();
372 }
373
374 void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
375 {
376 }
377
378 void wxMDIChildFrame::OnIdle(wxIdleEvent& event)
379 {
380 event.Skip();
381 }
382
383 // ---------------------------------------------------------------------------
384 // non member functions
385 // ---------------------------------------------------------------------------
386
387 static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow)
388 {
389 }
390
391 static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu)
392 {
393 }
394
395 static void RemoveWindowMenu(wxWindow *win, WXHMENU menu)
396 {
397 }
398
399 static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam,
400 WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact)
401 {
402 }
403
404 #endif // wxUSE_MDI