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

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

Issue 6622002: Do all OOLing in the views code. linux_views now builds clean with the clang plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 VIEWS_CONTROLS_LABEL_H_ 5 #ifndef VIEWS_CONTROLS_LABEL_H_
6 #define VIEWS_CONTROLS_LABEL_H_ 6 #define VIEWS_CONTROLS_LABEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 // Return the height necessary to display this label with the provided width. 63 // Return the height necessary to display this label with the provided width.
64 // This method is used to layout multi-line labels. It is equivalent to 64 // This method is used to layout multi-line labels. It is equivalent to
65 // GetPreferredSize().height() if the receiver is not multi-line. 65 // GetPreferredSize().height() if the receiver is not multi-line.
66 virtual int GetHeightForWidth(int w); 66 virtual int GetHeightForWidth(int w);
67 67
68 // Overriden to dirty our text bounds if we're multi-line. 68 // Overriden to dirty our text bounds if we're multi-line.
69 virtual void OnBoundsChanged(); 69 virtual void OnBoundsChanged();
70 70
71 // Returns views/Label. 71 // Returns views/Label.
72 virtual std::string GetClassName() const { return kViewClassName; } 72 virtual std::string GetClassName() const;
73 73
74 // Overridden to paint 74 // Overridden to paint
75 virtual void OnPaint(gfx::Canvas* canvas); 75 virtual void OnPaint(gfx::Canvas* canvas);
76 76
77 // If the mouse is over the label, and a mouse over background has been 77 // If the mouse is over the label, and a mouse over background has been
78 // specified, its used. Otherwise super's implementation is invoked. 78 // specified, its used. Otherwise super's implementation is invoked.
79 virtual void OnPaintBackground(gfx::Canvas* canvas); 79 virtual void OnPaintBackground(gfx::Canvas* canvas);
80 80
81 // Set the font. 81 // Set the font.
82 void SetFont(const gfx::Font& font); 82 void SetFont(const gfx::Font& font);
83 83
84 // Set the label text. 84 // Set the label text.
85 void SetText(const std::wstring& text); 85 void SetText(const std::wstring& text);
86 86
87 // Return the font used by this label. 87 // Return the font used by this label.
88 gfx::Font font() const { return font_; } 88 gfx::Font font() const { return font_; }
89 89
90 // Return the label text. 90 // Return the label text.
91 const std::wstring GetText() const; 91 const std::wstring GetText() const;
92 92
93 // Set URL Value - text_ is set to spec(). 93 // Set URL Value - text_ is set to spec().
94 void SetURL(const GURL& url); 94 void SetURL(const GURL& url);
95 95
96 // Return the label URL. 96 // Return the label URL.
97 const GURL GetURL() const; 97 const GURL GetURL() const;
98 98
99 // Set the color 99 // Set the color
100 virtual void SetColor(const SkColor& color) { color_ = color; } 100 virtual void SetColor(const SkColor& color);
101 101
102 // Return a reference to the currently used color. 102 // Return a reference to the currently used color.
103 virtual SkColor GetColor() const { return color_; } 103 virtual SkColor GetColor() const;
104 104
105 // Set horizontal alignment. If the locale is RTL, and the RTL alignment 105 // Set horizontal alignment. If the locale is RTL, and the RTL alignment
106 // setting is set as USE_UI_ALIGNMENT, the alignment is flipped around. 106 // setting is set as USE_UI_ALIGNMENT, the alignment is flipped around.
107 // 107 //
108 // Caveat: for labels originating from a web page, the RTL alignment mode 108 // Caveat: for labels originating from a web page, the RTL alignment mode
109 // should be reset to AUTO_DETECT_ALIGNMENT before the horizontal alignment 109 // should be reset to AUTO_DETECT_ALIGNMENT before the horizontal alignment
110 // is set. Otherwise, the label's alignment specified as a parameter will be 110 // is set. Otherwise, the label's alignment specified as a parameter will be
111 // flipped in RTL locales. Please see the comments in SetRTLAlignmentMode for 111 // flipped in RTL locales. Please see the comments in SetRTLAlignmentMode for
112 // more information. 112 // more information.
113 void SetHorizontalAlignment(Alignment alignment); 113 void SetHorizontalAlignment(Alignment alignment);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // allows this view to reserve space for a focus border that it otherwise 272 // allows this view to reserve space for a focus border that it otherwise
273 // might not have because it is not itself focusable. 273 // might not have because it is not itself focusable.
274 bool has_focus_border_; 274 bool has_focus_border_;
275 275
276 DISALLOW_COPY_AND_ASSIGN(Label); 276 DISALLOW_COPY_AND_ASSIGN(Label);
277 }; 277 };
278 278
279 } // namespace views 279 } // namespace views
280 280
281 #endif // VIEWS_CONTROLS_LABEL_H_ 281 #endif // VIEWS_CONTROLS_LABEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698