| 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 12 matching lines...) Expand all Loading... |
| 23 #include "ui/base/touch/touch_editing_controller.h" | 23 #include "ui/base/touch/touch_editing_controller.h" |
| 24 #include "ui/events/keycodes/keyboard_codes.h" | 24 #include "ui/events/keycodes/keyboard_codes.h" |
| 25 #include "ui/gfx/font_list.h" | 25 #include "ui/gfx/font_list.h" |
| 26 #include "ui/gfx/range/range.h" | 26 #include "ui/gfx/range/range.h" |
| 27 #include "ui/gfx/selection_model.h" | 27 #include "ui/gfx/selection_model.h" |
| 28 #include "ui/gfx/text_constants.h" | 28 #include "ui/gfx/text_constants.h" |
| 29 #include "ui/views/context_menu_controller.h" | 29 #include "ui/views/context_menu_controller.h" |
| 30 #include "ui/views/controls/textfield/textfield_model.h" | 30 #include "ui/views/controls/textfield/textfield_model.h" |
| 31 #include "ui/views/drag_controller.h" | 31 #include "ui/views/drag_controller.h" |
| 32 #include "ui/views/view.h" | 32 #include "ui/views/view.h" |
| 33 #include "ui/views/word_lookup_client.h" |
| 33 | 34 |
| 34 namespace views { | 35 namespace views { |
| 35 | 36 |
| 36 class MenuRunner; | 37 class MenuRunner; |
| 37 class Painter; | 38 class Painter; |
| 38 class TextfieldController; | 39 class TextfieldController; |
| 39 | 40 |
| 40 // A views/skia textfield implementation. No platform-specific code is used. | 41 // A views/skia textfield implementation. No platform-specific code is used. |
| 41 class VIEWS_EXPORT Textfield : public View, | 42 class VIEWS_EXPORT Textfield : public View, |
| 42 public TextfieldModel::Delegate, | 43 public TextfieldModel::Delegate, |
| 43 public ContextMenuController, | 44 public ContextMenuController, |
| 44 public DragController, | 45 public DragController, |
| 46 public WordLookupClient, |
| 45 public ui::TouchEditable, | 47 public ui::TouchEditable, |
| 46 public ui::TextInputClient { | 48 public ui::TextInputClient { |
| 47 public: | 49 public: |
| 48 // The textfield's class name. | 50 // The textfield's class name. |
| 49 static const char kViewClassName[]; | 51 static const char kViewClassName[]; |
| 50 | 52 |
| 51 // The preferred size of the padding to be used around textfield text. | 53 // The preferred size of the padding to be used around textfield text. |
| 52 static const int kTextPadding; | 54 static const int kTextPadding; |
| 53 | 55 |
| 54 // Returns the text cursor blink time in milliseconds, or 0 for no blinking. | 56 // Returns the text cursor blink time in milliseconds, or 0 for no blinking. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 208 |
| 207 // View overrides: | 209 // View overrides: |
| 208 gfx::Insets GetInsets() const override; | 210 gfx::Insets GetInsets() const override; |
| 209 int GetBaseline() const override; | 211 int GetBaseline() const override; |
| 210 gfx::Size GetPreferredSize() const override; | 212 gfx::Size GetPreferredSize() const override; |
| 211 const char* GetClassName() const override; | 213 const char* GetClassName() const override; |
| 212 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; | 214 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; |
| 213 bool OnMousePressed(const ui::MouseEvent& event) override; | 215 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 214 bool OnMouseDragged(const ui::MouseEvent& event) override; | 216 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 215 void OnMouseReleased(const ui::MouseEvent& event) override; | 217 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 218 WordLookupClient* GetWordLookupClient() override; |
| 216 void OnGestureEvent(ui::GestureEvent* event) override; | 219 void OnGestureEvent(ui::GestureEvent* event) override; |
| 217 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 220 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
| 218 bool CanHandleAccelerators() const override; | 221 bool CanHandleAccelerators() const override; |
| 219 void AboutToRequestFocusFromTabTraversal(bool reverse) override; | 222 void AboutToRequestFocusFromTabTraversal(bool reverse) override; |
| 220 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; | 223 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; |
| 221 bool GetDropFormats( | 224 bool GetDropFormats( |
| 222 int* formats, | 225 int* formats, |
| 223 std::set<ui::Clipboard::FormatType>* format_types) override; | 226 std::set<ui::Clipboard::FormatType>* format_types) override; |
| 224 bool CanDrop(const ui::OSExchangeData& data) override; | 227 bool CanDrop(const ui::OSExchangeData& data) override; |
| 225 int OnDragUpdated(const ui::DropTargetEvent& event) override; | 228 int OnDragUpdated(const ui::DropTargetEvent& event) override; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 247 | 250 |
| 248 // DragController overrides: | 251 // DragController overrides: |
| 249 void WriteDragDataForView(View* sender, | 252 void WriteDragDataForView(View* sender, |
| 250 const gfx::Point& press_pt, | 253 const gfx::Point& press_pt, |
| 251 ui::OSExchangeData* data) override; | 254 ui::OSExchangeData* data) override; |
| 252 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; | 255 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; |
| 253 bool CanStartDragForView(View* sender, | 256 bool CanStartDragForView(View* sender, |
| 254 const gfx::Point& press_pt, | 257 const gfx::Point& press_pt, |
| 255 const gfx::Point& p) override; | 258 const gfx::Point& p) override; |
| 256 | 259 |
| 260 // WordLookupClient overrides: |
| 261 bool GetDecoratedWordAtPoint(const gfx::Point& point, |
| 262 gfx::DecoratedText* decorated_word, |
| 263 gfx::Point* baseline_point) override; |
| 264 |
| 257 // ui::TouchEditable overrides: | 265 // ui::TouchEditable overrides: |
| 258 void SelectRect(const gfx::Point& start, const gfx::Point& end) override; | 266 void SelectRect(const gfx::Point& start, const gfx::Point& end) override; |
| 259 void MoveCaretTo(const gfx::Point& point) override; | 267 void MoveCaretTo(const gfx::Point& point) override; |
| 260 void GetSelectionEndPoints(gfx::SelectionBound* anchor, | 268 void GetSelectionEndPoints(gfx::SelectionBound* anchor, |
| 261 gfx::SelectionBound* focus) override; | 269 gfx::SelectionBound* focus) override; |
| 262 gfx::Rect GetBounds() override; | 270 gfx::Rect GetBounds() override; |
| 263 gfx::NativeView GetNativeView() const override; | 271 gfx::NativeView GetNativeView() const override; |
| 264 void ConvertPointToScreen(gfx::Point* point) override; | 272 void ConvertPointToScreen(gfx::Point* point) override; |
| 265 void ConvertPointFromScreen(gfx::Point* point) override; | 273 void ConvertPointFromScreen(gfx::Point* point) override; |
| 266 bool DrawsHandles() override; | 274 bool DrawsHandles() override; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 | 518 |
| 511 // Used to bind callback functions to this object. | 519 // Used to bind callback functions to this object. |
| 512 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 520 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
| 513 | 521 |
| 514 DISALLOW_COPY_AND_ASSIGN(Textfield); | 522 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 515 }; | 523 }; |
| 516 | 524 |
| 517 } // namespace views | 525 } // namespace views |
| 518 | 526 |
| 519 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 527 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |