This source file includes following definitions.
- repeater_
- OnMousePressed
- OnMouseReleased
- OnMouseCaptureLost
- RepeaterNotifyClick
#include "ui/views/controls/scrollbar/base_scroll_bar_button.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "ui/gfx/screen.h"
namespace views {
BaseScrollBarButton::BaseScrollBarButton(ButtonListener* listener)
: CustomButton(listener),
repeater_(base::Bind(&BaseScrollBarButton::RepeaterNotifyClick,
base::Unretained(this))) {
}
BaseScrollBarButton::~BaseScrollBarButton() {
}
bool BaseScrollBarButton::OnMousePressed(const ui::MouseEvent& event) {
Button::NotifyClick(event);
repeater_.Start();
return true;
}
void BaseScrollBarButton::OnMouseReleased(const ui::MouseEvent& event) {
OnMouseCaptureLost();
}
void BaseScrollBarButton::OnMouseCaptureLost() {
repeater_.Stop();
}
void BaseScrollBarButton::RepeaterNotifyClick() {
gfx::Point cursor_point =
gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
ui::MouseEvent event(ui::ET_MOUSE_RELEASED,
cursor_point, cursor_point,
ui::EF_LEFT_MOUSE_BUTTON,
ui::EF_LEFT_MOUSE_BUTTON);
Button::NotifyClick(event);
}
}