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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 // View overrides: | 206 // View overrides: |
207 gfx::Insets GetInsets() const override; | 207 gfx::Insets GetInsets() const override; |
208 int GetBaseline() const override; | 208 int GetBaseline() const override; |
209 gfx::Size GetPreferredSize() const override; | 209 gfx::Size GetPreferredSize() const override; |
210 const char* GetClassName() const override; | 210 const char* GetClassName() const override; |
211 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; | 211 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; |
212 bool OnMousePressed(const ui::MouseEvent& event) override; | 212 bool OnMousePressed(const ui::MouseEvent& event) override; |
213 bool OnMouseDragged(const ui::MouseEvent& event) override; | 213 bool OnMouseDragged(const ui::MouseEvent& event) override; |
214 void OnMouseReleased(const ui::MouseEvent& event) override; | 214 void OnMouseReleased(const ui::MouseEvent& event) override; |
215 bool OnKeyPressed(const ui::KeyEvent& event) override; | |
216 bool OnKeyReleased(const ui::KeyEvent& event) override; | |
217 void OnGestureEvent(ui::GestureEvent* event) override; | 215 void OnGestureEvent(ui::GestureEvent* event) override; |
218 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 216 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
219 bool CanHandleAccelerators() const override; | 217 bool CanHandleAccelerators() const override; |
220 void AboutToRequestFocusFromTabTraversal(bool reverse) override; | 218 void AboutToRequestFocusFromTabTraversal(bool reverse) override; |
221 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; | 219 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; |
222 bool GetDropFormats( | 220 bool GetDropFormats( |
223 int* formats, | 221 int* formats, |
224 std::set<ui::Clipboard::FormatType>* format_types) override; | 222 std::set<ui::Clipboard::FormatType>* format_types) override; |
225 bool CanDrop(const ui::OSExchangeData& data) override; | 223 bool CanDrop(const ui::OSExchangeData& data) override; |
226 int OnDragUpdated(const ui::DropTargetEvent& event) override; | 224 int OnDragUpdated(const ui::DropTargetEvent& event) override; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 314 |
317 // Get the text from the selection clipboard. | 315 // Get the text from the selection clipboard. |
318 virtual base::string16 GetSelectionClipboardText() const; | 316 virtual base::string16 GetSelectionClipboardText() const; |
319 | 317 |
320 // Executes the given |command|. | 318 // Executes the given |command|. |
321 virtual void ExecuteTextEditCommand(ui::TextEditCommand command); | 319 virtual void ExecuteTextEditCommand(ui::TextEditCommand command); |
322 | 320 |
323 private: | 321 private: |
324 friend class TextfieldTestApi; | 322 friend class TextfieldTestApi; |
325 | 323 |
| 324 // View overrides: |
| 325 // Declared final since overriding by subclasses would interfere with the |
| 326 // accounting related to the scheduled text edit command. Subclasses should |
| 327 // use TextfieldController::HandleKeyEvent, to intercept the key event. |
| 328 bool OnKeyPressed(const ui::KeyEvent& event) final; |
| 329 bool OnKeyReleased(const ui::KeyEvent& event) final; |
| 330 |
326 // Handles a request to change the value of this text field from software | 331 // Handles a request to change the value of this text field from software |
327 // using an accessibility API (typically automation software, screen readers | 332 // using an accessibility API (typically automation software, screen readers |
328 // don't normally use this). Sets the value and clears the selection. | 333 // don't normally use this). Sets the value and clears the selection. |
329 void AccessibilitySetValue(const base::string16& new_value); | 334 void AccessibilitySetValue(const base::string16& new_value); |
330 | 335 |
331 // Updates the painted background color. | 336 // Updates the painted background color. |
332 void UpdateBackgroundColor(); | 337 void UpdateBackgroundColor(); |
333 | 338 |
334 // Does necessary updates when the text and/or cursor position changes. | 339 // Does necessary updates when the text and/or cursor position changes. |
335 void UpdateAfterChange(bool text_changed, bool cursor_changed); | 340 void UpdateAfterChange(bool text_changed, bool cursor_changed); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 489 |
485 // Used to bind callback functions to this object. | 490 // Used to bind callback functions to this object. |
486 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 491 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
487 | 492 |
488 DISALLOW_COPY_AND_ASSIGN(Textfield); | 493 DISALLOW_COPY_AND_ASSIGN(Textfield); |
489 }; | 494 }; |
490 | 495 |
491 } // namespace views | 496 } // namespace views |
492 | 497 |
493 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 498 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
OLD | NEW |