OLD | NEW |
(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 #ifndef UI_BASE_TOUCH_AXIS_H_ |
| 5 #define UI_BASE_TOUCH_AXIS_H_ |
| 6 |
| 7 #include "base/property_bag.h" |
| 8 |
| 9 #include <limits> |
| 10 #include <string> |
| 11 |
| 12 namespace ui { |
| 13 |
| 14 class Axis { |
| 15 public: |
| 16 enum Type { |
| 17 AXIS_TYPE_X = 0, /**< X coordinate */ |
| 18 AXIS_TYPE_Y, /**< Y coordinate */ |
| 19 AXIS_TYPE_TOUCH_MAJOR, |
| 20 /**< Width along major axis of contact area of touch */ |
| 21 AXIS_TYPE_TOUCH_MINOR, |
| 22 /**< Width along minor axis of contact area of touch */ |
| 23 AXIS_TYPE_WIDTH_MAJOR, /**< Width along major axis of touch tool */ |
| 24 AXIS_TYPE_WIDTH_MINOR, /**< Width along minor axis of touch tool */ |
| 25 AXIS_TYPE_ORIENTATION, /**< Orientation of major axis of contact ellipse */ |
| 26 AXIS_TYPE_TOOL, /**< Tool type */ |
| 27 AXIS_TYPE_BLOB_ID, /**< Blob ID of group of touches */ |
| 28 AXIS_TYPE_TRACKING_ID, /**< Tracking ID */ |
| 29 AXIS_TYPE_PRESSURE, /**< Pressure */ |
| 30 AXIS_TYPE_HOVER_DISTANCE, /**< Hover distance */ |
| 31 AXIS_TYPE_UNKNOWN, |
| 32 AXIS_TYPE_LAST |
| 33 }; |
| 34 |
| 35 Axis() |
| 36 : id_(-1), |
| 37 type_(AXIS_TYPE_UNKNOWN), |
| 38 name_("Unknown axis"), |
| 39 min_(-std::numeric_limits<float>::max()), |
| 40 max_(std::numeric_limits<float>::max()), |
| 41 resolution_(0.f), |
| 42 value_(0.f), |
| 43 payload_(NULL) { |
| 44 } |
| 45 |
| 46 ~Axis() { |
| 47 delete(payload_); |
| 48 } |
| 49 |
| 50 int id() const { return id_; } |
| 51 void set_id(int id) { id_ = id; } |
| 52 |
| 53 Type type() const { return type_; } |
| 54 void set_type(Type type) { type_ = type; } |
| 55 |
| 56 const std::string & name() const { return name_; } |
| 57 void set_name(const std::string& name) { name_ = name; } |
| 58 |
| 59 float min() const { return min_; } |
| 60 void set_min(float min) { min_ = min; } |
| 61 |
| 62 float max() const { return max_; } |
| 63 void set_max(float max) { max_ = max; } |
| 64 |
| 65 float resolution() const { return resolution_; } |
| 66 void set_resolution(float res) { resolution_ = res; } |
| 67 |
| 68 float value() const { return value_; } |
| 69 void set_value(float value) { value_ = value; } |
| 70 |
| 71 base::PropertyBag * payload() { |
| 72 if (payload_ == NULL) |
| 73 payload_ = new base::PropertyBag(); |
| 74 |
| 75 return payload_; |
| 76 } |
| 77 |
| 78 private: |
| 79 int id_; |
| 80 Type type_; |
| 81 std::string name_; |
| 82 float min_; |
| 83 float max_; |
| 84 float resolution_; |
| 85 float value_; |
| 86 base::PropertyBag* payload_; |
| 87 }; |
| 88 } |
| 89 #endif // UI_BASE_TOUCH_AXIS_H_ |
OLD | NEW |