| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Gets/sets the flag to determine whether the label should be collapsed when | 169 // Gets/sets the flag to determine whether the label should be collapsed when |
| 170 // it's hidden (not visible). If this flag is true, the label will return a | 170 // it's hidden (not visible). If this flag is true, the label will return a |
| 171 // preferred size of (0, 0) when it's not visible. | 171 // preferred size of (0, 0) when it's not visible. |
| 172 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; } | 172 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; } |
| 173 bool collapse_when_hidden() const { return collapse_when_hidden_; } | 173 bool collapse_when_hidden() const { return collapse_when_hidden_; } |
| 174 | 174 |
| 175 // Overridden from View: | 175 // Overridden from View: |
| 176 virtual gfx::Insets GetInsets() const OVERRIDE; | 176 virtual gfx::Insets GetInsets() const OVERRIDE; |
| 177 virtual int GetBaseline() const OVERRIDE; | 177 virtual int GetBaseline() const OVERRIDE; |
| 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() const 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() const 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) const 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; | 188 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; |
| 189 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 189 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
| 190 // Gets the tooltip text for labels that are wider than their bounds, except | 190 // 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 | 191 // when the label is multiline, in which case it just returns false (no |
| 192 // tooltip). If a custom tooltip has been specified with SetTooltipText() | 192 // tooltip). If a custom tooltip has been specified with SetTooltipText() |
| 193 // it is returned instead. | 193 // it is returned instead. |
| 194 virtual bool GetTooltipText(const gfx::Point& p, | 194 virtual bool GetTooltipText(const gfx::Point& p, |
| 195 base::string16* tooltip) const OVERRIDE; | 195 base::string16* tooltip) const OVERRIDE; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 SkColor enabled_shadow_color_; | 290 SkColor enabled_shadow_color_; |
| 291 SkColor disabled_shadow_color_; | 291 SkColor disabled_shadow_color_; |
| 292 | 292 |
| 293 // Space between text and shadow. | 293 // Space between text and shadow. |
| 294 gfx::Point shadow_offset_; | 294 gfx::Point shadow_offset_; |
| 295 | 295 |
| 296 // Should a shadow be drawn behind the text? | 296 // Should a shadow be drawn behind the text? |
| 297 bool has_shadow_; | 297 bool has_shadow_; |
| 298 | 298 |
| 299 // The cached heights to avoid recalculation in GetHeightForWidth(). | 299 // The cached heights to avoid recalculation in GetHeightForWidth(). |
| 300 std::vector<gfx::Size> cached_heights_; | 300 mutable std::vector<gfx::Size> cached_heights_; |
| 301 int cached_heights_cursor_; | 301 mutable int cached_heights_cursor_; |
| 302 | 302 |
| 303 DISALLOW_COPY_AND_ASSIGN(Label); | 303 DISALLOW_COPY_AND_ASSIGN(Label); |
| 304 }; | 304 }; |
| 305 | 305 |
| 306 } // namespace views | 306 } // namespace views |
| 307 | 307 |
| 308 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 308 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
| OLD | NEW |