Chromium Code Reviews| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 bool GetSelectionRange(gfx::Range* range) const override; | 296 bool GetSelectionRange(gfx::Range* range) const override; |
| 297 bool SetSelectionRange(const gfx::Range& range) override; | 297 bool SetSelectionRange(const gfx::Range& range) override; |
| 298 bool DeleteRange(const gfx::Range& range) override; | 298 bool DeleteRange(const gfx::Range& range) override; |
| 299 bool GetTextFromRange(const gfx::Range& range, | 299 bool GetTextFromRange(const gfx::Range& range, |
| 300 base::string16* text) const override; | 300 base::string16* text) const override; |
| 301 void OnInputMethodChanged() override; | 301 void OnInputMethodChanged() override; |
| 302 bool ChangeTextDirectionAndLayoutAlignment( | 302 bool ChangeTextDirectionAndLayoutAlignment( |
| 303 base::i18n::TextDirection direction) override; | 303 base::i18n::TextDirection direction) override; |
| 304 void ExtendSelectionAndDelete(size_t before, size_t after) override; | 304 void ExtendSelectionAndDelete(size_t before, size_t after) override; |
| 305 void EnsureCaretInRect(const gfx::Rect& rect) override; | 305 void EnsureCaretInRect(const gfx::Rect& rect) override; |
| 306 bool IsEditCommandEnabled(int command_id) const override; | 306 bool IsEditCommandEnabled(ui::TextEditCommand command) const override; |
| 307 void SetEditCommandForNextKeyEvent(int command_id) override; | 307 void SetEditCommandForNextKeyEvent(ui::TextEditCommand command) override; |
| 308 | 308 |
| 309 protected: | 309 protected: |
| 310 // Inserts or appends a character in response to an IME operation. | 310 // Inserts or appends a character in response to an IME operation. |
| 311 virtual void DoInsertChar(base::char16 ch); | 311 virtual void DoInsertChar(base::char16 ch); |
| 312 | 312 |
| 313 // Returns the TextfieldModel's text/cursor/selection rendering model. | 313 // Returns the TextfieldModel's text/cursor/selection rendering model. |
| 314 gfx::RenderText* GetRenderText() const; | 314 gfx::RenderText* GetRenderText() const; |
| 315 | 315 |
| 316 gfx::Point last_click_location() const { return last_click_location_; } | 316 gfx::Point last_click_location() const { return last_click_location_; } |
| 317 | 317 |
| 318 // Get the text from the selection clipboard. | 318 // Get the text from the selection clipboard. |
| 319 virtual base::string16 GetSelectionClipboardText() const; | 319 virtual base::string16 GetSelectionClipboardText() const; |
| 320 | 320 |
| 321 // Executes the given text editing command. | 321 // Executes the given |command|. |
| 322 virtual void ExecuteEditCommand(int command_id); | 322 virtual void ExecuteEditCommand(ui::TextEditCommand command); |
|
sky
2016/06/16 17:00:37
ExecuteTextEditCommand?
karandeepb
2016/06/17 02:39:03
Done.
| |
| 323 | 323 |
| 324 private: | 324 private: |
| 325 friend class TextfieldTestApi; | 325 friend class TextfieldTestApi; |
| 326 | 326 |
| 327 // Handles a request to change the value of this text field from software | 327 // Handles a request to change the value of this text field from software |
| 328 // using an accessibility API (typically automation software, screen readers | 328 // using an accessibility API (typically automation software, screen readers |
| 329 // don't normally use this). Sets the value and clears the selection. | 329 // don't normally use this). Sets the value and clears the selection. |
| 330 void AccessibilitySetValue(const base::string16& new_value); | 330 void AccessibilitySetValue(const base::string16& new_value); |
| 331 | 331 |
| 332 // Updates the painted background color. | 332 // Updates the painted background color. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 | 388 |
| 389 // Pastes the selection clipboard for the specified mouse event. | 389 // Pastes the selection clipboard for the specified mouse event. |
| 390 void PasteSelectionClipboard(const ui::MouseEvent& event); | 390 void PasteSelectionClipboard(const ui::MouseEvent& event); |
| 391 | 391 |
| 392 // The text model. | 392 // The text model. |
| 393 std::unique_ptr<TextfieldModel> model_; | 393 std::unique_ptr<TextfieldModel> model_; |
| 394 | 394 |
| 395 // This is the current listener for events from this Textfield. | 395 // This is the current listener for events from this Textfield. |
| 396 TextfieldController* controller_; | 396 TextfieldController* controller_; |
| 397 | 397 |
| 398 // If non-zero, an edit command to execute on the next key event. When set, | 398 // An edit command to execute on the next key event. When set to a valid |
| 399 // the key event is still passed to |controller_|, but otherwise ignored in | 399 // value, the key event is still passed to |controller_|, but otherwise |
| 400 // favor of the edit command. Set via SetEditCommandForNextKeyEvent() during | 400 // ignored in favor of the edit command. Set via |
| 401 // dispatch of that key event (see comment in TextInputClient). | 401 // SetEditCommandForNextKeyEvent() during dispatch of that key event (see |
| 402 int scheduled_edit_command_; | 402 // comment in TextInputClient). |
| 403 ui::TextEditCommand scheduled_edit_command_; | |
| 403 | 404 |
| 404 // True if this Textfield cannot accept input and is read-only. | 405 // True if this Textfield cannot accept input and is read-only. |
| 405 bool read_only_; | 406 bool read_only_; |
| 406 | 407 |
| 407 // The default number of average characters for the width of this text field. | 408 // The default number of average characters for the width of this text field. |
| 408 // This will be reported as the "desired size". Defaults to 0. | 409 // This will be reported as the "desired size". Defaults to 0. |
| 409 int default_width_in_chars_; | 410 int default_width_in_chars_; |
| 410 | 411 |
| 411 // Flags indicating whether various system colors should be used, and if not, | 412 // Flags indicating whether various system colors should be used, and if not, |
| 412 // what overriding color values should be used instead. | 413 // what overriding color values should be used instead. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 484 | 485 |
| 485 // Used to bind callback functions to this object. | 486 // Used to bind callback functions to this object. |
| 486 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 487 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
| 487 | 488 |
| 488 DISALLOW_COPY_AND_ASSIGN(Textfield); | 489 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 489 }; | 490 }; |
| 490 | 491 |
| 491 } // namespace views | 492 } // namespace views |
| 492 | 493 |
| 493 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 494 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |