| 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 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 | 14 |
| 15 class Border; | 15 class Border; |
| 16 class FocusableBorder; | 16 class FocusableBorder; |
| 17 class LabelButton; | 17 class LabelButton; |
| 18 class LabelButtonBorder; | 18 class LabelButtonBorder; |
| 19 class ScrollBar; | 19 class ScrollBar; |
| 20 | 20 |
| 21 // Cross-platform API for providing platform-specific styling for toolkit-views. | 21 // Cross-platform API for providing platform-specific styling for toolkit-views. |
| 22 class PlatformStyle { | 22 class VIEWS_EXPORT PlatformStyle { |
| 23 public: | 23 public: |
| 24 enum class CONTROL { |
| 25 BUTTON, |
| 26 COMBOBOX, |
| 27 LINK, |
| 28 ICON, |
| 29 SCROLLBAR_VIEW, |
| 30 SEPARATOR, |
| 31 SLIDER, |
| 32 TREE_VIEW, |
| 33 TEXTFIELD, |
| 34 TABLE_VIEW, |
| 35 TABBED_PANE, |
| 36 IN_MENU_BUTTON, // To be used for buttons in Menus. |
| 37 WEBVIEW, |
| 38 COLOR_CHOOSER_VIEW, |
| 39 CREDENTIALS_ITEM_VIEW, |
| 40 DESKTOP_MEDIA_SOURCE_VIEW, |
| 41 DESKTOP_MEDIA_LIST_VIEW, |
| 42 TOOLBAR_BUTTON, |
| 43 }; |
| 44 |
| 24 // Creates an ImageSkia containing the image to use for the combobox arrow. | 45 // 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 | 46 // 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 | 47 // enabled, and false if the control is disabled. The |style| argument is the |
| 27 // style of the combobox the arrow is being drawn for. | 48 // style of the combobox the arrow is being drawn for. |
| 28 static gfx::ImageSkia CreateComboboxArrow(bool is_enabled, | 49 static gfx::ImageSkia CreateComboboxArrow(bool is_enabled, |
| 29 Combobox::Style style); | 50 Combobox::Style style); |
| 30 | 51 |
| 31 // Creates the appropriate border for a focusable Combobox. | 52 // Creates the appropriate border for a focusable Combobox. |
| 32 static scoped_ptr<FocusableBorder> CreateComboboxBorder(); | 53 static scoped_ptr<FocusableBorder> CreateComboboxBorder(); |
| 33 | 54 |
| 34 // Creates the appropriate background for a Combobox. | 55 // Creates the appropriate background for a Combobox. |
| 35 static scoped_ptr<Background> CreateComboboxBackground(); | 56 static scoped_ptr<Background> CreateComboboxBackground(); |
| 36 | 57 |
| 37 // Creates the default label button border for the given |style|. Used when a | 58 // 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. | 59 // custom default border is not provided for a particular LabelButton class. |
| 39 static scoped_ptr<LabelButtonBorder> CreateLabelButtonBorder( | 60 static scoped_ptr<LabelButtonBorder> CreateLabelButtonBorder( |
| 40 Button::ButtonStyle style); | 61 Button::ButtonStyle style); |
| 41 | 62 |
| 42 // Applies the current system theme to the default border created by |button|. | 63 // Applies the current system theme to the default border created by |button|. |
| 43 static scoped_ptr<Border> CreateThemedLabelButtonBorder(LabelButton* button); | 64 static scoped_ptr<Border> CreateThemedLabelButtonBorder(LabelButton* button); |
| 44 | 65 |
| 45 // Creates the default scrollbar for the given orientation. | 66 // Creates the default scrollbar for the given orientation. |
| 46 static scoped_ptr<ScrollBar> CreateScrollBar(bool is_horizontal); | 67 static scoped_ptr<ScrollBar> CreateScrollBar(bool is_horizontal); |
| 47 | 68 |
| 69 // Sets the correct focusability setting on |view| based on the |control| |
| 70 // type. |
| 71 static void ConfigureFocus(CONTROL control, View* view); |
| 72 |
| 48 private: | 73 private: |
| 49 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformStyle); | 74 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformStyle); |
| 50 }; | 75 }; |
| 51 | 76 |
| 52 } // namespace views | 77 } // namespace views |
| 53 | 78 |
| 54 #endif // UI_VIEWS_STYLE_PLATFORM_STYLE_H_ | 79 #endif // UI_VIEWS_STYLE_PLATFORM_STYLE_H_ |
| OLD | NEW |