| 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" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 // Sets the left and right margin (in pixels) within the text box. On Windows | 151 // Sets the left and right margin (in pixels) within the text box. On Windows |
| 152 // this is accomplished by packing the left and right margin into a single | 152 // this is accomplished by packing the left and right margin into a single |
| 153 // 32 bit number, so the left and right margins are effectively 16 bits. | 153 // 32 bit number, so the left and right margins are effectively 16 bits. |
| 154 void SetHorizontalMargins(int left, int right); | 154 void SetHorizontalMargins(int left, int right); |
| 155 | 155 |
| 156 // Sets the top and bottom margins (in pixels) within the textfield. | 156 // Sets the top and bottom margins (in pixels) within the textfield. |
| 157 // NOTE: in most cases height could be changed instead. | 157 // NOTE: in most cases height could be changed instead. |
| 158 void SetVerticalMargins(int top, int bottom); | 158 void SetVerticalMargins(int top, int bottom); |
| 159 | 159 |
| 160 // Set the text vertical alignment. Text is vertically centered by default. | |
| 161 gfx::VerticalAlignment vertical_alignment() const { | |
| 162 return vertical_alignment_; | |
| 163 } | |
| 164 void SetVerticalAlignment(gfx::VerticalAlignment alignment); | |
| 165 | |
| 166 // Sets the default width of the text control. See default_width_in_chars_. | 160 // Sets the default width of the text control. See default_width_in_chars_. |
| 167 void set_default_width_in_chars(int default_width) { | 161 void set_default_width_in_chars(int default_width) { |
| 168 default_width_in_chars_ = default_width; | 162 default_width_in_chars_ = default_width; |
| 169 } | 163 } |
| 170 | 164 |
| 171 // Removes the border from the edit box, giving it a 2D look. | 165 // Removes the border from the edit box, giving it a 2D look. |
| 172 bool draw_border() const { return draw_border_; } | 166 bool draw_border() const { return draw_border_; } |
| 173 void RemoveBorder(); | 167 void RemoveBorder(); |
| 174 | 168 |
| 175 // Sets the text to display when empty. | 169 // Sets the text to display when empty. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 // Should we use the system background color instead of |background_color_|? | 323 // Should we use the system background color instead of |background_color_|? |
| 330 bool use_default_background_color_; | 324 bool use_default_background_color_; |
| 331 | 325 |
| 332 // Holds inner textfield margins. | 326 // Holds inner textfield margins. |
| 333 gfx::Insets margins_; | 327 gfx::Insets margins_; |
| 334 | 328 |
| 335 // Holds whether margins were set. | 329 // Holds whether margins were set. |
| 336 bool horizontal_margins_were_set_; | 330 bool horizontal_margins_were_set_; |
| 337 bool vertical_margins_were_set_; | 331 bool vertical_margins_were_set_; |
| 338 | 332 |
| 339 // The vertical alignment of text in the Textfield. | |
| 340 gfx::VerticalAlignment vertical_alignment_; | |
| 341 | |
| 342 // Text to display when empty. | 333 // Text to display when empty. |
| 343 string16 placeholder_text_; | 334 string16 placeholder_text_; |
| 344 | 335 |
| 345 // Placeholder text color. | 336 // Placeholder text color. |
| 346 SkColor placeholder_text_color_; | 337 SkColor placeholder_text_color_; |
| 347 | 338 |
| 348 // The accessible name of the text field. | 339 // The accessible name of the text field. |
| 349 string16 accessible_name_; | 340 string16 accessible_name_; |
| 350 | 341 |
| 351 // The input type of this text field. | 342 // The input type of this text field. |
| 352 ui::TextInputType text_input_type_; | 343 ui::TextInputType text_input_type_; |
| 353 | 344 |
| 354 // The duration to reveal the last typed char for obscured textfields. | 345 // The duration to reveal the last typed char for obscured textfields. |
| 355 base::TimeDelta obscured_reveal_duration_; | 346 base::TimeDelta obscured_reveal_duration_; |
| 356 | 347 |
| 357 // Used to bind callback functions to this object. | 348 // Used to bind callback functions to this object. |
| 358 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 349 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
| 359 | 350 |
| 360 DISALLOW_COPY_AND_ASSIGN(Textfield); | 351 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 361 }; | 352 }; |
| 362 | 353 |
| 363 } // namespace views | 354 } // namespace views |
| 364 | 355 |
| 365 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 356 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |