From 542875a8c4f12b16fef8c1c25ee7e8166902f9bb Mon Sep 17 00:00:00 2001 From: David Webster Date: Fri, 25 Feb 2000 04:17:55 +0000 Subject: [PATCH] latest wxWindow updates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6276 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/frame.cpp | 124 +++++++++++++++++++++++++++++++++++++++++++++ src/os2/window.cpp | 91 +++++++++++++++++---------------- 2 files changed, 170 insertions(+), 45 deletions(-) diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index 14a35cba8f..4c15e005b4 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -585,6 +585,130 @@ void wxFrame::OnSysColourChanged( wxWindow::OnSysColourChanged(rEvent); } // end of wxFrame::OnSysColourChanged +// Pass TRUE to show full screen, FALSE to restore. +bool wxFrame::ShowFullScreen( + bool bShow +, long lStyle +) +{ + /* + // TODO + if (show) + { + if (IsFullScreen()) + return FALSE; + + m_fsIsShowing = TRUE; + m_fsStyle = style; + + wxToolBar *theToolBar = GetToolBar(); + wxStatusBar *theStatusBar = GetStatusBar(); + + int dummyWidth; + + if (theToolBar) + theToolBar->GetSize(&dummyWidth, &m_fsToolBarHeight); + if (theStatusBar) + theStatusBar->GetSize(&dummyWidth, &m_fsStatusBarHeight); + + // zap the toolbar, menubar, and statusbar + + if ((style & wxFULLSCREEN_NOTOOLBAR) && theToolBar) + { + theToolBar->SetSize(-1,0); + theToolBar->Show(FALSE); + } + + if (style & wxFULLSCREEN_NOMENUBAR) + SetMenu((HWND)GetHWND(), (HMENU) NULL); + + // Save the number of fields in the statusbar + if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar) + { + m_fsStatusBarFields = theStatusBar->GetFieldsCount(); + SetStatusBar((wxStatusBar*) NULL); + delete theStatusBar; + } + else + m_fsStatusBarFields = 0; + + // zap the frame borders + + // save the 'normal' window style + m_fsOldWindowStyle = GetWindowLong((HWND)GetHWND(), GWL_STYLE); + + // save the old position, width & height, maximize state + m_fsOldSize = GetRect(); + m_fsIsMaximized = IsMaximized(); + + // decide which window style flags to turn off + LONG newStyle = m_fsOldWindowStyle; + LONG offFlags = 0; + + if (style & wxFULLSCREEN_NOBORDER) + offFlags |= WS_BORDER; + if (style & wxFULLSCREEN_NOCAPTION) + offFlags |= (WS_CAPTION | WS_SYSMENU); + + newStyle &= (~offFlags); + + // change our window style to be compatible with full-screen mode + SetWindowLong((HWND)GetHWND(), GWL_STYLE, newStyle); + + // resize to the size of the desktop + int width, height; + + RECT rect; + ::GetWindowRect(GetDesktopWindow(), &rect); + width = rect.right - rect.left; + height = rect.bottom - rect.top; + + SetSize(width, height); + + // now flush the window style cache and actually go full-screen + SetWindowPos((HWND)GetHWND(), HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED); + + wxSizeEvent event(wxSize(width, height), GetId()); + GetEventHandler()->ProcessEvent(event); + + return TRUE; + } + else + { + if (!IsFullScreen()) + return FALSE; + + m_fsIsShowing = FALSE; + + wxToolBar *theToolBar = GetToolBar(); + + // restore the toolbar, menubar, and statusbar + if (theToolBar && (m_fsStyle & wxFULLSCREEN_NOTOOLBAR)) + { + theToolBar->SetSize(-1, m_fsToolBarHeight); + theToolBar->Show(TRUE); + } + + if ((m_fsStyle & wxFULLSCREEN_NOSTATUSBAR) && (m_fsStatusBarFields > 0)) + { + CreateStatusBar(m_fsStatusBarFields); + PositionStatusBar(); + } + + if ((m_fsStyle & wxFULLSCREEN_NOMENUBAR) && (m_hMenu != 0)) + SetMenu((HWND)GetHWND(), (HMENU)m_hMenu); + + Maximize(m_fsIsMaximized); + SetWindowLong((HWND)GetHWND(),GWL_STYLE, m_fsOldWindowStyle); + SetWindowPos((HWND)GetHWND(),HWND_TOP,m_fsOldSize.x, m_fsOldSize.y, + m_fsOldSize.width, m_fsOldSize.height, SWP_FRAMECHANGED); + + return TRUE; + } +*/ + return TRUE; +} // end of wxFrame::ShowFullScreen + // // Frame window // diff --git a/src/os2/window.cpp b/src/os2/window.cpp index ef7c01da88..a821b547ba 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -715,8 +715,8 @@ void wxWindow::SubclassWin( wxAssociateWinWithHandle(hwnd, this); - m_fnOldWndProc = (WXFARPROC) ::WinSubclassWindow(hwnd, wxWndProc); - ::WinSetWindowULong(hwnd, QWS_USER, wxWndProc); + m_fnOldWndProc = (WXFARPROC) ::WinSubclassWindow(hwnd, (PFNWP)wxWndProc); + ::WinSetWindowULong(hwnd, QWS_USER, (ULONG)wxWndProc); } // end of wxWindow::SubclassWin void wxWindow::UnsubclassWin() @@ -767,11 +767,11 @@ WXDWORD wxWindow::MakeExtendedStyle( // WXDWORD wxWindow::Determine3DEffects( WXDWORD dwDefaultBorderStyle -, YBool* pbWant3D +, bool* pbWant3D ) const { - WXDWORD dwStyle = 0L; - + WXDWORD dwStyle = 0L; + // // Native PM does not have any specialize 3D effects like WIN32 does // @@ -853,7 +853,7 @@ void wxWindow::OnIdle( if (::WinGetKeyState(HWND_DESKTOP, VK_SHIFT) != 0) nState |= VK_SHIFT; - if (::WinGetKeyState(HWND_DESKTOP, VK_CTRL) != 0; + if (::WinGetKeyState(HWND_DESKTOP, VK_CTRL) != 0); nState |= VK_CTRL; wxMouseEvent rEvent(wxEVT_LEAVE_WINDOW); @@ -863,7 +863,7 @@ void wxWindow::OnIdle( ,vPoint.y ,nState ); - (void)GetEventHandler()->ProcessEvent(event); + (void)GetEventHandler()->ProcessEvent(rEvent); } } UpdateWindowUI(); @@ -911,7 +911,7 @@ void wxWindow::Refresh( RECTL vOs2Rect; vOs2Rect.xLeft = pRect->x; - vOS2Rect.yTop = pRect->y; + vOs2Rect.yTop = pRect->y; vOs2Rect.xRight = pRect->x + pRect->width; vOs2Rect.yBottom = pRect->y + pRect->height; @@ -931,7 +931,7 @@ void wxWindow::SetDropTarget( wxDropTarget* pDropTarget ) { - if (m_dropTarget != 0) + if (m_dropTarget != 0) { m_dropTarget->Revoke(m_hWnd); delete m_dropTarget; @@ -953,7 +953,7 @@ void wxWindow::DragAcceptFiles( HWND hWnd = GetHwnd(); if (hWnd && bAccept) - ::DragAcceptDroppedFiles(hWnd, NULL, NULL, DO_COPY, 0L); + ::DrgAcceptDroppedFiles(hWnd, NULL, NULL, DO_COPY, 0L); } // end of wxWindow::DragAcceptFiles // ---------------------------------------------------------------------------- @@ -968,7 +968,7 @@ void wxWindow::DoSetToolTip( { wxWindowBase::DoSetToolTip(pTooltip); - if (m_pTooltip) + if (m_tooltip) m_tooltip->SetWindow(this); } // end of wxWindow::DoSetToolTip @@ -979,7 +979,7 @@ void wxWindow::DoSetToolTip( // --------------------------------------------------------------------------- // Get total size -void wxWindow::DoGetSize( +void wxWindow::DoGetSize( int* pWidth , int* pHeight ) const @@ -1030,7 +1030,7 @@ void wxWindow::DoGetPosition( { RECTL vRect2; - ::WinQueryWindowRect(hParentWnd, vRect2); + ::WinQueryWindowRect(hParentWnd, &vRect2); vPoint.x -= vRect.xLeft; vPoint.y -= vRect.yBottom; } @@ -1047,7 +1047,7 @@ void wxWindow::DoGetPosition( if (pX) *pX = vPoint.x; - if y) + if (pY) *pY = vPoint.y; } // end of wxWindow::DoGetPosition @@ -1057,14 +1057,14 @@ void wxWindow::DoScreenToClient( ) const { HWND hWnd = GetHwnd(); - RECTL vRect; + SWP vSwp; + + ::WinQueryWindowPos(hWnd, &vSwp); - ::WinQueryWindowPos(hWnd, &vRect); - if (pX) - *pX -= vRect.xLeft; + *pX -= vSwp.x; if (pY) - *pY -= vRect.yBottom; + *pY -= vSwp.y; } // end of wxWindow::DoScreenToClient void wxWindow::DoClientToScreen( @@ -1073,14 +1073,14 @@ void wxWindow::DoClientToScreen( ) const { HWND hWnd = GetHwnd(); - RECTL vRect; + SWP vSwp; - ::WinQueryWindowPos(hWnd, &vRect); + ::WinQueryWindowPos(hWnd, &vSwp); if (pX) - *pX += vRect.xLeft; + *pX += vSwp.x; if (pY) - *pY += vRect.yBottom; + *pY += vSwp.y; } // end of wxWindow::DoClientToScreen // @@ -1099,9 +1099,9 @@ void wxWindow::DoGetClientSize( hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); ::WinQueryWindowRect(hWndClient, &vRect); - if (pX) + if (pWidth) *pWidth = vRect.xRight; - if (pY) + if (pHeight) *pHeight = vRect.yTop; } // end of wxWindow::DoGetClientSize @@ -1112,16 +1112,14 @@ void wxWindow::DoMoveWindow( , int nHeight ) { - ::WinSetWindowPos( - if ( !::MoveWindow( GetHwnd() - ,HWND_TOP - ,(LONG)nX - ,(LONG)nY - ,(LONG)nWidth - ,(LONG)nHeight - ,SWP_SIZE | SWP_MOVE - , - )) + if ( !::WinSetWindowPos( GetHwnd() + ,HWND_TOP + ,(LONG)nX + ,(LONG)nY + ,(LONG)nWidth + ,(LONG)nHeight + ,SWP_SIZE | SWP_MOVE + )) { wxLogLastError("MoveWindow"); } @@ -1152,7 +1150,7 @@ void wxWindow::DoSetSize( int nCurrentY; int nCurrentWidth; int nCurrentHeight; - wxSize size(-1, -1); + wxSize vSize(-1, -1); GetPosition( &nCurrentX ,&nCurrentY @@ -1164,9 +1162,9 @@ void wxWindow::DoSetSize( // // ... and don't do anything (avoiding flicker) if it's already ok // - if ( nX == nCurrentX && + if ( nX == nCurrentX && nY == nCurrentY && - nWidth == nCurrentWidth && + nWidth == nCurrentWidth && nHeight == nCurrentHeight ) { @@ -1175,7 +1173,7 @@ void wxWindow::DoSetSize( if (nX == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) nX = nCurrentX; - if (y == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) + if (nY == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) nY = nCurrentY; AdjustForParentClientOrigin( nX @@ -1236,7 +1234,7 @@ void wxWindow::DoSetClientSize( RECT vRect2; RECT vRect3; - hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); + hClientWnd = ::WinWindowFromID(GetHwnd(), FID_CLIENT); ::WinQueryWindowRect(hClientWnd, &vRect2); if (pParent) @@ -1263,7 +1261,7 @@ void wxWindow::DoSetClientSize( if (pParent) { vPoint.x -= vRect3.xLeft; - vPoint.y -= vRect3.xBottom; + vPoint.y -= vRect3.yBottom; } DoMoveWindow( vPoint.x @@ -1304,7 +1302,7 @@ void wxWindow::AdjustForParentClientOrigin( if (!(nSizeFlags & wxSIZE_NO_ADJUSTMENTS) && pParent) { wxPoint vPoint(pParent->GetClientAreaOrigin()); - rX += vPoint.x; + rX += vPoint.x; rY += vPoint.y; } } @@ -1322,7 +1320,7 @@ int wxWindow::GetCharHeight() const hPs = ::WinGetPS(GetHwnd()); - if(!GipQueryFontMetrics(hPs, sizeof(FONTMETIRCS), &vFontMetrics); + if(!GpiQueryFontMetrics(hPs, sizeof(FONTMETRICS), &vFontMetrics)) return (0); else return(vFontMetrics.lMaxAscender + vFontMetrics.lMaxDescender); @@ -1331,16 +1329,19 @@ int wxWindow::GetCharHeight() const int wxWindow::GetCharWidth() const { + HPS hPs; + FONTMETRICS vFontMetrics; + hPs = ::WinGetPS(GetHwnd()); - if(!GipQueryFontMetrics(hPs, sizeof(FONTMETIRCS), &vFontMetrics); + if(!GpiQueryFontMetrics(hPs, sizeof(FONTMETRICS), &vFontMetrics)) return (0); else return(vFontMetrics.lAveCharWidth); ::WinReleasePS(hPs); } // end of wxWindow::GetCharWidth -void wxWindow::GetTextExtent( +void wxWindow::GetTextExtent( const wxString& rString , int* pX , int* pY -- 2.45.2