+ if ((ulStyle & wxTHICK_FRAME) == 0)
+ ulCreateFlags |= FCF_BORDER;
+ if (ulStyle & wxFRAME_TOOL_WINDOW)
+ ulExtraFlags = kFrameToolWindow;
+
+ if (ulStyle & wxSTAY_ON_TOP)
+ ulCreateFlags |= FCF_SYSMODAL;
+ }
+ if ((ulStyle & wxMINIMIZE) || (ulStyle & wxICONIZE))
+ ulStyleFlags |= WS_MINIMIZED;
+ if (ulStyle & wxMAXIMIZE)
+ ulStyleFlags |= WS_MAXIMIZED;
+
+ //
+ // Clear the visible flag, we always call show
+ //
+ ulStyleFlags &= (unsigned long)~WS_VISIBLE;
+ m_bIconized = FALSE;
+
+ //
+ // Set the frame control block
+ //
+ vFrameCtlData.cb = sizeof(vFrameCtlData);
+ vFrameCtlData.flCreateFlags = ulCreateFlags;
+ vFrameCtlData.hmodResources = 0L;
+ vFrameCtlData.idResources = 0;
+
+ //
+ // Create the frame window
+ //
+ if ((m_hFrame = ::WinCreateWindow( hParent // Frame is parent
+ ,WC_FRAME // standard frame class
+ ,(PSZ)zTitle // Window title
+ ,0 // No styles
+ ,0, 0, 0, 0 // Window position
+ ,NULLHANDLE // Owner
+ ,HWND_TOP // Sibling
+ ,(ULONG)nId // ID
+ ,(PVOID)&vFrameCtlData // Creation data
+ ,NULL // Window Pres Params
+ )) == 0L)
+ {
+ return FALSE;
+ }
+
+ if (!wxWindow::OS2Create( m_hFrame
+ ,wxFrameClassName
+ ,NULL
+ ,0L
+ ,0L
+ ,0L
+ ,0L
+ ,0L
+ ,NULLHANDLE
+ ,HWND_TOP
+ ,(unsigned long)FID_CLIENT
+ ,NULL
+ ,NULL
+ ))
+ {
+ return FALSE;
+ }
+
+ //
+ // Now size everything. If adding a menu the client will need to be resized.
+ //
+ if (!::WinSetWindowPos( m_hFrame
+ ,HWND_TOP
+ ,nX
+ ,nY
+ ,nWidth
+ ,nHeight
+ ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE | SWP_ZORDER
+ ))
+ return FALSE;
+
+ uCtlCount = SHORT1FROMMP(::WinSendMsg(m_hFrame, WM_FORMATFRAME, (MPARAM)vSwp, (MPARAM)vRect));
+ for (int i = 0; i < uCtlCount; i++)
+ {
+ if (vSwp[i].hwnd == m_hFrame)
+ memcpy(&m_vSwp, &vSwp[i], sizeof(SWP));
+ else if (vSwp[i].hwnd == m_hVScroll)
+ memcpy(&m_vSwpVScroll, &vSwp[i], sizeof(SWP));
+ else if (vSwp[i].hwnd == m_hHScroll)
+ memcpy(&m_vSwpVScroll, &vSwp[i], sizeof(SWP));
+ else if (vSwp[i].hwnd == m_hTitleBar)
+ memcpy(&m_vSwpTitleBar, &vSwp[i], sizeof(SWP));
+ }
+
+ //
+ // Now set the size of the client
+ //
+ WinSetWindowPos( hClient
+ ,HWND_TOP
+ ,SV_CXSIZEBORDER/2
+ ,(SV_CYSIZEBORDER/2) + m_vSwpHScroll.cy/2
+ ,m_vSwp.cx - ((SV_CXSIZEBORDER + 1) + m_vSwpVScroll.cx)
+ ,m_vSwp.cy - ((SV_CYSIZEBORDER + 1) + m_vSwpTitleBar.cy + m_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
+// ----------------------------------------------------------------------------