| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // trigger an automatic mapper that uses color_utils::GetReadableColor() to | 54 // trigger an automatic mapper that uses color_utils::GetReadableColor() to |
| 55 // ensure that the foreground colors are readable over the background color. | 55 // ensure that the foreground colors are readable over the background color. |
| 56 void SetAutoColorReadabilityEnabled(bool enabled); | 56 void SetAutoColorReadabilityEnabled(bool enabled); |
| 57 | 57 |
| 58 // Sets the color. This will automatically force the color to be readable | 58 // Sets the color. This will automatically force the color to be readable |
| 59 // over the current background color, if auto color readability is enabled. | 59 // over the current background color, if auto color readability is enabled. |
| 60 virtual void SetEnabledColor(SkColor color); | 60 virtual void SetEnabledColor(SkColor color); |
| 61 void SetDisabledColor(SkColor color); | 61 void SetDisabledColor(SkColor color); |
| 62 | 62 |
| 63 SkColor enabled_color() const { return actual_enabled_color_; } | 63 SkColor enabled_color() const { return actual_enabled_color_; } |
| 64 SkColor disabled_color() const { return actual_disabled_color_; } |
| 64 | 65 |
| 65 // Sets the background color. This won't be explicitly drawn, but the label | 66 // Sets the background color. This won't be explicitly drawn, but the label |
| 66 // will force the text color to be readable over it. | 67 // will force the text color to be readable over it. |
| 67 void SetBackgroundColor(SkColor color); | 68 void SetBackgroundColor(SkColor color); |
| 68 SkColor background_color() const { return background_color_; } | 69 SkColor background_color() const { return background_color_; } |
| 69 | 70 |
| 70 // Sets the selection text color. This will automatically force the color to | 71 // Sets the selection text color. This will automatically force the color to |
| 71 // be readable over the selection background color, if auto color readability | 72 // be readable over the selection background color, if auto color readability |
| 72 // is enabled. Initialized with system default. | 73 // is enabled. Initialized with system default. |
| 73 void SetSelectionTextColor(SkColor color); | 74 void SetSelectionTextColor(SkColor color); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 protected: | 197 protected: |
| 197 // Create a single RenderText instance to actually be painted. | 198 // Create a single RenderText instance to actually be painted. |
| 198 virtual std::unique_ptr<gfx::RenderText> CreateRenderText( | 199 virtual std::unique_ptr<gfx::RenderText> CreateRenderText( |
| 199 const base::string16& text, | 200 const base::string16& text, |
| 200 gfx::HorizontalAlignment alignment, | 201 gfx::HorizontalAlignment alignment, |
| 201 gfx::DirectionalityMode directionality, | 202 gfx::DirectionalityMode directionality, |
| 202 gfx::ElideBehavior elide_behavior) const; | 203 gfx::ElideBehavior elide_behavior) const; |
| 203 | 204 |
| 204 void PaintText(gfx::Canvas* canvas); | 205 void PaintText(gfx::Canvas* canvas); |
| 205 | 206 |
| 206 SkColor disabled_color() const { return actual_disabled_color_; } | |
| 207 | |
| 208 // View: | 207 // View: |
| 209 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 208 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| 210 void VisibilityChanged(View* starting_from, bool is_visible) override; | 209 void VisibilityChanged(View* starting_from, bool is_visible) override; |
| 211 void OnPaint(gfx::Canvas* canvas) override; | 210 void OnPaint(gfx::Canvas* canvas) override; |
| 212 void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 211 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
| 213 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 212 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 214 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; | 213 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; |
| 215 void OnFocus() override; | 214 void OnFocus() override; |
| 216 void OnBlur() override; | 215 void OnBlur() override; |
| 217 bool OnMousePressed(const ui::MouseEvent& event) override; | 216 bool OnMousePressed(const ui::MouseEvent& event) override; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // Context menu related members. | 350 // Context menu related members. |
| 352 ui::SimpleMenuModel context_menu_contents_; | 351 ui::SimpleMenuModel context_menu_contents_; |
| 353 std::unique_ptr<views::MenuRunner> context_menu_runner_; | 352 std::unique_ptr<views::MenuRunner> context_menu_runner_; |
| 354 | 353 |
| 355 DISALLOW_COPY_AND_ASSIGN(Label); | 354 DISALLOW_COPY_AND_ASSIGN(Label); |
| 356 }; | 355 }; |
| 357 | 356 |
| 358 } // namespace views | 357 } // namespace views |
| 359 | 358 |
| 360 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 359 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
| OLD | NEW |