gtk-4.0/widgets/_entries.scss 5.5 K raw
1
/****************
2
 * Text Entries *
3
 ****************/
4
5
%entry,
6
entry {
7
  %entry_basic, & {
8
    min-height: 28px;
9
    padding-left: 8px;
10
    padding-right: 8px;
11
    border: 1px solid;
12
    border-radius: 6px;
13
    transition: all 200ms $ease-out-quad;
14
15
    @include entry(normal);
16
17
    image { // icons inside the entry
18
      &.left { padding-left: 0; padding-right: 6px; }
19
      &.right { padding-left: 6px; padding-right: 0; }
20
    }
21
22
    undershoot {
23
      &.left { @include undershoot(left); }
24
      &.right { @include undershoot(right); }
25
    }
26
27
    &.flat {
28
      &:focus-within, & {
29
        min-height: 0;
30
        padding: 2px;
31
        background-image: none;
32
        border-color: transparent;
33
        box-shadow: none;
34
        border-radius: 0;
35
      }
36
    }
37
38
    &:focus-within { @include entry(focus); }
39
40
    &:disabled { @include entry(insensitive); }
41
42
    &:backdrop {
43
      @include entry(backdrop);
44
45
      transition: $backdrop_transition;
46
    }
47
48
    &:backdrop:disabled { @include entry(backdrop-insensitive); }
49
50
    selection { &:focus, & { @extend %selected_items; }}
51
52
    // entry error and warning style
53
    @each $e_type, $e_color in (error, $error_color),
54
                               (warning, $warning_color) {
55
      &.#{$e_type} {
56
        @include entry(normal);
57
        color: $e_color;
58
        border-color: entry_focus_border($e_color);
59
60
        &:focus-within { @include entry(focus, $e_color); }
61
62
        &:selected { &:focus, & { background-color: $e_color; }}
63
      }
64
    }
65
66
    & image { // entry icons colors
67
      color: mix($fg_color, $base_color, 80%);
68
69
      &:hover { color: $fg_color; }
70
71
      &:active { color: $selected_bg_color; }
72
73
      &:backdrop { color: mix($backdrop_fg_color, $backdrop_base_color, 80%); }
74
    }
75
76
    &:drop(active) {
77
      &:focus-within, & {
78
        border-color: $drop_target_color;
79
        box-shadow: inset 0 0 0 1px $drop_target_color;
80
      }
81
    }
82
83
    .osd & {
84
      @include entry(osd);
85
86
      &:focus-within { @include entry(osd-focus); }
87
88
      &:backdrop { @include entry(osd-backdrop); }
89
90
      &:disabled { @include entry(osd-insensitive); }
91
    }
92
  }
93
94
  progress {
95
    margin: 2px -6px;
96
    background-color: transparent;
97
    background-image: none;
98
    border-radius: 0;
99
    border-width: 0 0 2px;
100
    border-color: $selected_bg_color;
101
    border-style: solid;
102
    box-shadow: none;
103
104
    &:backdrop { background-color: transparent; }
105
  }
106
107
   // linked entries
108
  .linked:not(.vertical) > & { @extend %linked; }
109
110
  .linked:not(.vertical) > &:drop(active) + &,
111
  .linked:not(.vertical) > &:drop(active) + button,
112
  .linked:not(.vertical) > &:drop(active) + menubutton > button,
113
  .linked:not(.vertical) > &:drop(active) + dropdown > button,
114
  .linked:not(.vertical) > &:drop(active) + colorbutton > button,
115
  .linked:not(.vertical) > &:drop(active) + fontbutton > button,
116
  .linked:not(.vertical) > &:drop(active) + filechooserbutton > button,
117
  .linked:not(.vertical) > &:drop(active) + filechooserbutton > combobox > box > button.combo,
118
  .linked:not(.vertical) > &:drop(active) + appchooserbutton > combobox > box > button.combo,
119
  .linked:not(.vertical) > &:drop(active) + combobox > box > button.combo { border-left-color: $drop_target_color; }
120
121
  
122
  .linked:not(.vertical) > & { 
123
    &:focus-within {
124
      border-color: entry_focus_border(); 
125
      box-shadow: 0px 0px 1px 1px $selected_bg_color inset;
126
      border-right-style: solid;
127
      + .popup button {
128
        border-left-color: $selected_bg_color;
129
      }
130
    }
131
    + .popup button {
132
      border-radius: 0px 6px 6px 0px;
133
    }
134
  }
135
  // Vertically linked entries
136
  // FIXME: take care of "colored" entries
137
  .linked.vertical > & {
138
    @extend %linked_vertical;
139
140
    // brighter border between linked entries
141
    &:not(:disabled) + entry:not(:disabled),
142
    &:not(:disabled) + %entry:not(:disabled) {
143
      border-top-color: mix($borders_color, $base_color, 30%);
144
      background-image: linear-gradient(to bottom, $base_color, $base_color);
145
146
      &:backdrop {
147
        border-top-color: mix($backdrop_borders_color, $backdrop_base_color, 30%);
148
        background-image: linear-gradient(to bottom, $backdrop_base_color, $backdrop_base_color);
149
      }
150
    }
151
152
    // brighter border between linked insensitive entries
153
    &:disabled + %entry:disabled,
154
    &:disabled + entry:disabled { border-top-color: mix($borders_color, $base_color, 30%); }
155
156
    // color back the top border of a linked focused entry following another entry and add back the focus shadow.
157
    // :not(:only-child) is a specificity bump hack.
158
    + %entry:focus:not(:only-child),
159
    + entry:focus:not(:only-child) { border-top-color: entry_focus_border(); }
160
161
    + %entry:drop(active):not(:only-child),
162
    + entry:drop(active):not(:only-child) { border-top-color: $drop_target_color; }
163
164
    // this takes care of coloring the top border of the focused entry subsequent widget.
165
    // :not(:only-child) is a specificity bump hack.
166
    &:focus:not(:only-child) {
167
      + %entry,
168
      + entry,
169
      + button,
170
      + combobox > box > button.combo { border-top-color: entry_focus_border(); }
171
    }
172
173
    &:drop(active):not(:only-child) {
174
      + %entry,
175
      + entry,
176
      + button,
177
      + combobox > box > button.combo { border-top-color: $drop_target_color; }
178
    }
179
  }
180
}
181
182
treeview entry {
183
  &:focus-within {
184
    &:dir(rtl), &:dir(ltr) { // specificity bump hack
185
      background-color: $base_color;
186
      transition-property: color, background;
187
    }
188
  }
189
190
  &.flat, & {
191
    border-radius: 0;
192
    background-image: none;
193
    background-color: $base_color;
194
195
    &:focus-within { border-color: $selected_bg_color; }
196
  }
197
}