OLD | NEW |
| (Empty) |
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 VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_BUTTON_H_ | |
6 #define VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_BUTTON_H_ | |
7 #pragma once | |
8 | |
9 #include "views/controls/button/custom_button.h" | |
10 | |
11 #include "views/repeat_controller.h" | |
12 | |
13 #if defined(OS_LINUX) | |
14 #include "ui/gfx/screen.h" | |
15 #endif | |
16 | |
17 namespace views { | |
18 | |
19 /////////////////////////////////////////////////////////////////////////////// | |
20 // | |
21 // ScrollBarButton | |
22 // | |
23 // A button that activates on mouse pressed rather than released, and that | |
24 // continues to fire the clicked action as the mouse button remains pressed | |
25 // down on the button. | |
26 // | |
27 /////////////////////////////////////////////////////////////////////////////// | |
28 class VIEWS_EXPORT BaseScrollBarButton : public CustomButton { | |
29 public: | |
30 explicit BaseScrollBarButton(ButtonListener* listener); | |
31 virtual ~BaseScrollBarButton(); | |
32 | |
33 protected: | |
34 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; | |
35 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; | |
36 virtual void OnMouseCaptureLost() OVERRIDE; | |
37 | |
38 private: | |
39 void RepeaterNotifyClick(); | |
40 | |
41 // The repeat controller that we use to repeatedly click the button when the | |
42 // mouse button is down. | |
43 RepeatController repeater_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(BaseScrollBarButton); | |
46 }; | |
47 | |
48 } // namespace views | |
49 | |
50 #endif // VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_BUTTON_H_ | |
OLD | NEW |