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

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

Issue 9562038: ui/gfx: Make gfx::Canvas inherit from gfx::CanvasSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // Gets the tooltip text for labels that are wider than their bounds, except 184 // Gets the tooltip text for labels that are wider than their bounds, except
185 // when the label is multiline, in which case it just returns false (no 185 // when the label is multiline, in which case it just returns false (no
186 // tooltip). If a custom tooltip has been specified with SetTooltipText() 186 // tooltip). If a custom tooltip has been specified with SetTooltipText()
187 // it is returned instead. 187 // it is returned instead.
188 virtual bool GetTooltipText(const gfx::Point& p, 188 virtual bool GetTooltipText(const gfx::Point& p,
189 string16* tooltip) const OVERRIDE; 189 string16* tooltip) const OVERRIDE;
190 190
191 protected: 191 protected:
192 // Called by Paint to paint the text. Override this to change how 192 // Called by Paint to paint the text. Override this to change how
193 // text is painted. 193 // text is painted.
194 virtual void PaintText(gfx::Canvas* canvas, 194 virtual void PaintText(gfx::CanvasSkia* canvas,
195 const string16& text, 195 const string16& text,
196 const gfx::Rect& text_bounds, 196 const gfx::Rect& text_bounds,
197 int flags); 197 int flags);
198 198
199 void invalidate_text_size() { text_size_valid_ = false; } 199 void invalidate_text_size() { text_size_valid_ = false; }
200 200
201 virtual gfx::Size GetTextSize() const; 201 virtual gfx::Size GetTextSize() const;
202 202
203 SkColor disabled_color() const { return actual_disabled_color_; } 203 SkColor disabled_color() const { return actual_disabled_color_; }
204 204
205 // Overridden from View: 205 // Overridden from View:
206 // Overridden to dirty our text bounds if we're multi-line. 206 // Overridden to dirty our text bounds if we're multi-line.
207 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; 207 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
208 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 208 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE;
209 // If the mouse is over the label, and a mouse over background has been 209 // If the mouse is over the label, and a mouse over background has been
210 // specified, its used. Otherwise super's implementation is invoked. 210 // specified, its used. Otherwise super's implementation is invoked.
211 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; 211 virtual void OnPaintBackground(gfx::CanvasSkia* canvas) OVERRIDE;
212 212
213 private: 213 private:
214 // These tests call CalculateDrawStringParams in order to verify the 214 // These tests call CalculateDrawStringParams in order to verify the
215 // calculations done for drawing text. 215 // calculations done for drawing text.
216 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineString); 216 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineString);
217 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineString); 217 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineString);
218 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineStringInRTL); 218 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineStringInRTL);
219 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineStringInRTL); 219 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineStringInRTL);
220 FRIEND_TEST_ALL_PREFIXES(LabelTest, AutoDetectDirectionality); 220 FRIEND_TEST_ALL_PREFIXES(LabelTest, AutoDetectDirectionality);
221 221
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // allows this view to reserve space for a focus border that it otherwise 279 // allows this view to reserve space for a focus border that it otherwise
280 // might not have because it is not itself focusable. 280 // might not have because it is not itself focusable.
281 bool has_focus_border_; 281 bool has_focus_border_;
282 282
283 DISALLOW_COPY_AND_ASSIGN(Label); 283 DISALLOW_COPY_AND_ASSIGN(Label);
284 }; 284 };
285 285
286 } // namespace views 286 } // namespace views
287 287
288 #endif // UI_VIEWS_CONTROLS_LABEL_H_ 288 #endif // UI_VIEWS_CONTROLS_LABEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698