OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
6 #define VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 6 #define VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 namespace gfx { | 23 namespace gfx { |
24 class Canvas; | 24 class Canvas; |
25 } | 25 } |
26 | 26 |
27 namespace views { | 27 namespace views { |
28 | 28 |
29 class FocusableBorder; | 29 class FocusableBorder; |
30 class KeyEvent; | 30 class KeyEvent; |
31 class Menu2; | 31 class MenuItemView; |
| 32 class MenuModelAdapter; |
32 | 33 |
33 // A views/skia only implementation of NativeTextfieldWrapper. | 34 // A views/skia only implementation of NativeTextfieldWrapper. |
34 // No platform specific code is used. | 35 // No platform specific code is used. |
35 // Following features are not yet supported. | 36 // Following features are not yet supported. |
36 // * BIDI/Complex script. | 37 // * BIDI/Complex script. |
37 // * Support surrogate pair, or maybe we should just use UTF32 internally. | 38 // * Support surrogate pair, or maybe we should just use UTF32 internally. |
38 // * X selection (only if we want to support). | 39 // * X selection (only if we want to support). |
39 // Once completed, this will replace Textfield, NativeTextfieldWin and | 40 // Once completed, this will replace Textfield, NativeTextfieldWin and |
40 // NativeTextfieldGtk. | 41 // NativeTextfieldGtk. |
41 class NativeTextfieldViews : public View, | 42 class NativeTextfieldViews : public View, |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 bool MoveCursorTo(const gfx::Point& point, bool select); | 200 bool MoveCursorTo(const gfx::Point& point, bool select); |
200 | 201 |
201 // Utility function to inform the parent textfield (and its controller if any) | 202 // Utility function to inform the parent textfield (and its controller if any) |
202 // that the text in the textfield has changed. | 203 // that the text in the textfield has changed. |
203 void PropagateTextChange(); | 204 void PropagateTextChange(); |
204 | 205 |
205 // Does necessary updates when the text and/or the position of the cursor | 206 // Does necessary updates when the text and/or the position of the cursor |
206 // changed. | 207 // changed. |
207 void UpdateAfterChange(bool text_changed, bool cursor_changed); | 208 void UpdateAfterChange(bool text_changed, bool cursor_changed); |
208 | 209 |
209 // Utility function to create the context menu if one does not already exist. | 210 // Utility function to prepare the context menu.. |
210 void InitContextMenuIfRequired(); | 211 void UpdateContextMenu(); |
211 | 212 |
212 // Convenience method to call InputMethod::OnTextInputTypeChanged(); | 213 // Convenience method to call InputMethod::OnTextInputTypeChanged(); |
213 void OnTextInputTypeChanged(); | 214 void OnTextInputTypeChanged(); |
214 | 215 |
215 // Convenience method to call InputMethod::OnCaretBoundsChanged(); | 216 // Convenience method to call InputMethod::OnCaretBoundsChanged(); |
216 void OnCaretBoundsChanged(); | 217 void OnCaretBoundsChanged(); |
217 | 218 |
218 // Convenience method to call TextfieldController::OnBeforeUserAction(); | 219 // Convenience method to call TextfieldController::OnBeforeUserAction(); |
219 void OnBeforeUserAction(); | 220 void OnBeforeUserAction(); |
220 | 221 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // A runnable method factory for callback to update the cursor. | 260 // A runnable method factory for callback to update the cursor. |
260 ScopedRunnableMethodFactory<NativeTextfieldViews> cursor_timer_; | 261 ScopedRunnableMethodFactory<NativeTextfieldViews> cursor_timer_; |
261 | 262 |
262 // State variables used to track double and triple clicks. | 263 // State variables used to track double and triple clicks. |
263 size_t aggregated_clicks_; | 264 size_t aggregated_clicks_; |
264 base::Time last_click_time_; | 265 base::Time last_click_time_; |
265 gfx::Point last_click_location_; | 266 gfx::Point last_click_location_; |
266 | 267 |
267 // Context menu and its content list for the textfield. | 268 // Context menu and its content list for the textfield. |
268 scoped_ptr<ui::SimpleMenuModel> context_menu_contents_; | 269 scoped_ptr<ui::SimpleMenuModel> context_menu_contents_; |
269 scoped_ptr<Menu2> context_menu_menu_; | 270 scoped_ptr<views::MenuModelAdapter> context_menu_delegate_; |
| 271 scoped_ptr<views::MenuItemView> context_menu_menu_; |
270 | 272 |
271 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); | 273 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); |
272 }; | 274 }; |
273 | 275 |
274 } // namespace views | 276 } // namespace views |
275 | 277 |
276 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 278 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
OLD | NEW |