Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / views / controls / progress_bar.h
blobab3a62a871ceec77d131feabf2a4e721901e8b30
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.
5 #ifndef UI_VIEWS_CONTROLS_PROGRESS_BAR_H_
6 #define UI_VIEWS_CONTROLS_PROGRESS_BAR_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/views/view.h"
12 namespace views {
14 // Progress bar is a control that indicates progress visually.
15 class VIEWS_EXPORT ProgressBar : public View {
16 public:
17 // The value range defaults to [0.0, 1.0].
18 ProgressBar();
19 ~ProgressBar() override;
21 double current_value() const { return current_value_; }
23 // Gets a normalized current value in [0.0, 1.0] range based on current value
24 // range and the min/max display value range.
25 double GetNormalizedValue() const;
27 // Sets the inclusive range of values to be displayed. Values outside of the
28 // range will be capped when displayed.
29 void SetDisplayRange(double min_display_value, double max_display_value);
31 // Sets the current value. Values outside of the range [min_display_value_,
32 // max_display_value_] will be stored unmodified and capped for display.
33 void SetValue(double value);
35 // Sets the tooltip text. Default behavior for a progress bar is to show no
36 // tooltip on mouse hover. Calling this lets you set a custom tooltip. To
37 // revert to default behavior, call this with an empty string.
38 void SetTooltipText(const base::string16& tooltip_text);
40 // Overridden from View:
41 bool GetTooltipText(const gfx::Point& p,
42 base::string16* tooltip) const override;
43 void GetAccessibleState(ui::AXViewState* state) override;
45 private:
46 static const char kViewClassName[];
48 // Overridden from View:
49 gfx::Size GetPreferredSize() const override;
50 const char* GetClassName() const override;
51 void OnPaint(gfx::Canvas* canvas) override;
53 // Inclusive range used when displaying values.
54 double min_display_value_;
55 double max_display_value_;
57 // Current value. May be outside of [min_display_value_, max_display_value_].
58 double current_value_;
60 // Tooltip text.
61 base::string16 tooltip_text_;
63 DISALLOW_COPY_AND_ASSIGN(ProgressBar);
66 } // namespace views
68 #endif // UI_VIEWS_CONTROLS_PROGRESS_BAR_H_