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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/touch/axis.h
===================================================================
--- ui/base/touch/axis.h (revision 0)
+++ ui/base/touch/axis.h (revision 0)
@@ -0,0 +1,98 @@
+// 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_BASE_TOUCH_AXIS_H_
+#define UI_BASE_TOUCH_AXIS_H_
+#pragma once
+
+#include <string>
+
+#include "base/property_bag.h"
+
+namespace ui {
+// Wraps up properties of an axis of a multi-touch device.
+// An axis refers to a measurement associated with a touch
+// reported by a device.
+class Axis {
+ public:
+ enum Type {
+ AXIS_TYPE_X = 0, // X coordinate.
+ AXIS_TYPE_Y, // Y coordinate.
+ AXIS_TYPE_TOUCH_MAJOR, // Width along major axis of contact area of touch.
+ AXIS_TYPE_TOUCH_MINOR, // Width along minor axis of contact area of touch.
+ AXIS_TYPE_WIDTH_MAJOR, // Width along major axis of touch tool.
+ AXIS_TYPE_WIDTH_MINOR, // Width along minor axis of touch tool.
+ AXIS_TYPE_ORIENTATION, // Orientation of major axis of contact ellipse.
+ AXIS_TYPE_TOOL, // Tool type.
+ AXIS_TYPE_BLOB_ID, // Blob ID of group of touches.
+ AXIS_TYPE_TRACKING_ID, // Tracking ID.
+ AXIS_TYPE_PRESSURE, // Pressure.
+ AXIS_TYPE_HOVER_DISTANCE, // Hover distance
+ AXIS_TYPE_UNKNOWN,
+ AXIS_TYPE_LAST
+ };
+
+ Axis();
+ ~Axis();
+
+ // Compiler generated copy-c'tor and assignment operator are fine.
+ // Returns the id of the axis.
+ int id() const { return id_; }
+ // Adjusts the id of the axis.
+ void set_id(int id) { id_ = id; }
+
+ // Returns the type of the axis.
+ Type type() const { return type_; }
+ // Adjusts the type of the axis.
+ void set_type(Type type) { type_ = type; }
+
+ // Returns the human-readable name of the axis.
+ const std::string & name() const { return name_; }
+ // Adjusts the human-readable name of the axis.
+ void set_name(const std::string& name) { name_ = name; }
+
+ // Returns the minimum value of the axis' measurement.
+ float min() const { return min_; }
+ // Adjusts the minimum value of the axis' measurement.
+ void set_min(float min) { min_ = min; }
+
+ // Returns the maximum value of the axis' measurement.
+ float max() const { return max_; }
+ // Adjusts the maximum value of the axis' measurement.
+ void set_max(float max) { max_ = max; }
+
+ // Returns the resolution of values supported by the axis/device.
+ float resolution() const { return resolution_; }
+ // Adjusts the resolution of values supported by the axis/device.
+ void set_resolution(float res) { resolution_ = res; }
+
+ // Returns the current value of the measurement.
+ float value() const { return value_; }
+ // Adjusts the current value of the measurement.
+ void set_value(float value) { value_ = value; }
+
+ // Returns a pointer to a property bag to associate arbitrary
+ // information with an axis object.
+ base::PropertyBag * payload() {
+ if (payload_ == NULL)
+ payload_ = new base::PropertyBag();
+
+ return payload_;
+ }
+
+ private:
+ int id_;
+ Type type_;
+ std::string name_;
+ float min_;
+ float max_;
+ float resolution_;
+ float value_;
+ base::PropertyBag* payload_;
+};
+
+} // namespace ui
+
+#endif // UI_BASE_TOUCH_AXIS_H_
+
Property changes on: ui/base/touch/axis.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« 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