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

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

Issue 10310131: Support placeholder text in NativeTextfieldViews. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for comments in #3 Created 8 years, 7 months 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 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h"
10
11 #include <string> 9 #include <string>
12 10
13 #include "base/basictypes.h" 11 #include "base/basictypes.h"
14 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
15 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "build/build_config.h"
16 #include "third_party/skia/include/core/SkColor.h" 15 #include "third_party/skia/include/core/SkColor.h"
17 #include "ui/base/ime/text_input_type.h" 16 #include "ui/base/ime/text_input_type.h"
18 #include "ui/base/keycodes/keyboard_codes.h" 17 #include "ui/base/keycodes/keyboard_codes.h"
19 #include "ui/gfx/font.h" 18 #include "ui/gfx/font.h"
20 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
21 #include "ui/views/controls/textfield/native_textfield_wrapper.h" 20 #include "ui/views/controls/textfield/native_textfield_wrapper.h"
22 #include "ui/views/view.h" 21 #include "ui/views/view.h"
23 22
24 #if !defined(OS_LINUX) 23 #if !defined(OS_LINUX)
25 #include "base/logging.h" 24 #include "base/logging.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Sets the default width of the text control. See default_width_in_chars_. 149 // Sets the default width of the text control. See default_width_in_chars_.
151 void set_default_width_in_chars(int default_width) { 150 void set_default_width_in_chars(int default_width) {
152 default_width_in_chars_ = default_width; 151 default_width_in_chars_ = default_width;
153 } 152 }
154 153
155 // Removes the border from the edit box, giving it a 2D look. 154 // Removes the border from the edit box, giving it a 2D look.
156 bool draw_border() const { return draw_border_; } 155 bool draw_border() const { return draw_border_; }
157 void RemoveBorder(); 156 void RemoveBorder();
158 157
159 // Sets the text to display when empty. 158 // Sets the text to display when empty.
160 void set_text_to_display_when_empty(const string16& text) { 159 void set_placeholder_text(const string16& text) {
161 text_to_display_when_empty_ = text; 160 placeholder_text_ = text;
162 #if !defined(OS_LINUX) 161 #if !defined(OS_LINUX)
163 NOTIMPLEMENTED(); 162 NOTIMPLEMENTED();
164 #endif 163 #endif
165 } 164 }
166 const string16& text_to_display_when_empty() { 165 const string16& placeholder_text() const {
167 return text_to_display_when_empty_; 166 return placeholder_text_;
167 }
168
169 SkColor placeholder_text_color() const { return placeholder_text_color_; }
170 void set_placeholder_text_color(SkColor color) {
171 placeholder_text_color_ = color;
168 } 172 }
169 173
170 // Getter for the horizontal margins that were set. Returns false if 174 // Getter for the horizontal margins that were set. Returns false if
171 // horizontal margins weren't set. 175 // horizontal margins weren't set.
172 bool GetHorizontalMargins(int* left, int* right); 176 bool GetHorizontalMargins(int* left, int* right);
173 177
174 // Getter for the vertical margins that were set. Returns false if vertical 178 // Getter for the vertical margins that were set. Returns false if vertical
175 // margins weren't set. 179 // margins weren't set.
176 bool GetVerticalMargins(int* top, int* bottom); 180 bool GetVerticalMargins(int* top, int* bottom);
177 181
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 bool initialized_; 303 bool initialized_;
300 304
301 // Holds inner textfield margins. 305 // Holds inner textfield margins.
302 gfx::Insets margins_; 306 gfx::Insets margins_;
303 307
304 // Holds whether margins were set. 308 // Holds whether margins were set.
305 bool horizontal_margins_were_set_; 309 bool horizontal_margins_were_set_;
306 bool vertical_margins_were_set_; 310 bool vertical_margins_were_set_;
307 311
308 // Text to display when empty. 312 // Text to display when empty.
309 string16 text_to_display_when_empty_; 313 string16 placeholder_text_;
314
315 // Placeholder text color.
316 SkColor placeholder_text_color_;
310 317
311 // The accessible name of the text field. 318 // The accessible name of the text field.
312 string16 accessible_name_; 319 string16 accessible_name_;
313 320
314 // The input type of this text field. 321 // The input type of this text field.
315 ui::TextInputType text_input_type_; 322 ui::TextInputType text_input_type_;
316 323
317 DISALLOW_COPY_AND_ASSIGN(Textfield); 324 DISALLOW_COPY_AND_ASSIGN(Textfield);
318 }; 325 };
319 326
320 } // namespace views 327 } // namespace views
321 328
322 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 329 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/native_textfield_views.cc ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698