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
|
# File 'lib/gtk_paradise/examples/gtk3/011_spin_button_example.rb', line 18
def initialize
super(:vertical)
main_vbox = ::Gtk::Box.new(:vertical)
main_vbox.set_border_width(10)
add(main_vbox)
frame = ::Gtk::Frame.new('SpinButton example')
main_vbox.pack_start(frame, expand: true, fill: true, padding: 0)
vbox = ::Gtk::Box.new(:vertical)
vbox.set_border_width(5)
frame.add(vbox)
hbox = ::Gtk::Box.new(:horizontal)
vbox.pack_start(hbox, expand: true, fill: true, padding: 5)
vbox2 = ::Gtk::Box.new(:vertical)
hbox.pack_start(vbox2, expand: true, fill: true, padding: 5)
label = ::Gtk::Label.new('Day :')
label.set_alignment(0, 0.5)
vbox2.pack_start(label, expand: true, fill: true, padding: 0)
adj = ::Gtk::Adjustment.new(1.0, 1.0, 31.0, 1.0, 5.0, 0.0)
spinner = ::Gtk::SpinButton.new(adj, 0, 0)
spinner.wrap = true
vbox2.pack_start(spinner, expand: false, fill: true, padding: 5)
vbox2 = ::Gtk::Box.new(:vertical)
hbox.pack_start(vbox2, expand: true, fill: true, padding: 5)
hbox = ::Gtk::Box.new(:horizontal)
vbox.pack_start(hbox, expand: false, fill: true, padding: 5)
button = ::Gtk::Button.new(label: 'Close')
button.signal_connect(:clicked) { destroy } hbox.pack_start(button, expand: true, fill: true, padding: 5)
end
|