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