-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 hTitlebar = NULLHANDLE;
- HWND hHScroll = NULLHANDLE;
- HWND hVScroll = NULLHANDLE;
- HWND hMenuBar = NULLHANDLE;
- HWND hMenu1 = NULLHANDLE;
- HWND hMenu2 = NULLHANDLE;
- HWND hFrame = NULLHANDLE;
- SWP vSwp;
- SWP vSwpTitlebar;
- SWP vSwpVScroll;
- SWP vSwpHScroll;
- SWP vSwpMenu;
- RGB2 vRgb;
-
- m_hDefaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON);
- memset(&vSwp, '\0', sizeof(SWP));
- memset(&vSwpTitlebar, '\0', sizeof(SWP));
- memset(&vSwpVScroll, '\0', sizeof(SWP));
- memset(&vSwpHScroll, '\0', sizeof(SWP));
-
- if (pParent)
- hParent = GetWinHwnd(pParent);
- else
- hParent = HWND_DESKTOP;
-
- if (ulStyle == wxDEFAULT_FRAME_STYLE)
- ulCreateFlags = FCF_SIZEBORDER | FCF_TITLEBAR | FCF_SYSMENU |
- FCF_MINMAX | FCF_VERTSCROLL | FCF_HORZSCROLL | FCF_TASKLIST;
- else
- {
- if ((ulStyle & wxCAPTION) == wxCAPTION)
- ulCreateFlags = FCF_TASKLIST;
- else
- ulCreateFlags = FCF_NOMOVEWITHOWNER;
-
- 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 (!wxWindow::OS2Create( hParent
- ,WC_FRAME
- ,zTitle
- ,ulStyleFlags
- ,(long)nX
- ,(long)nY
- ,(long)nWidth
- ,(long)nHeight
- ,NULLHANDLE
- ,HWND_TOP
- ,(long)nId
- ,(void*)&vFrameCtlData
- ,NULL
- ))
- {
- return FALSE;
- }
-
- //
- // 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;
- }
- //
- // 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(hFrame, &vSwp);
-
- //
- // Set the client window's background, otherwise it is transparent!
- //
- wxColour vColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
-
- vRgb.bRed = (BYTE)vColour.Red();
- vRgb.bGreen = (BYTE)vColour.Green();
- vRgb.bBlue = (BYTE)vColour.Blue();
- WinSetPresParam( hClient
- ,PP_BACKGROUNDCOLOR
- ,(ULONG)sizeof(RGB2)
- ,(PVOID)&vRgb
- );
- if (ulCreateFlags & FCF_TITLEBAR)
- {
- hTitlebar = WinWindowFromID(hFrame, FID_TITLEBAR);
- WinQueryWindowPos(hTitlebar, &vSwpTitlebar);
- }
- if (ulCreateFlags & FCF_HORZSCROLL)
- {
- hHScroll = WinWindowFromID(hFrame, FID_HORZSCROLL);
- WinQueryWindowPos(hHScroll, &vSwpHScroll);
- }
- if (ulCreateFlags & FCF_VERTSCROLL)
- {
- hVScroll = WinWindowFromID(hFrame, FID_VERTSCROLL);
- WinQueryWindowPos(hVScroll, &vSwpVScroll);
- }
- if (!::WinSetWindowPos( hClient
- ,HWND_TOP
- ,SV_CXSIZEBORDER
- ,(SV_CYSIZEBORDER - 1) + vSwpHScroll.cy
- ,vSwp.cx - ((SV_CXSIZEBORDER * 2) + vSwpVScroll.cx)
- ,vSwp.cy - ((SV_CYSIZEBORDER * 2) + 1 + vSwpTitlebar.cy + vSwpHScroll.cy)
- ,SWP_SIZE | SWP_MOVE
- ))
- return FALSE;
- WinQueryWindowPos(hClient, &vSwp);
- ::WinShowWindow(hClient, TRUE);
- return TRUE;
-} // end of wxFrame::OS2Create
-