-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmySpinRow.js
74 lines (60 loc) · 1.69 KB
/
mySpinRow.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* mySpinRow.js
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
// Implements most of Adw.SpinRow the extension needs.
import Adw from 'gi://Adw';
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
import Gtk from 'gi://Gtk';
export default
class SpinRow extends Adw.ActionRow {
static {
GObject.registerClass(
{
Properties: {
'value': GObject.ParamSpec.double(
'value',
'Value',
'The value',
GObject.ParamFlags.READWRITE,
-Number.MAX_VALUE,
Number.MAX_VALUE,
0
)
}
},
this);
}
constructor({adjustment = null,
climb_rate = null,
digits = null,
numeric = null,
snap_to_ticks = null,
update_policy = null,
wrap = null,
value = null,
width_chars = null,
...args})
{
super(args);
const spin = new Gtk.SpinButton({
adjustment,
climb_rate,
digits,
numeric,
snap_to_ticks,
update_policy,
valign: Gtk.Align.CENTER,
value,
width_chars,
wrap,
});
spin.add_css_class('flat');
this.bind_property('value',
spin, 'value',
GObject.BindingFlags.BIDIRECTIONAL);
this.add_suffix(spin);
}
};