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

Side by Side Diff: views/controls/textfield/textfield_views_model.h

Issue 6267002: Implement double/triple click functionality in views textfield. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: minor refactoring Created 9 years, 11 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_
6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ 6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 gfx::Rect GetCursorBounds(const gfx::Font& font) const; 110 gfx::Rect GetCursorBounds(const gfx::Font& font) const;
111 111
112 // Selection related method 112 // Selection related method
113 113
114 // Returns the selected text. 114 // Returns the selected text.
115 string16 GetSelectedText() const; 115 string16 GetSelectedText() const;
116 116
117 // Selects all text. 117 // Selects all text.
118 void SelectAll(); 118 void SelectAll();
119 119
120 // Selects the word at which the cursor is currently positioned.
121 void SelectWord();
122
120 // Clears selection. 123 // Clears selection.
121 void ClearSelection(); 124 void ClearSelection();
122 125
123 // Returns visible text. If the field is password, it returns the 126 // Returns visible text. If the field is password, it returns the
124 // sequence of "*". 127 // sequence of "*".
125 string16 GetVisibleText() const { 128 string16 GetVisibleText() const {
126 return GetVisibleText(0U, text_.length()); 129 return GetVisibleText(0U, text_.length());
127 } 130 }
128 131
129 // Cuts the currently selected text and puts it to clipboard. Returns true 132 // Cuts the currently selected text and puts it to clipboard. Returns true
(...skipping 12 matching lines...) Expand all
142 145
143 private: 146 private:
144 friend class NativeTextfieldViews; 147 friend class NativeTextfieldViews;
145 148
146 // Deletes the selected text. 149 // Deletes the selected text.
147 void DeleteSelection(); 150 void DeleteSelection();
148 151
149 // Returns the visible text given |start| and |end|. 152 // Returns the visible text given |start| and |end|.
150 string16 GetVisibleText(size_t start, size_t end) const; 153 string16 GetVisibleText(size_t start, size_t end) const;
151 154
155 // Utility for SelectWord(). Checks whether position pos is at word boundary.
156 bool IsPositionAtWordSelectionBoundary(size_t pos);
157
152 // The text in utf16 format. 158 // The text in utf16 format.
153 string16 text_; 159 string16 text_;
154 160
155 // Current cursor position. 161 // Current cursor position.
156 size_t cursor_pos_; 162 size_t cursor_pos_;
157 163
158 // Selection range. 164 // Selection range.
159 size_t selection_begin_; 165 size_t selection_begin_;
160 166
161 // True if the text is the password. 167 // True if the text is the password.
162 bool is_password_; 168 bool is_password_;
163 169
164 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); 170 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel);
165 }; 171 };
166 172
167 } // namespace views 173 } // namespace views
168 174
169 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ 175 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698