| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // Sets the text to display when empty. | 156 // Sets the text to display when empty. |
| 157 void set_placeholder_text(const base::string16& text) { | 157 void set_placeholder_text(const base::string16& text) { |
| 158 placeholder_text_ = text; | 158 placeholder_text_ = text; |
| 159 } | 159 } |
| 160 base::string16 GetPlaceholderText() const; | 160 base::string16 GetPlaceholderText() const; |
| 161 | 161 |
| 162 void set_placeholder_text_color(SkColor color) { | 162 void set_placeholder_text_color(SkColor color) { |
| 163 placeholder_text_color_ = color; | 163 placeholder_text_color_ = color; |
| 164 } | 164 } |
| 165 | 165 |
| 166 // Sets whether to indicate the textfield has invalid content. |
| 167 void SetInvalid(bool invalid); |
| 168 bool invalid() const { return invalid_; } |
| 169 |
| 166 // Get or set the horizontal alignment used for the button from the underlying | 170 // Get or set the horizontal alignment used for the button from the underlying |
| 167 // RenderText object. | 171 // RenderText object. |
| 168 gfx::HorizontalAlignment GetHorizontalAlignment() const; | 172 gfx::HorizontalAlignment GetHorizontalAlignment() const; |
| 169 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment); | 173 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment); |
| 170 | 174 |
| 171 // Displays a virtual keyboard or alternate input view if enabled. | 175 // Displays a virtual keyboard or alternate input view if enabled. |
| 172 void ShowImeIfNeeded(); | 176 void ShowImeIfNeeded(); |
| 173 | 177 |
| 174 // Returns whether or not an IME is composing text. | 178 // Returns whether or not an IME is composing text. |
| 175 bool IsIMEComposing() const; | 179 bool IsIMEComposing() const; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 bool OnKeyReleased(const ui::KeyEvent& event) final; | 346 bool OnKeyReleased(const ui::KeyEvent& event) final; |
| 343 | 347 |
| 344 // Handles a request to change the value of this text field from software | 348 // Handles a request to change the value of this text field from software |
| 345 // using an accessibility API (typically automation software, screen readers | 349 // using an accessibility API (typically automation software, screen readers |
| 346 // don't normally use this). Sets the value and clears the selection. | 350 // don't normally use this). Sets the value and clears the selection. |
| 347 void AccessibilitySetValue(const base::string16& new_value); | 351 void AccessibilitySetValue(const base::string16& new_value); |
| 348 | 352 |
| 349 // Updates the painted background color. | 353 // Updates the painted background color. |
| 350 void UpdateBackgroundColor(); | 354 void UpdateBackgroundColor(); |
| 351 | 355 |
| 356 // Updates the border per the state of |invalid_|. |
| 357 void UpdateBorder(); |
| 358 |
| 352 // Does necessary updates when the text and/or cursor position changes. | 359 // Does necessary updates when the text and/or cursor position changes. |
| 353 void UpdateAfterChange(bool text_changed, bool cursor_changed); | 360 void UpdateAfterChange(bool text_changed, bool cursor_changed); |
| 354 | 361 |
| 355 // A callback function to periodically update the cursor state. | 362 // A callback function to periodically update the cursor state. |
| 356 void UpdateCursor(); | 363 void UpdateCursor(); |
| 357 | 364 |
| 358 // Repaint the cursor. | 365 // Repaint the cursor. |
| 359 void RepaintCursor(); | 366 void RepaintCursor(); |
| 360 | 367 |
| 361 void PaintTextAndCursor(gfx::Canvas* canvas); | 368 void PaintTextAndCursor(gfx::Canvas* canvas); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 SkColor selection_text_color_; | 464 SkColor selection_text_color_; |
| 458 SkColor selection_background_color_; | 465 SkColor selection_background_color_; |
| 459 | 466 |
| 460 // Text to display when empty. | 467 // Text to display when empty. |
| 461 base::string16 placeholder_text_; | 468 base::string16 placeholder_text_; |
| 462 | 469 |
| 463 // Placeholder text color. | 470 // Placeholder text color. |
| 464 // TODO(estade): remove this when Harmony/MD is default. | 471 // TODO(estade): remove this when Harmony/MD is default. |
| 465 SkColor placeholder_text_color_; | 472 SkColor placeholder_text_color_; |
| 466 | 473 |
| 474 // True when the contents are deemed unacceptable and should be indicated as |
| 475 // such. |
| 476 bool invalid_; |
| 477 |
| 467 // The accessible name of the text field. | 478 // The accessible name of the text field. |
| 468 base::string16 accessible_name_; | 479 base::string16 accessible_name_; |
| 469 | 480 |
| 470 // The input type of this text field. | 481 // The input type of this text field. |
| 471 ui::TextInputType text_input_type_; | 482 ui::TextInputType text_input_type_; |
| 472 | 483 |
| 473 // The input flags of this text field. | 484 // The input flags of this text field. |
| 474 int text_input_flags_; | 485 int text_input_flags_; |
| 475 | 486 |
| 476 // The timer to reveal the last typed password character. | 487 // The timer to reveal the last typed password character. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 535 |
| 525 // Used to bind callback functions to this object. | 536 // Used to bind callback functions to this object. |
| 526 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 537 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
| 527 | 538 |
| 528 DISALLOW_COPY_AND_ASSIGN(Textfield); | 539 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 529 }; | 540 }; |
| 530 | 541 |
| 531 } // namespace views | 542 } // namespace views |
| 532 | 543 |
| 533 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 544 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |