Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / views / controls / scrollbar / base_scroll_bar_button.h
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_BUTTON_H_
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_BUTTON_H_
7
8 #include "ui/views/controls/button/custom_button.h"
9
10 #include "ui/views/repeat_controller.h"
11
12 #if defined(OS_LINUX)
13 #include "ui/gfx/screen.h"
14 #endif
15
16 namespace views {
17
18 ///////////////////////////////////////////////////////////////////////////////
19 //
20 // ScrollBarButton
21 //
22 //  A button that activates on mouse pressed rather than released, and that
23 //  continues to fire the clicked action as the mouse button remains pressed
24 //  down on the button.
25 //
26 ///////////////////////////////////////////////////////////////////////////////
27 class VIEWS_EXPORT BaseScrollBarButton : public CustomButton {
28  public:
29   explicit BaseScrollBarButton(ButtonListener* listener);
30   ~BaseScrollBarButton() override;
31
32  protected:
33   bool OnMousePressed(const ui::MouseEvent& event) override;
34   void OnMouseReleased(const ui::MouseEvent& event) override;
35   void OnMouseCaptureLost() override;
36
37  private:
38   void RepeaterNotifyClick();
39
40   // The repeat controller that we use to repeatedly click the button when the
41   // mouse button is down.
42   RepeatController repeater_;
43
44   DISALLOW_COPY_AND_ASSIGN(BaseScrollBarButton);
45 };
46
47 }  // namespace views
48
49 #endif  // UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_BUTTON_H_