ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / ui / base / touch / selection_bound.h
blob52491f0a7c655b4e5e5fa522291cfc6f5e351a4c
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.
5 #ifndef UI_BASE_TOUCH_SELECTION_BOUND_H_
6 #define UI_BASE_TOUCH_SELECTION_BOUND_H_
8 #include "ui/base/ui_base_export.h"
9 #include "ui/gfx/geometry/point.h"
10 #include "ui/gfx/geometry/point_f.h"
12 namespace gfx {
13 class Rect;
16 namespace ui {
18 // Bound of a selection end-point.
19 class UI_BASE_EXPORT SelectionBound {
20 public:
21 enum Type {
22 LEFT,
23 RIGHT,
24 CENTER,
25 EMPTY,
26 LAST = EMPTY
29 SelectionBound();
30 SelectionBound(const SelectionBound& other);
31 ~SelectionBound();
33 Type type() const { return type_; }
34 void set_type(Type value) { type_ = value; }
36 const gfx::PointF& edge_top() const { return edge_top_; }
37 const gfx::Point& edge_top_rounded() const { return edge_top_rounded_; }
38 void SetEdgeTop(const gfx::PointF& value);
40 const gfx::PointF& edge_bottom() const { return edge_bottom_; }
41 const gfx::Point& edge_bottom_rounded() const { return edge_bottom_rounded_; }
42 void SetEdgeBottom(const gfx::PointF& value);
44 void SetEdge(const gfx::PointF& top, const gfx::PointF& bottom);
46 bool visible() const { return visible_; }
47 void set_visible(bool value) { visible_ = value; }
49 // Returns the vertical difference between rounded top and bottom.
50 int GetHeight() const;
52 private:
53 Type type_;
54 gfx::PointF edge_top_;
55 gfx::PointF edge_bottom_;
56 gfx::Point edge_top_rounded_;
57 gfx::Point edge_bottom_rounded_;
58 bool visible_;
61 UI_BASE_EXPORT bool operator==(const SelectionBound& lhs,
62 const SelectionBound& rhs);
63 UI_BASE_EXPORT bool operator!=(const SelectionBound& lhs,
64 const SelectionBound& rhs);
66 UI_BASE_EXPORT gfx::Rect RectBetweenSelectionBounds(const SelectionBound& b1,
67 const SelectionBound& b2);
69 } // namespace ui
71 #endif // UI_BASE_TOUCH_SELECTION_BOUND_H_