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

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

Issue 343853002: Fix new avatar button appearance regressions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused label halo code; update example. Created 6 years, 6 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
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/controls/label.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_LABEL_H_ 5 #ifndef UI_VIEWS_CONTROLS_LABEL_H_
6 #define UI_VIEWS_CONTROLS_LABEL_H_ 6 #define UI_VIEWS_CONTROLS_LABEL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void SetDisabledColor(SkColor color); 53 void SetDisabledColor(SkColor color);
54 54
55 SkColor enabled_color() const { return actual_enabled_color_; } 55 SkColor enabled_color() const { return actual_enabled_color_; }
56 56
57 // Sets the background color. This won't be explicitly drawn, but the label 57 // Sets the background color. This won't be explicitly drawn, but the label
58 // will force the text color to be readable over it. 58 // will force the text color to be readable over it.
59 void SetBackgroundColor(SkColor color); 59 void SetBackgroundColor(SkColor color);
60 SkColor background_color() const { return background_color_; } 60 SkColor background_color() const { return background_color_; }
61 61
62 // Set drop shadows underneath the text. 62 // Set drop shadows underneath the text.
63 void set_shadows(const gfx::ShadowValues& shadows) { shadows_ = shadows; } 63 void set_shadows(const gfx::ShadowValues& shadows) {
64 shadows_ = shadows;
65 text_size_valid_ = false;
66 }
67 const gfx::ShadowValues& shadows() const { return shadows_; }
64 68
65 // Sets whether subpixel rendering is used; the default is true, but this 69 // Sets whether subpixel rendering is used; the default is true, but this
66 // feature also requires an opaque background color. 70 // feature also requires an opaque background color.
67 void set_subpixel_rendering_enabled(bool subpixel_rendering_enabled) { 71 void set_subpixel_rendering_enabled(bool subpixel_rendering_enabled) {
68 subpixel_rendering_enabled_ = subpixel_rendering_enabled; 72 subpixel_rendering_enabled_ = subpixel_rendering_enabled;
69 } 73 }
70 74
71 // Set the color of a halo on the painted text (use transparent for none).
72 void set_halo_color(SkColor halo_color) { halo_color_ = halo_color; }
73
74 // Sets the horizontal alignment; the argument value is mirrored in RTL UI. 75 // Sets the horizontal alignment; the argument value is mirrored in RTL UI.
75 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment); 76 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment);
76 gfx::HorizontalAlignment GetHorizontalAlignment() const; 77 gfx::HorizontalAlignment GetHorizontalAlignment() const;
77 78
78 // Sets the directionality mode. The default value is DIRECTIONALITY_FROM_UI, 79 // Sets the directionality mode. The default value is DIRECTIONALITY_FROM_UI,
79 // which should be suitable for most text originating from UI string assets. 80 // which should be suitable for most text originating from UI string assets.
80 // Most text originating from web content should use DIRECTIONALITY_FROM_TEXT. 81 // Most text originating from web content should use DIRECTIONALITY_FROM_TEXT.
81 void set_directionality_mode(gfx::DirectionalityMode mode) { 82 void set_directionality_mode(gfx::DirectionalityMode mode) {
82 directionality_mode_ = mode; 83 directionality_mode_ = mode;
83 } 84 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 gfx::ElideBehavior elide_behavior_; 236 gfx::ElideBehavior elide_behavior_;
236 gfx::HorizontalAlignment horizontal_alignment_; 237 gfx::HorizontalAlignment horizontal_alignment_;
237 base::string16 tooltip_text_; 238 base::string16 tooltip_text_;
238 // Whether to collapse the label when it's not visible. 239 // Whether to collapse the label when it's not visible.
239 bool collapse_when_hidden_; 240 bool collapse_when_hidden_;
240 // Controls whether the directionality is auto-detected based on first strong 241 // Controls whether the directionality is auto-detected based on first strong
241 // directionality character or is determined by the application UI's locale. 242 // directionality character or is determined by the application UI's locale.
242 gfx::DirectionalityMode directionality_mode_; 243 gfx::DirectionalityMode directionality_mode_;
243 gfx::ShadowValues shadows_; 244 gfx::ShadowValues shadows_;
244 245
245 // The halo color drawn around the text if it is not transparent.
246 SkColor halo_color_;
247
248 // The cached heights to avoid recalculation in GetHeightForWidth(). 246 // The cached heights to avoid recalculation in GetHeightForWidth().
249 mutable std::vector<gfx::Size> cached_heights_; 247 mutable std::vector<gfx::Size> cached_heights_;
250 mutable int cached_heights_cursor_; 248 mutable int cached_heights_cursor_;
251 249
252 DISALLOW_COPY_AND_ASSIGN(Label); 250 DISALLOW_COPY_AND_ASSIGN(Label);
253 }; 251 };
254 252
255 } // namespace views 253 } // namespace views
256 254
257 #endif // UI_VIEWS_CONTROLS_LABEL_H_ 255 #endif // UI_VIEWS_CONTROLS_LABEL_H_
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698