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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 base::i18n::TextDirection GetTextDirection() const; | 82 base::i18n::TextDirection GetTextDirection() const; |
83 | 83 |
84 // Returns the text that is currently selected. | 84 // Returns the text that is currently selected. |
85 base::string16 GetSelectedText() const; | 85 base::string16 GetSelectedText() const; |
86 | 86 |
87 // Select the entire text range. If |reversed| is true, the range will end at | 87 // Select the entire text range. If |reversed| is true, the range will end at |
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 // A convenience method to select the word closest to |point|. |
| 93 void SelectWordAt(const gfx::Point& point); |
| 94 |
92 // Clears the selection within the edit field and sets the caret to the end. | 95 // Clears the selection within the edit field and sets the caret to the end. |
93 void ClearSelection(); | 96 void ClearSelection(); |
94 | 97 |
95 // Checks if there is any selected text. | 98 // Checks if there is any selected text. |
96 bool HasSelection() const; | 99 bool HasSelection() const; |
97 | 100 |
98 // Gets/sets the text color to be used when painting the Textfield. | 101 // Gets/sets the text color to be used when painting the Textfield. |
99 // Call UseDefaultTextColor() to restore the default system color. | 102 // Call UseDefaultTextColor() to restore the default system color. |
100 SkColor GetTextColor() const; | 103 SkColor GetTextColor() const; |
101 void SetTextColor(SkColor color); | 104 void SetTextColor(SkColor color); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 gfx::Point last_drag_location_; | 446 gfx::Point last_drag_location_; |
444 | 447 |
445 // State variables used to track double and triple clicks. | 448 // State variables used to track double and triple clicks. |
446 size_t aggregated_clicks_; | 449 size_t aggregated_clicks_; |
447 base::TimeDelta last_click_time_; | 450 base::TimeDelta last_click_time_; |
448 gfx::Point last_click_location_; | 451 gfx::Point last_click_location_; |
449 gfx::Range double_click_word_; | 452 gfx::Range double_click_word_; |
450 | 453 |
451 scoped_ptr<ui::TouchSelectionController> touch_selection_controller_; | 454 scoped_ptr<ui::TouchSelectionController> touch_selection_controller_; |
452 | 455 |
| 456 // Used to track touch drag starting location and offset to enable touch |
| 457 // scrolling. |
| 458 gfx::Point drag_start_location_; |
| 459 int drag_start_display_offset_; |
| 460 |
| 461 // Tracks if touch editing handles are hidden because user has started |
| 462 // scrolling. If |true|, handles are shown after scrolling ends. |
| 463 bool touch_handles_hidden_due_to_scroll_; |
| 464 |
453 // Context menu related members. | 465 // Context menu related members. |
454 scoped_ptr<ui::SimpleMenuModel> context_menu_contents_; | 466 scoped_ptr<ui::SimpleMenuModel> context_menu_contents_; |
455 scoped_ptr<views::MenuRunner> context_menu_runner_; | 467 scoped_ptr<views::MenuRunner> context_menu_runner_; |
456 | 468 |
457 // Used to bind callback functions to this object. | 469 // Used to bind callback functions to this object. |
458 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 470 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
459 | 471 |
460 DISALLOW_COPY_AND_ASSIGN(Textfield); | 472 DISALLOW_COPY_AND_ASSIGN(Textfield); |
461 }; | 473 }; |
462 | 474 |
463 } // namespace views | 475 } // namespace views |
464 | 476 |
465 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 477 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
OLD | NEW |