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

Unified Diff: ui/views/controls/combobox/combobox.cc

Issue 1819443002: MacViews: draw combobox arrow backgrounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix linux build Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/combobox/combobox.cc
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc
index 382c6db3ce101d65d28c70c697fb281a6a0fe20c..88cd6efcd828144ff173e548ec2d958d3ce94dbf 100644
--- a/ui/views/controls/combobox/combobox.cc
+++ b/ui/views/controls/combobox/combobox.cc
@@ -27,6 +27,7 @@
#include "ui/native_theme/native_theme.h"
#include "ui/native_theme/native_theme_aura.h"
#include "ui/resources/grit/ui_resources.h"
+#include "ui/views/background.h"
#include "ui/views/controls/button/custom_button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/combobox/combobox_listener.h"
@@ -354,6 +355,9 @@ Combobox::Combobox(ui::ComboboxModel* model)
ModelChanged();
SetFocusable(true);
UpdateBorder();
+ // set_background() takes ownership but takes a raw pointer.
+ scoped_ptr<Background> b = PlatformStyle::CreateComboboxBackground();
+ set_background(b.release());
// Initialize the button images.
Button::ButtonState button_states[] = {
@@ -457,6 +461,12 @@ void Combobox::SetInvalid(bool invalid) {
SchedulePaint();
}
+int Combobox::GetArrowButtonWidth() const {
+ return GetDisclosureArrowLeftPadding() +
+ ArrowSize().width() +
+ GetDisclosureArrowRightPadding();
+}
+
void Combobox::Layout() {
PrefixDelegate::Layout();
@@ -713,7 +723,8 @@ void Combobox::PaintText(gfx::Canvas* canvas) {
int y = insets.top();
int text_height = height() - insets.height();
SkColor text_color = GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_LabelEnabledColor);
+ enabled() ? ui::NativeTheme::kColorId_LabelEnabledColor :
+ ui::NativeTheme::kColorId_LabelDisabledColor);
DCHECK_GE(selected_index_, 0);
DCHECK_LT(selected_index_, model()->GetItemCount());

Powered by Google App Engine
This is Rietveld 408576698