| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 198 |
| 199 // Performs the action associated with the specified command id. | 199 // Performs the action associated with the specified command id. |
| 200 void ExecuteCommand(int command_id); | 200 void ExecuteCommand(int command_id); |
| 201 | 201 |
| 202 void SetFocusPainter(scoped_ptr<Painter> focus_painter); | 202 void SetFocusPainter(scoped_ptr<Painter> focus_painter); |
| 203 | 203 |
| 204 // Returns whether there is a drag operation originating from the textfield. | 204 // Returns whether there is a drag operation originating from the textfield. |
| 205 bool HasTextBeingDragged(); | 205 bool HasTextBeingDragged(); |
| 206 | 206 |
| 207 // View overrides: | 207 // View overrides: |
| 208 virtual gfx::Insets GetInsets() const OVERRIDE; | 208 virtual gfx::Insets GetInsets() const override; |
| 209 virtual int GetBaseline() const OVERRIDE; | 209 virtual int GetBaseline() const override; |
| 210 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 210 virtual gfx::Size GetPreferredSize() const override; |
| 211 virtual const char* GetClassName() const OVERRIDE; | 211 virtual const char* GetClassName() const override; |
| 212 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; | 212 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; |
| 213 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 213 virtual bool OnMousePressed(const ui::MouseEvent& event) override; |
| 214 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 214 virtual bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 215 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 215 virtual void OnMouseReleased(const ui::MouseEvent& event) override; |
| 216 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 216 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 217 virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; | 217 virtual ui::TextInputClient* GetTextInputClient() override; |
| 218 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 218 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
| 219 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; | 219 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) override; |
| 220 virtual bool SkipDefaultKeyEventProcessing( | 220 virtual bool SkipDefaultKeyEventProcessing( |
| 221 const ui::KeyEvent& event) OVERRIDE; | 221 const ui::KeyEvent& event) override; |
| 222 virtual bool GetDropFormats( | 222 virtual bool GetDropFormats( |
| 223 int* formats, | 223 int* formats, |
| 224 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; | 224 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) override; |
| 225 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; | 225 virtual bool CanDrop(const ui::OSExchangeData& data) override; |
| 226 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 226 virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; |
| 227 virtual void OnDragExited() OVERRIDE; | 227 virtual void OnDragExited() override; |
| 228 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 228 virtual int OnPerformDrop(const ui::DropTargetEvent& event) override; |
| 229 virtual void OnDragDone() OVERRIDE; | 229 virtual void OnDragDone() override; |
| 230 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 230 virtual void GetAccessibleState(ui::AXViewState* state) override; |
| 231 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 231 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| 232 virtual bool GetNeedsNotificationWhenVisibleBoundsChange() const OVERRIDE; | 232 virtual bool GetNeedsNotificationWhenVisibleBoundsChange() const override; |
| 233 virtual void OnVisibleBoundsChanged() OVERRIDE; | 233 virtual void OnVisibleBoundsChanged() override; |
| 234 virtual void OnEnabledChanged() OVERRIDE; | 234 virtual void OnEnabledChanged() override; |
| 235 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 235 virtual void OnPaint(gfx::Canvas* canvas) override; |
| 236 virtual void OnFocus() OVERRIDE; | 236 virtual void OnFocus() override; |
| 237 virtual void OnBlur() OVERRIDE; | 237 virtual void OnBlur() override; |
| 238 virtual gfx::Point GetKeyboardContextMenuLocation() OVERRIDE; | 238 virtual gfx::Point GetKeyboardContextMenuLocation() override; |
| 239 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; | 239 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 240 | 240 |
| 241 // TextfieldModel::Delegate overrides: | 241 // TextfieldModel::Delegate overrides: |
| 242 virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE; | 242 virtual void OnCompositionTextConfirmedOrCleared() override; |
| 243 | 243 |
| 244 // ContextMenuController overrides: | 244 // ContextMenuController overrides: |
| 245 virtual void ShowContextMenuForView(View* source, | 245 virtual void ShowContextMenuForView(View* source, |
| 246 const gfx::Point& point, | 246 const gfx::Point& point, |
| 247 ui::MenuSourceType source_type) OVERRIDE; | 247 ui::MenuSourceType source_type) override; |
| 248 | 248 |
| 249 // DragController overrides: | 249 // DragController overrides: |
| 250 virtual void WriteDragDataForView(View* sender, | 250 virtual void WriteDragDataForView(View* sender, |
| 251 const gfx::Point& press_pt, | 251 const gfx::Point& press_pt, |
| 252 ui::OSExchangeData* data) OVERRIDE; | 252 ui::OSExchangeData* data) override; |
| 253 virtual int GetDragOperationsForView(View* sender, | 253 virtual int GetDragOperationsForView(View* sender, |
| 254 const gfx::Point& p) OVERRIDE; | 254 const gfx::Point& p) override; |
| 255 virtual bool CanStartDragForView(View* sender, | 255 virtual bool CanStartDragForView(View* sender, |
| 256 const gfx::Point& press_pt, | 256 const gfx::Point& press_pt, |
| 257 const gfx::Point& p) OVERRIDE; | 257 const gfx::Point& p) override; |
| 258 | 258 |
| 259 // ui::TouchEditable overrides: | 259 // ui::TouchEditable overrides: |
| 260 virtual void SelectRect(const gfx::Point& start, | 260 virtual void SelectRect(const gfx::Point& start, |
| 261 const gfx::Point& end) OVERRIDE; | 261 const gfx::Point& end) override; |
| 262 virtual void MoveCaretTo(const gfx::Point& point) OVERRIDE; | 262 virtual void MoveCaretTo(const gfx::Point& point) override; |
| 263 virtual void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) OVERRIDE; | 263 virtual void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) override; |
| 264 virtual gfx::Rect GetBounds() OVERRIDE; | 264 virtual gfx::Rect GetBounds() override; |
| 265 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 265 virtual gfx::NativeView GetNativeView() const override; |
| 266 virtual void ConvertPointToScreen(gfx::Point* point) OVERRIDE; | 266 virtual void ConvertPointToScreen(gfx::Point* point) override; |
| 267 virtual void ConvertPointFromScreen(gfx::Point* point) OVERRIDE; | 267 virtual void ConvertPointFromScreen(gfx::Point* point) override; |
| 268 virtual bool DrawsHandles() OVERRIDE; | 268 virtual bool DrawsHandles() override; |
| 269 virtual void OpenContextMenu(const gfx::Point& anchor) OVERRIDE; | 269 virtual void OpenContextMenu(const gfx::Point& anchor) override; |
| 270 virtual void DestroyTouchSelection() OVERRIDE; | 270 virtual void DestroyTouchSelection() override; |
| 271 | 271 |
| 272 // ui::SimpleMenuModel::Delegate overrides: | 272 // ui::SimpleMenuModel::Delegate overrides: |
| 273 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 273 virtual bool IsCommandIdChecked(int command_id) const override; |
| 274 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 274 virtual bool IsCommandIdEnabled(int command_id) const override; |
| 275 virtual bool GetAcceleratorForCommandId( | 275 virtual bool GetAcceleratorForCommandId( |
| 276 int command_id, | 276 int command_id, |
| 277 ui::Accelerator* accelerator) OVERRIDE; | 277 ui::Accelerator* accelerator) override; |
| 278 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 278 virtual void ExecuteCommand(int command_id, int event_flags) override; |
| 279 | 279 |
| 280 // ui::TextInputClient overrides: | 280 // ui::TextInputClient overrides: |
| 281 virtual void SetCompositionText( | 281 virtual void SetCompositionText( |
| 282 const ui::CompositionText& composition) OVERRIDE; | 282 const ui::CompositionText& composition) override; |
| 283 virtual void ConfirmCompositionText() OVERRIDE; | 283 virtual void ConfirmCompositionText() override; |
| 284 virtual void ClearCompositionText() OVERRIDE; | 284 virtual void ClearCompositionText() override; |
| 285 virtual void InsertText(const base::string16& text) OVERRIDE; | 285 virtual void InsertText(const base::string16& text) override; |
| 286 virtual void InsertChar(base::char16 ch, int flags) OVERRIDE; | 286 virtual void InsertChar(base::char16 ch, int flags) override; |
| 287 virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE; | 287 virtual gfx::NativeWindow GetAttachedWindow() const override; |
| 288 virtual ui::TextInputType GetTextInputType() const OVERRIDE; | 288 virtual ui::TextInputType GetTextInputType() const override; |
| 289 virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; | 289 virtual ui::TextInputMode GetTextInputMode() const override; |
| 290 virtual bool CanComposeInline() const OVERRIDE; | 290 virtual bool CanComposeInline() const override; |
| 291 virtual gfx::Rect GetCaretBounds() const OVERRIDE; | 291 virtual gfx::Rect GetCaretBounds() const override; |
| 292 virtual bool GetCompositionCharacterBounds(uint32 index, | 292 virtual bool GetCompositionCharacterBounds(uint32 index, |
| 293 gfx::Rect* rect) const OVERRIDE; | 293 gfx::Rect* rect) const override; |
| 294 virtual bool HasCompositionText() const OVERRIDE; | 294 virtual bool HasCompositionText() const override; |
| 295 virtual bool GetTextRange(gfx::Range* range) const OVERRIDE; | 295 virtual bool GetTextRange(gfx::Range* range) const override; |
| 296 virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE; | 296 virtual bool GetCompositionTextRange(gfx::Range* range) const override; |
| 297 virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE; | 297 virtual bool GetSelectionRange(gfx::Range* range) const override; |
| 298 virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE; | 298 virtual bool SetSelectionRange(const gfx::Range& range) override; |
| 299 virtual bool DeleteRange(const gfx::Range& range) OVERRIDE; | 299 virtual bool DeleteRange(const gfx::Range& range) override; |
| 300 virtual bool GetTextFromRange(const gfx::Range& range, | 300 virtual bool GetTextFromRange(const gfx::Range& range, |
| 301 base::string16* text) const OVERRIDE; | 301 base::string16* text) const override; |
| 302 virtual void OnInputMethodChanged() OVERRIDE; | 302 virtual void OnInputMethodChanged() override; |
| 303 virtual bool ChangeTextDirectionAndLayoutAlignment( | 303 virtual bool ChangeTextDirectionAndLayoutAlignment( |
| 304 base::i18n::TextDirection direction) OVERRIDE; | 304 base::i18n::TextDirection direction) override; |
| 305 virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE; | 305 virtual void ExtendSelectionAndDelete(size_t before, size_t after) override; |
| 306 virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE; | 306 virtual void EnsureCaretInRect(const gfx::Rect& rect) override; |
| 307 virtual void OnCandidateWindowShown() OVERRIDE; | 307 virtual void OnCandidateWindowShown() override; |
| 308 virtual void OnCandidateWindowUpdated() OVERRIDE; | 308 virtual void OnCandidateWindowUpdated() override; |
| 309 virtual void OnCandidateWindowHidden() OVERRIDE; | 309 virtual void OnCandidateWindowHidden() override; |
| 310 virtual bool IsEditingCommandEnabled(int command_id) OVERRIDE; | 310 virtual bool IsEditingCommandEnabled(int command_id) override; |
| 311 virtual void ExecuteEditingCommand(int command_id) OVERRIDE; | 311 virtual void ExecuteEditingCommand(int command_id) override; |
| 312 | 312 |
| 313 protected: | 313 protected: |
| 314 // Returns the TextfieldModel's text/cursor/selection rendering model. | 314 // Returns the TextfieldModel's text/cursor/selection rendering model. |
| 315 gfx::RenderText* GetRenderText() const; | 315 gfx::RenderText* GetRenderText() const; |
| 316 | 316 |
| 317 gfx::Point last_click_location() const { return last_click_location_; } | 317 gfx::Point last_click_location() const { return last_click_location_; } |
| 318 | 318 |
| 319 // Get the text from the selection clipboard. | 319 // Get the text from the selection clipboard. |
| 320 virtual base::string16 GetSelectionClipboardText() const; | 320 virtual base::string16 GetSelectionClipboardText() const; |
| 321 | 321 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 474 |
| 475 // Used to bind callback functions to this object. | 475 // Used to bind callback functions to this object. |
| 476 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 476 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
| 477 | 477 |
| 478 DISALLOW_COPY_AND_ASSIGN(Textfield); | 478 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 479 }; | 479 }; |
| 480 | 480 |
| 481 } // namespace views | 481 } // namespace views |
| 482 | 482 |
| 483 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 483 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |