gtk-4.0/widgets/_spinbuttons.scss 4.5 K raw
1
/*****************
2
 * GtkSpinButton *
3
 *****************/
4
spinbutton {
5
  &:not(.vertical) {
6
    // in this horizontal configuration, the whole spinbutton
7
    // behaves as the entry, so we extend the entry styling
8
    // and nuke the style on the internal entry
9
    @extend %entry;
10
11
    padding: 0;
12
    border-spacing: 0;
13
14
    %spinbutton_horz_entry {
15
      min-width: 28px;
16
      // reset all the other props since the spinbutton node is styled here
17
      margin: 0;
18
      background: none;
19
      background-color: transparent;
20
      border: none;
21
      border-radius: 0;
22
      box-shadow: none;
23
      padding: 6px;
24
25
      &:backdrop:disabled { background-color: transparent; }
26
    }
27
28
    > text {
29
      @extend %spinbutton_horz_entry;
30
    }
31
32
    /* :not here just to bump specificity above that of the list button styling */
33
    > button.image-button.up:not(.flat),
34
    > button.image-button.down:not(.flat) {
35
      min-height: 16px;
36
      margin: 0;
37
      padding-bottom: 0;
38
      padding-top: 0;
39
      color: mix($fg_color, $base_color, 90%);
40
      background-image: none;
41
      border-style: none none none solid;
42
      border-color: transparentize($borders_color, 0.7);
43
      border-radius: 0;
44
      box-shadow: none;
45
      background-color: transparent;
46
47
      &:dir(rtl) { border-style: none solid none none; }
48
49
      &:hover {
50
        color: $fg_color;
51
        background-color: darken($bg_color,5%);
52
      }
53
54
      &:disabled {
55
        color: transparentize($insensitive_fg_color, 0.7);
56
        background-color: transparent;
57
      }
58
59
      &:active {
60
        background-color: transparentize(black, 0.9);
61
        box-shadow: inset 0 2px 3px -1px transparentize(black, 0.8);
62
      }
63
64
      &:dir(ltr):last-child { border-radius: 0 6px 6px 0; }
65
66
      &:dir(rtl):first-child { border-radius: 6px 0 0 6px; }
67
    }
68
  }
69
70
  // OSD horizontal
71
  .osd &:not(.vertical) {
72
    > text {
73
      @extend %spinbutton_horz_entry;
74
    }
75
76
    > button.image-button.up:not(.flat),
77
    > button.image-button.down:not(.flat) {
78
      @include button(undecorated);
79
80
      color: $osd_fg_color;
81
      border-style: none none none solid;
82
      border-color: transparentize($osd_borders_color, 0.3);
83
      border-radius: 0;
84
      box-shadow: none;
85
      -gtk-icon-shadow: 0 1px black;
86
87
      &:dir(rtl) { border-style: none solid none none; }
88
89
      &:hover {
90
        @include button(undecorated);
91
92
        color: $osd_fg_color;
93
        border-color: transparentize(opacify($osd_borders_color, 1), 0.5);
94
        background-color: darken($osd_bg_color,10%);
95
        -gtk-icon-shadow: 0 1px black;
96
        box-shadow: none;
97
      }
98
99
      &:disabled {
100
        @include button(undecorated);
101
102
        color: $osd_insensitive_fg_color;
103
        border-color: transparentize(opacify($osd_borders_color, 1), 0.5);
104
        -gtk-icon-shadow: none;
105
        box-shadow: none;
106
      }
107
108
      &:dir(ltr):last-child { border-radius: 0 6px 6px 0; }
109
110
      &:dir(rtl):first-child { border-radius: 6px 0 0 6px; }
111
    }
112
  }
113
114
  // Vertical
115
  &.vertical {
116
    // in the vertical configuration, we treat the spinbutton
117
    // as a box, and tweak the style of the entry in the middle
118
    // so that it's linked
119
120
    // FIXME: this should not be set at all, but otherwise it gets the wrong
121
    // color
122
    &:disabled { color: $insensitive_fg_color; }
123
124
    &:drop(active) {
125
      border-color: transparent;
126
      box-shadow: none;
127
    }
128
129
    > text {
130
      @extend %entry;
131
132
      min-height: 32px;
133
      min-width: 32px;
134
      padding: 0;
135
      border-radius: 0;
136
137
      > selection {
138
        background-color: $backdrop_selected_bg_color;
139
        color: transparent;
140
        &:focus-within {
141
          color: $fg_color;
142
        }
143
      }
144
      > block-cursor { @include entry(block_cursor); }
145
    }
146
147
    > button {
148
      min-height: 32px;
149
      min-width: 32px;
150
      padding: 0;
151
152
      &.up { @extend %top_button; }
153
154
      &.down { @extend %bottom_button; }
155
    }
156
157
    %top_button {
158
      border-bottom-style: none;
159
      border-bottom-left-radius: 0;
160
      border-bottom-right-radius: 0;
161
    }
162
163
    %bottom_button {
164
      border-top-style: none;
165
      border-top-left-radius: 0;
166
      border-top-right-radius: 0;
167
    }
168
  }
169
170
  // OSD vertical
171
  .osd &.vertical > button:first-child {
172
    @include button(osd);
173
174
    &:hover { @include button(osd-hover);}
175
176
    &:active { @include button(osd-active); }
177
178
    &:disabled { @include button(osd-insensitive); }
179
  }
180
181
  // Misc
182
  treeview &:not(.vertical) {
183
    min-height: 0;
184
    border-style: none;
185
    border-radius: 0;
186
187
    > text {
188
      min-height: 0;
189
      padding: 1px 2px;
190
    }
191
  }
192
193
  font-feature-settings: "tnum";
194
}
195