| 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_PROGRESS_BAR_H_ | 5 #ifndef UI_VIEWS_CONTROLS_PROGRESS_BAR_H_ |
| 6 #define UI_VIEWS_CONTROLS_PROGRESS_BAR_H_ | 6 #define UI_VIEWS_CONTROLS_PROGRESS_BAR_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/gfx/animation/animation_delegate.h" | 10 #include "ui/gfx/animation/animation_delegate.h" |
| 11 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 class LinearAnimation; | 14 class LinearAnimation; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 // Progress bar is a control that indicates progress visually. | 19 // Progress bar is a control that indicates progress visually. |
| 20 class VIEWS_EXPORT ProgressBar : public View, public gfx::AnimationDelegate { | 20 class VIEWS_EXPORT ProgressBar : public View, public gfx::AnimationDelegate { |
| 21 public: | 21 public: |
| 22 // The preferred height parameter makes it easier to use a ProgressBar with | 22 // The preferred height parameter makes it easier to use a ProgressBar with |
| 23 // layout managers that size to preferred size. | 23 // layout managers that size to preferred size. |
| 24 explicit ProgressBar(int preferred_height = 5); | 24 explicit ProgressBar(int preferred_height = 5, |
| 25 bool allow_round_corner = true); |
| 25 ~ProgressBar() override; | 26 ~ProgressBar() override; |
| 26 | 27 |
| 27 // Overridden from View: | 28 // Overridden from View: |
| 28 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 29 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 29 gfx::Size CalculatePreferredSize() const override; | 30 gfx::Size CalculatePreferredSize() const override; |
| 30 const char* GetClassName() const override; | 31 const char* GetClassName() const override; |
| 31 void OnPaint(gfx::Canvas* canvas) override; | 32 void OnPaint(gfx::Canvas* canvas) override; |
| 32 | 33 |
| 33 double current_value() const { return current_value_; } | 34 double current_value() const { return current_value_; } |
| 34 | 35 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 53 | 54 |
| 54 bool IsIndeterminate(); | 55 bool IsIndeterminate(); |
| 55 void OnPaintIndeterminate(gfx::Canvas* canvas); | 56 void OnPaintIndeterminate(gfx::Canvas* canvas); |
| 56 | 57 |
| 57 // Current progress to display, should be in the range 0.0 to 1.0. | 58 // Current progress to display, should be in the range 0.0 to 1.0. |
| 58 double current_value_ = 0.0; | 59 double current_value_ = 0.0; |
| 59 | 60 |
| 60 // In DP, the preferred height of this progress bar. | 61 // In DP, the preferred height of this progress bar. |
| 61 const int preferred_height_; | 62 const int preferred_height_; |
| 62 | 63 |
| 64 const bool allow_round_corner_; |
| 65 |
| 63 std::unique_ptr<gfx::LinearAnimation> indeterminate_bar_animation_; | 66 std::unique_ptr<gfx::LinearAnimation> indeterminate_bar_animation_; |
| 64 | 67 |
| 65 DISALLOW_COPY_AND_ASSIGN(ProgressBar); | 68 DISALLOW_COPY_AND_ASSIGN(ProgressBar); |
| 66 }; | 69 }; |
| 67 | 70 |
| 68 } // namespace views | 71 } // namespace views |
| 69 | 72 |
| 70 #endif // UI_VIEWS_CONTROLS_PROGRESS_BAR_H_ | 73 #endif // UI_VIEWS_CONTROLS_PROGRESS_BAR_H_ |
| OLD | NEW |