gtk3 2.2.0-x86-mingw32 → 2.2.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/gtk3/extconf.rb +3 -2
- data/ext/gtk3/rbgtk-color-button.c +7 -1
- data/ext/gtk3/rbgtk-dialog.c +26 -6
- data/ext/gtk3/rbgtk-image.c +1 -0
- data/ext/gtk3/rbgtk-selection-data.c +4 -5
- data/ext/gtk3/rbgtk-stack-switcher.c +41 -0
- data/ext/gtk3/rbgtk-window.c +8 -0
- data/ext/gtk3/rbgtk.c +158 -0
- data/ext/gtk3/rbgtk3.h +33 -0
- data/ext/gtk3/rbgtk3conversions.h +60 -1
- data/ext/gtk3/rbgtk3private.h +1 -1
- data/lib/2.0/gtk3.so +0 -0
- data/lib/gtk3.rb +1 -0
- data/sample/gtk-demo/cairo-arc-negative.rb +1 -1
- data/sample/gtk-demo/cairo-arc.rb +1 -1
- data/sample/gtk-demo/cairo-clip-image.rb +6 -6
- data/sample/gtk-demo/cairo-clip-rectangle.rb +2 -2
- data/sample/gtk-demo/cairo-curve-rectangle.rb +2 -2
- data/sample/gtk-demo/cairo-curve-to.rb +2 -2
- data/sample/gtk-demo/cairo-dash.rb +1 -1
- data/sample/gtk-demo/cairo-fill-and-stroke.rb +1 -1
- data/sample/gtk-demo/cairo-fill-and-stroke2.rb +2 -2
- data/sample/gtk-demo/cairo-gradient.rb +1 -1
- data/sample/gtk-demo/cairo-image-pattern.rb +5 -5
- data/sample/gtk-demo/cairo-image.rb +4 -4
- data/sample/gtk-demo/cairo-line-cap.rb +8 -8
- data/sample/gtk-demo/cairo-line-join.rb +3 -3
- data/sample/gtk-demo/cairo-long-lines.rb +3 -3
- data/sample/gtk-demo/cairo-pattern-fill.rb +11 -11
- data/sample/gtk-demo/cairo-self-intersect.rb +2 -2
- data/sample/gtk-demo/cairo-text-align-center.rb +4 -4
- data/sample/gtk-demo/cairo-text-extents.rb +5 -5
- data/sample/gtk-demo/cairo-text.rb +3 -3
- data/sample/gtk-demo/common.rb +0 -1
- data/sample/gtk-demo/dialog.rb +23 -23
- data/sample/gtk-demo/drawingarea.rb +5 -1
- data/sample/gtk-demo/editable_cells.rb +28 -28
- data/sample/gtk-demo/entry_completion.rb +3 -3
- data/sample/gtk-demo/images.rb +75 -75
- data/sample/gtk-demo/item_factory.rb +40 -40
- data/sample/gtk-demo/list_store.rb +13 -13
- data/sample/gtk-demo/menus.rb +34 -34
- data/sample/gtk-demo/panes.rb +28 -28
- data/sample/gtk-demo/rotated_text.rb +41 -53
- data/sample/gtk-demo/sizegroup.rb +17 -17
- data/sample/gtk-demo/spinner.rb +1 -1
- data/sample/gtk-demo/textview.rb +137 -137
- data/sample/gtk-demo/theming.ui +319 -0
- data/sample/gtk-demo/theming_style_classes.rb +48 -0
- data/sample/gtk-demo/tree_store.rb +127 -127
- data/sample/misc/assistant.rb +6 -66
- data/sample/misc/bindings.rb +22 -32
- data/sample/misc/button.rb +8 -5
- data/sample/misc/buttonbox.rb +2 -2
- data/sample/misc/checkbutton.rb +4 -1
- data/sample/misc/colorselection.rb +7 -10
- data/sample/misc/combo_check.rb +34 -26
- data/sample/misc/combobox.rb +10 -11
- data/sample/misc/cursor.rb +3 -1
- data/sample/misc/dialog.rb +12 -12
- data/sample/misc/dialog2.rb +13 -16
- data/sample/misc/drawing.rb +40 -21
- data/sample/misc/statusicon.rb +28 -45
- data/sample/misc/threads.rb +16 -18
- data/sample/misc/tree_progress.rb +10 -12
- data/test/run-test.rb +17 -9
- data/test/test_gtk_search_bar.rb +1 -1
- data/test/test_gtk_stack_switcher.rb +30 -0
- metadata +26 -24
- data/lib/1.9/gtk3.so +0 -0
- data/lib/2.1/gtk3.so +0 -0
data/sample/misc/assistant.rb
CHANGED
@@ -18,7 +18,6 @@ class AssistantRunner
|
|
18
18
|
@generous_assistant = nil
|
19
19
|
@selected_branch = "A"
|
20
20
|
@nonlinear_assistant = nil
|
21
|
-
@full_featured_assistant = nil
|
22
21
|
end
|
23
22
|
|
24
23
|
def run_simple_assistant
|
@@ -36,11 +35,6 @@ class AssistantRunner
|
|
36
35
|
:create_nonlinear_assistant)
|
37
36
|
end
|
38
37
|
|
39
|
-
def run_full_featured_assistant
|
40
|
-
@full_featured_assistant = run_assistant(@full_featured_assistant,
|
41
|
-
:create_full_featured_assistant)
|
42
|
-
end
|
43
|
-
|
44
38
|
private
|
45
39
|
def run_assistant(assistant, assistant_create_method)
|
46
40
|
assistant ||= send(assistant_create_method)
|
@@ -84,7 +78,7 @@ class AssistantRunner
|
|
84
78
|
GLib::Timeout.add(300) do
|
85
79
|
page = assistant.get_nth_page(assistant.current_page)
|
86
80
|
progress = page.child
|
87
|
-
value = progress.fraction = progress.fraction + 0.1
|
81
|
+
value = progress.fraction = (progress.fraction + 0.1).round(1)
|
88
82
|
continue = value < 1.0
|
89
83
|
assistant.set_page_complete(page, true) unless continue
|
90
84
|
continue
|
@@ -256,67 +250,13 @@ class AssistantRunner
|
|
256
250
|
assistant.set_page_type(page, :confirm)
|
257
251
|
assistant.set_page_complete(page, true)
|
258
252
|
end
|
259
|
-
|
260
|
-
def create_full_featured_assistant
|
261
|
-
assistant = Gtk::Assistant.new
|
262
|
-
assistant.set_default_size(400, 300)
|
263
|
-
assistant.signal_connect("cancel") do
|
264
|
-
puts "cancel"
|
265
|
-
assistant.hide
|
266
|
-
end
|
267
|
-
assistant.signal_connect("close") do
|
268
|
-
puts "close"
|
269
|
-
assistant.hide
|
270
|
-
end
|
271
|
-
assistant.signal_connect("apply") do
|
272
|
-
puts "apply"
|
273
|
-
end
|
274
|
-
assistant.signal_connect("prepare") do |_assistant, page|
|
275
|
-
prepare_cb(_assistant, page)
|
276
|
-
end
|
277
|
-
|
278
|
-
button = Gtk::Button.new(:stock_id => Gtk::Stock::STOP)
|
279
|
-
button.show
|
280
|
-
assistant.add_action_widget(button)
|
281
|
-
|
282
|
-
page = create_test_page("Page 1")
|
283
|
-
page.show
|
284
|
-
assistant.append_page(page)
|
285
|
-
assistant.set_page_title(page, "Page 1")
|
286
|
-
assistant.set_page_complete(page, true)
|
287
|
-
|
288
|
-
#- set a side image
|
289
|
-
pixbuf = page.render_icon(Gtk::Stock::DIALOG_WARNING, :dialog)
|
290
|
-
assistant.set_page_side_image(page, pixbuf)
|
291
|
-
|
292
|
-
#- set a header image
|
293
|
-
pixbuf = page.render_icon(Gtk::Stock::DIALOG_INFO, :dialog)
|
294
|
-
assistant.set_page_header_image(page, pixbuf)
|
295
|
-
|
296
|
-
page = create_test_page("Invisible page")
|
297
|
-
assistant.append_page(page)
|
298
|
-
|
299
|
-
page = create_test_page("Page 3")
|
300
|
-
page.show
|
301
|
-
assistant.append_page(page)
|
302
|
-
assistant.set_page_title(page, "Page 3")
|
303
|
-
assistant.set_page_type(page, :confirm)
|
304
|
-
assistant.set_page_complete(page, true)
|
305
|
-
|
306
|
-
#- set a header image
|
307
|
-
pixbuf = page.render_icon(Gtk::Stock::DIALOG_INFO, :dialog)
|
308
|
-
assistant.set_page_header_image(page, pixbuf)
|
309
|
-
|
310
|
-
assistant
|
311
|
-
end
|
312
253
|
end
|
313
254
|
|
314
255
|
runner = AssistantRunner.new
|
315
256
|
buttons = [
|
316
|
-
[
|
317
|
-
[
|
318
|
-
[
|
319
|
-
[ "full featured assistant", proc { runner.run_full_featured_assistant } ],
|
257
|
+
["simple assistant", proc {runner.run_simple_assistant}],
|
258
|
+
["generous assistant", proc {runner.run_generous_assistant}],
|
259
|
+
["nonlinear assistant", proc {runner.run_nonlinear_assistant}]
|
320
260
|
]
|
321
261
|
|
322
262
|
if ENV["RTL"]
|
@@ -324,8 +264,8 @@ if ENV["RTL"]
|
|
324
264
|
end
|
325
265
|
|
326
266
|
window = Gtk::Window.new(:toplevel)
|
327
|
-
window.signal_connect("destroy") {
|
328
|
-
window.signal_connect("delete-event") {
|
267
|
+
window.signal_connect("destroy") {Gtk.main_quit}
|
268
|
+
window.signal_connect("delete-event") {false}
|
329
269
|
|
330
270
|
box = Gtk::Box.new(:vertical, 6)
|
331
271
|
window.add(box)
|
data/sample/misc/bindings.rb
CHANGED
@@ -25,18 +25,24 @@ Usage:
|
|
25
25
|
"back_space" : same as pressing <backspace> in text view area.
|
26
26
|
"cancel j/k" : disable 'j' and 'k' binding
|
27
27
|
=end
|
28
|
-
require
|
28
|
+
require "gtk3"
|
29
29
|
|
30
30
|
class Pager < Gtk::TextView
|
31
31
|
type_register
|
32
32
|
|
33
33
|
# widget's key binding can be defined like this
|
34
|
-
binding_set.add_signal(Gdk::Keyval::
|
34
|
+
binding_set.add_signal(Gdk::Keyval::GDK_KEY_space, 0,
|
35
35
|
"move_cursor",
|
36
|
-
Gtk::
|
37
|
-
binding_set.add_signal(Gdk::Keyval::
|
36
|
+
Gtk::MovementStep::PAGES, 1, false)
|
37
|
+
binding_set.add_signal(Gdk::Keyval::GDK_KEY_BackSpace, 0,
|
38
38
|
"move_cursor",
|
39
|
-
Gtk::
|
39
|
+
Gtk::MovementStep::PAGES, -1, false)
|
40
|
+
binding_set.add_signal(Gdk::Keyval::GDK_KEY_j, 0,
|
41
|
+
"move_cursor",
|
42
|
+
Gtk::MovementStep::DISPLAY_LINES, 1, false)
|
43
|
+
binding_set.add_signal(Gdk::Keyval::GDK_KEY_k, 0,
|
44
|
+
"move_cursor",
|
45
|
+
Gtk::MovementStep::DISPLAY_LINES, -1, false)
|
40
46
|
|
41
47
|
def initialize(path)
|
42
48
|
@path = path
|
@@ -55,42 +61,28 @@ class Pager < Gtk::TextView
|
|
55
61
|
end
|
56
62
|
end
|
57
63
|
|
58
|
-
path = ARGV[0] || __FILE__
|
64
|
+
path = ARGV[0] || __FILE__
|
59
65
|
|
60
66
|
window = Gtk::Window.new
|
61
67
|
window.name = "pager_window"
|
62
68
|
sw = Gtk::ScrolledWindow.new
|
63
|
-
vbox = Gtk::
|
64
|
-
hbox = Gtk::
|
69
|
+
vbox = Gtk::Box.new(:vertical)
|
70
|
+
hbox = Gtk::Box.new(:horizontal)
|
65
71
|
pager = Pager.new(path)
|
66
72
|
|
67
|
-
hbox.add(button1 = Gtk::Button.new("space"))
|
68
|
-
hbox.add(button2 = Gtk::Button.new("back_space"))
|
69
|
-
hbox.add(button3 = Gtk::Button.new("cancel j/k"))
|
73
|
+
hbox.add(button1 = Gtk::Button.new(:label => "space"))
|
74
|
+
hbox.add(button2 = Gtk::Button.new(:label => "back_space"))
|
75
|
+
hbox.add(button3 = Gtk::Button.new(:label => "cancel j/k"))
|
70
76
|
|
71
77
|
button1.signal_connect("clicked") do
|
72
|
-
Pager.binding_set.activate(Gdk::Keyval::
|
78
|
+
Pager.binding_set.activate(Gdk::Keyval::GDK_KEY_space, 0, pager)
|
73
79
|
end
|
74
80
|
button2.signal_connect("clicked") do
|
75
|
-
pager.bindings_activate(Gdk::Keyval::
|
81
|
+
pager.bindings_activate(Gdk::Keyval::GDK_KEY_BackSpace, 0)
|
76
82
|
end
|
77
|
-
|
78
|
-
# Key bindings can be attached to any widget by
|
79
|
-
# Gtk::BindingSet#add_path
|
80
|
-
# see RC Files section of GTK+ documentation for more detail.
|
81
|
-
bset = Gtk::BindingSet.new("j_and_k")
|
82
|
-
bset.add_signal(Gdk::Keyval::GDK_j, 0,
|
83
|
-
"move_cursor",
|
84
|
-
Gtk::MOVEMENT_DISPLAY_LINES, 1, false)
|
85
|
-
bset.add_signal(Gdk::Keyval::GDK_k, 0,
|
86
|
-
"move_cursor",
|
87
|
-
Gtk::MOVEMENT_DISPLAY_LINES, -1, false)
|
88
|
-
bset.add_path(Gtk::PathType::WIDGET, "pager_window.*.Pager",
|
89
|
-
Gtk::PathPriorityType::APPLICATION)
|
90
|
-
|
91
83
|
button3.signal_connect("clicked") do
|
92
|
-
|
93
|
-
|
84
|
+
Pager.binding_set.entry_remove(Gdk::Keyval::GDK_KEY_j, 0)
|
85
|
+
Pager.binding_set.entry_remove(Gdk::Keyval::GDK_KEY_k, 0)
|
94
86
|
end
|
95
87
|
|
96
88
|
sw.add(pager)
|
@@ -100,8 +92,6 @@ window.show_all
|
|
100
92
|
|
101
93
|
pager.grab_focus
|
102
94
|
|
103
|
-
window.signal_connect("destroy") {
|
95
|
+
window.signal_connect("destroy") {Gtk.main_quit}
|
104
96
|
|
105
97
|
Gtk.main
|
106
|
-
|
107
|
-
|
data/sample/misc/button.rb
CHANGED
@@ -8,10 +8,13 @@
|
|
8
8
|
$Id: button.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require
|
11
|
+
require "gtk3"
|
12
12
|
|
13
13
|
window = Gtk::Window.new("buttons")
|
14
14
|
window.border_width = 0
|
15
|
+
window.signal_connect("delete_event") do
|
16
|
+
Gtk.main_quit
|
17
|
+
end
|
15
18
|
|
16
19
|
box1 = Gtk::Box.new(:vertical, 0)
|
17
20
|
window.add(box1)
|
@@ -20,7 +23,7 @@ table = Gtk::Table.new(3, 3, false)
|
|
20
23
|
table.set_row_spacings(5)
|
21
24
|
table.set_column_spacings(5)
|
22
25
|
table.set_border_width(10)
|
23
|
-
box1.pack_start(table, true, true, 0)
|
26
|
+
box1.pack_start(table, :expand => true, :fill => true, :padding => 0)
|
24
27
|
|
25
28
|
button = []
|
26
29
|
0.upto(8) do |i|
|
@@ -49,18 +52,18 @@ table.attach(button[7], 2, 3, 1, 2, nil, nil, 0, 0)
|
|
49
52
|
table.attach(button[8], 0, 1, 1, 2, nil, nil, 0, 0)
|
50
53
|
|
51
54
|
separator = Gtk::Separator.new(:vertical)
|
52
|
-
box1.pack_start(separator, false, true, 0)
|
55
|
+
box1.pack_start(separator, :expand => false, :fill => true, :padding => 0)
|
53
56
|
|
54
57
|
box2 = Gtk::Box.new(:vertical, 10)
|
55
58
|
box2.border_width = 10
|
56
|
-
box1.pack_start(box2, false, true, 0)
|
59
|
+
box1.pack_start(box2, :expand => false, :fill => true, :padding => 0)
|
57
60
|
|
58
61
|
close = Gtk::Button.new(:label => "close")
|
59
62
|
close.signal_connect("clicked") do
|
60
63
|
Gtk.main_quit
|
61
64
|
end
|
62
65
|
|
63
|
-
box2.pack_start(close, true, true, 0)
|
66
|
+
box2.pack_start(close, :expand => true, :fill => true, :padding => 0)
|
64
67
|
close.can_default = true
|
65
68
|
close.grab_default
|
66
69
|
|
data/sample/misc/buttonbox.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
$Id: buttonbox.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require
|
11
|
+
require "gtk3"
|
12
12
|
|
13
13
|
def create_bbox_window(horizontal, title, pos, spacing, layout)
|
14
14
|
window = Gtk::Window.new(title)
|
@@ -32,7 +32,7 @@ def create_bbox_window(horizontal, title, pos, spacing, layout)
|
|
32
32
|
bbox.layout_style = layout
|
33
33
|
bbox.spacing = spacing
|
34
34
|
box1.border_width = 25
|
35
|
-
box1.pack_start(bbox, true, true, 0)
|
35
|
+
box1.pack_start(bbox, :expand => true, :fill => true, :padding => 0)
|
36
36
|
|
37
37
|
button = Gtk::Button.new(:label => "OK")
|
38
38
|
bbox.add(button)
|
data/sample/misc/checkbutton.rb
CHANGED
@@ -8,10 +8,13 @@
|
|
8
8
|
$Id: checkbutton.rb,v 1.10 2006/06/17 13:18:12 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require
|
11
|
+
require "gtk3"
|
12
12
|
|
13
13
|
window = Gtk::Window.new("check buttons")
|
14
14
|
window.border_width = 0
|
15
|
+
window.signal_connect("delete_event") do
|
16
|
+
Gtk.main_quit
|
17
|
+
end
|
15
18
|
|
16
19
|
box1 = Gtk::Box.new(:vertical)
|
17
20
|
window.add(box1)
|
@@ -7,19 +7,16 @@
|
|
7
7
|
$Id: colorselection.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
8
8
|
=end
|
9
9
|
|
10
|
-
require
|
11
|
-
|
12
|
-
settings = Gtk::Settings.default
|
13
|
-
|
14
|
-
# You can save the palette to use right click on the palette.
|
15
|
-
Gtk::ColorSelection.set_change_palette_hook{|screen, colors|
|
16
|
-
puts strs = Gtk::ColorSelection.palette_to_string(colors)
|
17
|
-
settings.gtk_color_palette = strs
|
18
|
-
}
|
10
|
+
require "gtk3"
|
19
11
|
|
20
12
|
a = Gtk::ColorSelection.new
|
21
13
|
a.has_palette = true
|
14
|
+
a.signal_connect("color_changed") do |w|
|
15
|
+
unless w.adjusting?
|
16
|
+
p w.current_rgba.to_s
|
17
|
+
end
|
18
|
+
end
|
22
19
|
|
23
|
-
Gtk::Window.new.add(a).show_all.signal_connect("destroy"){Gtk.main_quit}
|
20
|
+
Gtk::Window.new.add(a).show_all.signal_connect("destroy") {Gtk.main_quit}
|
24
21
|
|
25
22
|
Gtk.main
|
data/sample/misc/combo_check.rb
CHANGED
@@ -8,56 +8,64 @@
|
|
8
8
|
$Id: combo_check.rb,v 1.9 2006/06/17 13:18:12 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require
|
11
|
+
require "gtk3"
|
12
12
|
|
13
13
|
window = Gtk::Window.new("entry")
|
14
14
|
window.border_width = 0
|
15
|
+
window.signal_connect("destroy") do
|
16
|
+
Gtk.main_quit
|
17
|
+
end
|
15
18
|
|
16
|
-
box1 = Gtk::
|
19
|
+
box1 = Gtk::Box.new(:vertical)
|
17
20
|
window.add(box1)
|
18
21
|
|
19
|
-
box2 = Gtk::
|
22
|
+
box2 = Gtk::Box.new(:vertical, 10)
|
20
23
|
box2.border_width = 10
|
21
24
|
box1.pack_start(box2)
|
22
25
|
|
23
26
|
entry = Gtk::Entry.new
|
24
27
|
entry.text = "hello world"
|
28
|
+
entry.set_editable(false)
|
25
29
|
entry.select_region(0, -1)
|
26
30
|
box2.pack_start(entry)
|
27
31
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
cb
|
32
|
-
cb.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
cb.
|
43
|
-
cb.
|
44
|
-
box2.pack_start(cb, true, true, 0)
|
32
|
+
## Gtk::ComboBoxText is simpler than Gtk::ComboBox, but has less functions.
|
33
|
+
## Gtk::Combo has been deprecated.
|
34
|
+
cb = Gtk::ComboBoxText.new(:entry => true)
|
35
|
+
cb.append_text("item0")
|
36
|
+
cb.append_text("item1 item1")
|
37
|
+
cb.append_text("item2 item2 item2")
|
38
|
+
cb.append_text("item3 item3 item3 item3")
|
39
|
+
cb.append_text("item4 item4 item4 item4 item4")
|
40
|
+
cb.append_text("item5 item5 item5 item5 item5 item5")
|
41
|
+
cb.append_text("item6 item6 item6 item6 item6")
|
42
|
+
cb.append_text("item7 item7 item7 item7")
|
43
|
+
cb.append_text("item8 item8 item8")
|
44
|
+
cb.append_text("item9 item9")
|
45
|
+
cb.child.text = "hello world"
|
46
|
+
cb.child.select_region(0, -1)
|
47
|
+
cb.child.set_editable(false)
|
48
|
+
box2.pack_start(cb, :expand => true, :fill => true, :padding => 0)
|
45
49
|
|
46
50
|
check = Gtk::CheckButton.new("Editable")
|
47
|
-
box2.pack_start(check, false, true, 0)
|
51
|
+
box2.pack_start(check, :expand => false, :fill => true, :padding => 0)
|
48
52
|
check.signal_connect("toggled") do
|
49
|
-
cb.
|
53
|
+
cb.child.set_editable(check.active?)
|
50
54
|
entry.set_editable(check.active?)
|
51
55
|
end
|
52
|
-
check.
|
56
|
+
check.set_state_flags(Gtk::StateFlags::NORMAL, true)
|
57
|
+
## Run this code to see all of GtkStateFlags ##
|
58
|
+
# Gtk::StateFlags.constants.each do |i|
|
59
|
+
# p i
|
60
|
+
# end
|
53
61
|
|
54
|
-
box1.pack_start(Gtk::
|
62
|
+
box1.pack_start(Gtk::Separator.new(:horizontal))
|
55
63
|
|
56
|
-
box2 = Gtk::
|
64
|
+
box2 = Gtk::Box.new(:vertical, 10)
|
57
65
|
box2.border_width = 10
|
58
66
|
box1.pack_start(box2)
|
59
67
|
|
60
|
-
button = Gtk::Button.new("close")
|
68
|
+
button = Gtk::Button.new(:label => "close")
|
61
69
|
button.signal_connect("clicked") do
|
62
70
|
Gtk.main_quit
|
63
71
|
end
|
data/sample/misc/combobox.rb
CHANGED
@@ -8,21 +8,21 @@
|
|
8
8
|
$Id: combobox.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $
|
9
9
|
=end
|
10
10
|
|
11
|
-
require
|
11
|
+
require "gtk3"
|
12
12
|
|
13
|
-
if str = Gtk.check_version(
|
14
|
-
puts "This sample requires GTK+
|
13
|
+
if str = Gtk.check_version(3, 10, 7)
|
14
|
+
puts "This sample requires GTK+ 3.10.7 or later"
|
15
15
|
puts str
|
16
16
|
exit
|
17
17
|
end
|
18
18
|
|
19
19
|
window = Gtk::Window.new("Gtk::ComboBox sample")
|
20
|
-
window.signal_connect("destroy"){Gtk.main_quit}
|
20
|
+
window.signal_connect("destroy") {Gtk.main_quit}
|
21
21
|
|
22
22
|
#
|
23
23
|
# Text only
|
24
24
|
#
|
25
|
-
combo1 = Gtk::
|
25
|
+
combo1 = Gtk::ComboBoxText.new
|
26
26
|
["foo", "bar", "fuga", "hoge"].each do |val|
|
27
27
|
combo1.append_text(val)
|
28
28
|
end
|
@@ -40,11 +40,11 @@ model = Gtk::ListStore.new(Gdk::Pixbuf, String)
|
|
40
40
|
[Gtk::Stock::CANCEL, "cancel"],
|
41
41
|
[Gtk::Stock::OK, "ok"]].each do |stock, name|
|
42
42
|
iter = model.append
|
43
|
-
iter[0] = window.
|
43
|
+
iter[0] = window.render_icon_pixbuf(stock, Gtk::IconSize::IconSize::MENU)
|
44
44
|
iter[1] = name
|
45
45
|
end
|
46
46
|
|
47
|
-
combo2 = Gtk::ComboBox.new(model)
|
47
|
+
combo2 = Gtk::ComboBox.new(:model => model)
|
48
48
|
|
49
49
|
# column 1
|
50
50
|
renderer = Gtk::CellRendererPixbuf.new
|
@@ -65,7 +65,7 @@ end
|
|
65
65
|
#
|
66
66
|
# Gtk::ComboBoxEntry
|
67
67
|
#
|
68
|
-
combo3 = Gtk::
|
68
|
+
combo3 = Gtk::ComboBoxText.new(:entry => true)
|
69
69
|
["foo", "bar", "fuga", "hoge"].each do |val|
|
70
70
|
combo3.append_text(val)
|
71
71
|
end
|
@@ -76,11 +76,10 @@ combo3.signal_connect("changed") do
|
|
76
76
|
p "combo3: #{combo3.active}, #{combo3.active_iter[0]}"
|
77
77
|
end
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
# Show main window
|
81
|
-
vbox = Gtk::
|
81
|
+
vbox = Gtk::Box.new(:vertical)
|
82
82
|
vbox.add(combo1).add(combo2).add(combo3)
|
83
83
|
window.add(vbox).show_all
|
84
84
|
|
85
85
|
Gtk.main
|
86
|
-
|