Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: views/controls/slider/slider.h

Issue 211002: Add touchpad speed factor setting to Chrome OS touchpad settings page... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/slider/native_slider_wrapper.h ('k') | views/controls/slider/slider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 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.
4
5 #ifndef VIEWS_CONTROLS_SLIDER_SLIDER_H_
6 #define VIEWS_CONTROLS_SLIDER_SLIDER_H_
7
8 #if defined(OS_LINUX)
9 #include <gdk/gdk.h>
10 #endif
11
12 #include <string>
13
14 #include "base/basictypes.h"
15 #include "views/view.h"
16
17 namespace views {
18
19 class NativeSliderWrapper;
20 class Slider;
21
22 // An interface implemented by an object to let it know that the slider value
23 // was changed.
24 class SliderListener {
25 public:
26 virtual void SliderValueChanged(Slider* sender) = 0;
27 };
28
29 // This class implements a ChromeView that wraps a native slider.
30 class Slider : public View {
31 public:
32 // The slider's class name.
33 static const char kViewClassName[];
34
35 enum StyleFlags {
36 STYLE_HORIZONTAL = 0, // Horizontal is default type.
37 STYLE_VERTICAL = 1<<0,
38 STYLE_DRAW_VALUE = 1<<1, // Display current value next to the slider.
39 STYLE_ONE_DIGIT = 1<<2, // 1 decimal place of precision for value.
40 STYLE_TWO_DIGITS = 1<<3, // 2 decimal places of precision for value.
41 STYLE_UPDATE_ON_RELEASE = 1<<4, // The slider will only notify value
42 // changed on release of mouse
43 };
44
45 Slider();
46 Slider(double min, double max, double step, StyleFlags style,
47 SliderListener* listener);
48 virtual ~Slider();
49
50 // Cause the slider to notify the listener that the value has changed.
51 virtual void NotifyValueChanged();
52
53 // Gets/Sets the value in the slider.
54 const double value() const { return value_; }
55 void SetValue(double value);
56
57 // Accessor for |style_|.
58 StyleFlags style() const { return style_; }
59
60 // Accessor for |min_|.
61 const double min() const { return min_; }
62
63 // Accessor for |max_|.
64 const double max() const { return max_; }
65
66 // Accessor for |step_|.
67 const double step() const { return step_; }
68
69 // Overridden from View:
70 virtual void Layout();
71 virtual gfx::Size GetPreferredSize();
72 virtual bool IsFocusable() const;
73 virtual void SetEnabled(bool enabled);
74
75 protected:
76 virtual void Focus();
77 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
78 virtual std::string GetClassName() const;
79
80 // Creates a new native wrapper properly initialized and returns it. Ownership
81 // is passed to the caller.
82 NativeSliderWrapper* CreateWrapper();
83
84 private:
85 // The object that actually implements the native slider.
86 NativeSliderWrapper* native_wrapper_;
87
88 // The slider's listener. Notified when slider value changed.
89 SliderListener* listener_;
90
91 // The mask of style options for this Slider.
92 StyleFlags style_;
93
94 // The minimum value of the slider.
95 double min_;
96
97 // The maximum value of the slider.
98 double max_;
99
100 // The step increment of the slider.
101 double step_;
102
103 // The value displayed in the slider.
104 double value_;
105
106 DISALLOW_COPY_AND_ASSIGN(Slider);
107 };
108
109 } // namespace views
110
111 #endif // VIEWS_CONTROLS_SLIDER_SLIDER_H_
OLDNEW
« no previous file with comments | « views/controls/slider/native_slider_wrapper.h ('k') | views/controls/slider/slider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698