Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: ui/views/style/platform_style_mac.mm

Issue 1904753002: MenuButton: support Mac look & feel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add basic tests Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "ui/views/style/platform_style.h" 5 #include "ui/views/style/platform_style.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/gfx/paint_vector_icon.h" 9 #include "ui/gfx/paint_vector_icon.h"
10 #include "ui/gfx/vector_icons.h" 10 #include "ui/gfx/vector_icons.h"
(...skipping 21 matching lines...) Expand all
32 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 32 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
33 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW); 33 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW);
34 } 34 }
35 const int kComboboxArrowWidth = 13; 35 const int kComboboxArrowWidth = 13;
36 return gfx::CreateVectorIcon(gfx::VectorIconId::COMBOBOX_ARROW_MAC, 36 return gfx::CreateVectorIcon(gfx::VectorIconId::COMBOBOX_ARROW_MAC,
37 kComboboxArrowWidth, 37 kComboboxArrowWidth,
38 is_enabled ? SK_ColorWHITE : SK_ColorBLACK); 38 is_enabled ? SK_ColorWHITE : SK_ColorBLACK);
39 } 39 }
40 40
41 // static 41 // static
42 gfx::ImageSkia PlatformStyle::CreateMenuButtonArrow(bool is_enabled) {
43 const int kMenuButtonArrowWidth = 13;
44 return gfx::CreateVectorIcon(gfx::VectorIconId::MENU_BUTTON_ARROW_MAC,
45 kMenuButtonArrowWidth,
46 is_enabled ? SK_ColorWHITE : SK_ColorBLACK);
47 }
48
49 // static
42 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() { 50 std::unique_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() {
43 return base::WrapUnique(new FocusableRoundedBorder); 51 return base::WrapUnique(new FocusableRoundedBorder);
44 } 52 }
45 53
46 // static 54 // static
47 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground() { 55 std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground(
48 return base::WrapUnique(new ComboboxBackgroundMac); 56 int shoulder_width) {
57 return base::WrapUnique(new ComboboxBackgroundMac(shoulder_width));
49 } 58 }
50 59
51 // static 60 // static
61 std::unique_ptr<FocusableBorder> PlatformStyle::CreateMenuButtonBorder() {
62 return base::WrapUnique(new FocusableRoundedBorder);
63 }
64
65 // static
66 std::unique_ptr<Background> PlatformStyle::CreateMenuButtonBackground(
67 int shoulder_width) {
68 return base::WrapUnique(new ComboboxBackgroundMac(shoulder_width));
69 }
70
71 // static
52 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder( 72 std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
53 Button::ButtonStyle style) { 73 Button::ButtonStyle style) {
54 if (style == Button::STYLE_BUTTON) 74 if (style == Button::STYLE_BUTTON)
55 return base::WrapUnique(new DialogButtonBorderMac()); 75 return base::WrapUnique(new DialogButtonBorderMac());
56 76
57 return base::WrapUnique(new LabelButtonAssetBorder(style)); 77 return base::WrapUnique(new LabelButtonAssetBorder(style));
58 } 78 }
59 79
60 // static 80 // static
61 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { 81 std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
(...skipping 18 matching lines...) Expand all
80 void PlatformStyle::ApplyLabelButtonTextStyle( 100 void PlatformStyle::ApplyLabelButtonTextStyle(
81 views::Label* label, 101 views::Label* label,
82 ButtonColorByState* color_by_state) { 102 ButtonColorByState* color_by_state) {
83 const ui::NativeTheme* theme = label->GetNativeTheme(); 103 const ui::NativeTheme* theme = label->GetNativeTheme();
84 ButtonColorByState& colors = *color_by_state; 104 ButtonColorByState& colors = *color_by_state;
85 colors[Button::STATE_PRESSED] = 105 colors[Button::STATE_PRESSED] =
86 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonHighlightColor); 106 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonHighlightColor);
87 } 107 }
88 108
89 } // namespace views 109 } // namespace views
OLDNEW
« ui/views/style/mac/combobox_background_mac.h ('K') | « ui/views/style/platform_style.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698