No real changes, just cleanup wxMSW wxScrollBar a little.
Get rid of old, Win16-compatible, commented out code. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -106,46 +106,21 @@ wxScrollBar::~wxScrollBar(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam,
|
bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam,
|
||||||
WXWORD pos, WXHWND WXUNUSED(control))
|
WXWORD WXUNUSED(pos), WXHWND WXUNUSED(control))
|
||||||
{
|
{
|
||||||
// current and max positions
|
// don't use pos parameter because it is limited to 16 bits, get the full
|
||||||
int position,
|
// 32 bit position from the control itself instead
|
||||||
maxPos, trackPos = pos;
|
WinStruct<SCROLLINFO> scrollInfo;
|
||||||
|
scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_TRACKPOS;
|
||||||
|
|
||||||
wxUnusedVar(trackPos);
|
if ( !::GetScrollInfo(GetHwnd(), SB_CTL, &scrollInfo) )
|
||||||
|
|
||||||
// when we're dragging the scrollbar we can't use pos parameter because it
|
|
||||||
// is limited to 16 bits
|
|
||||||
// JACS: now always using GetScrollInfo, since there's no reason
|
|
||||||
// not to
|
|
||||||
// if ( wParam == SB_THUMBPOSITION || wParam == SB_THUMBTRACK )
|
|
||||||
{
|
{
|
||||||
SCROLLINFO scrollInfo;
|
wxLogLastError(wxT("GetScrollInfo"));
|
||||||
wxZeroMemory(scrollInfo);
|
return false;
|
||||||
scrollInfo.cbSize = sizeof(SCROLLINFO);
|
|
||||||
|
|
||||||
// also get the range if we call GetScrollInfo() anyhow -- this is less
|
|
||||||
// expensive than call it once here and then call GetScrollRange()
|
|
||||||
// below
|
|
||||||
scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_TRACKPOS;
|
|
||||||
|
|
||||||
if ( !::GetScrollInfo(GetHwnd(), SB_CTL, &scrollInfo) )
|
|
||||||
{
|
|
||||||
wxLogLastError(wxT("GetScrollInfo"));
|
|
||||||
}
|
|
||||||
|
|
||||||
trackPos = scrollInfo.nTrackPos;
|
|
||||||
position = scrollInfo.nPos;
|
|
||||||
maxPos = scrollInfo.nMax;
|
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
else
|
int position = scrollInfo.nPos;
|
||||||
{
|
int maxPos = scrollInfo.nMax;
|
||||||
position = ::GetScrollPos((HWND) control, SB_CTL);
|
|
||||||
int minPos;
|
|
||||||
::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// A page size greater than one has the effect of reducing the effective
|
// A page size greater than one has the effect of reducing the effective
|
||||||
// range, therefore the range has already been boosted artificially - so
|
// range, therefore the range has already been boosted artificially - so
|
||||||
@@ -189,13 +164,10 @@ bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_THUMBPOSITION:
|
case SB_THUMBPOSITION:
|
||||||
nScrollInc = trackPos - position;
|
|
||||||
scrollEvent = wxEVT_SCROLL_THUMBRELEASE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SB_THUMBTRACK:
|
case SB_THUMBTRACK:
|
||||||
nScrollInc = trackPos - position;
|
nScrollInc = scrollInfo.nTrackPos - position;
|
||||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
scrollEvent = wParam == SB_THUMBPOSITION ? wxEVT_SCROLL_THUMBRELEASE
|
||||||
|
: wxEVT_SCROLL_THUMBTRACK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_ENDSCROLL:
|
case SB_ENDSCROLL:
|
||||||
@@ -258,7 +230,6 @@ int wxScrollBar::GetThumbPosition(void) const
|
|||||||
wxLogLastError(wxT("GetScrollInfo"));
|
wxLogLastError(wxT("GetScrollInfo"));
|
||||||
}
|
}
|
||||||
return scrollInfo.nPos;
|
return scrollInfo.nPos;
|
||||||
// return ::GetScrollPos((HWND)m_hWnd, SB_CTL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize,
|
void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize,
|
||||||
|
Reference in New Issue
Block a user