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

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

Issue 308083011: Add support for painting halos on Views Labels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Draw halos over shadows; refine function order and 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 | « no previous file | 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 // Sets the drop shadow's offset from the text. 94 // Sets the drop shadow's offset from the text.
95 void SetShadowOffset(int x, int y); 95 void SetShadowOffset(int x, int y);
96 96
97 // Sets the shadow blur. Default is zero. 97 // Sets the shadow blur. Default is zero.
98 void set_shadow_blur(double shadow_blur) { shadow_blur_ = shadow_blur; } 98 void set_shadow_blur(double shadow_blur) { shadow_blur_ = shadow_blur; }
99 99
100 // Disables shadows. 100 // Disables shadows.
101 void ClearEmbellishing(); 101 void ClearEmbellishing();
102 102
103 // Set the color of a halo on the painted text (use transparent for none).
104 void set_halo_color(SkColor halo_color) { halo_color_ = halo_color; }
105
103 // Sets horizontal alignment. If the locale is RTL, and the directionality 106 // Sets horizontal alignment. If the locale is RTL, and the directionality
104 // mode is USE_UI_DIRECTIONALITY, the alignment is flipped around. 107 // mode is USE_UI_DIRECTIONALITY, the alignment is flipped around.
105 // 108 //
106 // Caveat: for labels originating from a web page, the directionality mode 109 // Caveat: for labels originating from a web page, the directionality mode
107 // should be reset to AUTO_DETECT_DIRECTIONALITY before the horizontal 110 // should be reset to AUTO_DETECT_DIRECTIONALITY before the horizontal
108 // alignment is set. Otherwise, the label's alignment specified as a parameter 111 // alignment is set. Otherwise, the label's alignment specified as a parameter
109 // will be flipped in RTL locales. 112 // will be flipped in RTL locales.
110 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment); 113 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment);
111 114
112 gfx::HorizontalAlignment horizontal_alignment() const { 115 gfx::HorizontalAlignment horizontal_alignment() const {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 SkColor background_color_; 266 SkColor background_color_;
264 267
265 // Set to true once the corresponding setter is invoked. 268 // Set to true once the corresponding setter is invoked.
266 bool enabled_color_set_; 269 bool enabled_color_set_;
267 bool disabled_color_set_; 270 bool disabled_color_set_;
268 bool background_color_set_; 271 bool background_color_set_;
269 272
270 bool auto_color_readability_; 273 bool auto_color_readability_;
271 mutable gfx::Size text_size_; 274 mutable gfx::Size text_size_;
272 mutable bool text_size_valid_; 275 mutable bool text_size_valid_;
273 // Indicates the level of shadow blurring. Default is zero.
274 double shadow_blur_;
275 int line_height_; 276 int line_height_;
276 bool is_multi_line_; 277 bool is_multi_line_;
277 bool is_obscured_; 278 bool is_obscured_;
278 bool allow_character_break_; 279 bool allow_character_break_;
279 ElideBehavior elide_behavior_; 280 ElideBehavior elide_behavior_;
280 gfx::HorizontalAlignment horizontal_alignment_; 281 gfx::HorizontalAlignment horizontal_alignment_;
281 base::string16 tooltip_text_; 282 base::string16 tooltip_text_;
282 // Whether to collapse the label when it's not visible. 283 // Whether to collapse the label when it's not visible.
283 bool collapse_when_hidden_; 284 bool collapse_when_hidden_;
284 // The following member variable is used to control whether the 285 // The following member variable is used to control whether the
285 // directionality is auto-detected based on first strong directionality 286 // directionality is auto-detected based on first strong directionality
286 // character or is determined by chrome UI's locale. 287 // character or is determined by chrome UI's locale.
287 DirectionalityMode directionality_mode_; 288 DirectionalityMode directionality_mode_;
288 289
289 // Colors for shadow. 290 // Colors for shadow.
290 SkColor enabled_shadow_color_; 291 SkColor enabled_shadow_color_;
291 SkColor disabled_shadow_color_; 292 SkColor disabled_shadow_color_;
292 293
293 // Space between text and shadow. 294 // Space between text and shadow.
294 gfx::Point shadow_offset_; 295 gfx::Point shadow_offset_;
295 296
296 // Should a shadow be drawn behind the text? 297 // Should a shadow be drawn behind the text?
297 bool has_shadow_; 298 bool has_shadow_;
298 299
300 // Indicates the level of shadow blurring. Default is zero.
301 double shadow_blur_;
302
303 // The halo color drawn around the text if it is not transparent.
304 SkColor halo_color_;
305
299 // The cached heights to avoid recalculation in GetHeightForWidth(). 306 // The cached heights to avoid recalculation in GetHeightForWidth().
300 mutable std::vector<gfx::Size> cached_heights_; 307 mutable std::vector<gfx::Size> cached_heights_;
301 mutable int cached_heights_cursor_; 308 mutable int cached_heights_cursor_;
302 309
303 DISALLOW_COPY_AND_ASSIGN(Label); 310 DISALLOW_COPY_AND_ASSIGN(Label);
304 }; 311 };
305 312
306 } // namespace views 313 } // namespace views
307 314
308 #endif // UI_VIEWS_CONTROLS_LABEL_H_ 315 #endif // UI_VIEWS_CONTROLS_LABEL_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698