OLD | NEW |
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 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "googleurl/src/gurl.h" | |
14 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
15 #include "ui/gfx/font.h" | 14 #include "ui/gfx/font.h" |
16 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
17 | 16 |
18 namespace views { | 17 namespace views { |
19 | 18 |
20 ///////////////////////////////////////////////////////////////////////////// | 19 ///////////////////////////////////////////////////////////////////////////// |
21 // | 20 // |
22 // Label class | 21 // Label class |
23 // | 22 // |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 57 |
59 // Sets the font. | 58 // Sets the font. |
60 virtual void SetFont(const gfx::Font& font); | 59 virtual void SetFont(const gfx::Font& font); |
61 | 60 |
62 // Sets the label text. | 61 // Sets the label text. |
63 void SetText(const string16& text); | 62 void SetText(const string16& text); |
64 | 63 |
65 // Sets the label text to |email|. Emails have a custom eliding algorithm. | 64 // Sets the label text to |email|. Emails have a custom eliding algorithm. |
66 void SetEmail(const string16& email); | 65 void SetEmail(const string16& email); |
67 | 66 |
68 // Sets URL Value - text_ is set to spec(). | |
69 void SetURL(const GURL& url); | |
70 | |
71 // Returns the font used by this label. | 67 // Returns the font used by this label. |
72 gfx::Font font() const { return font_; } | 68 gfx::Font font() const { return font_; } |
73 | 69 |
74 // Returns the label text. | 70 // Returns the label text. |
75 string16 text() const { return text_; }; | 71 string16 text() const { return text_; }; |
76 | 72 |
77 // Enables or disables auto-color-readability (enabled by default). If this | 73 // Enables or disables auto-color-readability (enabled by default). If this |
78 // is enabled, then calls to set any foreground or background color will | 74 // is enabled, then calls to set any foreground or background color will |
79 // trigger an automatic mapper that uses color_utils::GetReadableColor() to | 75 // trigger an automatic mapper that uses color_utils::GetReadableColor() to |
80 // ensure that the foreground colors are readable over the background color. | 76 // ensure that the foreground colors are readable over the background color. |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 int ComputeDrawStringFlags() const; | 247 int ComputeDrawStringFlags() const; |
252 | 248 |
253 gfx::Rect GetAvailableRect() const; | 249 gfx::Rect GetAvailableRect() const; |
254 | 250 |
255 // Returns parameters to be used for the DrawString call. | 251 // Returns parameters to be used for the DrawString call. |
256 void CalculateDrawStringParams(string16* paint_text, | 252 void CalculateDrawStringParams(string16* paint_text, |
257 gfx::Rect* text_bounds, | 253 gfx::Rect* text_bounds, |
258 int* flags) const; | 254 int* flags) const; |
259 | 255 |
260 string16 text_; | 256 string16 text_; |
261 GURL url_; | |
262 gfx::Font font_; | 257 gfx::Font font_; |
263 SkColor requested_enabled_color_; | 258 SkColor requested_enabled_color_; |
264 SkColor actual_enabled_color_; | 259 SkColor actual_enabled_color_; |
265 SkColor requested_disabled_color_; | 260 SkColor requested_disabled_color_; |
266 SkColor actual_disabled_color_; | 261 SkColor actual_disabled_color_; |
267 SkColor background_color_; | 262 SkColor background_color_; |
268 bool auto_color_readability_; | 263 bool auto_color_readability_; |
269 mutable gfx::Size text_size_; | 264 mutable gfx::Size text_size_; |
270 mutable bool text_size_valid_; | 265 mutable bool text_size_valid_; |
271 bool is_multi_line_; | 266 bool is_multi_line_; |
(...skipping 29 matching lines...) Expand all Loading... |
301 // Should a shadow be drawn behind the text? | 296 // Should a shadow be drawn behind the text? |
302 bool has_shadow_; | 297 bool has_shadow_; |
303 | 298 |
304 | 299 |
305 DISALLOW_COPY_AND_ASSIGN(Label); | 300 DISALLOW_COPY_AND_ASSIGN(Label); |
306 }; | 301 }; |
307 | 302 |
308 } // namespace views | 303 } // namespace views |
309 | 304 |
310 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 305 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
OLD | NEW |