summaryrefslogtreecommitdiffstats
path: root/views/controls/progress_bar.h
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-15 23:15:45 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-15 23:15:45 +0000
commitadc407950219a661c21804ee68729ce0fd1e460c (patch)
tree7923da1423b440c9f6f677f153314e988d948a12 /views/controls/progress_bar.h
parente2f0954d5f4ecbcd8b701e0b74b677c8b2ed3eeb (diff)
downloadchromium_src-adc407950219a661c21804ee68729ce0fd1e460c.zip
chromium_src-adc407950219a661c21804ee68729ce0fd1e460c.tar.gz
chromium_src-adc407950219a661c21804ee68729ce0fd1e460c.tar.bz2
chromeos: Improve brightness and volume animations.
Make the onscreen brightness and volume indicators not be janky. Also change views::ProgressBar to permit specifying min and max double values, instead of just using a hardcoded integer range between 0 and 100. BUG=chromium-os:19141,chromium-os:8473 TEST=manual: held volume keys and checked that animation is smooth Review URL: http://codereview.chromium.org/7646004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/progress_bar.h')
-rw-r--r--views/controls/progress_bar.h56
1 files changed, 26 insertions, 30 deletions
diff --git a/views/controls/progress_bar.h b/views/controls/progress_bar.h
index 61c050f..5156c8f 100644
--- a/views/controls/progress_bar.h
+++ b/views/controls/progress_bar.h
@@ -28,52 +28,48 @@ namespace views {
class VIEWS_EXPORT ProgressBar : public View {
public:
+ // The value range defaults to [0.0, 1.0].
ProgressBar();
virtual ~ProgressBar();
- // Overridden to return preferred size of the progress bar.
- virtual gfx::Size GetPreferredSize();
+ double current_value() const { return current_value_; }
- // Returns views/ProgressBar.
- virtual std::string GetClassName() const;
+ // View implementation.
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual std::string GetClassName() const OVERRIDE;
+ virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
+ virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip)
+ OVERRIDE;
- // Overridden to paint
- virtual void OnPaint(gfx::Canvas* canvas);
+ // Sets the inclusive range of values to be displayed. Values outside of the
+ // range will be capped when displayed.
+ virtual void SetDisplayRange(double min_display_value,
+ double max_display_value);
- // Set and get the progress bar progress in range [0, kMaxProgress].
- virtual void SetProgress(int progress);
- virtual int GetProgress() const;
- // Add progress to current.
- virtual void AddProgress(int tick);
+ // Sets the current value. Values outside of the range [min_display_value_,
+ // max_display_value_] will be stored unmodified and capped for display.
+ virtual void SetValue(double value);
- // Sets the tooltip text. Default behavior for a progress bar is to show
- // no tooltip on mouse hover. Calling this lets you set a custom tooltip.
- // To revert to default behavior, call this with an empty string.
+ // Sets the tooltip text. Default behavior for a progress bar is to show no
+ // tooltip on mouse hover. Calling this lets you set a custom tooltip. To
+ // revert to default behavior, call this with an empty string.
virtual void SetTooltipText(const std::wstring& tooltip_text);
- // Gets the tooltip text if has been specified with SetTooltipText().
- virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip)
- OVERRIDE;
-
- // Sets the enabled state.
- virtual void OnEnabledChanged() OVERRIDE;
- // Accessibility accessors, overridden from View.
- virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
+ private:
+ static const char kViewClassName[];
- // Maximum value of progress.
- static const int kMaxProgress;
+ // Inclusive range used when displaying values.
+ double min_display_value_;
+ double max_display_value_;
- private:
- // Progress in range [0, kMaxProgress].
- int progress_;
+ // Current value. May be outside of [min_display_value_, max_display_value_].
+ double current_value_;
// Tooltip text.
string16 tooltip_text_;
- // The view class name.
- static const char kViewClassName[];
-
DISALLOW_COPY_AND_ASSIGN(ProgressBar);
};