| 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_NATIVE_TEXTFIELD_VIEWS_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
| 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 virtual void OnInputMethodChanged() OVERRIDE; | 165 virtual void OnInputMethodChanged() OVERRIDE; |
| 166 virtual bool ChangeTextDirectionAndLayoutAlignment( | 166 virtual bool ChangeTextDirectionAndLayoutAlignment( |
| 167 base::i18n::TextDirection direction) OVERRIDE; | 167 base::i18n::TextDirection direction) OVERRIDE; |
| 168 | 168 |
| 169 // Overridden from TextfieldViewsModel::Delegate: | 169 // Overridden from TextfieldViewsModel::Delegate: |
| 170 virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE; | 170 virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE; |
| 171 | 171 |
| 172 // Returns the TextfieldViewsModel's text/cursor/selection rendering model. | 172 // Returns the TextfieldViewsModel's text/cursor/selection rendering model. |
| 173 gfx::RenderText* GetRenderText() const; | 173 gfx::RenderText* GetRenderText() const; |
| 174 | 174 |
| 175 // Converts |text| according to textfield style, e.g. lower case if |
| 176 // |textfield_| has STYLE_LOWERCASE style. |
| 177 string16 GetTextForDisplay(const string16& text); |
| 178 |
| 175 // A callback function to periodically update the cursor state. | 179 // A callback function to periodically update the cursor state. |
| 176 void UpdateCursor(); | 180 void UpdateCursor(); |
| 177 | 181 |
| 178 // Repaint the cursor. | 182 // Repaint the cursor. |
| 179 void RepaintCursor(); | 183 void RepaintCursor(); |
| 180 | 184 |
| 181 // Update the cursor_bounds and text_offset. | 185 // Update the cursor_bounds and text_offset. |
| 182 void UpdateCursorBoundsAndTextOffset(size_t cursor_pos, bool insert_mode); | 186 void UpdateCursorBoundsAndTextOffset(size_t cursor_pos, bool insert_mode); |
| 183 | 187 |
| 184 void PaintTextAndCursor(gfx::Canvas* canvas); | 188 void PaintTextAndCursor(gfx::Canvas* canvas); |
| 185 | 189 |
| 186 // Handle the keyevent. | 190 // Handle the keyevent. |
| 187 bool HandleKeyEvent(const KeyEvent& key_event); | 191 bool HandleKeyEvent(const KeyEvent& key_event); |
| 188 | 192 |
| 189 // Helper function to call MoveCursorTo on the TextfieldViewsModel. | 193 // Helper function to call MoveCursorTo on the TextfieldViewsModel. |
| 190 bool MoveCursorTo(const gfx::Point& point, bool select); | 194 bool MoveCursorTo(const gfx::Point& point, bool select); |
| 191 | 195 |
| 192 // Utility function to inform the parent textfield (and its controller if any) | 196 // Utility function to inform the parent textfield (and its controller if any) |
| 193 // that the text in the textfield has changed. | 197 // that the text in the textfield has changed. |
| 194 void PropagateTextChange(); | 198 void PropagateTextChange(); |
| 195 | 199 |
| 196 // Does necessary updates when the text and/or the position of the cursor | 200 // Does necessary updates when the text and/or the position of the cursor |
| 197 // changed. | 201 // changed. |
| 198 void UpdateAfterChange(bool text_changed, bool cursor_changed); | 202 void UpdateAfterChange(bool text_changed, bool cursor_changed); |
| 199 | 203 |
| 200 // Utility function to prepare the context menu.. | 204 // Utility function to prepare the context menu. |
| 201 void UpdateContextMenu(); | 205 void UpdateContextMenu(); |
| 202 | 206 |
| 203 // Convenience method to call InputMethod::OnTextInputTypeChanged(); | 207 // Convenience method to call InputMethod::OnTextInputTypeChanged(); |
| 204 void OnTextInputTypeChanged(); | 208 void OnTextInputTypeChanged(); |
| 205 | 209 |
| 206 // Convenience method to call InputMethod::OnCaretBoundsChanged(); | 210 // Convenience method to call InputMethod::OnCaretBoundsChanged(); |
| 207 void OnCaretBoundsChanged(); | 211 void OnCaretBoundsChanged(); |
| 208 | 212 |
| 209 // Convenience method to call TextfieldController::OnBeforeUserAction(); | 213 // Convenience method to call TextfieldController::OnBeforeUserAction(); |
| 210 void OnBeforeUserAction(); | 214 void OnBeforeUserAction(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 scoped_ptr<views::MenuRunner> context_menu_runner_; | 277 scoped_ptr<views::MenuRunner> context_menu_runner_; |
| 274 | 278 |
| 275 scoped_ptr<TouchSelectionController> touch_selection_controller_; | 279 scoped_ptr<TouchSelectionController> touch_selection_controller_; |
| 276 | 280 |
| 277 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); | 281 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); |
| 278 }; | 282 }; |
| 279 | 283 |
| 280 } // namespace views | 284 } // namespace views |
| 281 | 285 |
| 282 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 286 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
| OLD | NEW |