| 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 "base/macros.h" | 8 #include "base/macros.h" | 
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" | 
| 10 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" | 
| 11 #include "ui/views/controls/combobox/combobox.h" | 11 #include "ui/views/controls/combobox/combobox.h" | 
|  | 12 #include "ui/views/views_export.h" | 
| 12 | 13 | 
| 13 namespace views { | 14 namespace views { | 
| 14 | 15 | 
| 15 class Border; | 16 class Border; | 
| 16 class FocusableBorder; | 17 class FocusableBorder; | 
|  | 18 class Label; | 
| 17 class LabelButton; | 19 class LabelButton; | 
| 18 class LabelButtonBorder; | 20 class LabelButtonBorder; | 
| 19 class ScrollBar; | 21 class ScrollBar; | 
| 20 | 22 | 
| 21 // Cross-platform API for providing platform-specific styling for toolkit-views. | 23 // Cross-platform API for providing platform-specific styling for toolkit-views. | 
| 22 class PlatformStyle { | 24 class VIEWS_EXPORT PlatformStyle { | 
| 23  public: | 25  public: | 
|  | 26   // Type used by LabelButton to map button states to text colors. | 
|  | 27   typedef SkColor ButtonColorByState[Button::STATE_COUNT]; | 
|  | 28 | 
|  | 29   // Minimum size for platform-styled buttons (Button::STYLE_BUTTON). | 
|  | 30   static const int kMinLabelButtonWidth; | 
|  | 31   static const int kMinLabelButtonHeight; | 
|  | 32 | 
|  | 33   // Whether dialog-default buttons are given a bold font style. | 
|  | 34   static const bool kDefaultLabelButtonHasBoldFont; | 
|  | 35 | 
| 24   // Creates an ImageSkia containing the image to use for the combobox arrow. | 36   // Creates an ImageSkia containing the image to use for the combobox arrow. | 
| 25   // The |is_enabled| argument is true if the control the arrow is for is | 37   // The |is_enabled| argument is true if the control the arrow is for is | 
| 26   // enabled, and false if the control is disabled. The |style| argument is the | 38   // enabled, and false if the control is disabled. The |style| argument is the | 
| 27   // style of the combobox the arrow is being drawn for. | 39   // style of the combobox the arrow is being drawn for. | 
| 28   static gfx::ImageSkia CreateComboboxArrow(bool is_enabled, | 40   static gfx::ImageSkia CreateComboboxArrow(bool is_enabled, | 
| 29                                             Combobox::Style style); | 41                                             Combobox::Style style); | 
| 30 | 42 | 
| 31   // Creates the appropriate border for a focusable Combobox. | 43   // Creates the appropriate border for a focusable Combobox. | 
| 32   static scoped_ptr<FocusableBorder> CreateComboboxBorder(); | 44   static scoped_ptr<FocusableBorder> CreateComboboxBorder(); | 
| 33 | 45 | 
| 34   // Creates the appropriate background for a Combobox. | 46   // Creates the appropriate background for a Combobox. | 
| 35   static scoped_ptr<Background> CreateComboboxBackground(); | 47   static scoped_ptr<Background> CreateComboboxBackground(); | 
| 36 | 48 | 
| 37   // Creates the default label button border for the given |style|. Used when a | 49   // Creates the default label button border for the given |style|. Used when a | 
| 38   // custom default border is not provided for a particular LabelButton class. | 50   // custom default border is not provided for a particular LabelButton class. | 
| 39   static scoped_ptr<LabelButtonBorder> CreateLabelButtonBorder( | 51   static scoped_ptr<LabelButtonBorder> CreateLabelButtonBorder( | 
| 40       Button::ButtonStyle style); | 52       Button::ButtonStyle style); | 
| 41 | 53 | 
|  | 54   // Creates the default scrollbar for the given orientation. | 
|  | 55   static scoped_ptr<ScrollBar> CreateScrollBar(bool is_horizontal); | 
|  | 56 | 
|  | 57   // Returns the current text color for the current button state. | 
|  | 58   static SkColor TextColorForButton(const ButtonColorByState& color_by_state, | 
|  | 59                                     const LabelButton& button); | 
|  | 60 | 
|  | 61   // 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   // Button::STYLE_BUTTON buttons differ from those provided by ui::NativeTheme. | 
|  | 64   static void ApplyLabelButtonTextStyle(Label* label, | 
|  | 65                                         ButtonColorByState* color_by_state); | 
|  | 66 | 
| 42   // Applies the current system theme to the default border created by |button|. | 67   // Applies the current system theme to the default border created by |button|. | 
| 43   static scoped_ptr<Border> CreateThemedLabelButtonBorder(LabelButton* button); | 68   static scoped_ptr<Border> CreateThemedLabelButtonBorder(LabelButton* button); | 
| 44 | 69 | 
| 45   // Creates the default scrollbar for the given orientation. |  | 
| 46   static scoped_ptr<ScrollBar> CreateScrollBar(bool is_horizontal); |  | 
| 47 |  | 
| 48  private: | 70  private: | 
| 49   DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformStyle); | 71   DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformStyle); | 
| 50 }; | 72 }; | 
| 51 | 73 | 
| 52 }  // namespace views | 74 }  // namespace views | 
| 53 | 75 | 
| 54 #endif  // UI_VIEWS_STYLE_PLATFORM_STYLE_H_ | 76 #endif  // UI_VIEWS_STYLE_PLATFORM_STYLE_H_ | 
| OLD | NEW | 
|---|