#pragma hdrstop
#endif
-#ifndef WX_PRECOMP
- #include "wx/dc.h"
-#endif
+#if wxUSE_SLIDER
#include "wx/slider.h"
-#if wxUSE_SLIDER
+#ifndef WX_PRECOMP
+ #include "wx/dc.h"
+#endif
#include "wx/univ/renderer.h"
#include "wx/univ/inphand.h"
#include "wx/univ/theme.h"
+// ----------------------------------------------------------------------------
+// wxStdSliderInputHandler: default slider input handling
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdSliderInputHandler : public wxStdInputHandler
+{
+public:
+ // default ctor
+ wxStdSliderInputHandler(wxInputHandler *inphand)
+ : wxStdInputHandler(inphand)
+ {
+ }
+
+ // base class methods
+ virtual bool HandleKey(wxInputConsumer *consumer,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxInputConsumer *consumer,
+ const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxInputConsumer *consumer,
+ const wxMouseEvent& event);
+
+ virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
+};
+
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// call this after setting the range as the best size depends (at least if
// we have wxSL_LABELS style) on the range
- SetBestSize(size);
+ SetInitialSize(size);
CreateInputHandler(wxINP_HANDLER_SLIDER);
return true;
}
+/* static */
+wxInputHandler *wxSlider::GetStdInputHandler(wxInputHandler *handlerDef)
+{
+ static wxStdSliderInputHandler s_handler(handlerDef);
+
+ return &s_handler;
+}
+
// ----------------------------------------------------------------------------
// wxSlider implementation of wxControlWithThumb interface
// ----------------------------------------------------------------------------
CalcThumbRect(&rectShaft, &rectThumb, NULL);
// check for possible shaft or thumb hit
- if (!rectShaft.Inside(pt) && !rectThumb.Inside(pt))
+ if (!rectShaft.Contains(pt) && !rectThumb.Contains(pt))
{
return wxScrollThumb::Shaft_None;
}
}
// ----------------------------------------------------------------------------
-// wxStdSliderButtonInputHandler
+// wxStdSliderInputHandler
// ----------------------------------------------------------------------------
-bool wxStdSliderButtonInputHandler::HandleKey(wxInputConsumer *consumer,
+bool wxStdSliderInputHandler::HandleKey(wxInputConsumer *consumer,
const wxKeyEvent& event,
bool pressed)
{
return wxStdInputHandler::HandleKey(consumer, event, pressed);
}
-bool wxStdSliderButtonInputHandler::HandleMouse(wxInputConsumer *consumer,
+bool wxStdSliderInputHandler::HandleMouse(wxInputConsumer *consumer,
const wxMouseEvent& event)
{
wxSlider *slider = wxStaticCast(consumer->GetInputWindow(), wxSlider);
return wxStdInputHandler::HandleMouse(consumer, event);
}
-bool wxStdSliderButtonInputHandler::HandleMouseMove(wxInputConsumer *consumer,
+bool wxStdSliderInputHandler::HandleMouseMove(wxInputConsumer *consumer,
const wxMouseEvent& event)
{
wxSlider *slider = wxStaticCast(consumer->GetInputWindow(), wxSlider);
}
bool
-wxStdSliderButtonInputHandler::HandleFocus(wxInputConsumer * WXUNUSED(consumer),
+wxStdSliderInputHandler::HandleFocus(wxInputConsumer * WXUNUSED(consumer),
const wxFocusEvent& WXUNUSED(event))
{
- // slider's appearance changes when it gets/loses focus
+ // slider appearance changes when it gets/loses focus
return true;
}