+ hFrame = GetHwnd();
+
+ //
+ // Since under PM the controling window proc is associated with the client window handle
+ // not the frame's we have to perform the hook here in order to associated the client handle,
+ // not the frame's with the window object !
+ //
+
+ wxWndHook = this;
+ //
+ // Create the client window. We must call the API from here rather than
+ // the static base class create because we need a separate handle
+ //
+ if ((hClient = ::WinCreateWindow( hFrame // Frame is parent
+ ,wxFrameClassName
+ ,NULL // Window title
+ ,0 // No styles
+ ,0, 0, 0, 0 // Window position
+ ,NULLHANDLE // Owner
+ ,HWND_TOP // Sibling
+ ,FID_CLIENT // standard client ID
+ ,NULL // Creation data
+ ,NULL // Window Pres Params
+ )) == 0L)
+ {
+ return FALSE;
+ }
+
+ wxWndHook = NULL;
+ //
+ // Send anything to initialize the frame
+ //
+ ::WinSendMsg( hFrame
+ ,WM_UPDATEFRAME
+ ,(MPARAM)FCF_TASKLIST
+ ,(MPARAM)0
+ );
+
+ //
+ // Now size everything. If adding a menu the client will need to be resized.
+ //
+ if (!::WinSetWindowPos( hFrame
+ ,HWND_TOP
+ ,nX
+ ,nY
+ ,nWidth
+ ,nHeight
+ ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE
+ ))
+ return FALSE;
+
+ WinQueryWindowPos(GetHwnd(), &vSwp);
+ hClient = WinWindowFromID(GetHwnd(), FID_CLIENT);
+ hTitlebar = WinWindowFromID(GetHwnd(), FID_TITLEBAR);
+ WinQueryWindowPos(hTitlebar, &vSwpTitlebar);
+ hHScroll = WinWindowFromID(GetHwnd(), FID_HORZSCROLL);
+ WinQueryWindowPos(hHScroll, &vSwpHScroll);
+ hVScroll = WinWindowFromID(GetHwnd(), FID_VERTSCROLL);
+ WinQueryWindowPos(hVScroll, &vSwpVScroll);
+ WinSetWindowPos( hClient
+ ,HWND_TOP
+ ,SV_CXSIZEBORDER/2
+ ,(SV_CYSIZEBORDER/2) + vSwpHScroll.cy/2
+ ,vSwp.cx - ((SV_CXSIZEBORDER + 1) + vSwpVScroll.cx)
+ ,vSwp.cy - ((SV_CYSIZEBORDER + 1) + vSwpTitlebar.cy + vSwpHScroll.cy/2)
+ ,SWP_SIZE | SWP_MOVE
+ );
+
+ //
+ // Set the client window's background, otherwise it is transparent!
+ //
+ return TRUE;
+} // end of wxFrame::OS2Create
+
+//
+// Default activation behaviour - set the focus for the first child
+// subwindow found.
+//
+void wxFrame::OnActivate(
+ wxActivateEvent& rEvent
+)
+{
+ for (wxWindowList::Node* pNode = GetChildren().GetFirst();
+ pNode;
+ pNode = pNode->GetNext())
+ {
+ // FIXME all this is totally bogus - we need to do the same as wxPanel,
+ // but how to do it without duplicating the code?
+
+ // restore focus
+ wxWindow* pChild = pNode->GetData();
+
+ if (!pChild->IsTopLevel()
+#if wxUSE_TOOLBAR
+ && !wxDynamicCast(pChild, wxToolBar)
+#endif // wxUSE_TOOLBAR
+#if wxUSE_STATUSBAR
+ && !wxDynamicCast(pChild, wxStatusBar)
+#endif // wxUSE_STATUSBAR
+ )
+ {
+ pChild->SetFocus();
+ return;
+ }
+ }
+} // end of wxFrame::OnActivate
+
+// ----------------------------------------------------------------------------
+// wxFrame size management: we exclude the areas taken by menu/status/toolbars
+// from the client area, so the client area is what's really available for the
+// frame contents
+// ----------------------------------------------------------------------------