OLD | NEW |
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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // Overridden to compute the size required to display this label. | 178 // Overridden to compute the size required to display this label. |
179 virtual gfx::Size GetPreferredSize() OVERRIDE; | 179 virtual gfx::Size GetPreferredSize() OVERRIDE; |
180 // Returns the width of an ellipsis if the label is non-empty, or 0 otherwise. | 180 // Returns the width of an ellipsis if the label is non-empty, or 0 otherwise. |
181 virtual gfx::Size GetMinimumSize() OVERRIDE; | 181 virtual gfx::Size GetMinimumSize() OVERRIDE; |
182 // Returns the height necessary to display this label with the provided width. | 182 // Returns the height necessary to display this label with the provided width. |
183 // This method is used to layout multi-line labels. It is equivalent to | 183 // This method is used to layout multi-line labels. It is equivalent to |
184 // GetPreferredSize().height() if the receiver is not multi-line. | 184 // GetPreferredSize().height() if the receiver is not multi-line. |
185 virtual int GetHeightForWidth(int w) OVERRIDE; | 185 virtual int GetHeightForWidth(int w) OVERRIDE; |
186 virtual const char* GetClassName() const OVERRIDE; | 186 virtual const char* GetClassName() const OVERRIDE; |
187 virtual View* GetTooltipHandlerForPoint(const gfx::Point& point) OVERRIDE; | 187 virtual View* GetTooltipHandlerForPoint(const gfx::Point& point) OVERRIDE; |
188 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | |
189 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 188 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
190 // Gets the tooltip text for labels that are wider than their bounds, except | 189 // Gets the tooltip text for labels that are wider than their bounds, except |
191 // when the label is multiline, in which case it just returns false (no | 190 // when the label is multiline, in which case it just returns false (no |
192 // tooltip). If a custom tooltip has been specified with SetTooltipText() | 191 // tooltip). If a custom tooltip has been specified with SetTooltipText() |
193 // it is returned instead. | 192 // it is returned instead. |
194 virtual bool GetTooltipText(const gfx::Point& p, | 193 virtual bool GetTooltipText(const gfx::Point& p, |
195 base::string16* tooltip) const OVERRIDE; | 194 base::string16* tooltip) const OVERRIDE; |
196 | 195 |
| 196 // ui::EventTarget: |
| 197 virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; |
| 198 |
197 protected: | 199 protected: |
198 // Called by Paint to paint the text. Override this to change how | 200 // Called by Paint to paint the text. Override this to change how |
199 // text is painted. | 201 // text is painted. |
200 virtual void PaintText(gfx::Canvas* canvas, | 202 virtual void PaintText(gfx::Canvas* canvas, |
201 const base::string16& text, | 203 const base::string16& text, |
202 const gfx::Rect& text_bounds, | 204 const gfx::Rect& text_bounds, |
203 int flags); | 205 int flags); |
204 | 206 |
205 virtual gfx::Size GetTextSize() const; | 207 virtual gfx::Size GetTextSize() const; |
206 | 208 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 // The cached heights to avoid recalculation in GetHeightForWidth(). | 301 // The cached heights to avoid recalculation in GetHeightForWidth(). |
300 std::vector<gfx::Size> cached_heights_; | 302 std::vector<gfx::Size> cached_heights_; |
301 int cached_heights_cursor_; | 303 int cached_heights_cursor_; |
302 | 304 |
303 DISALLOW_COPY_AND_ASSIGN(Label); | 305 DISALLOW_COPY_AND_ASSIGN(Label); |
304 }; | 306 }; |
305 | 307 |
306 } // namespace views | 308 } // namespace views |
307 | 309 |
308 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 310 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
OLD | NEW |