| 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/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "third_party/skia/include/core/SkColor.h" | 15 #include "third_party/skia/include/core/SkColor.h" |
| 16 #include "ui/base/ime/text_input_type.h" | 16 #include "ui/base/ime/text_input_type.h" |
| 17 #include "ui/base/keycodes/keyboard_codes.h" | 17 #include "ui/base/keycodes/keyboard_codes.h" |
| 18 #include "ui/gfx/font.h" | 18 #include "ui/gfx/font_list.h" |
| 19 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 20 #include "ui/gfx/text_constants.h" | 20 #include "ui/gfx/text_constants.h" |
| 21 #include "ui/views/controls/textfield/native_textfield_wrapper.h" | 21 #include "ui/views/controls/textfield/native_textfield_wrapper.h" |
| 22 #include "ui/views/view.h" | 22 #include "ui/views/view.h" |
| 23 | 23 |
| 24 #if !defined(OS_LINUX) | 24 #if !defined(OS_LINUX) |
| 25 #include "base/logging.h" | 25 #include "base/logging.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 namespace gfx { | 28 namespace gfx { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // Gets/Sets the background color to be used when painting the Textfield. | 131 // Gets/Sets the background color to be used when painting the Textfield. |
| 132 // Call |UseDefaultBackgroundColor| to restore the default system color. | 132 // Call |UseDefaultBackgroundColor| to restore the default system color. |
| 133 SkColor GetBackgroundColor() const; | 133 SkColor GetBackgroundColor() const; |
| 134 void SetBackgroundColor(SkColor color); | 134 void SetBackgroundColor(SkColor color); |
| 135 void UseDefaultBackgroundColor(); | 135 void UseDefaultBackgroundColor(); |
| 136 | 136 |
| 137 // Gets/Sets whether or not the cursor is enabled. | 137 // Gets/Sets whether or not the cursor is enabled. |
| 138 bool GetCursorEnabled() const; | 138 bool GetCursorEnabled() const; |
| 139 void SetCursorEnabled(bool enabled); | 139 void SetCursorEnabled(bool enabled); |
| 140 | 140 |
| 141 // Gets/Sets the font used when rendering the text within the Textfield. | 141 // Gets/Sets the fonts used when rendering the text within the Textfield. |
| 142 const gfx::Font& font() const { return font_; } | 142 const gfx::FontList& font_list() const { return font_list_; } |
| 143 void SetFontList(const gfx::FontList& font_list); |
| 144 const gfx::Font& GetPrimaryFont() const; |
| 143 void SetFont(const gfx::Font& font); | 145 void SetFont(const gfx::Font& font); |
| 144 | 146 |
| 145 // Sets the left and right margin (in pixels) within the text box. On Windows | 147 // Sets the left and right margin (in pixels) within the text box. On Windows |
| 146 // this is accomplished by packing the left and right margin into a single | 148 // this is accomplished by packing the left and right margin into a single |
| 147 // 32 bit number, so the left and right margins are effectively 16 bits. | 149 // 32 bit number, so the left and right margins are effectively 16 bits. |
| 148 void SetHorizontalMargins(int left, int right); | 150 void SetHorizontalMargins(int left, int right); |
| 149 | 151 |
| 150 // Sets the top and bottom margins (in pixels) within the textfield. | 152 // Sets the top and bottom margins (in pixels) within the textfield. |
| 151 // NOTE: in most cases height could be changed instead. | 153 // NOTE: in most cases height could be changed instead. |
| 152 void SetVerticalMargins(int top, int bottom); | 154 void SetVerticalMargins(int top, int bottom); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 private: | 287 private: |
| 286 // Returns the insets to the rectangle where text is actually painted. | 288 // Returns the insets to the rectangle where text is actually painted. |
| 287 gfx::Insets GetTextInsets() const; | 289 gfx::Insets GetTextInsets() const; |
| 288 | 290 |
| 289 // This is the current listener for events from this Textfield. | 291 // This is the current listener for events from this Textfield. |
| 290 TextfieldController* controller_; | 292 TextfieldController* controller_; |
| 291 | 293 |
| 292 // The mask of style options for this Textfield. | 294 // The mask of style options for this Textfield. |
| 293 StyleFlags style_; | 295 StyleFlags style_; |
| 294 | 296 |
| 295 // The font used to render the text in the Textfield. | 297 // The fonts used to render the text in the Textfield. |
| 296 gfx::Font font_; | 298 gfx::FontList font_list_; |
| 297 | 299 |
| 298 // The text displayed in the Textfield. | 300 // The text displayed in the Textfield. |
| 299 string16 text_; | 301 string16 text_; |
| 300 | 302 |
| 301 // True if this Textfield cannot accept input and is read-only. | 303 // True if this Textfield cannot accept input and is read-only. |
| 302 bool read_only_; | 304 bool read_only_; |
| 303 | 305 |
| 304 // The default number of average characters for the width of this text field. | 306 // The default number of average characters for the width of this text field. |
| 305 // This will be reported as the "desired size". Defaults to 0. | 307 // This will be reported as the "desired size". Defaults to 0. |
| 306 int default_width_in_chars_; | 308 int default_width_in_chars_; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 346 |
| 345 // The duration to reveal the last typed char for obscured textfields. | 347 // The duration to reveal the last typed char for obscured textfields. |
| 346 base::TimeDelta obscured_reveal_duration_; | 348 base::TimeDelta obscured_reveal_duration_; |
| 347 | 349 |
| 348 DISALLOW_COPY_AND_ASSIGN(Textfield); | 350 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 349 }; | 351 }; |
| 350 | 352 |
| 351 } // namespace views | 353 } // namespace views |
| 352 | 354 |
| 353 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 355 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |