| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_STYLE_PLATFORM_STYLE_H_ | 5 #ifndef UI_VIEWS_STYLE_PLATFORM_STYLE_H_ |
| 6 #define UI_VIEWS_STYLE_PLATFORM_STYLE_H_ | 6 #define UI_VIEWS_STYLE_PLATFORM_STYLE_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "ui/views/controls/button/button.h" | 11 #include "ui/views/controls/button/button.h" |
| 11 #include "ui/views/controls/combobox/combobox.h" | 12 #include "ui/views/controls/combobox/combobox.h" |
| 12 #include "ui/views/views_export.h" | 13 #include "ui/views/views_export.h" |
| 13 | 14 |
| 14 namespace views { | 15 namespace views { |
| 15 | 16 |
| 16 class Border; | 17 class Border; |
| 17 class FocusableBorder; | 18 class FocusableBorder; |
| 18 class Label; | 19 class Label; |
| 19 class LabelButton; | 20 class LabelButton; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 static const bool kDefaultLabelButtonHasBoldFont; | 35 static const bool kDefaultLabelButtonHasBoldFont; |
| 35 | 36 |
| 36 // Creates an ImageSkia containing the image to use for the combobox arrow. | 37 // Creates an ImageSkia containing the image to use for the combobox arrow. |
| 37 // The |is_enabled| argument is true if the control the arrow is for is | 38 // The |is_enabled| argument is true if the control the arrow is for is |
| 38 // enabled, and false if the control is disabled. The |style| argument is the | 39 // enabled, and false if the control is disabled. The |style| argument is the |
| 39 // style of the combobox the arrow is being drawn for. | 40 // style of the combobox the arrow is being drawn for. |
| 40 static gfx::ImageSkia CreateComboboxArrow(bool is_enabled, | 41 static gfx::ImageSkia CreateComboboxArrow(bool is_enabled, |
| 41 Combobox::Style style); | 42 Combobox::Style style); |
| 42 | 43 |
| 43 // Creates the appropriate border for a focusable Combobox. | 44 // Creates the appropriate border for a focusable Combobox. |
| 44 static scoped_ptr<FocusableBorder> CreateComboboxBorder(); | 45 static std::unique_ptr<FocusableBorder> CreateComboboxBorder(); |
| 45 | 46 |
| 46 // Creates the appropriate background for a Combobox. | 47 // Creates the appropriate background for a Combobox. |
| 47 static scoped_ptr<Background> CreateComboboxBackground(); | 48 static std::unique_ptr<Background> CreateComboboxBackground(); |
| 48 | 49 |
| 49 // Creates the default label button border for the given |style|. Used when a | 50 // Creates the default label button border for the given |style|. Used when a |
| 50 // custom default border is not provided for a particular LabelButton class. | 51 // custom default border is not provided for a particular LabelButton class. |
| 51 static scoped_ptr<LabelButtonBorder> CreateLabelButtonBorder( | 52 static std::unique_ptr<LabelButtonBorder> CreateLabelButtonBorder( |
| 52 Button::ButtonStyle style); | 53 Button::ButtonStyle style); |
| 53 | 54 |
| 54 // Creates the default scrollbar for the given orientation. | 55 // Creates the default scrollbar for the given orientation. |
| 55 static scoped_ptr<ScrollBar> CreateScrollBar(bool is_horizontal); | 56 static std::unique_ptr<ScrollBar> CreateScrollBar(bool is_horizontal); |
| 56 | 57 |
| 57 // Returns the current text color for the current button state. | 58 // Returns the current text color for the current button state. |
| 58 static SkColor TextColorForButton(const ButtonColorByState& color_by_state, | 59 static SkColor TextColorForButton(const ButtonColorByState& color_by_state, |
| 59 const LabelButton& button); | 60 const LabelButton& button); |
| 60 | 61 |
| 61 // Applies platform styles to |label| and fills |color_by_state| with the text | 62 // Applies platform styles to |label| and fills |color_by_state| with the text |
| 62 // colors for normal, pressed, hovered, and disabled states, if the colors for | 63 // colors for normal, pressed, hovered, and disabled states, if the colors for |
| 63 // Button::STYLE_BUTTON buttons differ from those provided by ui::NativeTheme. | 64 // Button::STYLE_BUTTON buttons differ from those provided by ui::NativeTheme. |
| 64 static void ApplyLabelButtonTextStyle(Label* label, | 65 static void ApplyLabelButtonTextStyle(Label* label, |
| 65 ButtonColorByState* color_by_state); | 66 ButtonColorByState* color_by_state); |
| 66 | 67 |
| 67 // Applies the current system theme to the default border created by |button|. | 68 // Applies the current system theme to the default border created by |button|. |
| 68 static scoped_ptr<Border> CreateThemedLabelButtonBorder(LabelButton* button); | 69 static std::unique_ptr<Border> CreateThemedLabelButtonBorder( |
| 70 LabelButton* button); |
| 69 | 71 |
| 70 private: | 72 private: |
| 71 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformStyle); | 73 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformStyle); |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 } // namespace views | 76 } // namespace views |
| 75 | 77 |
| 76 #endif // UI_VIEWS_STYLE_PLATFORM_STYLE_H_ | 78 #endif // UI_VIEWS_STYLE_PLATFORM_STYLE_H_ |
| OLD | NEW |