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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // wrapped). If 0, no maximum width is enforced. | 113 // wrapped). If 0, no maximum width is enforced. |
114 void SizeToFit(int max_width); | 114 void SizeToFit(int max_width); |
115 | 115 |
116 // Sets whether the preferred size is empty when the label is not visible. | 116 // Sets whether the preferred size is empty when the label is not visible. |
117 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; } | 117 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; } |
118 | 118 |
119 // Get the text as displayed to the user, respecting the obscured flag. | 119 // Get the text as displayed to the user, respecting the obscured flag. |
120 const base::string16& GetLayoutTextForTesting() const; | 120 const base::string16& GetLayoutTextForTesting() const; |
121 | 121 |
122 // View: | 122 // View: |
123 virtual gfx::Insets GetInsets() const OVERRIDE; | 123 virtual gfx::Insets GetInsets() const override; |
124 virtual int GetBaseline() const OVERRIDE; | 124 virtual int GetBaseline() const override; |
125 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 125 virtual gfx::Size GetPreferredSize() const override; |
126 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 126 virtual gfx::Size GetMinimumSize() const override; |
127 virtual int GetHeightForWidth(int w) const OVERRIDE; | 127 virtual int GetHeightForWidth(int w) const override; |
128 virtual const char* GetClassName() const OVERRIDE; | 128 virtual const char* GetClassName() const override; |
129 virtual View* GetTooltipHandlerForPoint(const gfx::Point& point) OVERRIDE; | 129 virtual View* GetTooltipHandlerForPoint(const gfx::Point& point) override; |
130 virtual bool CanProcessEventsWithinSubtree() const OVERRIDE; | 130 virtual bool CanProcessEventsWithinSubtree() const override; |
131 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 131 virtual void GetAccessibleState(ui::AXViewState* state) override; |
132 virtual bool GetTooltipText(const gfx::Point& p, | 132 virtual bool GetTooltipText(const gfx::Point& p, |
133 base::string16* tooltip) const OVERRIDE; | 133 base::string16* tooltip) const override; |
134 | 134 |
135 protected: | 135 protected: |
136 // Called by Paint to paint the text. | 136 // Called by Paint to paint the text. |
137 void PaintText(gfx::Canvas* canvas, | 137 void PaintText(gfx::Canvas* canvas, |
138 const base::string16& text, | 138 const base::string16& text, |
139 const gfx::Rect& text_bounds, | 139 const gfx::Rect& text_bounds, |
140 int flags); | 140 int flags); |
141 | 141 |
142 virtual gfx::Size GetTextSize() const; | 142 virtual gfx::Size GetTextSize() const; |
143 | 143 |
144 SkColor disabled_color() const { return actual_disabled_color_; } | 144 SkColor disabled_color() const { return actual_disabled_color_; } |
145 | 145 |
146 // View: | 146 // View: |
147 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 147 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
148 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 148 virtual void OnPaint(gfx::Canvas* canvas) override; |
149 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; | 149 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
150 | 150 |
151 private: | 151 private: |
152 // These tests call CalculateDrawStringParams in order to verify the | 152 // These tests call CalculateDrawStringParams in order to verify the |
153 // calculations done for drawing text. | 153 // calculations done for drawing text. |
154 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineString); | 154 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineString); |
155 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineString); | 155 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineString); |
156 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineStringInRTL); | 156 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineStringInRTL); |
157 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineStringInRTL); | 157 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineStringInRTL); |
158 FRIEND_TEST_ALL_PREFIXES(LabelTest, DirectionalityFromText); | 158 FRIEND_TEST_ALL_PREFIXES(LabelTest, DirectionalityFromText); |
159 FRIEND_TEST_ALL_PREFIXES(LabelTest, DisableSubpixelRendering); | 159 FRIEND_TEST_ALL_PREFIXES(LabelTest, DisableSubpixelRendering); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // The cached heights to avoid recalculation in GetHeightForWidth(). | 220 // The cached heights to avoid recalculation in GetHeightForWidth(). |
221 mutable std::vector<gfx::Size> cached_heights_; | 221 mutable std::vector<gfx::Size> cached_heights_; |
222 mutable int cached_heights_cursor_; | 222 mutable int cached_heights_cursor_; |
223 | 223 |
224 DISALLOW_COPY_AND_ASSIGN(Label); | 224 DISALLOW_COPY_AND_ASSIGN(Label); |
225 }; | 225 }; |
226 | 226 |
227 } // namespace views | 227 } // namespace views |
228 | 228 |
229 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 229 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
OLD | NEW |