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" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/weak_ptr.h" |
12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
15 #include "third_party/skia/include/core/SkColor.h" | 16 #include "third_party/skia/include/core/SkColor.h" |
16 #include "ui/base/ime/text_input_type.h" | 17 #include "ui/base/ime/text_input_type.h" |
17 #include "ui/base/keycodes/keyboard_codes.h" | 18 #include "ui/base/keycodes/keyboard_codes.h" |
18 #include "ui/gfx/font_list.h" | 19 #include "ui/gfx/font_list.h" |
19 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
20 #include "ui/gfx/text_constants.h" | 21 #include "ui/gfx/text_constants.h" |
21 #include "ui/views/controls/textfield/native_textfield_wrapper.h" | 22 #include "ui/views/controls/textfield/native_textfield_wrapper.h" |
(...skipping 12 matching lines...) Expand all Loading... |
34 class TextInputClient; | 35 class TextInputClient; |
35 } // namespace ui | 36 } // namespace ui |
36 | 37 |
37 namespace views { | 38 namespace views { |
38 | 39 |
39 class ImageView; | 40 class ImageView; |
40 | 41 |
41 class TextfieldController; | 42 class TextfieldController; |
42 | 43 |
43 // This class implements a View that wraps a native text (edit) field. | 44 // This class implements a View that wraps a native text (edit) field. |
44 class VIEWS_EXPORT Textfield : public View { | 45 class VIEWS_EXPORT Textfield |
| 46 : public View, |
| 47 public base::SupportsWeakPtr<Textfield> { |
45 public: | 48 public: |
46 // The textfield's class name. | 49 // The textfield's class name. |
47 static const char kViewClassName[]; | 50 static const char kViewClassName[]; |
48 | 51 |
49 enum StyleFlags { | 52 enum StyleFlags { |
50 STYLE_DEFAULT = 0, | 53 STYLE_DEFAULT = 0, |
51 STYLE_OBSCURED = 1 << 0, | 54 STYLE_OBSCURED = 1 << 0, |
52 STYLE_LOWERCASE = 1 << 1 | 55 STYLE_LOWERCASE = 1 << 1 |
53 }; | 56 }; |
54 | 57 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 const ViewHierarchyChangedDetails& details) OVERRIDE; | 281 const ViewHierarchyChangedDetails& details) OVERRIDE; |
279 virtual const char* GetClassName() const OVERRIDE; | 282 virtual const char* GetClassName() const OVERRIDE; |
280 | 283 |
281 // The object that actually implements the native text field. | 284 // The object that actually implements the native text field. |
282 NativeTextfieldWrapper* native_wrapper_; | 285 NativeTextfieldWrapper* native_wrapper_; |
283 | 286 |
284 private: | 287 private: |
285 // Returns the insets to the rectangle where text is actually painted. | 288 // Returns the insets to the rectangle where text is actually painted. |
286 gfx::Insets GetTextInsets() const; | 289 gfx::Insets GetTextInsets() const; |
287 | 290 |
| 291 // Handles a request to change the value of this text field from software |
| 292 // using an accessibility API (typically automation software, screen readers |
| 293 // don't normally use this). Sets the value and clears the selection. |
| 294 void AccessibilitySetValue(const string16& new_value); |
| 295 |
288 // This is the current listener for events from this Textfield. | 296 // This is the current listener for events from this Textfield. |
289 TextfieldController* controller_; | 297 TextfieldController* controller_; |
290 | 298 |
291 // The mask of style options for this Textfield. | 299 // The mask of style options for this Textfield. |
292 StyleFlags style_; | 300 StyleFlags style_; |
293 | 301 |
294 // The fonts used to render the text in the Textfield. | 302 // The fonts used to render the text in the Textfield. |
295 gfx::FontList font_list_; | 303 gfx::FontList font_list_; |
296 | 304 |
297 // The text displayed in the Textfield. | 305 // The text displayed in the Textfield. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 351 |
344 // The duration to reveal the last typed char for obscured textfields. | 352 // The duration to reveal the last typed char for obscured textfields. |
345 base::TimeDelta obscured_reveal_duration_; | 353 base::TimeDelta obscured_reveal_duration_; |
346 | 354 |
347 DISALLOW_COPY_AND_ASSIGN(Textfield); | 355 DISALLOW_COPY_AND_ASSIGN(Textfield); |
348 }; | 356 }; |
349 | 357 |
350 } // namespace views | 358 } // namespace views |
351 | 359 |
352 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 360 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
OLD | NEW |