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

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

Issue 342833002: [Password Generation] Update Aura UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 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
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void SetBaseFontList(const gfx::FontList& font_list); 66 void SetBaseFontList(const gfx::FontList& font_list);
67 67
68 // Marks the given range within |text_| with style defined by |style_info|. 68 // Marks the given range within |text_| with style defined by |style_info|.
69 // |range| must be contained in |text_|. 69 // |range| must be contained in |text_|.
70 void AddStyleRange(const gfx::Range& range, const RangeStyleInfo& style_info); 70 void AddStyleRange(const gfx::Range& range, const RangeStyleInfo& style_info);
71 71
72 // Sets the default style to use for any part of the text that isn't within 72 // Sets the default style to use for any part of the text that isn't within
73 // a range set by AddStyleRange. 73 // a range set by AddStyleRange.
74 void SetDefaultStyle(const RangeStyleInfo& style_info); 74 void SetDefaultStyle(const RangeStyleInfo& style_info);
75 75
76 // Sets multiplier for line height. Multipliers < 1.0 will be ignored. Text
77 // will be centered in the available space.
78 void SetLineHeightMultiplier(double multiplier);
79
76 // Sets the color of the background on which the label is drawn. This won't 80 // Sets the color of the background on which the label is drawn. This won't
77 // be explicitly drawn, but the label will force the text color to be 81 // be explicitly drawn, but the label will force the text color to be
78 // readable over it. 82 // readable over it.
79 void SetDisplayedOnBackgroundColor(SkColor color); 83 void SetDisplayedOnBackgroundColor(SkColor color);
80 SkColor displayed_on_background_color() const { 84 SkColor displayed_on_background_color() const {
81 return displayed_on_background_color_; 85 return displayed_on_background_color_;
82 } 86 }
83 87
84 void set_auto_color_readability_enabled(bool auto_color_readability) { 88 void set_auto_color_readability_enabled(bool auto_color_readability) {
85 auto_color_readability_enabled_ = auto_color_readability; 89 auto_color_readability_enabled_ = auto_color_readability;
(...skipping 23 matching lines...) Expand all
109 RangeStyleInfo style_info; 113 RangeStyleInfo style_info;
110 }; 114 };
111 typedef std::list<StyleRange> StyleRanges; 115 typedef std::list<StyleRange> StyleRanges;
112 116
113 // Calculates how to layout child views, creates them and sets their size 117 // Calculates how to layout child views, creates them and sets their size
114 // and position. |width| is the horizontal space, in pixels, that the view 118 // and position. |width| is the horizontal space, in pixels, that the view
115 // has to work with. If |dry_run| is true, the view hierarchy is not touched. 119 // has to work with. If |dry_run| is true, the view hierarchy is not touched.
116 // The return value is the necessary size. 120 // The return value is the necessary size.
117 gfx::Size CalculateAndDoLayout(int width, bool dry_run); 121 gfx::Size CalculateAndDoLayout(int width, bool dry_run);
118 122
123 // Returns the line height, either default or user specified.
124 int GetLineHeight() const;
125
126 // Returns the vetical offset for a given line. This is necessary to
127 // vertically center text when a user specifies a line height great than the
128 // default.
129 int GetOffsetForLine(int line) const;
130
119 // The text to display. 131 // The text to display.
120 base::string16 text_; 132 base::string16 text_;
121 133
122 // Fonts used to display text. Can be augmented by RangeStyleInfo. 134 // Fonts used to display text. Can be augmented by RangeStyleInfo.
123 gfx::FontList font_list_; 135 gfx::FontList font_list_;
124 136
137 // Line height multipler.
138 double line_height_multiplier_;
139
125 // The default style to use for any part of the text that isn't within 140 // The default style to use for any part of the text that isn't within
126 // a range in |style_ranges_|. 141 // a range in |style_ranges_|.
127 RangeStyleInfo default_style_info_; 142 RangeStyleInfo default_style_info_;
128 143
129 // The listener that will be informed of link clicks. 144 // The listener that will be informed of link clicks.
130 StyledLabelListener* listener_; 145 StyledLabelListener* listener_;
131 146
132 // The ranges that should be linkified, sorted by start position. 147 // The ranges that should be linkified, sorted by start position.
133 StyleRanges style_ranges_; 148 StyleRanges style_ranges_;
134 149
(...skipping 12 matching lines...) Expand all
147 // Controls whether the text is automatically re-colored to be readable on the 162 // Controls whether the text is automatically re-colored to be readable on the
148 // background. 163 // background.
149 bool auto_color_readability_enabled_; 164 bool auto_color_readability_enabled_;
150 165
151 DISALLOW_COPY_AND_ASSIGN(StyledLabel); 166 DISALLOW_COPY_AND_ASSIGN(StyledLabel);
152 }; 167 };
153 168
154 } // namespace views 169 } // namespace views
155 170
156 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_ 171 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698