X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/40bd6154f1476dbe598c60b4760bbf2fe0d9ab0f..f737d3967ff565d66d51a01cecb914c317c87d73:/src/os2/frame.cpp diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index ef321ea46c..f3faceb427 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -485,17 +485,63 @@ wxStatusBar* wxFrame::OnCreateStatusBar( ) { wxStatusBar* pStatusBar = NULL; + SWP vSwp; + ERRORID vError; + wxString sError; + HWND hWnd; pStatusBar = wxFrameBase::OnCreateStatusBar( nNumber ,lulStyle ,vId ,rName ); + // + // The default parent set for the Statusbar is m_hWnd which, of course, + // is the handle to the client window of the frame. We don't want that, + // so we have to set the parent to actually be the Frame. + // + hWnd = pStatusBar->GetHWND(); + if (!::WinSetParent(hWnd, m_hFrame, FALSE)) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting parent for statusbar. Error: %s\n", sError); + return NULL; + } + + // + // Also we need to reset it positioning to enable the SHOW attribute + // + if (!::WinQueryWindowPos((HWND)pStatusBar->GetHWND(), &vSwp)) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error querying frame for statusbar position. Error: %s\n", sError); + return NULL; + } + if (!::WinSetWindowPos( (HWND)pStatusBar->GetHWND() + ,HWND_TOP + ,vSwp.cx + ,vSwp.cy + ,vSwp.x + ,vSwp.y + ,SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER + )) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting statusbar position. Error: %s\n", sError); + return NULL; + } return pStatusBar; } // end of wxFrame::OnCreateStatusBar void wxFrame::PositionStatusBar() { + SWP vSwp; + ERRORID vError; + wxString sError; + // // Native status bar positions itself // @@ -525,6 +571,27 @@ void wxFrame::PositionStatusBar() ,nWidth ,nStatbarHeight ); + if (!::WinQueryWindowPos(m_frameStatusBar->GetHWND(), &vSwp)) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting parent for submenu. Error: %s\n", sError); + return; + } + if (!::WinSetWindowPos( m_frameStatusBar->GetHWND() + ,HWND_TOP + ,nStatbarWidth + ,nStatbarHeight + ,vSwp.x + ,vSwp.y + ,SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER + )) + { + vError = ::WinGetLastError(vHabmain); + sError = wxPMErrorToStr(vError); + wxLogError("Error setting parent for submenu. Error: %s\n", sError); + return; + } } } // end of wxFrame::PositionStatusBar #endif // wxUSE_STATUSBAR @@ -804,11 +871,8 @@ bool wxFrame::OS2Create( HWND hTitlebar = NULLHANDLE; HWND hHScroll = NULLHANDLE; HWND hVScroll = NULLHANDLE; - SWP vSwp; - SWP vSwpClient; - SWP vSwpTitlebar; - SWP vSwpVScroll; - SWP vSwpHScroll; + SWP vSwp[10]; + RECTL vRect[10]; USHORT uCtlCount; m_hDefaultIcon = (WXHICON) (wxSTD_FRAME_ICON ? wxSTD_FRAME_ICON : wxDEFAULT_FRAME_ICON); @@ -820,7 +884,7 @@ bool wxFrame::OS2Create( if (ulStyle == wxDEFAULT_FRAME_STYLE) ulCreateFlags = FCF_SIZEBORDER | FCF_TITLEBAR | FCF_SYSMENU | - FCF_MINMAX | FCF_VERTSCROLL | FCF_HORZSCROLL | FCF_TASKLIST; + FCF_MINMAX | FCF_TASKLIST; else { if ((ulStyle & wxCAPTION) == wxCAPTION) @@ -828,6 +892,10 @@ bool wxFrame::OS2Create( 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) @@ -878,16 +946,16 @@ bool wxFrame::OS2Create( // // 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)&flFrameCtlData // Creation data - ,NULL // Window Pres Params + 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; @@ -895,7 +963,7 @@ bool wxFrame::OS2Create( if (!wxWindow::OS2Create( m_hFrame ,wxFrameClassName - ,NULL + ,NULL ,0L ,0L ,0L @@ -920,21 +988,21 @@ bool wxFrame::OS2Create( ,nY ,nWidth ,nHeight - ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE + ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE | SWP_ZORDER )) return FALSE; - uCtlCount = ::WinSendMsg(m_hFrame, WM_FORMATFRAME, (MPARAM)pSwp, (MPARAM)pRect); + uCtlCount = SHORT1FROMMP(::WinSendMsg(m_hFrame, WM_FORMATFRAME, (MPARAM)vSwp, (MPARAM)vRect)); for (int i = 0; i < uCtlCount; i++) { - if (pSwp[i].hwnd == m_hFrame) - memcpy(m_vSwp, pSwp[i], sizeof(SWP)); - else if (pSwp[i].hwnd == m_hVScroll) - memcpy(m_vSwpVScroll, pSwp[i], sizeof(SWP)); - else if (pSwp[i].hwnd == m_hHScroll) - memcpy(m_vSwpVScroll, pSwp[i], sizeof(SWP)); - else if (pSwp[i].hwnd == m_hTitleBar) - memcpy(m_vSwpTitleBar, pSwp[i], sizeof(SWP)); + 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)); } // @@ -945,7 +1013,7 @@ bool wxFrame::OS2Create( ,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) + ,m_vSwp.cy - ((SV_CYSIZEBORDER + 1) + m_vSwpTitleBar.cy + m_vSwpHScroll.cy/2) ,SWP_SIZE | SWP_MOVE ); @@ -1132,8 +1200,6 @@ bool wxFrame::OS2TranslateMessage( WXMSG* pMsg ) { - if (wxWindow::OS2TranslateMessage(pMsg)) - return TRUE; // // try the menu bar accels // @@ -1143,7 +1209,7 @@ bool wxFrame::OS2TranslateMessage( return FALSE; const wxAcceleratorTable& rAcceleratorTable = pMenuBar->GetAccelTable(); - return rAcceleratorTable.Translate(this, pMsg); + return rAcceleratorTable.Translate(m_hFrame, pMsg); } // end of wxFrame::OS2TranslateMessage // --------------------------------------------------------------------------- @@ -1198,6 +1264,13 @@ bool wxFrame::HandlePaint() } else { + HPS hPS; + RECTL vRect; + + hPS = WinBeginPaint(GetHwnd(), 0L, &vRect); + WinFillRect(hPS, &vRect, SYSCLR_WINDOW); + WinEndPaint(hPS); + return wxWindow::HandlePaint(); } } @@ -1428,7 +1501,7 @@ MRESULT wxFrame::OS2WindowProc( // Return TRUE to request PM to paint the window background // in SYSCLR_WINDOW. // - bProcessed = TRUE; + bProcessed = TRUE; mRc = (MRESULT)(TRUE); break;