-bool wxFrame::OS2Create(
- int nId
-, wxWindow* pParent
-, const wxChar* zWclass
-, wxWindow* pWxWin
-, const wxChar* zTitle
-, int nX
-, int nY
-, int nWidth
-, int nHeight
-, long ulStyle
-)
-{
- ULONG ulCreateFlags = 0L;
- ULONG ulStyleFlags = 0L;
- ULONG ulExtraFlags = 0L;
- FRAMECDATA vFrameCtlData;
- HWND hParent = NULLHANDLE;
- HWND hClient = NULLHANDLE;
- HWND hFrame = NULLHANDLE;
- HWND hTitlebar = NULLHANDLE;
- HWND hHScroll = NULLHANDLE;
- HWND hVScroll = NULLHANDLE;
- SWP vSwp[10];
- RECTL vRect[10];
- USHORT uCtlCount;
-
- m_hDefaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON);
-
- if (pParent)
- hParent = GetWinHwnd(pParent);
- else
- hParent = HWND_DESKTOP;
-
- if (ulStyle == wxDEFAULT_FRAME_STYLE)
- ulCreateFlags = FCF_SIZEBORDER | FCF_TITLEBAR | FCF_SYSMENU |
- FCF_MINMAX | FCF_TASKLIST;
- else
- {
- if ((ulStyle & wxCAPTION) == wxCAPTION)
- ulCreateFlags = FCF_TASKLIST;
- else
- ulCreateFlags = FCF_NOMOVEWITHOWNER;
-
- if ((ulStyle & wxVSCROLL) == wxVSCROLL)
- ulCreateFlags |= FCF_VERTSCROLL;
- if ((ulStyle & wxHSCROLL) == wxHSCROLL)
- ulCreateFlags |= FCF_HORZSCROLL;
- if (ulStyle & wxMINIMIZE_BOX)
- ulCreateFlags |= FCF_MINBUTTON;
- if (ulStyle & wxMAXIMIZE_BOX)
- ulCreateFlags |= FCF_MAXBUTTON;
- if (ulStyle & wxTHICK_FRAME)
- ulCreateFlags |= FCF_DLGBORDER;
- if (ulStyle & wxSYSTEM_MENU)
- ulCreateFlags |= FCF_SYSMENU;
- if (ulStyle & wxCAPTION)
- ulCreateFlags |= FCF_TASKLIST;
- if (ulStyle & wxCLIP_CHILDREN)
- {
- // Invalid for frame windows under PM
- }
-
- if (ulStyle & wxTINY_CAPTION_VERT)
- ulCreateFlags |= FCF_TASKLIST;
- if (ulStyle & wxTINY_CAPTION_HORIZ)
- ulCreateFlags |= FCF_TASKLIST;
-
- 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
- ,m_hFrame
- ,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));
- }
- return TRUE;
-} // end of wxFrame::OS2Create
-