else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLL_PAGEUP;
else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLL_PAGEDOWN;
- int value = (int)ceil(adjust->value);
+ double dvalue = adjust->value;
+ int value = (int)(dvalue < 0 ? dvalue - 0.5 : dvalue + 0.5);
int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
if (win->m_isScrolling)
{
- wxEventType command = wxEVT_SCROLL_THUMBTRACK;
+ wxEventType command = wxEVT_SCROLL_THUMBRELEASE;
int value = (int)ceil(win->m_adjust->value);
int dir = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
wxScrollEvent event( command, value, dir );
- event.SetScrolling( FALSE );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
}
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
-wxScrollBar::~wxScrollBar(void)
+wxScrollBar::~wxScrollBar()
{
}
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxScrollBar creation failed") );
- return FALSE;
+ return FALSE;
}
m_oldPos = 0.0;
return TRUE;
}
-int wxScrollBar::GetThumbPosition(void) const
+int wxScrollBar::GetThumbPosition() const
{
- return (int)(m_adjust->value+0.5);
+ double val = m_adjust->value;
+ return (int)(val < 0 ? val - 0.5 : val + 0.5);
}
int wxScrollBar::GetThumbSize() const
}
/* Backward compatibility */
-int wxScrollBar::GetValue(void) const
+int wxScrollBar::GetValue() const
{
return GetThumbPosition();
}