Fix linked button issues

pull/224/head
Satyajit Sahoo 2014-12-13 19:47:53 +05:30
parent fd2a390954
commit 1bd02efcda
5 changed files with 70 additions and 48 deletions

View File

@ -125,8 +125,3 @@ GtkLabel {
&:insensitive { color: mix($fg_color, $bg_color, 0.50); } &:insensitive { color: mix($fg_color, $bg_color, 0.50); }
} }
.dim-label {
opacity: 0.5;
text-shadow: none;
}

View File

@ -6,13 +6,33 @@
! Buttons ! Buttons
**********/ **********/
@mixin linked_button($bg, $shadow) { %button {
border: 1px solid border_normal($bg); padding: ($spacing - 1px) ($spacing + 1px);
border-width: 1px;
border-style: solid;
border-radius: $roundness;
transition: 100ms ease;
-GtkWidget-focus-padding: 1;
-GtkWidget-focus-line-width: 0;
&.flat {
color: inherit;
border: none;
background-color: transparent;
background-image: none;
box-shadow: none;
}
&.separator, .separator { border: 1px solid currentColor; }
}
%linked_button {
border-width: 1px;
border-style: solid;
border-radius: 0; border-radius: 0;
border-right-style: none; border-right-style: none;
border-left-style: none; border-left-style: none;
box-shadow: inset -1px 0 border_normal($bg),
0 1px 2px -1px alpha($shadow, .3);
&:first-child { &:first-child {
border-width: 1px; border-width: 1px;
@ -42,14 +62,22 @@
} }
} }
&:only-child { &:only-child, &:first-child:only-child {
border-width: 1px; border-width: 1px;
border-style: solid;
border-radius: $roundness; border-radius: $roundness;
} }
}
@mixin linked_button($bg) {
@extend %linked_button;
box-shadow: inset -1px 0 border_normal($bg),
0 1px 2px -1px alpha($dark_shadow, .3);
&:focus, &:hover { &:focus, &:hover {
box-shadow: inset -1px 0 border_focus($bg), box-shadow: inset -1px 0 border_focus($bg),
0 1px 2px -1px alpha($shadow, .3); 0 1px 2px -1px alpha($dark_shadow, .3);
} }
&:active, &:active:hover, &:active, &:active:hover,
@ -57,9 +85,9 @@
&:checked, &:checked:hover, &:checked, &:checked:hover,
&:checked:focus, &:checked:hover:focus { &:checked:focus, &:checked:hover:focus {
box-shadow: inset -1px 0 border_active($bg), box-shadow: inset -1px 0 border_active($bg),
inset 1px 0 alpha($shadow, .07), inset 1px 0 alpha($dark_shadow, .07),
inset 0 1px alpha($shadow, .08), inset 0 1px alpha($dark_shadow, .08),
inset 0 -1px alpha($shadow, .05); inset 0 -1px alpha($dark_shadow, .05);
} }
&:insensitive { box-shadow: inset -1px 0 border_insensitive($bg); } &:insensitive { box-shadow: inset -1px 0 border_insensitive($bg); }
@ -70,37 +98,39 @@
&:checked:insensitive:last-child, &:checked:insensitive:only-child { box-shadow: none; } &:checked:insensitive:last-child, &:checked:insensitive:only-child { box-shadow: none; }
&:active:last-child, &:active:only-child, &:active:last-child, &:active:only-child,
&:checked:last-child, &:checked:only-child { &:active:last-child:focus, &:active:only-child:focus,
box-shadow: inset 1px 0 alpha($shadow, .07), &:active:last-child:hover, &:active:only-child:hover,
inset 0 1px alpha($shadow, .08), &:active:last-child:hover:focus, &:active:only-child:hover:focus,
inset -1px 0 alpha($shadow, .07); &:checked:last-child, &:checked:only-child,
&:checked:last-child:focus, &:checked:only-child:focus,
&:checked:last-child:hover, &:checked:only-child:hover,
&:checked:last-child:hover:focus, &:checked:only-child:hover:focus {
box-shadow: inset 1px 0 alpha($dark_shadow, .07),
inset 0 1px alpha($dark_shadow, .08),
inset -1px 0 alpha($dark_shadow, .07);
} }
} }
@mixin button($bg, $fg) { @mixin button($bg, $fg) {
@include linear-gradient(shade($bg, 1.05)); @include linear-gradient(shade($bg, 1.05));
@include border(shade($bg, 1.05)); @include border(shade($bg, 1.05));
@extend %button;
padding: ($spacing - 1px) ($spacing + 1px); border-color: border_normal($bg);
border-width: 1px;
border-radius: $roundness;
border-style: solid;
color: $fg; color: $fg;
transition: 100ms ease;
box-shadow: 0 1px 2px -1px alpha($dark_shadow, .3); box-shadow: 0 1px 2px -1px alpha($dark_shadow, .3);
-GtkWidget-focus-padding: 1;
-GtkWidget-focus-line-width: 0;
&:focus, &:hover { &:focus, &:hover {
@include linear-gradient(shade($bg, 1.1)); @include linear-gradient(shade($bg, 1.1));
border-color: border_focus($bg);
box-shadow: 0 1px 3px -1px alpha($dark_shadow, .5); box-shadow: 0 1px 3px -1px alpha($dark_shadow, .5);
} }
&:checked, &:active { &:checked, &:active {
@include linear-gradient(shade($bg, .95)); @include linear-gradient(shade($bg, .95));
border-color: border_active($bg);
box-shadow: inset 1px 0 alpha($dark_shadow, .07), box-shadow: inset 1px 0 alpha($dark_shadow, .07),
inset 0 1px alpha($dark_shadow, .08), inset 0 1px alpha($dark_shadow, .08),
inset -1px 0 alpha($dark_shadow, .07), inset -1px 0 alpha($dark_shadow, .07),
@ -110,6 +140,7 @@
&:insensitive { &:insensitive {
@include linear-gradient(shade($bg, .95)); @include linear-gradient(shade($bg, .95));
border-color: border_insensitive($bg);
color: mix($bg, $fg, .5); color: mix($bg, $fg, .5);
box-shadow: none; box-shadow: none;
} }
@ -121,29 +152,11 @@
box-shadow: none; box-shadow: none;
} }
&.flat {
color: inherit;
&, &:hover, &:focus,
&:active, &:active:hover, &:active:focus,
&:checked, &:checked:hover, &:checked:focus {
border: none;
background-color: transparent;
background-image: none;
box-shadow: none;
}
// TODO
}
&.separator, .separator { &.separator, .separator {
color: shade($bg, ($contrast + .05)); color: shade($bg, ($contrast + .05));
border: 1px solid currentColor;
&:insensitive { color: shade($bg, .85); } &:insensitive { color: shade($bg, .85); }
} }
.linked & { @include linked_button($bg, $dark_shadow); }
} }
@include exports("button") { @include exports("button") {
@ -173,10 +186,12 @@
&.default { @include button($selected_bg_color, $selected_fg_color); } &.default { @include button($selected_bg_color, $selected_fg_color); }
.linked & { @include linked_button($bg_color); }
.spinbutton & { .spinbutton & {
color: mix($text_color, $base_color, 0.4); color: mix($text_color, $base_color, 0.4);
padding: 2px 4px; padding: $spacing ($spacing * 2);
border-width: 0; border: none;
border-radius: 0; border-radius: 0;
border-style: none; border-style: none;
background-color: transparent; background-color: transparent;

View File

@ -2,6 +2,16 @@
@import "global"; @import "global";
/***************
! Dimmed label *
****************/
.dim-label {
opacity: 0.5;
text-shadow: none;
}
/*********** /***********
! Tooltip * ! Tooltip *
************/ ************/

View File

@ -29,7 +29,7 @@ GtkOverlay.osd {
-GtkToolbar-button-relief: normal; -GtkToolbar-button-relief: normal;
padding: $spacing; padding: $spacing;
border-width: 1px solid border_normal($osd_bg); border: 1px solid border_normal($osd_bg);
border-radius: $roundness; border-radius: $roundness;
background-color: $osd_bg; background-color: $osd_bg;
background-image: none; background-image: none;
@ -114,7 +114,7 @@ GtkOverlay.osd {
GtkIconView.cell { GtkIconView.cell {
&:selected, &:selected:focus { &:selected, &:selected:focus {
background-color: transparent; background-color: transparent;
border: 3px solid solid mix(shade($osd_bg, 0.87), $osd_fg, 0.21); border: 3px solid mix(shade($osd_bg, 0.87), $osd_fg, 0.21);
border-radius: $roundness; border-radius: $roundness;
outline-color: transparent; outline-color: transparent;
} }

View File

@ -31,6 +31,8 @@
.button { @include button($bg, $fg); } .button { @include button($bg, $fg); }
.linked .button { @include linked_button($bg); }
GtkComboBox, .button { GtkComboBox, .button {
padding: $spacing - 1px; padding: $spacing - 1px;