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 |
msw
2013/09/04 20:18:20
nit: you don't need to split this line anymore.
dmazzoni
2013/09/04 22:01:09
Done.
| |
46 : public View { | |
45 public: | 47 public: |
46 // The textfield's class name. | 48 // The textfield's class name. |
47 static const char kViewClassName[]; | 49 static const char kViewClassName[]; |
48 | 50 |
49 enum StyleFlags { | 51 enum StyleFlags { |
50 STYLE_DEFAULT = 0, | 52 STYLE_DEFAULT = 0, |
51 STYLE_OBSCURED = 1 << 0, | 53 STYLE_OBSCURED = 1 << 0, |
52 STYLE_LOWERCASE = 1 << 1 | 54 STYLE_LOWERCASE = 1 << 1 |
53 }; | 55 }; |
54 | 56 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
278 const ViewHierarchyChangedDetails& details) OVERRIDE; | 280 const ViewHierarchyChangedDetails& details) OVERRIDE; |
279 virtual const char* GetClassName() const OVERRIDE; | 281 virtual const char* GetClassName() const OVERRIDE; |
280 | 282 |
281 // The object that actually implements the native text field. | 283 // The object that actually implements the native text field. |
282 NativeTextfieldWrapper* native_wrapper_; | 284 NativeTextfieldWrapper* native_wrapper_; |
283 | 285 |
284 private: | 286 private: |
285 // Returns the insets to the rectangle where text is actually painted. | 287 // Returns the insets to the rectangle where text is actually painted. |
286 gfx::Insets GetTextInsets() const; | 288 gfx::Insets GetTextInsets() const; |
287 | 289 |
290 // Handles a request to change the value of this text field from software | |
291 // using an accessibility API (typically automation software, screen readers | |
292 // don't normally use this). Sets the value and clears the selection. | |
293 void AccessibilitySetValue(const string16& new_value); | |
294 | |
288 // This is the current listener for events from this Textfield. | 295 // This is the current listener for events from this Textfield. |
289 TextfieldController* controller_; | 296 TextfieldController* controller_; |
290 | 297 |
291 // The mask of style options for this Textfield. | 298 // The mask of style options for this Textfield. |
292 StyleFlags style_; | 299 StyleFlags style_; |
293 | 300 |
294 // The fonts used to render the text in the Textfield. | 301 // The fonts used to render the text in the Textfield. |
295 gfx::FontList font_list_; | 302 gfx::FontList font_list_; |
296 | 303 |
297 // The text displayed in the Textfield. | 304 // The text displayed in the Textfield. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 | 344 |
338 // The accessible name of the text field. | 345 // The accessible name of the text field. |
339 string16 accessible_name_; | 346 string16 accessible_name_; |
340 | 347 |
341 // The input type of this text field. | 348 // The input type of this text field. |
342 ui::TextInputType text_input_type_; | 349 ui::TextInputType text_input_type_; |
343 | 350 |
344 // The duration to reveal the last typed char for obscured textfields. | 351 // The duration to reveal the last typed char for obscured textfields. |
345 base::TimeDelta obscured_reveal_duration_; | 352 base::TimeDelta obscured_reveal_duration_; |
346 | 353 |
354 // Used to bind callback functions to this object. | |
355 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | |
356 | |
347 DISALLOW_COPY_AND_ASSIGN(Textfield); | 357 DISALLOW_COPY_AND_ASSIGN(Textfield); |
348 }; | 358 }; |
349 | 359 |
350 } // namespace views | 360 } // namespace views |
351 | 361 |
352 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 362 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
OLD | NEW |