[M108 Migration][Text Selection] Selection handles & Caret Selection
[platform/framework/web/chromium-efl.git] / tizen_src / chromium_impl / content / browser / selection / selection_box_efl.h
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.
4
5 #ifndef selection_box_efl_h
6 #define selection_box_efl_h
7
8 #include <Evas.h>
9
10 #include "content/public/browser/context_menu_params.h"
11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/range/range.h"
13
14 class EWebView;
15
16 namespace content {
17
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
21 // controlling
22 class SelectionBoxEfl {
23  public:
24   explicit SelectionBoxEfl(RenderWidgetHostViewAura* rwhva);
25   ~SelectionBoxEfl();
26
27   SelectionBoxEfl(const SelectionBoxEfl&) = delete;
28   SelectionBoxEfl& operator=(const SelectionBoxEfl&) = delete;
29
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);
37   void ClearRectData();
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(); }
44
45  private:
46   // Save the state of selection, if active or not
47   bool status_;
48
49   // Start of selection
50   gfx::Rect left_rect_;
51
52   // End of selection
53   gfx::Rect right_rect_;
54
55   bool is_anchor_first_;
56
57   // Contains the menu item data for which context needs to be populated
58   std::unique_ptr<ContextMenuParams> context_params_;
59
60   RenderWidgetHostViewAura* rwhva_;
61 };
62
63 }
64 #endif