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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 const char* GetClassName() const override; | 130 const char* GetClassName() const override; |
131 View* GetTooltipHandlerForPoint(const gfx::Point& point) override; | 131 View* GetTooltipHandlerForPoint(const gfx::Point& point) override; |
132 bool CanProcessEventsWithinSubtree() const override; | 132 bool CanProcessEventsWithinSubtree() const override; |
133 void GetAccessibleState(ui::AXViewState* state) override; | 133 void GetAccessibleState(ui::AXViewState* state) override; |
134 bool GetTooltipText(const gfx::Point& p, | 134 bool GetTooltipText(const gfx::Point& p, |
135 base::string16* tooltip) const override; | 135 base::string16* tooltip) const override; |
136 void OnEnabledChanged() override; | 136 void OnEnabledChanged() override; |
137 | 137 |
138 protected: | 138 protected: |
139 // Create a single RenderText instance to actually be painted. | 139 // Create a single RenderText instance to actually be painted. |
140 virtual scoped_ptr<gfx::RenderText> CreateRenderText( | 140 virtual std::unique_ptr<gfx::RenderText> CreateRenderText( |
141 const base::string16& text, | 141 const base::string16& text, |
142 gfx::HorizontalAlignment alignment, | 142 gfx::HorizontalAlignment alignment, |
143 gfx::DirectionalityMode directionality, | 143 gfx::DirectionalityMode directionality, |
144 gfx::ElideBehavior elide_behavior); | 144 gfx::ElideBehavior elide_behavior); |
145 | 145 |
146 void PaintText(gfx::Canvas* canvas); | 146 void PaintText(gfx::Canvas* canvas); |
147 | 147 |
148 SkColor disabled_color() const { return actual_disabled_color_; } | 148 SkColor disabled_color() const { return actual_disabled_color_; } |
149 | 149 |
150 // View: | 150 // View: |
(...skipping 26 matching lines...) Expand all Loading... |
177 gfx::Size GetTextSize() const; | 177 gfx::Size GetTextSize() const; |
178 | 178 |
179 void RecalculateColors(); | 179 void RecalculateColors(); |
180 | 180 |
181 // Updates any colors that have not been explicitly set from the theme. | 181 // Updates any colors that have not been explicitly set from the theme. |
182 void UpdateColorsFromTheme(const ui::NativeTheme* theme); | 182 void UpdateColorsFromTheme(const ui::NativeTheme* theme); |
183 | 183 |
184 bool ShouldShowDefaultTooltip() const; | 184 bool ShouldShowDefaultTooltip() const; |
185 | 185 |
186 // An un-elided and single-line RenderText object used for preferred sizing. | 186 // An un-elided and single-line RenderText object used for preferred sizing. |
187 scoped_ptr<gfx::RenderText> render_text_; | 187 std::unique_ptr<gfx::RenderText> render_text_; |
188 | 188 |
189 // The RenderText instances used to display elided and multi-line text. | 189 // The RenderText instances used to display elided and multi-line text. |
190 std::vector<scoped_ptr<gfx::RenderText>> lines_; | 190 std::vector<std::unique_ptr<gfx::RenderText>> lines_; |
191 | 191 |
192 SkColor requested_enabled_color_; | 192 SkColor requested_enabled_color_; |
193 SkColor actual_enabled_color_; | 193 SkColor actual_enabled_color_; |
194 SkColor requested_disabled_color_; | 194 SkColor requested_disabled_color_; |
195 SkColor actual_disabled_color_; | 195 SkColor actual_disabled_color_; |
196 SkColor background_color_; | 196 SkColor background_color_; |
197 | 197 |
198 // Set to true once the corresponding setter is invoked. | 198 // Set to true once the corresponding setter is invoked. |
199 bool enabled_color_set_; | 199 bool enabled_color_set_; |
200 bool disabled_color_set_; | 200 bool disabled_color_set_; |
(...skipping 14 matching lines...) Expand all Loading... |
215 // TODO(ckocagil): Remove is_first_paint_text_ before crbug.com/441028 is | 215 // TODO(ckocagil): Remove is_first_paint_text_ before crbug.com/441028 is |
216 // closed. | 216 // closed. |
217 bool is_first_paint_text_; | 217 bool is_first_paint_text_; |
218 | 218 |
219 DISALLOW_COPY_AND_ASSIGN(Label); | 219 DISALLOW_COPY_AND_ASSIGN(Label); |
220 }; | 220 }; |
221 | 221 |
222 } // namespace views | 222 } // namespace views |
223 | 223 |
224 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 224 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
OLD | NEW |