| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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_SELECTION_BOUND_H_ | |
| 6 #define UI_BASE_TOUCH_SELECTION_BOUND_H_ | |
| 7 | |
| 8 #include "ui/base/ui_base_export.h" | |
| 9 #include "ui/gfx/geometry/point.h" | |
| 10 #include "ui/gfx/geometry/point_f.h" | |
| 11 | |
| 12 namespace gfx { | |
| 13 class Rect; | |
| 14 class RectF; | |
| 15 } | |
| 16 | |
| 17 namespace ui { | |
| 18 | |
| 19 // Bound of a selection end-point. | |
| 20 class UI_BASE_EXPORT SelectionBound { | |
| 21 public: | |
| 22 enum Type { | |
| 23 LEFT, | |
| 24 RIGHT, | |
| 25 CENTER, | |
| 26 EMPTY, | |
| 27 LAST = EMPTY | |
| 28 }; | |
| 29 | |
| 30 SelectionBound(); | |
| 31 SelectionBound(const SelectionBound& other); | |
| 32 ~SelectionBound(); | |
| 33 | |
| 34 Type type() const { return type_; } | |
| 35 void set_type(Type value) { type_ = value; } | |
| 36 | |
| 37 const gfx::PointF& edge_top() const { return edge_top_; } | |
| 38 const gfx::Point& edge_top_rounded() const { return edge_top_rounded_; } | |
| 39 void SetEdgeTop(const gfx::PointF& value); | |
| 40 | |
| 41 const gfx::PointF& edge_bottom() const { return edge_bottom_; } | |
| 42 const gfx::Point& edge_bottom_rounded() const { return edge_bottom_rounded_; } | |
| 43 void SetEdgeBottom(const gfx::PointF& value); | |
| 44 | |
| 45 void SetEdge(const gfx::PointF& top, const gfx::PointF& bottom); | |
| 46 | |
| 47 bool visible() const { return visible_; } | |
| 48 void set_visible(bool value) { visible_ = value; } | |
| 49 | |
| 50 // Returns the vertical difference between rounded top and bottom. | |
| 51 int GetHeight() const; | |
| 52 | |
| 53 private: | |
| 54 Type type_; | |
| 55 gfx::PointF edge_top_; | |
| 56 gfx::PointF edge_bottom_; | |
| 57 gfx::Point edge_top_rounded_; | |
| 58 gfx::Point edge_bottom_rounded_; | |
| 59 bool visible_; | |
| 60 }; | |
| 61 | |
| 62 UI_BASE_EXPORT bool operator==(const SelectionBound& lhs, | |
| 63 const SelectionBound& rhs); | |
| 64 UI_BASE_EXPORT bool operator!=(const SelectionBound& lhs, | |
| 65 const SelectionBound& rhs); | |
| 66 | |
| 67 UI_BASE_EXPORT gfx::Rect RectBetweenSelectionBounds(const SelectionBound& b1, | |
| 68 const SelectionBound& b2); | |
| 69 | |
| 70 UI_BASE_EXPORT gfx::RectF RectFBetweenSelectionBounds(const SelectionBound& b1, | |
| 71 const SelectionBound& b2); | |
| 72 | |
| 73 } // namespace ui | |
| 74 | |
| 75 #endif // UI_BASE_TOUCH_SELECTION_BOUND_H_ | |
| OLD | NEW |