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

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

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
17 #include "ui/base/ime/text_input_type.h" 17 #include "ui/base/ime/text_input_type.h"
18 #include "ui/base/keycodes/keyboard_codes.h" 18 #include "ui/base/keycodes/keyboard_codes.h"
19 #include "ui/gfx/font_list.h" 19 #include "ui/gfx/font_list.h"
20 #include "ui/gfx/native_widget_types.h" 20 #include "ui/gfx/native_widget_types.h"
21 #include "ui/gfx/text_constants.h" 21 #include "ui/gfx/text_constants.h"
22 #include "ui/views/controls/textfield/native_textfield_wrapper.h" 22 #include "ui/views/controls/textfield/native_textfield_wrapper.h"
23 #include "ui/views/view.h" 23 #include "ui/views/view.h"
24 24
25 #if !defined(OS_LINUX) 25 #if !defined(OS_LINUX)
26 #include "base/logging.h" 26 #include "base/logging.h"
27 #endif 27 #endif
28 28
29 namespace gfx { 29 namespace gfx {
30 class Range;
30 class ImageSkia; 31 class ImageSkia;
31 } 32 }
32 33
33 namespace ui { 34 namespace ui {
34 class Range;
35 class TextInputClient; 35 class TextInputClient;
36 } // namespace ui 36 } // namespace ui
37 37
38 namespace views { 38 namespace views {
39 39
40 class ImageView; 40 class ImageView;
41 41
42 class TextfieldController; 42 class TextfieldController;
43 43
44 // This class implements a View that wraps a native text (edit) field. 44 // This class implements a View that wraps a native text (edit) field.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // This is important because the edit control can be replaced if it has 199 // This is important because the edit control can be replaced if it has
200 // been deleted during a window close. 200 // been deleted during a window close.
201 void SyncText(); 201 void SyncText();
202 202
203 // Returns whether or not an IME is composing text. 203 // Returns whether or not an IME is composing text.
204 bool IsIMEComposing() const; 204 bool IsIMEComposing() const;
205 205
206 // Gets the selected range. This is views-implementation only and 206 // Gets the selected range. This is views-implementation only and
207 // has to be called after the wrapper is created. 207 // has to be called after the wrapper is created.
208 // TODO(msw): Return a const reference when NativeTextfieldWin is gone. 208 // TODO(msw): Return a const reference when NativeTextfieldWin is gone.
209 ui::Range GetSelectedRange() const; 209 gfx::Range GetSelectedRange() const;
210 210
211 // Selects the text given by |range|. This is views-implementation only and 211 // Selects the text given by |range|. This is views-implementation only and
212 // has to be called after the wrapper is created. 212 // has to be called after the wrapper is created.
213 void SelectRange(const ui::Range& range); 213 void SelectRange(const gfx::Range& range);
214 214
215 // Gets the selection model. This is views-implementation only and 215 // Gets the selection model. This is views-implementation only and
216 // has to be called after the wrapper is created. 216 // has to be called after the wrapper is created.
217 // TODO(msw): Return a const reference when NativeTextfieldWin is gone. 217 // TODO(msw): Return a const reference when NativeTextfieldWin is gone.
218 gfx::SelectionModel GetSelectionModel() const; 218 gfx::SelectionModel GetSelectionModel() const;
219 219
220 // Selects the text given by |sel|. This is views-implementation only and 220 // Selects the text given by |sel|. This is views-implementation only and
221 // has to be called after the wrapper is created. 221 // has to be called after the wrapper is created.
222 void SelectSelectionModel(const gfx::SelectionModel& sel); 222 void SelectSelectionModel(const gfx::SelectionModel& sel);
223 223
224 // Returns the current cursor position. This is views-implementation 224 // Returns the current cursor position. This is views-implementation
225 // only and has to be called after the wrapper is created. 225 // only and has to be called after the wrapper is created.
226 size_t GetCursorPosition() const; 226 size_t GetCursorPosition() const;
227 227
228 // Set the text color over the entire text or a logical character range. 228 // Set the text color over the entire text or a logical character range.
229 // Empty and invalid ranges are ignored. This is views-implementation only and 229 // Empty and invalid ranges are ignored. This is views-implementation only and
230 // has to be called after the wrapper is created. 230 // has to be called after the wrapper is created.
231 void SetColor(SkColor value); 231 void SetColor(SkColor value);
232 void ApplyColor(SkColor value, const ui::Range& range); 232 void ApplyColor(SkColor value, const gfx::Range& range);
233 233
234 // Set various text styles over the entire text or a logical character range. 234 // Set various text styles over the entire text or a logical character range.
235 // The respective |style| is applied if |value| is true, or removed if false. 235 // The respective |style| is applied if |value| is true, or removed if false.
236 // Empty and invalid ranges are ignored. This is views-implementation only and 236 // Empty and invalid ranges are ignored. This is views-implementation only and
237 // has to be called after the wrapper is created. 237 // has to be called after the wrapper is created.
238 void SetStyle(gfx::TextStyle style, bool value); 238 void SetStyle(gfx::TextStyle style, bool value);
239 void ApplyStyle(gfx::TextStyle style, bool value, const ui::Range& range); 239 void ApplyStyle(gfx::TextStyle style, bool value, const gfx::Range& range);
240 240
241 // Clears Edit history. 241 // Clears Edit history.
242 void ClearEditHistory(); 242 void ClearEditHistory();
243 243
244 // Set the accessible name of the text field. 244 // Set the accessible name of the text field.
245 void SetAccessibleName(const string16& name); 245 void SetAccessibleName(const string16& name);
246 246
247 // Performs the action associated with the specified command id. 247 // Performs the action associated with the specified command id.
248 void ExecuteCommand(int command_id); 248 void ExecuteCommand(int command_id);
249 249
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 352
353 // Used to bind callback functions to this object. 353 // Used to bind callback functions to this object.
354 base::WeakPtrFactory<Textfield> weak_ptr_factory_; 354 base::WeakPtrFactory<Textfield> weak_ptr_factory_;
355 355
356 DISALLOW_COPY_AND_ASSIGN(Textfield); 356 DISALLOW_COPY_AND_ASSIGN(Textfield);
357 }; 357 };
358 358
359 } // namespace views 359 } // namespace views
360 360
361 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 361 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/native_textfield_wrapper.h ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698