latest wxWindow updates

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6276 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster 2000-02-25 04:17:55 +00:00
parent b2a81bd914
commit 542875a8c4
2 changed files with 170 additions and 45 deletions

View File

@ -585,6 +585,130 @@ void wxFrame::OnSysColourChanged(
wxWindow::OnSysColourChanged(rEvent); wxWindow::OnSysColourChanged(rEvent);
} // end of wxFrame::OnSysColourChanged } // 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 // Frame window
// //

View File

@ -715,8 +715,8 @@ void wxWindow::SubclassWin(
wxAssociateWinWithHandle(hwnd, this); wxAssociateWinWithHandle(hwnd, this);
m_fnOldWndProc = (WXFARPROC) ::WinSubclassWindow(hwnd, wxWndProc); m_fnOldWndProc = (WXFARPROC) ::WinSubclassWindow(hwnd, (PFNWP)wxWndProc);
::WinSetWindowULong(hwnd, QWS_USER, wxWndProc); ::WinSetWindowULong(hwnd, QWS_USER, (ULONG)wxWndProc);
} // end of wxWindow::SubclassWin } // end of wxWindow::SubclassWin
void wxWindow::UnsubclassWin() void wxWindow::UnsubclassWin()
@ -767,7 +767,7 @@ WXDWORD wxWindow::MakeExtendedStyle(
// //
WXDWORD wxWindow::Determine3DEffects( WXDWORD wxWindow::Determine3DEffects(
WXDWORD dwDefaultBorderStyle WXDWORD dwDefaultBorderStyle
, YBool* pbWant3D , bool* pbWant3D
) const ) const
{ {
WXDWORD dwStyle = 0L; WXDWORD dwStyle = 0L;
@ -853,7 +853,7 @@ void wxWindow::OnIdle(
if (::WinGetKeyState(HWND_DESKTOP, VK_SHIFT) != 0) if (::WinGetKeyState(HWND_DESKTOP, VK_SHIFT) != 0)
nState |= VK_SHIFT; nState |= VK_SHIFT;
if (::WinGetKeyState(HWND_DESKTOP, VK_CTRL) != 0; if (::WinGetKeyState(HWND_DESKTOP, VK_CTRL) != 0);
nState |= VK_CTRL; nState |= VK_CTRL;
wxMouseEvent rEvent(wxEVT_LEAVE_WINDOW); wxMouseEvent rEvent(wxEVT_LEAVE_WINDOW);
@ -863,7 +863,7 @@ void wxWindow::OnIdle(
,vPoint.y ,vPoint.y
,nState ,nState
); );
(void)GetEventHandler()->ProcessEvent(event); (void)GetEventHandler()->ProcessEvent(rEvent);
} }
} }
UpdateWindowUI(); UpdateWindowUI();
@ -911,7 +911,7 @@ void wxWindow::Refresh(
RECTL vOs2Rect; RECTL vOs2Rect;
vOs2Rect.xLeft = pRect->x; vOs2Rect.xLeft = pRect->x;
vOS2Rect.yTop = pRect->y; vOs2Rect.yTop = pRect->y;
vOs2Rect.xRight = pRect->x + pRect->width; vOs2Rect.xRight = pRect->x + pRect->width;
vOs2Rect.yBottom = pRect->y + pRect->height; vOs2Rect.yBottom = pRect->y + pRect->height;
@ -953,7 +953,7 @@ void wxWindow::DragAcceptFiles(
HWND hWnd = GetHwnd(); HWND hWnd = GetHwnd();
if (hWnd && bAccept) if (hWnd && bAccept)
::DragAcceptDroppedFiles(hWnd, NULL, NULL, DO_COPY, 0L); ::DrgAcceptDroppedFiles(hWnd, NULL, NULL, DO_COPY, 0L);
} // end of wxWindow::DragAcceptFiles } // end of wxWindow::DragAcceptFiles
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -968,7 +968,7 @@ void wxWindow::DoSetToolTip(
{ {
wxWindowBase::DoSetToolTip(pTooltip); wxWindowBase::DoSetToolTip(pTooltip);
if (m_pTooltip) if (m_tooltip)
m_tooltip->SetWindow(this); m_tooltip->SetWindow(this);
} // end of wxWindow::DoSetToolTip } // end of wxWindow::DoSetToolTip
@ -1030,7 +1030,7 @@ void wxWindow::DoGetPosition(
{ {
RECTL vRect2; RECTL vRect2;
::WinQueryWindowRect(hParentWnd, vRect2); ::WinQueryWindowRect(hParentWnd, &vRect2);
vPoint.x -= vRect.xLeft; vPoint.x -= vRect.xLeft;
vPoint.y -= vRect.yBottom; vPoint.y -= vRect.yBottom;
} }
@ -1047,7 +1047,7 @@ void wxWindow::DoGetPosition(
if (pX) if (pX)
*pX = vPoint.x; *pX = vPoint.x;
if y) if (pY)
*pY = vPoint.y; *pY = vPoint.y;
} // end of wxWindow::DoGetPosition } // end of wxWindow::DoGetPosition
@ -1057,14 +1057,14 @@ void wxWindow::DoScreenToClient(
) const ) const
{ {
HWND hWnd = GetHwnd(); HWND hWnd = GetHwnd();
RECTL vRect; SWP vSwp;
::WinQueryWindowPos(hWnd, &vRect); ::WinQueryWindowPos(hWnd, &vSwp);
if (pX) if (pX)
*pX -= vRect.xLeft; *pX -= vSwp.x;
if (pY) if (pY)
*pY -= vRect.yBottom; *pY -= vSwp.y;
} // end of wxWindow::DoScreenToClient } // end of wxWindow::DoScreenToClient
void wxWindow::DoClientToScreen( void wxWindow::DoClientToScreen(
@ -1073,14 +1073,14 @@ void wxWindow::DoClientToScreen(
) const ) const
{ {
HWND hWnd = GetHwnd(); HWND hWnd = GetHwnd();
RECTL vRect; SWP vSwp;
::WinQueryWindowPos(hWnd, &vRect); ::WinQueryWindowPos(hWnd, &vSwp);
if (pX) if (pX)
*pX += vRect.xLeft; *pX += vSwp.x;
if (pY) if (pY)
*pY += vRect.yBottom; *pY += vSwp.y;
} // end of wxWindow::DoClientToScreen } // end of wxWindow::DoClientToScreen
// //
@ -1099,9 +1099,9 @@ void wxWindow::DoGetClientSize(
hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT);
::WinQueryWindowRect(hWndClient, &vRect); ::WinQueryWindowRect(hWndClient, &vRect);
if (pX) if (pWidth)
*pWidth = vRect.xRight; *pWidth = vRect.xRight;
if (pY) if (pHeight)
*pHeight = vRect.yTop; *pHeight = vRect.yTop;
} // end of wxWindow::DoGetClientSize } // end of wxWindow::DoGetClientSize
@ -1112,16 +1112,14 @@ void wxWindow::DoMoveWindow(
, int nHeight , int nHeight
) )
{ {
::WinSetWindowPos( if ( !::WinSetWindowPos( GetHwnd()
if ( !::MoveWindow( GetHwnd() ,HWND_TOP
,HWND_TOP ,(LONG)nX
,(LONG)nX ,(LONG)nY
,(LONG)nY ,(LONG)nWidth
,(LONG)nWidth ,(LONG)nHeight
,(LONG)nHeight ,SWP_SIZE | SWP_MOVE
,SWP_SIZE | SWP_MOVE ))
,
))
{ {
wxLogLastError("MoveWindow"); wxLogLastError("MoveWindow");
} }
@ -1152,7 +1150,7 @@ void wxWindow::DoSetSize(
int nCurrentY; int nCurrentY;
int nCurrentWidth; int nCurrentWidth;
int nCurrentHeight; int nCurrentHeight;
wxSize size(-1, -1); wxSize vSize(-1, -1);
GetPosition( &nCurrentX GetPosition( &nCurrentX
,&nCurrentY ,&nCurrentY
@ -1175,7 +1173,7 @@ void wxWindow::DoSetSize(
if (nX == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) if (nX == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE))
nX = nCurrentX; nX = nCurrentX;
if (y == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) if (nY == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE))
nY = nCurrentY; nY = nCurrentY;
AdjustForParentClientOrigin( nX AdjustForParentClientOrigin( nX
@ -1236,7 +1234,7 @@ void wxWindow::DoSetClientSize(
RECT vRect2; RECT vRect2;
RECT vRect3; RECT vRect3;
hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); hClientWnd = ::WinWindowFromID(GetHwnd(), FID_CLIENT);
::WinQueryWindowRect(hClientWnd, &vRect2); ::WinQueryWindowRect(hClientWnd, &vRect2);
if (pParent) if (pParent)
@ -1263,7 +1261,7 @@ void wxWindow::DoSetClientSize(
if (pParent) if (pParent)
{ {
vPoint.x -= vRect3.xLeft; vPoint.x -= vRect3.xLeft;
vPoint.y -= vRect3.xBottom; vPoint.y -= vRect3.yBottom;
} }
DoMoveWindow( vPoint.x DoMoveWindow( vPoint.x
@ -1322,7 +1320,7 @@ int wxWindow::GetCharHeight() const
hPs = ::WinGetPS(GetHwnd()); hPs = ::WinGetPS(GetHwnd());
if(!GipQueryFontMetrics(hPs, sizeof(FONTMETIRCS), &vFontMetrics); if(!GpiQueryFontMetrics(hPs, sizeof(FONTMETRICS), &vFontMetrics))
return (0); return (0);
else else
return(vFontMetrics.lMaxAscender + vFontMetrics.lMaxDescender); return(vFontMetrics.lMaxAscender + vFontMetrics.lMaxDescender);
@ -1331,9 +1329,12 @@ int wxWindow::GetCharHeight() const
int wxWindow::GetCharWidth() const int wxWindow::GetCharWidth() const
{ {
HPS hPs;
FONTMETRICS vFontMetrics;
hPs = ::WinGetPS(GetHwnd()); hPs = ::WinGetPS(GetHwnd());
if(!GipQueryFontMetrics(hPs, sizeof(FONTMETIRCS), &vFontMetrics); if(!GpiQueryFontMetrics(hPs, sizeof(FONTMETRICS), &vFontMetrics))
return (0); return (0);
else else
return(vFontMetrics.lAveCharWidth); return(vFontMetrics.lAveCharWidth);