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

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: 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Returns the selected text. 116 // Returns the selected text.
117 string16 GetSelectedText() const; 117 string16 GetSelectedText() const;
118 118
119 void GetSelectedRange(TextRange* range) const; 119 void GetSelectedRange(TextRange* range) const;
120 120
121 void SelectRange(const TextRange& range); 121 void SelectRange(const TextRange& range);
122 122
123 // Selects all text. 123 // Selects all text.
124 void SelectAll(); 124 void SelectAll();
125 125
126 // Selects the word at which the cursor is currently positioned.
127 void SelectWord();
128
126 // Clears selection. 129 // Clears selection.
127 void ClearSelection(); 130 void ClearSelection();
128 131
129 // Returns visible text. If the field is password, it returns the 132 // Returns visible text. If the field is password, it returns the
130 // sequence of "*". 133 // sequence of "*".
131 string16 GetVisibleText() const { 134 string16 GetVisibleText() const {
132 return GetVisibleText(0U, text_.length()); 135 return GetVisibleText(0U, text_.length());
133 } 136 }
134 137
135 // Cuts the currently selected text and puts it to clipboard. Returns true 138 // Cuts the currently selected text and puts it to clipboard. Returns true
(...skipping 12 matching lines...) Expand all
148 151
149 private: 152 private:
150 friend class NativeTextfieldViews; 153 friend class NativeTextfieldViews;
151 154
152 // Deletes the selected text. 155 // Deletes the selected text.
153 void DeleteSelection(); 156 void DeleteSelection();
154 157
155 // Returns the visible text given |start| and |end|. 158 // Returns the visible text given |start| and |end|.
156 string16 GetVisibleText(size_t start, size_t end) const; 159 string16 GetVisibleText(size_t start, size_t end) const;
157 160
161 // Utility for SelectWord(). Checks whether position pos is at word boundary.
162 bool IsPositionAtWordSelectionBoundary(size_t pos);
163
158 // Returns the normalized cursor position that does not exceed the 164 // Returns the normalized cursor position that does not exceed the
159 // text length. 165 // text length.
160 size_t GetSafePosition(size_t position) const; 166 size_t GetSafePosition(size_t position) const;
161 167
162 // The text in utf16 format. 168 // The text in utf16 format.
163 string16 text_; 169 string16 text_;
164 170
165 // Current cursor position. 171 // Current cursor position.
166 size_t cursor_pos_; 172 size_t cursor_pos_;
167 173
168 // Selection range. 174 // Selection range.
169 size_t selection_begin_; 175 size_t selection_begin_;
170 176
171 // True if the text is the password. 177 // True if the text is the password.
172 bool is_password_; 178 bool is_password_;
173 179
174 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); 180 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel);
175 }; 181 };
176 182
177 } // namespace views 183 } // namespace views
178 184
179 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ 185 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_
OLDNEW
« no previous file with comments | « views/controls/textfield/native_textfield_views_unittest.cc ('k') | views/controls/textfield/textfield_views_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698