Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SLIDER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_SLIDER_H_ |
| 6 #define UI_VIEWS_CONTROLS_SLIDER_H_ | 6 #define UI_VIEWS_CONTROLS_SLIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ui/base/animation/animation_delegate.h" | 9 #include "ui/base/animation/animation_delegate.h" |
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| 11 #include "ui/views/views_export.h" | 11 #include "ui/views/views_export.h" |
| 12 | 12 |
| 13 typedef unsigned int SkColor; | |
| 14 | |
| 13 namespace ui { | 15 namespace ui { |
| 14 class SlideAnimation; | 16 class SlideAnimation; |
| 15 } | 17 } |
| 16 | 18 |
| 17 namespace views { | 19 namespace views { |
| 18 | 20 |
| 19 class Slider; | 21 class Slider; |
| 20 | 22 |
| 21 enum SliderChangeReason { | 23 enum SliderChangeReason { |
| 22 VALUE_CHANGED_BY_USER, // value was changed by the user (by clicking, e.g.) | 24 VALUE_CHANGED_BY_USER, // value was changed by the user (by clicking, e.g.) |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 51 virtual ~Slider(); | 53 virtual ~Slider(); |
| 52 | 54 |
| 53 float value() const { return value_; } | 55 float value() const { return value_; } |
| 54 void SetValue(float value); | 56 void SetValue(float value); |
| 55 | 57 |
| 56 // Set the delta used for changing the value via keyboard. | 58 // Set the delta used for changing the value via keyboard. |
| 57 void SetKeyboardIncrement(float increment); | 59 void SetKeyboardIncrement(float increment); |
| 58 | 60 |
| 59 void SetAccessibleName(const string16& name); | 61 void SetAccessibleName(const string16& name); |
| 60 | 62 |
| 63 void set_focus_color(SkColor color) { focus_color_ = color; } | |
|
Ben Goodger (Google)
2012/04/13 20:13:42
set_focus_border_color
sadrul
2012/04/13 20:42:46
Done.
| |
| 64 | |
| 61 private: | 65 private: |
| 62 void SetValueInternal(float value, SliderChangeReason reason); | 66 void SetValueInternal(float value, SliderChangeReason reason); |
| 63 | 67 |
| 64 // views::View overrides: | 68 // views::View overrides: |
| 65 virtual gfx::Size GetPreferredSize() OVERRIDE; | 69 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 66 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 70 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 67 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 71 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 68 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; | 72 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; |
| 69 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 73 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
| 70 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | 74 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; |
| 71 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 75 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 76 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | |
| 72 | 77 |
| 73 // ui::AnimationDelegate overrides: | 78 // ui::AnimationDelegate overrides: |
| 74 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 79 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 75 | 80 |
| 76 SliderListener* listener_; | 81 SliderListener* listener_; |
| 77 Orientation orientation_; | 82 Orientation orientation_; |
| 78 | 83 |
| 79 scoped_ptr<ui::SlideAnimation> move_animation_; | 84 scoped_ptr<ui::SlideAnimation> move_animation_; |
| 80 | 85 |
| 81 float value_; | 86 float value_; |
| 82 float keyboard_increment_; | 87 float keyboard_increment_; |
| 83 float animating_value_; | 88 float animating_value_; |
| 84 bool value_is_valid_; | 89 bool value_is_valid_; |
| 85 string16 accessible_name_; | 90 string16 accessible_name_; |
| 91 SkColor focus_color_; | |
| 86 | 92 |
| 87 DISALLOW_COPY_AND_ASSIGN(Slider); | 93 DISALLOW_COPY_AND_ASSIGN(Slider); |
| 88 }; | 94 }; |
| 89 | 95 |
| 90 } // namespace views | 96 } // namespace views |
| 91 | 97 |
| 92 #endif // UI_VIEWS_CONTROLS_SLIDER_H_ | 98 #endif // UI_VIEWS_CONTROLS_SLIDER_H_ |
| OLD | NEW |