Start of actual filling in of wxFrame. Makefile now supports tiff
[wxWidgets.git] / src / os2 / frame.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: frame.cpp
3 // Purpose: wxFrame
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/27/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #ifndef WX_PRECOMP
16 #include "wx/setup.h"
17 #include "wx/frame.h"
18 #include "wx/menu.h"
19 #include "wx/app.h"
20 #include "wx/utils.h"
21 #include "wx/dialog.h"
22 #include "wx/settings.h"
23 #include "wx/dcclient.h"
24 #endif // WX_PRECOMP
25
26 #include "wx/os2/private.h"
27
28 #if wxUSE_STATUSBAR
29 #include "wx/statusbr.h"
30 #include "wx/generic/statusbr.h"
31 #endif // wxUSE_STATUSBAR
32
33 #if wxUSE_TOOLBAR
34 #include "wx/toolbar.h"
35 #endif // wxUSE_TOOLBAR
36
37 #include "wx/menuitem.h"
38 #include "wx/log.h"
39
40 // ----------------------------------------------------------------------------
41 // globals
42 // ----------------------------------------------------------------------------
43
44 extern wxWindowList wxModelessWindows;
45 extern wxList WXDLLEXPORT wxPendingDelete;
46 extern wxChar wxFrameClassName[];
47 extern wxMenu *wxCurrentPopupMenu;
48
49 // ----------------------------------------------------------------------------
50 // event tables
51 // ----------------------------------------------------------------------------
52
53 BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
54 EVT_ACTIVATE(wxFrame::OnActivate)
55 EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
56 END_EVENT_TABLE()
57
58 IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
59
60 // ============================================================================
61 // implementation
62 // ============================================================================
63
64 // ----------------------------------------------------------------------------
65 // static class members
66 // ----------------------------------------------------------------------------
67
68 #if wxUSE_NATIVE_STATUSBAR
69 bool wxFrame::m_useNativeStatusBar = TRUE;
70 #else
71 bool wxFrame::m_useNativeStatusBar = FALSE;
72 #endif
73
74 // ----------------------------------------------------------------------------
75 // creation/destruction
76 // ----------------------------------------------------------------------------
77
78 void wxFrame::Init()
79 {
80 m_iconized = FALSE;
81
82 #if wxUSE_TOOLTIPS
83 m_hwndToolTip = 0;
84 #endif
85 // Data to save/restore when calling ShowFullScreen
86 m_lFsStyle = 0L;
87 m_lFsOldWindowStyle = 0L;
88 m_nFsStatusBarFields = 0;
89 m_nFsStatusBarHeight = 0;
90 m_nFsToolBarHeight = 0;
91 m_bFsIsMaximized = FALSE;
92 m_bFsIsShowing = FALSE;
93 } // end of wxFrame::Init
94
95 bool wxFrame::Create(
96 wxWindow* pParent
97 , wxWindowID vId
98 , const wxString& rsTitle
99 , const wxPoint& rPos
100 , const wxSize& rSize
101 , long lStyle
102 , const wxString& rsName
103 )
104 {
105 int nX = rPos.x;
106 int nY = rPos.y;
107 int nWidth = rSize.x;
108 int nHeight = rSize.y;
109 SWP vSwp;
110
111 SetName(rsName);
112 m_windowStyle = lStyle;
113 m_frameMenuBar = NULL;
114 m_frameToolBar = NULL;
115 m_frameStatusBar = NULL;
116
117 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
118
119 if (vId > -1 )
120 m_windowId = vId;
121 else
122 m_windowId = (int)NewControlId();
123
124 if (pParent)
125 pParent->AddChild(this);
126
127 m_bIconized = FALSE;
128
129 //
130 // We pass NULL as parent to MSWCreate because frames with parents behave
131 // very strangely under Win95 shell.
132 // Alteration by JACS: keep normal Windows behaviour (float on top of parent)
133 // with this style.
134 //
135 if ((m_windowStyle & wxFRAME_FLOAT_ON_PARENT) == 0)
136 pParent = NULL;
137
138 if (!pParent)
139 wxTopLevelWindows.Append(this);
140
141 OS2Create( m_windowId
142 ,pParent
143 ,wxFrameClassName
144 ,this
145 ,rsTitle
146 ,nX
147 ,nY
148 ,nWidth
149 ,nHeight
150 ,lStyle
151 );
152
153 wxModelessWindows.Append(this);
154 return TRUE;
155 } // end of wxFrame::Create
156
157 wxFrame::~wxFrame()
158 {
159 m_isBeingDeleted = TRUE;
160 wxTopLevelWindows.DeleteObject(this);
161
162 DeleteAllBars();
163
164 if (wxTheApp && (wxTopLevelWindows.Number() == 0))
165 {
166 wxTheApp->SetTopWindow(NULL);
167
168 if (wxTheApp->GetExitOnFrameDelete())
169 {
170 ::WinPostMsg(m_hwnd, WM_QUIT, 0, 0);
171 }
172 }
173 wxModelessWindows.DeleteObject(this);
174
175 //
176 // For some reason, wxWindows can activate another task altogether
177 // when a frame is destroyed after a modal dialog has been invoked.
178 // Try to bring the parent to the top.
179 //
180 // MT:Only do this if this frame is currently the active window, else weird
181 // things start to happen.
182 //
183 if (wxGetActiveWindow() == this)
184 {
185 if (GetParent() && GetParent()->GetHWND())
186 {
187 ::WinQueryWindowPos( (HWND) GetParent()->GetHWND()
188 ,&vSwp
189 );
190 ::WinSetWindowPos( (HWND) GetParent()->GetHWND()
191 ,HWND_TOP
192 ,vSwp.x
193 ,vSwp.y
194 ,vSwp.cx
195 ,vSwp,cy
196 ,SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW
197 );
198 }
199 }
200 } // end of wxFrame::~wxFrame
201
202 //
203 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
204 //
205 void wxFrame::DoGetClientSize(int *x, int *y) const
206 {
207 // TODO:
208 /*
209 RECT rect;
210 ::GetClientRect(GetHwnd(), &rect);
211
212 #if wxUSE_STATUSBAR
213 if ( GetStatusBar() )
214 {
215 int statusX, statusY;
216 GetStatusBar()->GetClientSize(&statusX, &statusY);
217 rect.bottom -= statusY;
218 }
219 #endif // wxUSE_STATUSBAR
220
221 wxPoint pt(GetClientAreaOrigin());
222 rect.bottom -= pt.y;
223 rect.right -= pt.x;
224
225 if ( x )
226 *x = rect.right;
227 if ( y )
228 *y = rect.bottom;
229 */
230 }
231
232 // Set the client size (i.e. leave the calculation of borders etc.
233 // to wxWindows)
234 void wxFrame::DoSetClientSize(int width, int height)
235 {
236 HWND hWnd = GetHwnd();
237
238 // TODO:
239 /*
240 RECT rect;
241 ::GetClientRect(hWnd, &rect);
242
243 RECT rect2;
244 GetWindowRect(hWnd, &rect2);
245
246 // Find the difference between the entire window (title bar and all)
247 // and the client area; add this to the new client size to move the
248 // window
249 int actual_width = rect2.right - rect2.left - rect.right + width;
250 int actual_height = rect2.bottom - rect2.top - rect.bottom + height;
251
252 #if wxUSE_STATUSBAR
253 if ( GetStatusBar() )
254 {
255 int statusX, statusY;
256 GetStatusBar()->GetClientSize(&statusX, &statusY);
257 actual_height += statusY;
258 }
259 #endif // wxUSE_STATUSBAR
260
261 wxPoint pt(GetClientAreaOrigin());
262 actual_width += pt.y;
263 actual_height += pt.x;
264
265 POINT point;
266 point.x = rect2.left;
267 point.y = rect2.top;
268
269 MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)TRUE);
270
271 wxSizeEvent event(wxSize(width, height), m_windowId);
272 event.SetEventObject( this );
273 GetEventHandler()->ProcessEvent(event);
274 */
275 }
276
277 void wxFrame::DoGetSize(int *width, int *height) const
278 {
279 // TODO:
280 /*
281 RECT rect;
282 GetWindowRect(GetHwnd(), &rect);
283 *width = rect.right - rect.left;
284 *height = rect.bottom - rect.top;
285 */
286 }
287
288 void wxFrame::DoGetPosition(int *x, int *y) const
289 {
290 // TODO:
291 /*
292 RECT rect;
293 GetWindowRect(GetHwnd(), &rect);
294 POINT point;
295 point.x = rect.left;
296 point.y = rect.top;
297
298 *x = point.x;
299 *y = point.y;
300 */
301 }
302
303 // ----------------------------------------------------------------------------
304 // variations around ::ShowWindow()
305 // ----------------------------------------------------------------------------
306
307 void wxFrame::DoShowWindow(int nShowCmd)
308 {
309 // TODO:
310 /*
311 ::ShowWindow(GetHwnd(), nShowCmd);
312
313 m_iconized = nShowCmd == SW_MINIMIZE;
314 */
315 }
316
317 bool wxFrame::Show(bool show)
318 {
319 // TODO:
320 /*
321 DoShowWindow(show ? SW_SHOW : SW_HIDE);
322
323 if ( show )
324 {
325 ::BringWindowToTop(GetHwnd());
326
327 wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId);
328 event.SetEventObject( this );
329 GetEventHandler()->ProcessEvent(event);
330 }
331 else
332 {
333 // Try to highlight the correct window (the parent)
334 if ( GetParent() )
335 {
336 HWND hWndParent = GetHwndOf(GetParent());
337 if (hWndParent)
338 ::BringWindowToTop(hWndParent);
339 }
340 }
341 */
342 return TRUE;
343 }
344
345 void wxFrame::Iconize(bool iconize)
346 {
347 // DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE);
348 }
349
350 void wxFrame::Maximize(bool maximize)
351 {
352 // DoShowWindow(maximize ? SW_MAXIMIZE : SW_RESTORE);
353 }
354
355 void wxFrame::Restore()
356 {
357 // DoShowWindow(SW_RESTORE);
358 }
359
360 bool wxFrame::IsIconized() const
361 {
362 // TODO:
363 /*
364 ((wxFrame *)this)->m_iconized = (::IsIconic(GetHwnd()) != 0);
365 return m_iconized;
366 */
367 return FALSE;
368 }
369
370 // Is it maximized?
371 bool wxFrame::IsMaximized() const
372 {
373 // TODO:
374 /*
375 return (::IsZoomed(GetHwnd()) != 0);
376 */
377 return FALSE;
378 }
379
380 void wxFrame::SetIcon(const wxIcon& icon)
381 {
382 wxFrameBase::SetIcon(icon);
383
384 // TODO:
385 /*
386 if ( m_icon.Ok() )
387 {
388 SendMessage(GetHwnd(), WM_SETICON,
389 (WPARAM)TRUE, (LPARAM)(HICON) m_icon.GetHICON());
390 }
391 */
392 }
393
394 #if wxUSE_STATUSBAR
395 wxStatusBar *wxFrame::OnCreateStatusBar(int number,
396 long style,
397 wxWindowID id,
398 const wxString& name)
399 {
400 wxStatusBar *statusBar = NULL;
401
402 statusBar = wxFrameBase::OnCreateStatusBar(number, style, id, name);
403
404 return statusBar;
405 }
406
407 void wxFrame::PositionStatusBar()
408 {
409 // TODO:
410 /*
411 // native status bar positions itself
412 if ( m_frameStatusBar )
413 {
414 int w, h;
415 GetClientSize(&w, &h);
416 int sw, sh;
417 m_frameStatusBar->GetSize(&sw, &sh);
418
419 // Since we wish the status bar to be directly under the client area,
420 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
421 m_frameStatusBar->SetSize(0, h, w, sh);
422 }
423 */
424 }
425 #endif // wxUSE_STATUSBAR
426
427 void wxFrame::DetachMenuBar()
428 {
429 if (m_frameMenuBar)
430 {
431 m_frameMenuBar->Detach();
432 m_frameMenuBar = NULL;
433 }
434 }
435
436 void wxFrame::SetMenuBar(wxMenuBar *menu_bar)
437 {
438 if (!menu_bar)
439 {
440 DetachMenuBar();
441 return;
442 }
443
444 wxCHECK_RET( !menu_bar->GetFrame(), wxT("this menubar is already attached") );
445
446 if (m_frameMenuBar)
447 delete m_frameMenuBar;
448
449 m_hMenu = menu_bar->Create();
450
451 if ( !m_hMenu )
452 return;
453
454 InternalSetMenuBar();
455
456 m_frameMenuBar = menu_bar;
457 menu_bar->Attach(this);
458 }
459
460 void wxFrame::InternalSetMenuBar()
461 {
462 // TODO:
463 /*
464 if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) )
465 {
466 wxLogLastError("SetMenu");
467 }
468 */
469 }
470
471 // Responds to colour changes, and passes event on to children.
472 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
473 {
474 // TODO:
475 /*
476 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
477 Refresh();
478
479 if ( m_frameStatusBar )
480 {
481 wxSysColourChangedEvent event2;
482 event2.SetEventObject( m_frameStatusBar );
483 m_frameStatusBar->GetEventHandler()->ProcessEvent(event2);
484 }
485
486 // Propagate the event to the non-top-level children
487 wxWindow::OnSysColourChanged(event);
488 */
489 }
490
491 /*
492 * Frame window
493 *
494 */
495
496 bool wxFrame::OS2Create(int id, wxWindow *parent, const wxChar *wclass, wxWindow *wx_win, const wxChar *title,
497 int x, int y, int width, int height, long style)
498
499 {
500 m_defaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON);
501
502 // If child windows aren't properly drawn initially, WS_CLIPCHILDREN
503 // could be the culprit. But without it, you can get a lot of flicker.
504
505 // TODO:
506 /*
507 DWORD msflags = 0;
508 if ((style & wxCAPTION) == wxCAPTION)
509 msflags = WS_OVERLAPPED;
510 else
511 msflags = WS_POPUP;
512
513 if (style & wxMINIMIZE_BOX)
514 msflags |= WS_MINIMIZEBOX;
515 if (style & wxMAXIMIZE_BOX)
516 msflags |= WS_MAXIMIZEBOX;
517 if (style & wxTHICK_FRAME)
518 msflags |= WS_THICKFRAME;
519 if (style & wxSYSTEM_MENU)
520 msflags |= WS_SYSMENU;
521 if ((style & wxMINIMIZE) || (style & wxICONIZE))
522 msflags |= WS_MINIMIZE;
523 if (style & wxMAXIMIZE)
524 msflags |= WS_MAXIMIZE;
525 if (style & wxCAPTION)
526 msflags |= WS_CAPTION;
527 if (style & wxCLIP_CHILDREN)
528 msflags |= WS_CLIPCHILDREN;
529
530 // Keep this in wxFrame because it saves recoding this function
531 // in wxTinyFrame
532 #if wxUSE_ITSY_BITSY
533 if (style & wxTINY_CAPTION_VERT)
534 msflags |= IBS_VERTCAPTION;
535 if (style & wxTINY_CAPTION_HORIZ)
536 msflags |= IBS_HORZCAPTION;
537 #else
538 if (style & wxTINY_CAPTION_VERT)
539 msflags |= WS_CAPTION;
540 if (style & wxTINY_CAPTION_HORIZ)
541 msflags |= WS_CAPTION;
542 #endif
543 if ((style & wxTHICK_FRAME) == 0)
544 msflags |= WS_BORDER;
545
546 WXDWORD extendedStyle = MakeExtendedStyle(style);
547
548 #if !defined(__WIN16__) && !defined(__SC__)
549 if (style & wxFRAME_TOOL_WINDOW)
550 extendedStyle |= WS_EX_TOOLWINDOW;
551 #endif
552
553 if (style & wxSTAY_ON_TOP)
554 extendedStyle |= WS_EX_TOPMOST;
555
556 m_iconized = FALSE;
557 if ( !wxWindow::MSWCreate(id, parent, wclass, wx_win, title, x, y, width, height,
558 msflags, NULL, extendedStyle) )
559 return FALSE;
560
561 // Seems to be necessary if we use WS_POPUP
562 // style instead of WS_OVERLAPPED
563 if (width > -1 && height > -1)
564 ::PostMessage(GetHwnd(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(width, height));
565 */
566 return TRUE;
567 }
568
569 // Default activation behaviour - set the focus for the first child
570 // subwindow found.
571 void wxFrame::OnActivate(wxActivateEvent& event)
572 {
573 for ( wxWindowList::Node *node = GetChildren().GetFirst();
574 node;
575 node = node->GetNext() )
576 {
577 // FIXME all this is totally bogus - we need to do the same as wxPanel,
578 // but how to do it without duplicating the code?
579
580 // restore focus
581 wxWindow *child = node->GetData();
582
583 if ( !child->IsTopLevel()
584 #if wxUSE_TOOLBAR
585 && !wxDynamicCast(child, wxToolBar)
586 #endif // wxUSE_TOOLBAR
587 #if wxUSE_STATUSBAR
588 && !wxDynamicCast(child, wxStatusBar)
589 #endif // wxUSE_STATUSBAR
590 )
591 {
592 child->SetFocus();
593 return;
594 }
595 }
596 }
597
598 // ----------------------------------------------------------------------------
599 // wxFrame size management: we exclude the areas taken by menu/status/toolbars
600 // from the client area, so the client area is what's really available for the
601 // frame contents
602 // ----------------------------------------------------------------------------
603
604 // Checks if there is a toolbar, and returns the first free client position
605 wxPoint wxFrame::GetClientAreaOrigin() const
606 {
607 wxPoint pt(0, 0);
608 if (GetToolBar())
609 {
610 int w, h;
611 GetToolBar()->GetSize(& w, & h);
612
613 if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
614 {
615 pt.x += w;
616 }
617 else
618 {
619 pt.y += h;
620 }
621 }
622 return pt;
623 }
624
625 void wxFrame::DoScreenToClient(int *x, int *y) const
626 {
627 wxWindow::DoScreenToClient(x, y);
628
629 // We may be faking the client origin.
630 // So a window that's really at (0, 30) may appear
631 // (to wxWin apps) to be at (0, 0).
632 wxPoint pt(GetClientAreaOrigin());
633 *x -= pt.x;
634 *y -= pt.y;
635 }
636
637 void wxFrame::DoClientToScreen(int *x, int *y) const
638 {
639 // We may be faking the client origin.
640 // So a window that's really at (0, 30) may appear
641 // (to wxWin apps) to be at (0, 0).
642 wxPoint pt1(GetClientAreaOrigin());
643 *x += pt1.x;
644 *y += pt1.y;
645
646 wxWindow::DoClientToScreen(x, y);
647 }
648
649 // ----------------------------------------------------------------------------
650 // tool/status bar stuff
651 // ----------------------------------------------------------------------------
652
653 #if wxUSE_TOOLBAR
654
655 wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
656 {
657 if ( wxFrameBase::CreateToolBar(style, id, name) )
658 {
659 PositionToolBar();
660 }
661
662 return m_frameToolBar;
663 }
664
665 void wxFrame::PositionToolBar()
666 {
667 // TODO:
668 /*
669 RECT rect;
670 ::GetClientRect(GetHwnd(), &rect);
671
672 #if wxUSE_STATUSBAR
673 if ( GetStatusBar() )
674 {
675 int statusX, statusY;
676 GetStatusBar()->GetClientSize(&statusX, &statusY);
677 rect.bottom -= statusY;
678 }
679 #endif // wxUSE_STATUSBAR
680
681 if ( GetToolBar() )
682 {
683 int tw, th;
684 GetToolBar()->GetSize(&tw, &th);
685
686 if ( GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL )
687 {
688 th = rect.bottom;
689 }
690 else
691 {
692 tw = rect.right;
693 }
694
695 // Use the 'real' MSW position here
696 GetToolBar()->SetSize(0, 0, tw, th, wxSIZE_NO_ADJUSTMENTS);
697 }
698 */
699 }
700 #endif // wxUSE_TOOLBAR
701
702 // ----------------------------------------------------------------------------
703 // frame state (iconized/maximized/...)
704 // ----------------------------------------------------------------------------
705
706 // propagate our state change to all child frames: this allows us to emulate X
707 // Windows behaviour where child frames float independently of the parent one
708 // on the desktop, but are iconized/restored with it
709 void wxFrame::IconizeChildFrames(bool bIconize)
710 {
711 for ( wxWindowList::Node *node = GetChildren().GetFirst();
712 node;
713 node = node->GetNext() )
714 {
715 wxWindow *win = node->GetData();
716
717 if ( win->IsKindOf(CLASSINFO(wxFrame)) )
718 {
719 ((wxFrame *)win)->Iconize(bIconize);
720 }
721 }
722 }
723
724 // ===========================================================================
725 // message processing
726 // ===========================================================================
727
728 // ---------------------------------------------------------------------------
729 // preprocessing
730 // ---------------------------------------------------------------------------
731
732 bool wxFrame::OS2TranslateMessage(WXMSG* pMsg)
733 {
734 // TODO:
735 /*
736 if ( wxWindow::OS2TranslateMessage(pMsg) )
737 return TRUE;
738 */
739 // try the menu bar accels
740 wxMenuBar *menuBar = GetMenuBar();
741 if ( !menuBar )
742 return FALSE;
743
744 const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable();
745 return acceleratorTable.Translate(this, pMsg);
746 }
747
748 // ---------------------------------------------------------------------------
749 // our private (non virtual) message handlers
750 // ---------------------------------------------------------------------------
751
752 bool wxFrame::HandlePaint()
753 {
754 // TODO:
755 /*
756 RECT rect;
757 if ( GetUpdateRect(GetHwnd(), &rect, FALSE) )
758 {
759 if ( m_iconized )
760 {
761 HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
762 : (HICON)m_defaultIcon;
763
764 // Hold a pointer to the dc so long as the OnPaint() message
765 // is being processed
766 PAINTSTRUCT ps;
767 HDC hdc = ::BeginPaint(GetHwnd(), &ps);
768
769 // Erase background before painting or we get white background
770 MSWDefWindowProc(WM_ICONERASEBKGND, (WORD)(LONG)ps.hdc, 0L);
771
772 if ( hIcon )
773 {
774 RECT rect;
775 ::GetClientRect(GetHwnd(), &rect);
776
777 // FIXME: why hardcoded?
778 static const int icon_width = 32;
779 static const int icon_height = 32;
780
781 int icon_x = (int)((rect.right - icon_width)/2);
782 int icon_y = (int)((rect.bottom - icon_height)/2);
783
784 ::DrawIcon(hdc, icon_x, icon_y, hIcon);
785 }
786
787 ::EndPaint(GetHwnd(), &ps);
788
789 return TRUE;
790 }
791 else
792 {
793 return wxWindow::HandlePaint();
794 }
795 }
796 else
797 {
798 // nothing to paint - processed
799 return TRUE;
800 }
801 */
802 return FALSE;
803 }
804
805 bool wxFrame::HandleSize(int x, int y, WXUINT id)
806 {
807 bool processed = FALSE;
808
809 // TODO:
810 /*
811 switch ( id )
812 {
813 case SIZENORMAL:
814 // only do it it if we were iconized before, otherwise resizing the
815 // parent frame has a curious side effect of bringing it under it's
816 // children
817 if ( !m_iconized )
818 break;
819
820 // restore all child frames too
821 IconizeChildFrames(FALSE);
822
823 // fall through
824
825 case SIZEFULLSCREEN:
826 m_iconized = FALSE;
827 break;
828
829 case SIZEICONIC:
830 // iconize all child frames too
831 IconizeChildFrames(TRUE);
832
833 m_iconized = TRUE;
834 break;
835 }
836
837 if ( !m_iconized )
838 {
839 // forward WM_SIZE to status bar control
840 #if wxUSE_NATIVE_STATUSBAR
841 if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
842 {
843 wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
844 event.SetEventObject( m_frameStatusBar );
845
846 ((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
847 }
848 #endif // wxUSE_NATIVE_STATUSBAR
849
850 PositionStatusBar();
851 PositionToolBar();
852
853 wxSizeEvent event(wxSize(x, y), m_windowId);
854 event.SetEventObject( this );
855 processed = GetEventHandler()->ProcessEvent(event);
856 }
857 */
858 return processed;
859 }
860
861 bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
862 {
863 // TODO:
864 /*
865 if ( control )
866 {
867 // In case it's e.g. a toolbar.
868 wxWindow *win = wxFindWinFromHandle(control);
869 if ( win )
870 return win->MSWCommand(cmd, id);
871 }
872
873 // handle here commands from menus and accelerators
874 if ( cmd == 0 || cmd == 1 )
875 {
876 if ( wxCurrentPopupMenu )
877 {
878 wxMenu *popupMenu = wxCurrentPopupMenu;
879 wxCurrentPopupMenu = NULL;
880
881 return popupMenu->MSWCommand(cmd, id);
882 }
883
884 if ( ProcessCommand(id) )
885 {
886 return TRUE;
887 }
888 }
889 */
890 return FALSE;
891 }
892
893 bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
894 {
895 int item;
896 if ( flags == 0xFFFF && hMenu == 0 )
897 {
898 // menu was removed from screen
899 item = -1;
900 }
901 // TODO:
902 /*
903 else if ( !(flags & MF_POPUP) && !(flags & MF_SEPARATOR) )
904 {
905 item = nItem;
906 }
907 else
908 {
909 // don't give hints for separators (doesn't make sense) nor for the
910 // items opening popup menus (they don't have them anyhow)
911 return FALSE;
912 }
913 */
914 wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item);
915 event.SetEventObject( this );
916
917 return GetEventHandler()->ProcessEvent(event);
918 }
919
920 // ---------------------------------------------------------------------------
921 // the window proc for wxFrame
922 // ---------------------------------------------------------------------------
923
924 MRESULT wxFrame::OS2WindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
925 {
926 long rc = 0;
927 bool processed = FALSE;
928
929 // TODO:
930 /*
931 switch ( message )
932 {
933 case WM_CLOSE:
934 // if we can't close, tell the system that we processed the
935 // message - otherwise it would close us
936 processed = !Close();
937 break;
938
939 case WM_COMMAND:
940 {
941 WORD id, cmd;
942 WXHWND hwnd;
943 UnpackCommand((WXWPARAM)wParam, (WXLPARAM)lParam,
944 &id, &hwnd, &cmd);
945
946 processed = HandleCommand(id, cmd, (WXHWND)hwnd);
947 }
948 break;
949
950 case WM_MENUSELECT:
951 {
952 WXWORD item, flags;
953 WXHMENU hmenu;
954 UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu);
955
956 processed = HandleMenuSelect(item, flags, hmenu);
957 }
958 break;
959
960 case WM_PAINT:
961 processed = HandlePaint();
962 break;
963
964 case WM_QUERYDRAGICON:
965 {
966 HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
967 : (HICON)(m_defaultIcon);
968 rc = (long)hIcon;
969 processed = rc != 0;
970 }
971 break;
972
973 case WM_SIZE:
974 processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
975 break;
976 }
977
978 if ( !processed )
979 rc = wxWindow::MSWWindowProc(message, wParam, lParam);
980
981 return rc;
982 */
983 return (MRESULT)0;
984 }
985