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

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

Issue 9837059: Cleanup for views::Label: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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_LABEL_H_ 5 #ifndef UI_VIEWS_CONTROLS_LABEL_H_
6 #define UI_VIEWS_CONTROLS_LABEL_H_ 6 #define UI_VIEWS_CONTROLS_LABEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 explicit Label(const string16& text); 56 explicit Label(const string16& text);
57 Label(const string16& text, const gfx::Font& font); 57 Label(const string16& text, const gfx::Font& font);
58 virtual ~Label(); 58 virtual ~Label();
59 59
60 // Set the font. 60 // Set the font.
61 virtual void SetFont(const gfx::Font& font); 61 virtual void SetFont(const gfx::Font& font);
62 62
63 // Set the label text. 63 // Set the label text.
64 void SetText(const string16& text); 64 void SetText(const string16& text);
65 65
66 // Set URL Value - text_ is set to spec().
67 void SetURL(const GURL& url);
68
66 // Return the font used by this label. 69 // Return the font used by this label.
67 gfx::Font font() const { return font_; } 70 gfx::Font font() const { return font_; }
68 71
69 // Return the label text. 72 // Return the label text.
70 const string16 GetText() const; 73 string16 text() const { return text_; };
71
72 // Set URL Value - text_ is set to spec().
73 void SetURL(const GURL& url);
74
75 // Return the label URL.
76 const GURL GetURL() const;
77 74
78 // Enables or disables auto-color-readability (enabled by default). If this 75 // Enables or disables auto-color-readability (enabled by default). If this
79 // is enabled, then calls to set any foreground or background color will 76 // is enabled, then calls to set any foreground or background color will
80 // trigger an automatic mapper that uses color_utils::GetReadableColor() to 77 // trigger an automatic mapper that uses color_utils::GetReadableColor() to
81 // ensure that the foreground colors are readable over the background color. 78 // ensure that the foreground colors are readable over the background color.
82 void SetAutoColorReadabilityEnabled(bool enabled); 79 void SetAutoColorReadabilityEnabled(bool enabled);
83 80
84 // Set the color. This will automatically force the color to be readable 81 // Set the color. This will automatically force the color to be readable
85 // over the current background color. 82 // over the current background color.
86 virtual void SetEnabledColor(const SkColor& color); 83 virtual void SetEnabledColor(const SkColor& color);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 SkColor actual_enabled_color_; 253 SkColor actual_enabled_color_;
257 SkColor requested_disabled_color_; 254 SkColor requested_disabled_color_;
258 SkColor actual_disabled_color_; 255 SkColor actual_disabled_color_;
259 SkColor background_color_; 256 SkColor background_color_;
260 bool auto_color_readability_; 257 bool auto_color_readability_;
261 mutable gfx::Size text_size_; 258 mutable gfx::Size text_size_;
262 mutable bool text_size_valid_; 259 mutable bool text_size_valid_;
263 bool is_multi_line_; 260 bool is_multi_line_;
264 bool allow_character_break_; 261 bool allow_character_break_;
265 bool elide_in_middle_; 262 bool elide_in_middle_;
266 bool url_set_;
267 Alignment horiz_alignment_; 263 Alignment horiz_alignment_;
268 string16 tooltip_text_; 264 string16 tooltip_text_;
269 // Whether the mouse is over this label. 265 // Whether the mouse is over this label.
270 bool contains_mouse_; 266 bool contains_mouse_;
271 scoped_ptr<Background> mouse_over_background_; 267 scoped_ptr<Background> mouse_over_background_;
272 // Whether to collapse the label when it's not visible. 268 // Whether to collapse the label when it's not visible.
273 bool collapse_when_hidden_; 269 bool collapse_when_hidden_;
274 // The following member variable is used to control whether the 270 // The following member variable is used to control whether the
275 // directionality is auto-detected based on first strong directionality 271 // directionality is auto-detected based on first strong directionality
276 // character or is determined by chrome UI's locale. 272 // character or is determined by chrome UI's locale.
277 DirectionalityMode directionality_mode_; 273 DirectionalityMode directionality_mode_;
278 // When embedded in a larger control that is focusable, setting this flag 274 // When embedded in a larger control that is focusable, setting this flag
279 // allows this view to be painted as focused even when it is itself not. 275 // allows this view to be painted as focused even when it is itself not.
280 bool paint_as_focused_; 276 bool paint_as_focused_;
281 // When embedded in a larger control that is focusable, setting this flag 277 // When embedded in a larger control that is focusable, setting this flag
282 // allows this view to reserve space for a focus border that it otherwise 278 // allows this view to reserve space for a focus border that it otherwise
283 // might not have because it is not itself focusable. 279 // might not have because it is not itself focusable.
284 bool has_focus_border_; 280 bool has_focus_border_;
285 281
286 DISALLOW_COPY_AND_ASSIGN(Label); 282 DISALLOW_COPY_AND_ASSIGN(Label);
287 }; 283 };
288 284
289 } // namespace views 285 } // namespace views
290 286
291 #endif // UI_VIEWS_CONTROLS_LABEL_H_ 287 #endif // UI_VIEWS_CONTROLS_LABEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/selected_keyword_view.cc ('k') | ui/views/controls/label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698