Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Side by Side Diff: ui/views/controls/textfield/textfield.h

Issue 11421204: Use native theme colors for textfields; etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase, add a blank line between includes. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Clears the selection within the edit field and sets the caret to the end. 101 // Clears the selection within the edit field and sets the caret to the end.
102 void ClearSelection() const; 102 void ClearSelection() const;
103 103
104 // Checks if there is any selected text. 104 // Checks if there is any selected text.
105 bool HasSelection() const; 105 bool HasSelection() const;
106 106
107 // Accessor for |style_|. 107 // Accessor for |style_|.
108 StyleFlags style() const { return style_; } 108 StyleFlags style() const { return style_; }
109 109
110 // Gets/Sets the text color to be used when painting the Textfield. 110 // Gets/Sets the text color to be used when painting the Textfield.
111 // Call |UseDefaultTextColor| to return to the system default colors. 111 // Call |UseDefaultTextColor| to restore the default system color.
112 SkColor text_color() const { return text_color_; } 112 SkColor GetTextColor() const;
113 void SetTextColor(SkColor color); 113 void SetTextColor(SkColor color);
114
115 // Gets/Sets whether the default text color should be used when painting the
116 // Textfield.
117 bool use_default_text_color() const {
118 return use_default_text_color_;
119 }
120 void UseDefaultTextColor(); 114 void UseDefaultTextColor();
121 115
122 // Gets/Sets the background color to be used when painting the Textfield. 116 // Gets/Sets the background color to be used when painting the Textfield.
123 // Call |UseDefaultBackgroundColor| to return to the system default colors. 117 // Call |UseDefaultBackgroundColor| to restore the default system color.
124 SkColor background_color() const { return background_color_; } 118 SkColor GetBackgroundColor() const;
125 void SetBackgroundColor(SkColor color); 119 void SetBackgroundColor(SkColor color);
126
127 // Gets/Sets whether the default background color should be used when painting
128 // the Textfield.
129 bool use_default_background_color() const {
130 return use_default_background_color_;
131 }
132 void UseDefaultBackgroundColor(); 120 void UseDefaultBackgroundColor();
133 121
134 // Gets/Sets the color to be used for the cursor. 122 // Gets/Sets whether or not the cursor is enabled.
135 SkColor cursor_color() const { return cursor_color_; } 123 bool GetCursorEnabled() const;
136 void SetCursorColor(SkColor color); 124 void SetCursorEnabled(bool enabled);
137
138 // Gets/Sets whether we use the system's default color for the cursor.
139 bool use_default_cursor_color() const { return use_default_cursor_color_; }
140 void UseDefaultCursorColor();
141 125
142 // Gets/Sets the font used when rendering the text within the Textfield. 126 // Gets/Sets the font used when rendering the text within the Textfield.
143 const gfx::Font& font() const { return font_; } 127 const gfx::Font& font() const { return font_; }
144 void SetFont(const gfx::Font& font); 128 void SetFont(const gfx::Font& font);
145 129
146 // Sets the left and right margin (in pixels) within the text box. On Windows 130 // Sets the left and right margin (in pixels) within the text box. On Windows
147 // this is accomplished by packing the left and right margin into a single 131 // this is accomplished by packing the left and right margin into a single
148 // 32 bit number, so the left and right margins are effectively 16 bits. 132 // 32 bit number, so the left and right margins are effectively 16 bits.
149 void SetHorizontalMargins(int left, int right); 133 void SetHorizontalMargins(int left, int right);
150 134
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 280
297 // Should we use the system text color instead of |text_color_|? 281 // Should we use the system text color instead of |text_color_|?
298 bool use_default_text_color_; 282 bool use_default_text_color_;
299 283
300 // Background color. Only used if |use_default_background_color_| is false. 284 // Background color. Only used if |use_default_background_color_| is false.
301 SkColor background_color_; 285 SkColor background_color_;
302 286
303 // Should we use the system background color instead of |background_color_|? 287 // Should we use the system background color instead of |background_color_|?
304 bool use_default_background_color_; 288 bool use_default_background_color_;
305 289
306 // Cursor color. Only used if |use_default_cursor_color_| is false.
307 SkColor cursor_color_;
308
309 // Should we use the system cursor color instead of |cursor_color_|?
310 bool use_default_cursor_color_;
311
312 // TODO(beng): remove this once NativeTextfieldWin subclasses 290 // TODO(beng): remove this once NativeTextfieldWin subclasses
313 // NativeControlWin. 291 // NativeControlWin.
314 bool initialized_; 292 bool initialized_;
315 293
316 // Holds inner textfield margins. 294 // Holds inner textfield margins.
317 gfx::Insets margins_; 295 gfx::Insets margins_;
318 296
319 // Holds whether margins were set. 297 // Holds whether margins were set.
320 bool horizontal_margins_were_set_; 298 bool horizontal_margins_were_set_;
321 bool vertical_margins_were_set_; 299 bool vertical_margins_were_set_;
322 300
323 // Text to display when empty. 301 // Text to display when empty.
324 string16 placeholder_text_; 302 string16 placeholder_text_;
325 303
326 // Placeholder text color. 304 // Placeholder text color.
327 SkColor placeholder_text_color_; 305 SkColor placeholder_text_color_;
328 306
329 // The accessible name of the text field. 307 // The accessible name of the text field.
330 string16 accessible_name_; 308 string16 accessible_name_;
331 309
332 // The input type of this text field. 310 // The input type of this text field.
333 ui::TextInputType text_input_type_; 311 ui::TextInputType text_input_type_;
334 312
335 DISALLOW_COPY_AND_ASSIGN(Textfield); 313 DISALLOW_COPY_AND_ASSIGN(Textfield);
336 }; 314 };
337 315
338 } // namespace views 316 } // namespace views
339 317
340 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 318 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/native_textfield_wrapper.h ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698