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

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: Nix cursor color; adjust textfield functions; add read-only theme colors. 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.
135 SkColor cursor_color() const { return cursor_color_; }
136 void SetCursorColor(SkColor color);
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
142 // Gets/Sets the font used when rendering the text within the Textfield. 122 // Gets/Sets the font used when rendering the text within the Textfield.
143 const gfx::Font& font() const { return font_; } 123 const gfx::Font& font() const { return font_; }
144 void SetFont(const gfx::Font& font); 124 void SetFont(const gfx::Font& font);
145 125
146 // Sets the left and right margin (in pixels) within the text box. On Windows 126 // 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 127 // 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. 128 // 32 bit number, so the left and right margins are effectively 16 bits.
149 void SetHorizontalMargins(int left, int right); 129 void SetHorizontalMargins(int left, int right);
150 130
151 // Sets the top and bottom margins (in pixels) within the textfield. 131 // Sets the top and bottom margins (in pixels) within the textfield.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 276
297 // Should we use the system text color instead of |text_color_|? 277 // Should we use the system text color instead of |text_color_|?
298 bool use_default_text_color_; 278 bool use_default_text_color_;
299 279
300 // Background color. Only used if |use_default_background_color_| is false. 280 // Background color. Only used if |use_default_background_color_| is false.
301 SkColor background_color_; 281 SkColor background_color_;
302 282
303 // Should we use the system background color instead of |background_color_|? 283 // Should we use the system background color instead of |background_color_|?
304 bool use_default_background_color_; 284 bool use_default_background_color_;
305 285
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 286 // TODO(beng): remove this once NativeTextfieldWin subclasses
313 // NativeControlWin. 287 // NativeControlWin.
314 bool initialized_; 288 bool initialized_;
315 289
316 // Holds inner textfield margins. 290 // Holds inner textfield margins.
317 gfx::Insets margins_; 291 gfx::Insets margins_;
318 292
319 // Holds whether margins were set. 293 // Holds whether margins were set.
320 bool horizontal_margins_were_set_; 294 bool horizontal_margins_were_set_;
321 bool vertical_margins_were_set_; 295 bool vertical_margins_were_set_;
322 296
323 // Text to display when empty. 297 // Text to display when empty.
324 string16 placeholder_text_; 298 string16 placeholder_text_;
325 299
326 // Placeholder text color. 300 // Placeholder text color.
327 SkColor placeholder_text_color_; 301 SkColor placeholder_text_color_;
328 302
329 // The accessible name of the text field. 303 // The accessible name of the text field.
330 string16 accessible_name_; 304 string16 accessible_name_;
331 305
332 // The input type of this text field. 306 // The input type of this text field.
333 ui::TextInputType text_input_type_; 307 ui::TextInputType text_input_type_;
334 308
335 DISALLOW_COPY_AND_ASSIGN(Textfield); 309 DISALLOW_COPY_AND_ASSIGN(Textfield);
336 }; 310 };
337 311
338 } // namespace views 312 } // namespace views
339 313
340 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 314 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698