1. fixed thumb track/release events for positions > 65536
2. fixed (untested) wxSpinCtrl::GetPosition() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7371 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -73,6 +73,7 @@ public:
|
||||
WXFARPROC GetBuddyWndProc() const { return m_oldBuddyWndProc; }
|
||||
|
||||
protected:
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
|
@@ -343,13 +343,24 @@ void wxSpinCtrl::DoGetSize(int *x, int *y) const
|
||||
GetWindowRect(GetHwnd(), &spinrect);
|
||||
GetWindowRect((HWND)m_hwndBuddy, &textrect);
|
||||
UnionRect(&ctrlrect,&textrect, &spinrect);
|
||||
|
||||
|
||||
if ( x )
|
||||
*x = ctrlrect.right - ctrlrect.left;
|
||||
if ( y )
|
||||
*y = ctrlrect.bottom - ctrlrect.top;
|
||||
}
|
||||
|
||||
void wxSpinCtrl::DoGetPosition(int *x, int *y) const
|
||||
{
|
||||
// hack: pretend that our HWND is the text control just for a moment
|
||||
WXHWND hWnd = GetHWND();
|
||||
wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hwndBuddy;
|
||||
|
||||
wxSpinButton::DoGetPosition(x, y);
|
||||
|
||||
wxConstCast(this, wxSpinCtrl)->m_hWnd = hWnd;
|
||||
}
|
||||
|
||||
#endif // __WIN95__
|
||||
|
||||
#endif
|
||||
|
@@ -3461,11 +3461,34 @@ bool wxWindow::MSWOnScroll(int orientation, WXWORD wParam,
|
||||
break;
|
||||
|
||||
case SB_THUMBPOSITION:
|
||||
event.m_eventType = wxEVT_SCROLLWIN_THUMBRELEASE;
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK:
|
||||
event.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK;
|
||||
#ifdef __WIN32__
|
||||
// under Win32, the scrollbar range and position are 32 bit integers,
|
||||
// but WM_[HV]SCROLL only carry the low 16 bits of them, so we must
|
||||
// explicitly query the scrollbar for the correct position (this must
|
||||
// be done only for these two SB_ events as they are the only one
|
||||
// carrying the scrollbar position)
|
||||
{
|
||||
SCROLLINFO scrollInfo;
|
||||
wxZeroMemory(scrollInfo);
|
||||
scrollInfo.cbSize = sizeof(SCROLLINFO);
|
||||
scrollInfo.fMask = SIF_TRACKPOS;
|
||||
|
||||
if ( !::GetScrollInfo(GetHwnd(),
|
||||
orientation == wxHORIZONTAL ? SB_HORZ
|
||||
: SB_VERT,
|
||||
&scrollInfo) )
|
||||
{
|
||||
wxLogLastError(_T("GetScrollInfo"));
|
||||
}
|
||||
|
||||
event.SetPosition(scrollInfo.nTrackPos);
|
||||
}
|
||||
#endif // Win32
|
||||
|
||||
event.m_eventType = wParam == SB_THUMBPOSITION
|
||||
? wxEVT_SCROLLWIN_THUMBRELEASE
|
||||
: wxEVT_SCROLLWIN_THUMBTRACK;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Reference in New Issue
Block a user