OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_VIEWS_LABEL_H__ | 5 #ifndef CHROME_VIEWS_LABEL_H__ |
6 #define CHROME_VIEWS_LABEL_H__ | 6 #define CHROME_VIEWS_LABEL_H__ |
7 | 7 |
8 #include "chrome/common/gfx/chrome_font.h" | 8 #include "chrome/common/gfx/chrome_font.h" |
9 #include "chrome/views/view.h" | 9 #include "chrome/views/view.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 Label(); | 32 Label(); |
33 | 33 |
34 // Create a new label with a default font | 34 // Create a new label with a default font |
35 explicit Label(const std::wstring& text); | 35 explicit Label(const std::wstring& text); |
36 | 36 |
37 Label(const std::wstring& text, const ChromeFont& font); | 37 Label(const std::wstring& text, const ChromeFont& font); |
38 | 38 |
39 virtual ~Label(); | 39 virtual ~Label(); |
40 | 40 |
41 // Overridden to compute the size required to display this label | 41 // Overridden to compute the size required to display this label |
42 virtual void GetPreferredSize(CSize* out); | 42 virtual gfx::Size GetPreferredSize(); |
43 | 43 |
44 // Return the height necessary to display this label with the provided width. | 44 // Return the height necessary to display this label with the provided width. |
45 // This method is used to layout multi-line labels. It is equivalent to | 45 // This method is used to layout multi-line labels. It is equivalent to |
46 // GetPreferredSize().cy if the receiver is not multi-line | 46 // GetPreferredSize().height() if the receiver is not multi-line |
47 virtual int GetHeightForWidth(int w); | 47 virtual int GetHeightForWidth(int w); |
48 | 48 |
49 // Returns chrome/views/Label. | 49 // Returns chrome/views/Label. |
50 virtual std::string GetClassName() const; | 50 virtual std::string GetClassName() const; |
51 | 51 |
52 // Overridden to paint | 52 // Overridden to paint |
53 virtual void Paint(ChromeCanvas* canvas); | 53 virtual void Paint(ChromeCanvas* canvas); |
54 | 54 |
55 // If the mouse is over the label, and a mouse over background has been | 55 // If the mouse is over the label, and a mouse over background has been |
56 // specified, its used. Otherwise super's implementation is invoked | 56 // specified, its used. Otherwise super's implementation is invoked |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 // Updates whether the mouse is contained in the Label. If the new value | 148 // Updates whether the mouse is contained in the Label. If the new value |
149 // differs from the current value, and a mouse over background is specified, | 149 // differs from the current value, and a mouse over background is specified, |
150 // SchedulePaint is invoked. | 150 // SchedulePaint is invoked. |
151 void SetContainsMouse(bool contains_mouse); | 151 void SetContainsMouse(bool contains_mouse); |
152 | 152 |
153 // Returns where the text is drawn, in the receivers coordinate system. | 153 // Returns where the text is drawn, in the receivers coordinate system. |
154 gfx::Rect GetTextBounds(); | 154 gfx::Rect GetTextBounds(); |
155 | 155 |
156 int ComputeMultiLineFlags(); | 156 int ComputeMultiLineFlags(); |
157 void GetTextSize(CSize* out); | 157 gfx::Size GetTextSize(); |
158 void Init(const std::wstring& text, const ChromeFont& font); | 158 void Init(const std::wstring& text, const ChromeFont& font); |
159 std::wstring text_; | 159 std::wstring text_; |
160 GURL url_; | 160 GURL url_; |
161 ChromeFont font_; | 161 ChromeFont font_; |
162 SkColor color_; | 162 SkColor color_; |
163 CSize text_size_; | 163 gfx::Size text_size_; |
164 bool text_size_valid_; | 164 bool text_size_valid_; |
165 bool is_multi_line_; | 165 bool is_multi_line_; |
166 bool url_set_; | 166 bool url_set_; |
167 Alignment horiz_alignment_; | 167 Alignment horiz_alignment_; |
168 std::wstring tooltip_text_; | 168 std::wstring tooltip_text_; |
169 // Whether the mouse is over this label. | 169 // Whether the mouse is over this label. |
170 bool contains_mouse_; | 170 bool contains_mouse_; |
171 scoped_ptr<Background> mouse_over_background_; | 171 scoped_ptr<Background> mouse_over_background_; |
172 }; | 172 }; |
173 | 173 |
174 } | 174 } |
175 #endif // CHROME_VIEWS_VIEW_H__ | 175 #endif // CHROME_VIEWS_VIEW_H__ |
176 | 176 |
OLD | NEW |