blob: c70147d88161f0a420a62c81a83592997c91ee6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_CONTROLS_SLIDER_H_
#define UI_VIEWS_CONTROLS_SLIDER_H_
#pragma once
#include "ui/views/view.h"
#include "ui/views/views_export.h"
namespace views {
class Slider;
class VIEWS_EXPORT SliderListener {
public:
virtual void SliderValueChanged(Slider* sender,
float value,
float old_value) = 0;
protected:
virtual ~SliderListener() {}
};
class VIEWS_EXPORT Slider : public View {
public:
enum Orientation {
HORIZONTAL,
VERTICAL
};
Slider(SliderListener* listener, Orientation orientation);
virtual ~Slider();
float value() const { return value_; }
void SetValue(float value);
private:
// views::View overrides:
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE;
SliderListener* listener_;
Orientation orientation_;
float value_;
DISALLOW_COPY_AND_ASSIGN(Slider);
};
} // namespace views
#endif // UI_VIEWS_CONTROLS_SLIDER_H_
|