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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // Should we use the system background color instead of |background_color_|? | 321 // Should we use the system background color instead of |background_color_|? |
328 bool use_default_background_color_; | 322 bool use_default_background_color_; |
329 | 323 |
330 // Holds inner textfield margins. | 324 // Holds inner textfield margins. |
331 gfx::Insets margins_; | 325 gfx::Insets margins_; |
332 | 326 |
333 // Holds whether margins were set. | 327 // Holds whether margins were set. |
334 bool horizontal_margins_were_set_; | 328 bool horizontal_margins_were_set_; |
335 bool vertical_margins_were_set_; | 329 bool vertical_margins_were_set_; |
336 | 330 |
337 // The vertical alignment of text in the Textfield. | |
338 gfx::VerticalAlignment vertical_alignment_; | |
339 | |
340 // Text to display when empty. | 331 // Text to display when empty. |
341 string16 placeholder_text_; | 332 string16 placeholder_text_; |
342 | 333 |
343 // Placeholder text color. | 334 // Placeholder text color. |
344 SkColor placeholder_text_color_; | 335 SkColor placeholder_text_color_; |
345 | 336 |
346 // The accessible name of the text field. | 337 // The accessible name of the text field. |
347 string16 accessible_name_; | 338 string16 accessible_name_; |
348 | 339 |
349 // The input type of this text field. | 340 // The input type of this text field. |
350 ui::TextInputType text_input_type_; | 341 ui::TextInputType text_input_type_; |
351 | 342 |
352 // The duration to reveal the last typed char for obscured textfields. | 343 // The duration to reveal the last typed char for obscured textfields. |
353 base::TimeDelta obscured_reveal_duration_; | 344 base::TimeDelta obscured_reveal_duration_; |
354 | 345 |
355 // Used to bind callback functions to this object. | 346 // Used to bind callback functions to this object. |
356 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 347 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
357 | 348 |
358 DISALLOW_COPY_AND_ASSIGN(Textfield); | 349 DISALLOW_COPY_AND_ASSIGN(Textfield); |
359 }; | 350 }; |
360 | 351 |
361 } // namespace views | 352 } // namespace views |
362 | 353 |
363 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 354 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
OLD | NEW |