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

Side by Side Diff: ui/base/touch/axis.h

Issue 9773024: This patch implements Chromium's Aura gesture recognizer in terms of utouch-grail and utouch-frame … (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 8 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
« no previous file with comments | « ui/base/ime/ibus_client.h ('k') | ui/base/touch/axis.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) 2012 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 UI_BASE_TOUCH_AXIS_H_
6 #define UI_BASE_TOUCH_AXIS_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/property_bag.h"
12
13 namespace ui {
14 // Wraps up properties of an axis of a multi-touch device.
15 // An axis refers to a measurement associated with a touch
16 // reported by a device.
17 class Axis {
18 public:
19 enum Type {
20 AXIS_TYPE_X = 0, // X coordinate.
21 AXIS_TYPE_Y, // Y coordinate.
22 AXIS_TYPE_TOUCH_MAJOR, // Width along major axis of contact area of touch.
23 AXIS_TYPE_TOUCH_MINOR, // Width along minor axis of contact area of touch.
24 AXIS_TYPE_WIDTH_MAJOR, // Width along major axis of touch tool.
25 AXIS_TYPE_WIDTH_MINOR, // Width along minor axis of touch tool.
26 AXIS_TYPE_ORIENTATION, // Orientation of major axis of contact ellipse.
27 AXIS_TYPE_TOOL, // Tool type.
28 AXIS_TYPE_BLOB_ID, // Blob ID of group of touches.
29 AXIS_TYPE_TRACKING_ID, // Tracking ID.
30 AXIS_TYPE_PRESSURE, // Pressure.
31 AXIS_TYPE_HOVER_DISTANCE, // Hover distance
32 AXIS_TYPE_UNKNOWN,
33 AXIS_TYPE_LAST
34 };
35
36 Axis();
37 ~Axis();
38
39 // Compiler generated copy-c'tor and assignment operator are fine.
40 // Returns the id of the axis.
41 int id() const { return id_; }
42 // Adjusts the id of the axis.
43 void set_id(int id) { id_ = id; }
44
45 // Returns the type of the axis.
46 Type type() const { return type_; }
47 // Adjusts the type of the axis.
48 void set_type(Type type) { type_ = type; }
49
50 // Returns the human-readable name of the axis.
51 const std::string & name() const { return name_; }
52 // Adjusts the human-readable name of the axis.
53 void set_name(const std::string& name) { name_ = name; }
54
55 // Returns the minimum value of the axis' measurement.
56 float min() const { return min_; }
57 // Adjusts the minimum value of the axis' measurement.
58 void set_min(float min) { min_ = min; }
59
60 // Returns the maximum value of the axis' measurement.
61 float max() const { return max_; }
62 // Adjusts the maximum value of the axis' measurement.
63 void set_max(float max) { max_ = max; }
64
65 // Returns the resolution of values supported by the axis/device.
66 float resolution() const { return resolution_; }
67 // Adjusts the resolution of values supported by the axis/device.
68 void set_resolution(float res) { resolution_ = res; }
69
70 // Returns the current value of the measurement.
71 float value() const { return value_; }
72 // Adjusts the current value of the measurement.
73 void set_value(float value) { value_ = value; }
74
75 // Returns a pointer to a property bag to associate arbitrary
76 // information with an axis object.
77 base::PropertyBag * payload() {
78 if (payload_ == NULL)
79 payload_ = new base::PropertyBag();
80
81 return payload_;
82 }
83
84 private:
85 int id_;
86 Type type_;
87 std::string name_;
88 float min_;
89 float max_;
90 float resolution_;
91 float value_;
92 base::PropertyBag* payload_;
93 };
94
95 } // namespace ui
96
97 #endif // UI_BASE_TOUCH_AXIS_H_
98
OLDNEW
« no previous file with comments | « ui/base/ime/ibus_client.h ('k') | ui/base/touch/axis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698