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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // the logical beginning of the text; this generally shows the leading portion | 88 // the logical beginning of the text; this generally shows the leading portion |
89 // of text that overflows its display area. | 89 // of text that overflows its display area. |
90 void SelectAll(bool reversed); | 90 void SelectAll(bool reversed); |
91 | 91 |
92 // Clears the selection within the edit field and sets the caret to the end. | 92 // Clears the selection within the edit field and sets the caret to the end. |
93 void ClearSelection(); | 93 void ClearSelection(); |
94 | 94 |
95 // Checks if there is any selected text. | 95 // Checks if there is any selected text. |
96 bool HasSelection() const; | 96 bool HasSelection() const; |
97 | 97 |
98 // Gets/Sets the text color to be used when painting the Textfield. | 98 // Gets/sets the text color to be used when painting the Textfield. |
99 // Call |UseDefaultTextColor| to restore the default system color. | 99 // Call UseDefaultTextColor() to restore the default system color. |
100 SkColor GetTextColor() const; | 100 SkColor GetTextColor() const; |
101 void SetTextColor(SkColor color); | 101 void SetTextColor(SkColor color); |
102 void UseDefaultTextColor(); | 102 void UseDefaultTextColor(); |
103 | 103 |
104 // Gets/Sets the background color to be used when painting the Textfield. | 104 // Gets/sets the background color to be used when painting the Textfield. |
105 // Call |UseDefaultBackgroundColor| to restore the default system color. | 105 // Call UseDefaultBackgroundColor() to restore the default system color. |
106 SkColor GetBackgroundColor() const; | 106 SkColor GetBackgroundColor() const; |
107 void SetBackgroundColor(SkColor color); | 107 void SetBackgroundColor(SkColor color); |
108 void UseDefaultBackgroundColor(); | 108 void UseDefaultBackgroundColor(); |
109 | 109 |
| 110 // Gets/sets the selection text color to be used when painting the Textfield. |
| 111 // Call UseDefaultSelectionTextColor() to restore the default system color. |
| 112 SkColor GetSelectionTextColor() const; |
| 113 void SetSelectionTextColor(SkColor color); |
| 114 void UseDefaultSelectionTextColor(); |
| 115 |
| 116 // Gets/sets the selection background color to be used when painting the |
| 117 // Textfield. Call UseDefaultSelectionBackgroundColor() to restore the default |
| 118 // system color. |
| 119 SkColor GetSelectionBackgroundColor() const; |
| 120 void SetSelectionBackgroundColor(SkColor color); |
| 121 void UseDefaultSelectionBackgroundColor(); |
| 122 |
110 // Gets/Sets whether or not the cursor is enabled. | 123 // Gets/Sets whether or not the cursor is enabled. |
111 bool GetCursorEnabled() const; | 124 bool GetCursorEnabled() const; |
112 void SetCursorEnabled(bool enabled); | 125 void SetCursorEnabled(bool enabled); |
113 | 126 |
114 // Gets/Sets the fonts used when rendering the text within the Textfield. | 127 // Gets/Sets the fonts used when rendering the text within the Textfield. |
115 const gfx::FontList& GetFontList() const; | 128 const gfx::FontList& GetFontList() const; |
116 void SetFontList(const gfx::FontList& font_list); | 129 void SetFontList(const gfx::FontList& font_list); |
117 | 130 |
118 // Sets the default width of the text control. See default_width_in_chars_. | 131 // Sets the default width of the text control. See default_width_in_chars_. |
119 void set_default_width_in_chars(int default_width) { | 132 void set_default_width_in_chars(int default_width) { |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 381 |
369 // True if this Textfield cannot accept input and is read-only. | 382 // True if this Textfield cannot accept input and is read-only. |
370 bool read_only_; | 383 bool read_only_; |
371 | 384 |
372 // The default number of average characters for the width of this text field. | 385 // The default number of average characters for the width of this text field. |
373 // This will be reported as the "desired size". Defaults to 0. | 386 // This will be reported as the "desired size". Defaults to 0. |
374 int default_width_in_chars_; | 387 int default_width_in_chars_; |
375 | 388 |
376 scoped_ptr<Painter> focus_painter_; | 389 scoped_ptr<Painter> focus_painter_; |
377 | 390 |
378 // Flags indicating whether text and background system colors should be used, | 391 // Flags indicating whether various system colors should be used, and if not, |
379 // and the actual color values used if the corresponding flags are set false. | 392 // what overriding color values should be used instead. |
| 393 bool use_default_text_color_; |
| 394 bool use_default_background_color_; |
| 395 bool use_default_selection_text_color_; |
| 396 bool use_default_selection_background_color_; |
380 SkColor text_color_; | 397 SkColor text_color_; |
381 bool use_default_text_color_; | |
382 SkColor background_color_; | 398 SkColor background_color_; |
383 bool use_default_background_color_; | 399 SkColor selection_text_color_; |
| 400 SkColor selection_background_color_; |
384 | 401 |
385 // Text to display when empty. | 402 // Text to display when empty. |
386 base::string16 placeholder_text_; | 403 base::string16 placeholder_text_; |
387 | 404 |
388 // Placeholder text color. | 405 // Placeholder text color. |
389 SkColor placeholder_text_color_; | 406 SkColor placeholder_text_color_; |
390 | 407 |
391 // The accessible name of the text field. | 408 // The accessible name of the text field. |
392 base::string16 accessible_name_; | 409 base::string16 accessible_name_; |
393 | 410 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 451 |
435 // Used to bind callback functions to this object. | 452 // Used to bind callback functions to this object. |
436 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 453 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
437 | 454 |
438 DISALLOW_COPY_AND_ASSIGN(Textfield); | 455 DISALLOW_COPY_AND_ASSIGN(Textfield); |
439 }; | 456 }; |
440 | 457 |
441 } // namespace views | 458 } // namespace views |
442 | 459 |
443 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 460 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
OLD | NEW |