OLD | NEW |
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" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // the logical beginning of the text; this generally shows the leading portion | 92 // the logical beginning of the text; this generally shows the leading portion |
93 // of text that overflows its display area. | 93 // of text that overflows its display area. |
94 void SelectAll(bool reversed); | 94 void SelectAll(bool reversed); |
95 | 95 |
96 // Clears the selection within the edit field and sets the caret to the end. | 96 // Clears the selection within the edit field and sets the caret to the end. |
97 void ClearSelection(); | 97 void ClearSelection(); |
98 | 98 |
99 // Checks if there is any selected text. | 99 // Checks if there is any selected text. |
100 bool HasSelection() const; | 100 bool HasSelection() const; |
101 | 101 |
102 // Gets/Sets the text color to be used when painting the Textfield. | 102 // Gets/sets the text color to be used when painting the Textfield. |
103 // Call |UseDefaultTextColor| to restore the default system color. | 103 // Call UseDefaultTextColor() to restore the default system color. |
104 SkColor GetTextColor() const; | 104 SkColor GetTextColor() const; |
105 void SetTextColor(SkColor color); | 105 void SetTextColor(SkColor color); |
106 void UseDefaultTextColor(); | 106 void UseDefaultTextColor(); |
107 | 107 |
108 // Gets/Sets the background color to be used when painting the Textfield. | 108 // Gets/sets the background color to be used when painting the Textfield. |
109 // Call |UseDefaultBackgroundColor| to restore the default system color. | 109 // Call UseDefaultBackgroundColor() to restore the default system color. |
110 SkColor GetBackgroundColor() const; | 110 SkColor GetBackgroundColor() const; |
111 void SetBackgroundColor(SkColor color); | 111 void SetBackgroundColor(SkColor color); |
112 void UseDefaultBackgroundColor(); | 112 void UseDefaultBackgroundColor(); |
113 | 113 |
| 114 // Gets/sets the selection text color to be used when painting the Textfield. |
| 115 // Call UseDefaultSelectionTextColor() to restore the default system color. |
| 116 SkColor GetSelectionTextColor() const; |
| 117 void SetSelectionTextColor(SkColor color); |
| 118 void UseDefaultSelectionTextColor(); |
| 119 |
| 120 // Gets/sets the selection background color to be used when painting the |
| 121 // Textfield. Call UseDefaultSelectionBackgroundColor() to restore the default |
| 122 // system color. |
| 123 SkColor GetSelectionBackgroundColor() const; |
| 124 void SetSelectionBackgroundColor(SkColor color); |
| 125 void UseDefaultSelectionBackgroundColor(); |
| 126 |
114 // Gets/Sets whether or not the cursor is enabled. | 127 // Gets/Sets whether or not the cursor is enabled. |
115 bool GetCursorEnabled() const; | 128 bool GetCursorEnabled() const; |
116 void SetCursorEnabled(bool enabled); | 129 void SetCursorEnabled(bool enabled); |
117 | 130 |
118 // Gets/Sets the fonts used when rendering the text within the Textfield. | 131 // Gets/Sets the fonts used when rendering the text within the Textfield. |
119 const gfx::FontList& GetFontList() const; | 132 const gfx::FontList& GetFontList() const; |
120 void SetFontList(const gfx::FontList& font_list); | 133 void SetFontList(const gfx::FontList& font_list); |
121 | 134 |
122 // Sets the default width of the text control. See default_width_in_chars_. | 135 // Sets the default width of the text control. See default_width_in_chars_. |
123 void set_default_width_in_chars(int default_width) { | 136 void set_default_width_in_chars(int default_width) { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 bool read_only_; | 386 bool read_only_; |
374 | 387 |
375 // The default number of average characters for the width of this text field. | 388 // The default number of average characters for the width of this text field. |
376 // This will be reported as the "desired size". Defaults to 0. | 389 // This will be reported as the "desired size". Defaults to 0. |
377 int default_width_in_chars_; | 390 int default_width_in_chars_; |
378 | 391 |
379 scoped_ptr<Painter> focus_painter_; | 392 scoped_ptr<Painter> focus_painter_; |
380 | 393 |
381 // Text color. Only used if |use_default_text_color_| is false. | 394 // Text color. Only used if |use_default_text_color_| is false. |
382 SkColor text_color_; | 395 SkColor text_color_; |
383 | |
384 // Should we use the system text color instead of |text_color_|? | |
385 bool use_default_text_color_; | 396 bool use_default_text_color_; |
386 | 397 |
387 // Background color. Only used if |use_default_background_color_| is false. | 398 // Background color. Only used if |use_default_background_color_| is false. |
388 SkColor background_color_; | 399 SkColor background_color_; |
| 400 bool use_default_background_color_; |
389 | 401 |
390 // Should we use the system background color instead of |background_color_|? | 402 // Selection text color. Only used if |use_default_selection_text_color_| is |
391 bool use_default_background_color_; | 403 // false. |
| 404 SkColor selection_text_color_; |
| 405 bool use_default_selection_text_color_; |
| 406 |
| 407 // Selection background color. Only used if |
| 408 // |use_default_selection_background_color_| is false. |
| 409 SkColor selection_background_color_; |
| 410 bool use_default_selection_background_color_; |
392 | 411 |
393 // Text to display when empty. | 412 // Text to display when empty. |
394 base::string16 placeholder_text_; | 413 base::string16 placeholder_text_; |
395 | 414 |
396 // Placeholder text color. | 415 // Placeholder text color. |
397 SkColor placeholder_text_color_; | 416 SkColor placeholder_text_color_; |
398 | 417 |
399 // The accessible name of the text field. | 418 // The accessible name of the text field. |
400 base::string16 accessible_name_; | 419 base::string16 accessible_name_; |
401 | 420 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 | 458 |
440 // Used to bind callback functions to this object. | 459 // Used to bind callback functions to this object. |
441 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 460 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
442 | 461 |
443 DISALLOW_COPY_AND_ASSIGN(Textfield); | 462 DISALLOW_COPY_AND_ASSIGN(Textfield); |
444 }; | 463 }; |
445 | 464 |
446 } // namespace views | 465 } // namespace views |
447 | 466 |
448 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 467 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
OLD | NEW |