Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: ui/views/selection_controller_delegate.h

Issue 2408623002: Views: Extract text selection code from Textfield. (Closed)
Patch Set: Address nits. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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_VIEWS_SELECTION_CONTROLLER_DELEGATE_H_
6 #define UI_VIEWS_SELECTION_CONTROLLER_DELEGATE_H_
7
8 #include "ui/views/views_export.h"
9
10 namespace ui {
11 class MouseEvent;
12 }
13
14 namespace views {
15
16 // An interface implemented/managed by a view which uses the
17 // SelectionController.
18 class VIEWS_EXPORT SelectionControllerDelegate {
19 public:
20 // Returns the associated RenderText instance to be used for selection.
21 virtual gfx::RenderText* GetRenderTextForSelectionController() = 0;
22
23 // Methods related to properties of the associated view.
24
25 // Returns true if the associated text view is read only.
26 virtual bool IsReadOnly() const = 0;
27 // Returns whether there is a drag operation originating from the associated
28 // view.
29 virtual bool HasTextBeingDragged() const = 0;
30 // Sets whether text is being dragged from the associated view.
31 virtual void SetTextBeingDragged(bool value) = 0;
32 // Returns the height of the associated view.
33 virtual int GetViewHeight() const = 0;
34 // Returns the width of the associated view.
35 virtual int GetViewWidth() const = 0;
36 // Returns the drag selection timer delay. This is the duration after which a
37 // drag selection is updated when the event location is outside the text
38 // bounds.
39 virtual int GetDragSelectionDelay() const = 0;
40
41 // Called before a mouse action which may change the associated view's
42 // selection and/or text. Should not be called in succession and must always
43 // be followed by an OnAfterMouseAction call.
44 virtual void OnBeforeMouseAction() = 0;
sky 2016/10/21 15:03:40 You are going to need to handle touch/gesture at s
karandeepb 2016/10/25 05:30:42 Done.
45 // Called after a mouse action. |text_changed| and |selection_changed| can be
46 // used by subclasses to make any necessary updates like redraw the text. Must
47 // always be preceeded by an OnBeforeMouseAction call.
48 virtual void OnAfterMouseAction(bool text_changed,
49 bool selection_changed) = 0;
50
51 // Pastes the text from the selection clipboard at the current cursor
52 // position. Always called within a mouse action for a non-readonly view.
53 // Returns true if some text was pasted.
54 virtual bool PasteSelectionClipboard() = 0;
55 // Updates the selection clipboard with the currently selected text. Should
56 // empty the selection clipboard if no text is currently selected.
57 // NO-OP if the associated text view is obscured. Since this does not modify
58 // the render text instance, it may be called outside of a mouse action.
59 virtual void UpdateSelectionClipboard() = 0;
60
61 protected:
62 virtual ~SelectionControllerDelegate() {}
63 };
64
65 } // namespace views
66
67 #endif // UI_VIEWS_SELECTION_CONTROLLER_DELEGATE_H_
OLDNEW
« ui/views/selection_controller.cc ('K') | « ui/views/selection_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698