| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. |
| 4 |
| 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
| 6 #define VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
| 7 |
| 8 #include "base/gfx/native_widget_types.h" |
| 9 |
| 10 namespace views { |
| 11 |
| 12 class Textfield; |
| 13 class View; |
| 14 |
| 15 // An interface implemented by an object that provides a platform-native |
| 16 // text field. |
| 17 class NativeTextfieldWrapper { |
| 18 public: |
| 19 // The Textfield calls this when it is destroyed to clean up the wrapper |
| 20 // object. |
| 21 virtual ~NativeTextfieldWrapper() {} |
| 22 |
| 23 // Gets the text displayed in the wrapped native text field. |
| 24 virtual std::wstring GetText() const = 0; |
| 25 |
| 26 // Updates the text displayed with the text held by the Textfield. |
| 27 virtual void UpdateText() = 0; |
| 28 |
| 29 // Adds the specified text to the text already displayed by the wrapped native |
| 30 // text field. |
| 31 virtual void AppendText(const std::wstring& text) = 0; |
| 32 |
| 33 // Gets the text that is selected in the wrapped native text field. |
| 34 virtual std::wstring GetSelectedText() const = 0; |
| 35 |
| 36 // Selects all the text in the edit. Use this in place of SetSelAll() to |
| 37 // avoid selecting the "phantom newline" at the end of the edit. |
| 38 virtual void SelectAll() = 0; |
| 39 |
| 40 // Clears the selection within the edit field and sets the caret to the end. |
| 41 virtual void ClearSelection() = 0; |
| 42 |
| 43 // Updates the border display for the native text field with the state desired |
| 44 // by the Textfield. |
| 45 virtual void UpdateBorder() = 0; |
| 46 |
| 47 // Updates the background color used when painting the native text field. |
| 48 virtual void UpdateBackgroundColor() = 0; |
| 49 |
| 50 // Updates the read-only state of the native text field. |
| 51 virtual void UpdateReadOnly() = 0; |
| 52 |
| 53 // Updates the font used to render text in the native text field. |
| 54 virtual void UpdateFont() = 0; |
| 55 |
| 56 // Updates the enabled state of the native text field. |
| 57 virtual void UpdateEnabled() = 0; |
| 58 |
| 59 // Sets the horizontal margins for the native text field. |
| 60 virtual void SetHorizontalMargins(int left, int right) = 0; |
| 61 |
| 62 // Sets the focus to the text field. |
| 63 virtual void SetFocus() = 0; |
| 64 |
| 65 // Retrieves the views::View that hosts the native control. |
| 66 virtual View* GetView() = 0; |
| 67 |
| 68 // Returns a handle to the underlying native view for testing. |
| 69 virtual gfx::NativeView GetTestingHandle() const = 0; |
| 70 |
| 71 // Creates an appropriate NativeTextfieldWrapper for the platform. |
| 72 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); |
| 73 }; |
| 74 |
| 75 } // namespace views |
| 76 |
| 77 #endif // #ifndef VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
| OLD | NEW |