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

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

Issue 1817613002: MacViews: draw Mac combobox arrows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove PaintComboboxArrow Created 4 years, 8 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 "ui/base/resource/resource_bundle.h"
8 #include "ui/gfx/paint_vector_icon.h"
9 #include "ui/gfx/vector_icons.h"
10 #include "ui/resources/grit/ui_resources.h"
7 #include "ui/views/controls/button/label_button.h" 11 #include "ui/views/controls/button/label_button.h"
8 #include "ui/views/controls/button/label_button_border.h" 12 #include "ui/views/controls/button/label_button_border.h"
9 #include "ui/views/controls/focusable_rounded_border_mac.h" 13 #include "ui/views/controls/focusable_rounded_border_mac.h"
10 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h" 14 #import "ui/views/controls/scrollbar/cocoa_scroll_bar.h"
11 #include "ui/views/style/mac/combobox_background_mac.h" 15 #include "ui/views/style/mac/combobox_background_mac.h"
12 #include "ui/views/style/mac/dialog_button_border_mac.h" 16 #include "ui/views/style/mac/dialog_button_border_mac.h"
13 17
14 namespace views { 18 namespace views {
15 19
16 // static 20 // static
21 gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled,
22 Combobox::Style style) {
23 // TODO(ellyjones): IDR_MENU_DROPARROW is a cross-platform image that doesn't
24 // look right on Mac. See https://crbug.com/384071.
25 if (style == Combobox::STYLE_ACTION) {
26 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
27 return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW);
28 }
29 const int kComboboxArrowWidth = 13;
30 return gfx::CreateVectorIcon(gfx::VectorIconId::COMBOBOX_ARROW_MAC,
31 kComboboxArrowWidth,
32 is_enabled ? SK_ColorWHITE : SK_ColorBLACK);
33 }
34
35 // static
17 scoped_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() { 36 scoped_ptr<FocusableBorder> PlatformStyle::CreateComboboxBorder() {
18 return make_scoped_ptr(new FocusableRoundedBorder); 37 return make_scoped_ptr(new FocusableRoundedBorder);
19 } 38 }
20 39
21 // static 40 // static
22 scoped_ptr<Background> PlatformStyle::CreateComboboxBackground() { 41 scoped_ptr<Background> PlatformStyle::CreateComboboxBackground() {
23 return make_scoped_ptr(new ComboboxBackgroundMac); 42 return make_scoped_ptr(new ComboboxBackgroundMac);
24 } 43 }
25 44
26 // static 45 // static
27 scoped_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder( 46 scoped_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
28 Button::ButtonStyle style) { 47 Button::ButtonStyle style) {
29 if (style == Button::STYLE_BUTTON) 48 if (style == Button::STYLE_BUTTON)
30 return make_scoped_ptr(new DialogButtonBorderMac()); 49 return make_scoped_ptr(new DialogButtonBorderMac());
31 50
32 return make_scoped_ptr(new LabelButtonAssetBorder(style)); 51 return make_scoped_ptr(new LabelButtonAssetBorder(style));
33 } 52 }
34 53
35 // static 54 // static
36 scoped_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { 55 scoped_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
37 return make_scoped_ptr(new CocoaScrollBar(is_horizontal)); 56 return make_scoped_ptr(new CocoaScrollBar(is_horizontal));
38 } 57 }
39 58
40 } // namespace views 59 } // namespace views
OLDNEW
« ui/views/style/platform_style.cc ('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