From 1b99e55e916e98c5703117f744ed215eb1aa7ce7 Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Sat, 20 Dec 2014 17:08:26 +0530 Subject: [PATCH] Improve combobox styling --- gtk-3.0/scss/widgets/_button.scss | 57 +++++++++++++++++++++++++++++++ gtk-3.0/scss/widgets/_entry.scss | 37 -------------------- 2 files changed, 57 insertions(+), 37 deletions(-) diff --git a/gtk-3.0/scss/widgets/_button.scss b/gtk-3.0/scss/widgets/_button.scss index 1b353b4..9310af9 100755 --- a/gtk-3.0/scss/widgets/_button.scss +++ b/gtk-3.0/scss/widgets/_button.scss @@ -15,6 +15,18 @@ -GtkWidget-focus-line-width: 0; } + %linked_middle { + border-radius: 0; + border-left-style: none; + border-right-style: solid; + + &:dir(rtl) { + border-radius: 0; // needed when including %linked_middle:dir(rtl) + border-right-style: none; + border-left-style: solid + } + } + %linked_button { border-width: 1px; border-style: solid; @@ -266,3 +278,48 @@ } } } + + +/****************** +! ComboBoxes * +*******************/ + +@include exports("combobox") { + GtkComboBox { + > .button { + padding: ($spacing - 2px) ($spacing + 1px); + + -GtkComboBox-arrow-scaling: 0.5; + -GtkComboBox-shadow-type: none; + } + + &.combobox-entry { + .entry, .button { @extend %linked_button; } + } + + .separator { + /* always disable separators */ + -GtkWidget-wide-separators: true; + -GtkWidget-horizontal-separator: 0; + -GtkWidget-vertical-separator: 0; + + border-style: none; + } + } + + .linked > GtkComboBox { + > .button { + // the combo is a composite widget so the way we do button linked doesn't + // work, special case needed. See + // https://bugzilla.gnome.org/show_bug.cgi?id=733979 + &:dir(ltr) { @extend %linked_middle; } // specificity bump + &:dir(rtl) { @extend %linked_middle:dir(rtl); } + } + + &:first-child > .button { @extend %linked_button:first-child; } + + &:last-child > .button { @extend %linked_button:last-child; } + + &:only-child > .button { @extend %linked_button:only-child; } + } +} diff --git a/gtk-3.0/scss/widgets/_entry.scss b/gtk-3.0/scss/widgets/_entry.scss index b3c4264..0015dee 100755 --- a/gtk-3.0/scss/widgets/_entry.scss +++ b/gtk-3.0/scss/widgets/_entry.scss @@ -76,40 +76,3 @@ &.linked, .linked & { @extend %linked_entry; } } } - - -/****************** - ! Combobox entry * -*******************/ - -@include exports("combobox") { - GtkComboBox { - &.combobox-entry { - .entry { - &, &:hover, &:focus, &:active, &:insensitive { - border-width: 1px 0 1px 1px; - border-top-right-radius: 0; - border-bottom-right-radius: 0; - } - } - - .button { - &, &:hover, &:focus, &:active, &:insensitive { - border-width: 1px 1px 1px 1px; - border-bottom-left-radius: 0; - border-top-left-radius: 0; - } - } - } - - .separator { - /* always disable separators */ - -GtkWidget-wide-separators: true; - -GtkWidget-horizontal-separator: 0; - -GtkWidget-vertical-separator: 0; - - border-style: none; - } - } -} -