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"
13 struct ViewportSelectionBound
;
22 // Bound of a selection end-point.
23 class UI_BASE_EXPORT SelectionBound
{
34 explicit SelectionBound(const cc::ViewportSelectionBound
& bound
);
37 Type
type() const { return type_
; }
38 void set_type(Type value
) { type_
= value
; }
40 const gfx::PointF
& edge_top() const { return edge_top_
; }
41 const gfx::Point
& edge_top_rounded() const { return edge_top_rounded_
; }
42 void SetEdgeTop(const gfx::PointF
& value
);
44 const gfx::PointF
& edge_bottom() const { return edge_bottom_
; }
45 const gfx::Point
& edge_bottom_rounded() const { return edge_bottom_rounded_
; }
46 void SetEdgeBottom(const gfx::PointF
& value
);
48 void SetEdge(const gfx::PointF
& top
, const gfx::PointF
& bottom
);
50 bool visible() const { return visible_
; }
51 void set_visible(bool value
) { visible_
= value
; }
53 // Returns the vertical difference between rounded top and bottom.
54 int GetHeight() const;
58 gfx::PointF edge_top_
;
59 gfx::PointF edge_bottom_
;
60 gfx::Point edge_top_rounded_
;
61 gfx::Point edge_bottom_rounded_
;
65 UI_BASE_EXPORT
bool operator==(const SelectionBound
& lhs
,
66 const SelectionBound
& rhs
);
67 UI_BASE_EXPORT
bool operator!=(const SelectionBound
& lhs
,
68 const SelectionBound
& rhs
);
70 UI_BASE_EXPORT
gfx::Rect
RectBetweenSelectionBounds(const SelectionBound
& b1
,
71 const SelectionBound
& b2
);
75 #endif // UI_BASE_TOUCH_SELECTION_BOUND_H_