+ else
+ {
+ // nothing to paint - processed
+ return TRUE;
+ }
+}
+
+bool wxFrame::HandleSize(int x, int y, WXUINT id)
+{
+ bool processed = FALSE;
+
+ switch ( id )
+ {
+ case SIZENORMAL:
+ // only do it it if we were iconized before, otherwise resizing the
+ // parent frame has a curious side effect of bringing it under it's
+ // children
+ if ( !m_iconized )
+ break;
+
+ // restore all child frames too
+ IconizeChildFrames(FALSE);
+
+ // fall through
+
+ case SIZEFULLSCREEN:
+ m_iconized = FALSE;
+ break;
+
+ case SIZEICONIC:
+ // iconize all child frames too
+ IconizeChildFrames(TRUE);
+
+ m_iconized = TRUE;
+ break;
+ }
+
+ if ( !m_iconized )
+ {
+ // forward WM_SIZE to status bar control
+#if wxUSE_NATIVE_STATUSBAR
+ if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
+ {
+ wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
+ event.SetEventObject( m_frameStatusBar );
+
+ ((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
+ }
+#endif // wxUSE_NATIVE_STATUSBAR
+
+ PositionStatusBar();
+ PositionToolBar();
+
+ wxSizeEvent event(wxSize(x, y), m_windowId);
+ event.SetEventObject( this );
+ processed = GetEventHandler()->ProcessEvent(event);
+ }
+
+ return processed;
+}
+
+bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
+{
+ if ( control )
+ {
+ // In case it's e.g. a toolbar.
+ wxWindow *win = wxFindWinFromHandle(control);
+ if ( win )
+ return win->MSWCommand(cmd, id);
+ }
+
+ // handle here commands from menus and accelerators
+ if ( cmd == 0 || cmd == 1 )
+ {
+ if ( wxCurrentPopupMenu )
+ {
+ wxMenu *popupMenu = wxCurrentPopupMenu;
+ wxCurrentPopupMenu = NULL;
+
+ return popupMenu->MSWCommand(cmd, id);
+ }
+
+ if ( ProcessCommand(id) )
+ {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu)
+{
+ int item;
+ if ( nFlags == 0xFFFF && hMenu == 0 )
+ {
+ // FIXME: what does this do? does it ever happen?
+ item = -1;
+ }
+ else if ((nFlags != MF_SEPARATOR) && (nItem != 0) && (nItem != 65535))
+ {
+ item = nItem;
+ }
+ else
+ {
+ return FALSE;
+ }
+
+ wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item);
+ event.SetEventObject( this );
+
+ return GetEventHandler()->ProcessEvent(event);
+}
+
+// ---------------------------------------------------------------------------
+// the window proc for wxFrame
+// ---------------------------------------------------------------------------
+
+long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+{
+ long rc = 0;
+ bool processed = FALSE;
+
+ switch ( message )
+ {
+ case WM_CLOSE:
+ // if we can't close, tell the system that we processed the
+ // message - otherwise it would close us
+ processed = !Close();
+ break;
+
+ case WM_COMMAND:
+ {
+ WORD id, cmd;
+ WXHWND hwnd;
+ UnpackCommand((WXWPARAM)wParam, (WXLPARAM)lParam,
+ &id, &hwnd, &cmd);
+
+ processed = HandleCommand(id, cmd, (WXHWND)hwnd);
+ }
+ break;
+
+ case WM_MENUSELECT:
+ {
+ WXWORD item, flags;
+ WXHMENU hmenu;
+ UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu);
+
+ processed = HandleMenuSelect(item, flags, hmenu);
+ }
+ break;
+
+ case WM_PAINT:
+ processed = HandlePaint();
+ break;
+
+ case WM_QUERYDRAGICON:
+ {
+ HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon)
+ : (HICON)(m_defaultIcon);
+ rc = (long)hIcon;
+ processed = rc != 0;
+ }
+ break;
+
+ case WM_SIZE:
+ processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam);
+ break;
+ }
+
+ if ( !processed )
+ rc = wxWindow::MSWWindowProc(message, wParam, lParam);
+
+ return rc;