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

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

Issue 147533005: [Password Generation] Update UI to match final mocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@replace_password_generation_ui
Patch Set: Created 6 years, 10 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_STYLED_LABEL_H_ 5 #ifndef UI_VIEWS_CONTROLS_STYLED_LABEL_H_
6 #define UI_VIEWS_CONTROLS_STYLED_LABEL_H_ 6 #define UI_VIEWS_CONTROLS_STYLED_LABEL_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "third_party/skia/include/core/SkColor.h" 13 #include "third_party/skia/include/core/SkColor.h"
14 #include "ui/gfx/font_list.h"
14 #include "ui/gfx/range/range.h" 15 #include "ui/gfx/range/range.h"
15 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
16 #include "ui/views/controls/link_listener.h" 17 #include "ui/views/controls/link_listener.h"
17 #include "ui/views/view.h" 18 #include "ui/views/view.h"
18 19
19 namespace views { 20 namespace views {
20 21
21 class Link; 22 class Link;
22 class StyledLabelListener; 23 class StyledLabelListener;
23 24
(...skipping 29 matching lines...) Expand all
53 bool is_link; 54 bool is_link;
54 }; 55 };
55 56
56 // Note that any trailing whitespace in |text| will be trimmed. 57 // Note that any trailing whitespace in |text| will be trimmed.
57 StyledLabel(const base::string16& text, StyledLabelListener* listener); 58 StyledLabel(const base::string16& text, StyledLabelListener* listener);
58 virtual ~StyledLabel(); 59 virtual ~StyledLabel();
59 60
60 // Sets the text to be displayed, and clears any previous styling. 61 // Sets the text to be displayed, and clears any previous styling.
61 void SetText(const base::string16& text); 62 void SetText(const base::string16& text);
62 63
64 // Sets the fonts used by all labels.
65 void SetFontList(const gfx::FontList& font_list);
66
63 // Marks the given range within |text_| with style defined by |style_info|. 67 // Marks the given range within |text_| with style defined by |style_info|.
64 // |range| must be contained in |text_|. 68 // |range| must be contained in |text_|.
65 void AddStyleRange(const gfx::Range& range, const RangeStyleInfo& style_info); 69 void AddStyleRange(const gfx::Range& range, const RangeStyleInfo& style_info);
66 70
67 // Sets the default style to use for any part of the text that isn't within 71 // Sets the default style to use for any part of the text that isn't within
68 // a range set by AddStyleRange. 72 // a range set by AddStyleRange.
69 void SetDefaultStyle(const RangeStyleInfo& style_info); 73 void SetDefaultStyle(const RangeStyleInfo& style_info);
70 74
71 // Sets the color of the background on which the label is drawn. This won't 75 // Sets the color of the background on which the label is drawn. This won't
72 // be explicitly drawn, but the label will force the text color to be 76 // be explicitly drawn, but the label will force the text color to be
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 111
108 // Calculates how to layout child views, creates them and sets their size 112 // Calculates how to layout child views, creates them and sets their size
109 // and position. |width| is the horizontal space, in pixels, that the view 113 // and position. |width| is the horizontal space, in pixels, that the view
110 // has to work with. If |dry_run| is true, the view hierarchy is not touched. 114 // has to work with. If |dry_run| is true, the view hierarchy is not touched.
111 // The return value is the necessary size. 115 // The return value is the necessary size.
112 gfx::Size CalculateAndDoLayout(int width, bool dry_run); 116 gfx::Size CalculateAndDoLayout(int width, bool dry_run);
113 117
114 // The text to display. 118 // The text to display.
115 base::string16 text_; 119 base::string16 text_;
116 120
121 // Fonts used to display text. Can be augmented by RangeStyleInfo.
122 gfx::FontList font_list_;
123
117 // The default style to use for any part of the text that isn't within 124 // The default style to use for any part of the text that isn't within
118 // a range in |style_ranges_|. 125 // a range in |style_ranges_|.
119 RangeStyleInfo default_style_info_; 126 RangeStyleInfo default_style_info_;
120 127
121 // The listener that will be informed of link clicks. 128 // The listener that will be informed of link clicks.
122 StyledLabelListener* listener_; 129 StyledLabelListener* listener_;
123 130
124 // The ranges that should be linkified, sorted by start position. 131 // The ranges that should be linkified, sorted by start position.
125 StyleRanges style_ranges_; 132 StyleRanges style_ranges_;
126 133
(...skipping 12 matching lines...) Expand all
139 // Controls whether the text is automatically re-colored to be readable on the 146 // Controls whether the text is automatically re-colored to be readable on the
140 // background. 147 // background.
141 bool auto_color_readability_enabled_; 148 bool auto_color_readability_enabled_;
142 149
143 DISALLOW_COPY_AND_ASSIGN(StyledLabel); 150 DISALLOW_COPY_AND_ASSIGN(StyledLabel);
144 }; 151 };
145 152
146 } // namespace views 153 } // namespace views
147 154
148 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_ 155 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698