/////////////////////////////////////////////////////////////////////////////
-// Name: univ/scrolbar.cpp
+// Name: src/univ/scrolbar.cpp
// Purpose: wxScrollBar implementation
// Author: Vadim Zeitlin
// Modified by:
// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "univscrolbar.h"
-#endif
-
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#if wxUSE_SCROLLBAR
+#include "wx/scrolbar.h"
+
#ifndef WX_PRECOMP
#include "wx/timer.h"
-
#include "wx/dcclient.h"
- #include "wx/scrolbar.h"
#include "wx/validate.h"
+ #include "wx/log.h"
#endif
#include "wx/univ/scrtimer.h"
#include "wx/univ/renderer.h"
#include "wx/univ/inphand.h"
#include "wx/univ/theme.h"
-#include "wx/log.h"
#define WXDEBUG_SCROLLBAR
int range, int pageSize,
bool refresh)
{
- // we only refresh everythign when the range changes, thumb position
+ // we only refresh everything when the range changes, thumb position
// changes are handled in OnIdle
bool needsRefresh = (range != m_range) ||
(thumbSize != m_thumbSize) ||
// NB: we assume that scrollbar events are sequentially numbered
// but this should be ok as other code relies on this as well
scrollType += wxEVT_SCROLL_TOP - wxEVT_SCROLLWIN_TOP;
+ wxScrollEvent event(scrollType, this->GetId(), m_thumbPos,
+ IsVertical() ? wxVERTICAL : wxHORIZONTAL);
+ event.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(event);
+ }
+ else // part of the window
+ {
+ wxScrollWinEvent event(scrollType, m_thumbPos,
+ IsVertical() ? wxVERTICAL : wxHORIZONTAL);
+ event.SetEventObject(this);
+ GetParent()->GetEventHandler()->ProcessEvent(event);
}
-
- wxScrollWinEvent event(scrollType, m_thumbPos,
- IsVertical() ? wxVERTICAL : wxHORIZONTAL);
- event.SetEventObject(this);
- GetParent()->GetEventHandler()->ProcessEvent(event);
}
return true;
return true;
}
+/* static */
+wxInputHandler *wxScrollBar::GetStdInputHandler(wxInputHandler *handlerDef)
+{
+ static wxStdScrollBarInputHandler
+ s_handler(wxTheme::Get()->GetRenderer(), handlerDef);
+
+ return &s_handler;
+}
+
// ============================================================================
// scroll bar input handler
// ============================================================================
case WXK_LEFT: action = wxACTION_SCROLL_LINE_UP; break;
case WXK_HOME: action = wxACTION_SCROLL_START; break;
case WXK_END: action = wxACTION_SCROLL_END; break;
- case WXK_PAGEUP:
- case WXK_PRIOR: action = wxACTION_SCROLL_PAGE_UP; break;
- case WXK_PAGEDOWN:
- case WXK_NEXT: action = wxACTION_SCROLL_PAGE_DOWN; break;
+ case WXK_PAGEUP: action = wxACTION_SCROLL_PAGE_UP; break;
+ case WXK_PAGEDOWN: action = wxACTION_SCROLL_PAGE_DOWN; break;
}
if ( !action.IsEmpty() )
{
// is this a click event from an acceptable button?
int btn = event.GetButton();
- if ( (btn != -1) && IsAllowedButton(btn) )
+ if ( btn == wxMOUSE_BTN_LEFT )
{
// determine which part of the window mouse is in
wxScrollBar *scrollbar = wxStaticCast(consumer->GetInputWindow(), wxScrollBar);
if ( m_winCapture )
{
- if ( (m_htLast == wxHT_SCROLLBAR_THUMB) && event.Moving() )
+ if ( (m_htLast == wxHT_SCROLLBAR_THUMB) && event.Dragging() )
{
// make the thumb follow the mouse by keeping the same offset
// between the mouse position and the top/left of the thumb
bool isArrow = scrollbar->GetArrows().HandleMouseMove(event);
- if ( event.Moving() )
+ if ( event.Dragging() )
{
wxHitTest ht = m_renderer->HitTestScrollbar
(
#endif // wxUSE_SCROLLBAR
+#if wxUSE_TIMER
+
// ----------------------------------------------------------------------------
// wxScrollTimer
// ----------------------------------------------------------------------------
}
}
+#endif // wxUSE_TIMER