1 // Copyright 2013 Samsung Electronics. 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 selection_box_efl_h
6 #define selection_box_efl_h
10 #include "content/public/browser/context_menu_params.h"
11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/range/range.h"
18 class RenderWidgetHostViewAura;
19 // Hold the data related to drwaing the selection handlers
20 // and context menu. Also stores all the data required for selection
22 class SelectionBoxEfl {
24 explicit SelectionBoxEfl(RenderWidgetHostViewAura* rwhva);
27 SelectionBoxEfl(const SelectionBoxEfl&) = delete;
28 SelectionBoxEfl& operator=(const SelectionBoxEfl&) = delete;
30 void SetStatus(bool enable);
31 bool GetStatus() const { return status_; }
32 void SetEditable(bool enable) { GetContextMenuParams()->is_editable = enable; }
33 bool GetEditable() const { return GetContextMenuParams()->is_editable; }
34 void UpdateSelectStringData(const std::u16string& text);
35 // Returns true if the rectangle is changed.
36 bool UpdateRectData(const gfx::Rect& left_rect, const gfx::Rect& right_rect);
38 bool IsInEditField() const;
39 gfx::Rect GetLeftRect() const { return left_rect_; }
40 gfx::Rect GetRightRect() const { return right_rect_; }
41 void SetIsAnchorFirst(bool value) { is_anchor_first_ = value; }
42 bool GetIsAnchorFirst() const { return is_anchor_first_; }
43 ContextMenuParams* GetContextMenuParams() const { return context_params_.get(); }
46 // Save the state of selection, if active or not
53 gfx::Rect right_rect_;
55 bool is_anchor_first_;
57 // Contains the menu item data for which context needs to be populated
58 std::unique_ptr<ContextMenuParams> context_params_;
60 RenderWidgetHostViewAura* rwhva_;