OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_THUMB_H_ | 5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_THUMB_H_ |
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_THUMB_H_ | 6 #define UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_THUMB_H_ |
7 | 7 |
8 #include "ui/gfx/size.h" | 8 #include "ui/gfx/size.h" |
9 #include "ui/views/controls/button/custom_button.h" | 9 #include "ui/views/controls/button/custom_button.h" |
10 #include "ui/views/controls/scrollbar/scroll_bar.h" | 10 #include "ui/views/controls/scrollbar/scroll_bar.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // Gets the position of the thumb on the x or y axis. | 43 // Gets the position of the thumb on the x or y axis. |
44 int GetPosition() const; | 44 int GetPosition() const; |
45 | 45 |
46 // View overrides: | 46 // View overrides: |
47 virtual gfx::Size GetPreferredSize() OVERRIDE = 0; | 47 virtual gfx::Size GetPreferredSize() OVERRIDE = 0; |
48 | 48 |
49 protected: | 49 protected: |
50 // View overrides: | 50 // View overrides: |
51 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE = 0; | 51 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE = 0; |
52 virtual void OnMouseEntered(const MouseEvent& event) OVERRIDE; | 52 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
53 virtual void OnMouseExited(const MouseEvent& event) OVERRIDE; | 53 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
54 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; | 54 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
55 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; | 55 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
56 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; | 56 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
57 virtual void OnMouseCaptureLost() OVERRIDE; | 57 virtual void OnMouseCaptureLost() OVERRIDE; |
58 | 58 |
59 CustomButton::ButtonState GetState() const; | 59 CustomButton::ButtonState GetState() const; |
60 // Update our state and schedule a repaint when the mouse moves over us. | 60 // Update our state and schedule a repaint when the mouse moves over us. |
61 void SetState(CustomButton::ButtonState state); | 61 void SetState(CustomButton::ButtonState state); |
62 | 62 |
63 private: | 63 private: |
64 // The BaseScrollBar that owns us. | 64 // The BaseScrollBar that owns us. |
65 BaseScrollBar* scroll_bar_; | 65 BaseScrollBar* scroll_bar_; |
66 | 66 |
67 int drag_start_position_; | 67 int drag_start_position_; |
68 | 68 |
69 // The position of the mouse on the scroll axis relative to the top of this | 69 // The position of the mouse on the scroll axis relative to the top of this |
70 // View when the drag started. | 70 // View when the drag started. |
71 int mouse_offset_; | 71 int mouse_offset_; |
72 | 72 |
73 // The current state of the thumb button. | 73 // The current state of the thumb button. |
74 CustomButton::ButtonState state_; | 74 CustomButton::ButtonState state_; |
75 | 75 |
76 DISALLOW_COPY_AND_ASSIGN(BaseScrollBarThumb); | 76 DISALLOW_COPY_AND_ASSIGN(BaseScrollBarThumb); |
77 }; | 77 }; |
78 | 78 |
79 } // namespace views | 79 } // namespace views |
80 | 80 |
81 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_THUMB_H_ | 81 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BASE_SCROLL_BAR_THUMB_H_ |
OLD | NEW |