gtk3 3.0.7 → 3.0.8
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 +1 -0
- data/ext/gtk3/rb-gtk3-tree-view.c +4 -0
- data/ext/gtk3/rb-gtk3.c +245 -60
- data/lib/gtk3/box.rb +22 -0
- data/lib/gtk3/builder.rb +50 -29
- data/lib/gtk3/deprecated.rb +7 -0
- data/lib/gtk3/entry-buffer.rb +28 -0
- data/lib/gtk3/list-store.rb +2 -20
- data/lib/gtk3/loader.rb +6 -0
- data/lib/gtk3/menu-item.rb +8 -7
- data/lib/gtk3/tree-iter.rb +25 -1
- data/lib/gtk3/tree-model.rb +41 -0
- data/lib/gtk3/tree-store.rb +7 -6
- data/lib/gtk3/widget.rb +18 -1
- data/sample/gtk-demo/TODO +45 -39
- data/sample/gtk-demo/assistant.rb +123 -0
- data/sample/gtk-demo/builder.rb +75 -38
- data/sample/gtk-demo/button_box.rb +100 -0
- data/sample/gtk-demo/colorsel.rb +49 -65
- data/sample/gtk-demo/css_accordion.rb +33 -55
- data/sample/gtk-demo/css_basics.rb +55 -80
- data/sample/gtk-demo/css_multiplebgs.rb +112 -0
- data/sample/gtk-demo/css_pixbufs.rb +84 -0
- data/sample/gtk-demo/css_shadows.rb +101 -0
- data/sample/gtk-demo/cursors.rb +114 -0
- data/sample/gtk-demo/dialog.rb +105 -115
- data/sample/gtk-demo/entry_buffer.rb +44 -0
- data/sample/gtk-demo/entry_completion.rb +40 -52
- data/sample/gtk-demo/expander.rb +60 -26
- data/sample/gtk-demo/filtermodel.rb +119 -0
- data/sample/gtk-demo/font_features.rb +117 -0
- data/sample/gtk-demo/headerbar.rb +57 -0
- data/sample/gtk-demo/iconview_edit.rb +79 -0
- data/sample/gtk-demo/infobar.rb +75 -59
- data/sample/gtk-demo/links.rb +53 -40
- data/sample/gtk-demo/main.rb +353 -43
- data/sample/gtk-demo/main.ui +9 -9
- data/sample/gtk-demo/markup.rb +46 -0
- data/sample/gtk-demo/menus.rb +111 -162
- data/sample/gtk-demo/modelbutton.rb +47 -0
- data/sample/gtk-demo/overlay.rb +61 -0
- data/sample/gtk-demo/overlay2.rb +75 -0
- data/sample/gtk-demo/panes.rb +114 -133
- data/sample/gtk-demo/pickers.rb +70 -0
- data/sample/gtk-demo/popover.rb +110 -0
- data/sample/gtk-demo/printing.rb +68 -83
- data/sample/gtk-demo/revealer.rb +53 -0
- data/sample/gtk-demo/scale.rb +26 -0
- data/sample/gtk-demo/search_entry2.rb +107 -0
- data/sample/gtk-demo/sidebar.rb +68 -0
- data/sample/gtk-demo/sizegroup.rb +93 -105
- data/sample/gtk-demo/spinner.rb +53 -50
- data/sample/gtk-demo/stack.rb +28 -0
- data/sample/gtk-demo/test_mod.rb +22 -0
- data/sample/gtk-demo/textmask.rb +61 -0
- data/sample/gtk-demo/theming_style_classes.rb +16 -12
- data/sample/misc/app-menu.ui +19 -0
- data/sample/misc/button-menu.ui +19 -0
- data/sample/misc/icons-theme-viewer.rb +65 -0
- data/sample/misc/menu.rb +3 -3
- data/sample/misc/menus_from_resources.gresource.xml +8 -0
- data/sample/misc/menus_from_resources.rb +91 -0
- data/sample/misc/statusicon.rb +1 -1
- data/sample/misc/toolbar-menu.ui +23 -0
- data/sample/misc/treestore.rb +63 -0
- data/sample/tutorial/README.md +368 -6
- data/test/test-gtk-box.rb +13 -0
- data/test/test-gtk-builder.rb +1 -1
- data/test/test-gtk-clipboard.rb +124 -0
- data/test/test-gtk-container.rb +3 -3
- data/test/test-gtk-entry-buffer.rb +32 -0
- data/test/test-gtk-list-store.rb +30 -12
- data/test/test-gtk-menu.rb +32 -0
- data/test/test-gtk-tree-iter.rb +61 -5
- data/test/test-gtk-tree-path.rb +26 -1
- data/test/test-gtk-tree-sortable.rb +35 -0
- data/test/test-gtk-tree-store.rb +34 -0
- data/test/test-gtk-widget.rb +33 -2
- metadata +55 -19
- data/sample/gtk-demo/button-box.rb +0 -82
@@ -1,118 +1,106 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
2
2
|
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
3
|
#
|
4
|
-
# $Id: sizegroup.rb,v 1.5 2005/02/12 23:02:43 kzys Exp $
|
5
4
|
=begin
|
6
|
-
=
|
7
|
-
|
8
|
-
|
9
|
-
widgets together so they all request the same amount of space.
|
10
|
-
This is typically useful when you want a column of widgets to
|
11
|
-
have the same size, but you can't use a
|
12
|
-
|
13
|
-
Note that size groups only affect the amount of space requested,
|
14
|
-
not the size that the widgets finally receive. If you want the
|
15
|
-
widgets in a
|
16
|
-
to pack them in such a way that they get the size they request
|
17
|
-
and not more. For example, if you are packing your widgets
|
18
|
-
into a table, you would not include the
|
5
|
+
= Size Groups
|
6
|
+
|
7
|
+
GtkSizeGroup provides a mechanism for grouping a number of
|
8
|
+
widgets together so they all request the same amount of space.
|
9
|
+
This is typically useful when you want a column of widgets to
|
10
|
+
have the same size, but you can't use a GtkTable widget.
|
11
|
+
|
12
|
+
Note that size groups only affect the amount of space requested,
|
13
|
+
not the size that the widgets finally receive. If you want the
|
14
|
+
widgets in a GtkSizeGroup to actually be the same size, you need
|
15
|
+
to pack them in such a way that they get the size they request
|
16
|
+
and not more. For example, if you are packing your widgets
|
17
|
+
into a table, you would not include the GTK_FILL flag.
|
19
18
|
=end
|
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
|
-
check_button.set_active(true)
|
75
|
-
check_button.signal_connect('toggled', size_group) do |check_button, size_group|
|
76
|
-
new_mode = if check_button.active?
|
77
|
-
Gtk::SizeGroup::HORIZONTAL
|
78
|
-
else
|
79
|
-
Gtk::SizeGroup::VERTICAL
|
80
|
-
end
|
81
|
-
size_group.set_mode(new_mode)
|
19
|
+
module SizegroupDemo
|
20
|
+
def self.run_demo(main_window)
|
21
|
+
color_options = %w(Red Green Blue)
|
22
|
+
dash_options = %w(Solid Dashed Dotted)
|
23
|
+
end_options = %w(Square Round Double Arrow)
|
24
|
+
|
25
|
+
window = Gtk::Window.new(:toplevel)
|
26
|
+
window.screen = main_window.screen
|
27
|
+
window.set_title("Size Groups")
|
28
|
+
window.set_resizable(false)
|
29
|
+
|
30
|
+
vbox = Gtk::Box.new(:vertical, 5)
|
31
|
+
window.add(vbox)
|
32
|
+
vbox.set_border_width(5)
|
33
|
+
|
34
|
+
size_group = Gtk::SizeGroup.new(:horizontal)
|
35
|
+
|
36
|
+
# Create one frame holding color options
|
37
|
+
frame = Gtk::Frame.new("Color Options")
|
38
|
+
vbox.pack_start(frame, :expand => true, :fill => true, :padding => 0)
|
39
|
+
|
40
|
+
table = Gtk::Grid.new
|
41
|
+
table.set_border_width(5)
|
42
|
+
table.set_row_spacing(5)
|
43
|
+
table.set_column_spacing(10)
|
44
|
+
frame.add(table)
|
45
|
+
|
46
|
+
add_row(table, 0, size_group, "_Foreground", color_options)
|
47
|
+
add_row(table, 1, size_group, "_Background", color_options)
|
48
|
+
|
49
|
+
# And another frame holding line style options
|
50
|
+
frame = Gtk::Frame.new("Line options")
|
51
|
+
vbox.pack_start(frame, :expand => false, :fill => false, :padding => 0)
|
52
|
+
|
53
|
+
table = Gtk::Grid.new
|
54
|
+
table.set_border_width(5)
|
55
|
+
table.set_row_spacing(5)
|
56
|
+
table.set_column_spacing(10)
|
57
|
+
frame.add(table)
|
58
|
+
|
59
|
+
add_row(table, 0, size_group, "_Dashing", dash_options)
|
60
|
+
add_row(table, 1, size_group, "_Line ends", end_options)
|
61
|
+
|
62
|
+
# And a check button to turn grouping on and off
|
63
|
+
check_button = Gtk::CheckButton.new("_Enable grouping")
|
64
|
+
check_button.set_use_underline(true)
|
65
|
+
vbox.pack_start(check_button, :expand => false, :fill => false, :padding => 0)
|
66
|
+
|
67
|
+
check_button.signal_connect("toggled") do |widget|
|
68
|
+
if widget.active?
|
69
|
+
size_group.set_mode(:horizontal)
|
70
|
+
else
|
71
|
+
size_group.set_mode(:none)
|
82
72
|
end
|
83
73
|
end
|
84
74
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
0, 1, row, row + 1,
|
90
|
-
Gtk::EXPAND | Gtk::FILL, 0,
|
91
|
-
0, 0)
|
92
|
-
|
93
|
-
option_menu = create_option_menu(options)
|
94
|
-
label.set_mnemonic_widget(option_menu)
|
95
|
-
size_group.add_widget(option_menu)
|
96
|
-
table.attach(option_menu,
|
97
|
-
1, 2, row, row + 1,
|
98
|
-
0, 0,
|
99
|
-
0, 0)
|
75
|
+
if !window.visible?
|
76
|
+
window.show_all
|
77
|
+
else
|
78
|
+
window.destroy
|
100
79
|
end
|
80
|
+
window
|
81
|
+
end
|
101
82
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
83
|
+
def self.add_row(table, row, size_group, label_text, options)
|
84
|
+
label = Gtk::Label.new(label_text, :use_underline => true)
|
85
|
+
label.set_halign(:start)
|
86
|
+
label.set_valign(:baseline)
|
87
|
+
label.set_hexpand(true)
|
88
|
+
table.attach(label, 0, row, 1, 1)
|
89
|
+
|
90
|
+
combo_box = create_combo_box(options)
|
91
|
+
label.set_mnemonic_widget(combo_box)
|
92
|
+
combo_box.set_halign(:end)
|
93
|
+
combo_box.set_valign(:baseline)
|
94
|
+
size_group.add_widget(combo_box)
|
95
|
+
table.attach(combo_box, 1, row, 1, 1)
|
96
|
+
end
|
114
97
|
|
115
|
-
|
98
|
+
def self.create_combo_box(options)
|
99
|
+
combo_box = Gtk::ComboBoxText.new
|
100
|
+
options.each do |o|
|
101
|
+
combo_box.append_text(o)
|
116
102
|
end
|
103
|
+
combo_box.set_active(0)
|
104
|
+
combo_box
|
117
105
|
end
|
118
106
|
end
|
data/sample/gtk-demo/spinner.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
2
2
|
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
3
|
#
|
4
4
|
=begin
|
@@ -6,54 +6,57 @@
|
|
6
6
|
|
7
7
|
GtkSpinner allows to show that background activity is on-going.
|
8
8
|
=end
|
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
|
-
button.signal_connect(:clicked) do
|
46
|
-
@spinner_sensitive.start
|
47
|
-
@spinner_insensitive.start
|
48
|
-
end
|
49
|
-
vbox.add button
|
50
|
-
|
51
|
-
button = Gtk::Button.new :stock_id => :media_stop
|
52
|
-
button.signal_connect(:clicked) do
|
53
|
-
@spinner_sensitive.stop
|
54
|
-
@spinner_insensitive.stop
|
55
|
-
end
|
56
|
-
vbox.add button
|
9
|
+
module SpinnerDemo
|
10
|
+
def self.run_demo(main_window)
|
11
|
+
window = Gtk::Dialog.new(:title => "Spinner",
|
12
|
+
:parent => main_window,
|
13
|
+
:flags => nil,
|
14
|
+
:buttons => [[:close, :none]])
|
15
|
+
|
16
|
+
window.set_resizable(false)
|
17
|
+
window.signal_connect("response") { window.destroy }
|
18
|
+
window.signal_connect("destroy") { window.destroy }
|
19
|
+
|
20
|
+
content_area = window.content_area
|
21
|
+
|
22
|
+
vbox = Gtk::Box.new(:vertical, 5)
|
23
|
+
content_area.pack_start(vbox, :expand => true, :fill => true, :padding => 0)
|
24
|
+
vbox.set_border_width(5)
|
25
|
+
|
26
|
+
# Sensitive
|
27
|
+
hbox = Gtk::Box.new(:horizontal, 5)
|
28
|
+
spinner_sensitive = Gtk::Spinner.new
|
29
|
+
hbox.add(spinner_sensitive)
|
30
|
+
hbox.add(Gtk::Entry.new)
|
31
|
+
vbox.add(hbox)
|
32
|
+
|
33
|
+
# Disabled
|
34
|
+
hbox = Gtk::Box.new(:horizontal, 5)
|
35
|
+
spinner_insensitive = Gtk::Spinner.new
|
36
|
+
hbox.add(spinner_insensitive)
|
37
|
+
hbox.add(Gtk::Entry.new)
|
38
|
+
vbox.add(hbox)
|
39
|
+
hbox.set_sensitive(false)
|
40
|
+
|
41
|
+
button = Gtk::Button.new(:stock_id => :media_play)
|
42
|
+
button.signal_connect "clicked" do
|
43
|
+
spinner_sensitive.start
|
44
|
+
spinner_insensitive.start
|
57
45
|
end
|
46
|
+
vbox.add(button)
|
47
|
+
|
48
|
+
button = Gtk::Button.new(:stock_id => :media_stop)
|
49
|
+
button.signal_connect "clicked" do
|
50
|
+
spinner_sensitive.stop
|
51
|
+
spinner_insensitive.stop
|
52
|
+
end
|
53
|
+
vbox.add(button)
|
54
|
+
|
55
|
+
if !window.visible?
|
56
|
+
window.show_all
|
57
|
+
else
|
58
|
+
window.destroy
|
59
|
+
end
|
60
|
+
window
|
58
61
|
end
|
59
|
-
end
|
62
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
#
|
4
|
+
=begin
|
5
|
+
= Stack
|
6
|
+
|
7
|
+
GtkStack is a container that shows a single child at a time,
|
8
|
+
with nice transitions when the visible child changes.
|
9
|
+
|
10
|
+
GtkStackSwitcher adds buttons to control which child is visible.
|
11
|
+
=end
|
12
|
+
|
13
|
+
module StackDemo
|
14
|
+
def self.run_demo(main_window)
|
15
|
+
builder = Gtk::Builder.new(:resource => "/stack/stack.ui")
|
16
|
+
builder.connect_signals {}
|
17
|
+
window = builder["window1"]
|
18
|
+
window.screen = main_window.screen
|
19
|
+
|
20
|
+
window.signal_connect("destroy") { window.destroyed(window) }
|
21
|
+
|
22
|
+
if !window.visible?
|
23
|
+
window.show_all
|
24
|
+
else
|
25
|
+
window.destroy
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright (c) 2008-2015 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
#
|
4
|
+
=begin
|
5
|
+
= test demo
|
6
|
+
|
7
|
+
Demonstrates the demo interface.
|
8
|
+
=end
|
9
|
+
module TestModDemo
|
10
|
+
|
11
|
+
def self.run_demo(window)
|
12
|
+
puts "ok"
|
13
|
+
window = Gtk::Window.new(:toplevel)
|
14
|
+
window.add(Gtk::Label.new("This is a test"))
|
15
|
+
|
16
|
+
if !window.visible?
|
17
|
+
window.show_all
|
18
|
+
else
|
19
|
+
window.destroy
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
2
|
+
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
|
+
#
|
4
|
+
=begin
|
5
|
+
= Pango/Text Mask
|
6
|
+
|
7
|
+
This demo shows how to use PangoCairo to draw text with more than
|
8
|
+
just a single color.
|
9
|
+
=end
|
10
|
+
module TextmaskDemo
|
11
|
+
def self.run_demo(_main_window)
|
12
|
+
window = Gtk::Window.new(:toplevel)
|
13
|
+
window.set_resizable(true)
|
14
|
+
window.set_size_request(400, 200)
|
15
|
+
window.set_title("Text Mask")
|
16
|
+
|
17
|
+
da = Gtk::DrawingArea.new
|
18
|
+
|
19
|
+
window.add(da)
|
20
|
+
|
21
|
+
da.signal_connect "draw" do |_widget, cr|
|
22
|
+
cr.save
|
23
|
+
|
24
|
+
layout = da.create_pango_layout("Pango power!\nPango power!\nPango power!")
|
25
|
+
desc = Pango::FontDescription.new("sans bold 34")
|
26
|
+
layout.font_description = desc
|
27
|
+
|
28
|
+
cr.move_to(30, 20)
|
29
|
+
cr.pango_layout_path(layout)
|
30
|
+
|
31
|
+
pattern = Cairo::LinearPattern.new(0.0, 0.0,
|
32
|
+
da.allocated_width,
|
33
|
+
da.allocated_height)
|
34
|
+
|
35
|
+
pattern.add_color_stop(0.0, 1.0, 0.0, 0.0)
|
36
|
+
pattern.add_color_stop(0.2, 1.0, 0.0, 0.0)
|
37
|
+
pattern.add_color_stop(0.3, 1.0, 1.0, 0.0)
|
38
|
+
pattern.add_color_stop(0.4, 0.0, 1.0, 0.0)
|
39
|
+
pattern.add_color_stop(0.6, 0.0, 1.0, 1.0)
|
40
|
+
pattern.add_color_stop(0.7, 0.0, 0.0, 1.0)
|
41
|
+
pattern.add_color_stop(0.8, 1.0, 0.0, 1.0)
|
42
|
+
pattern.add_color_stop(1.0, 1.0, 0.0, 1.0)
|
43
|
+
cr.set_source(pattern)
|
44
|
+
cr.fill_preserve
|
45
|
+
|
46
|
+
cr.set_source_rgb(0.0, 0.0, 0.0)
|
47
|
+
cr.set_line_width(0.5)
|
48
|
+
cr.stroke
|
49
|
+
cr.restore
|
50
|
+
true
|
51
|
+
end
|
52
|
+
|
53
|
+
if !window.visible?
|
54
|
+
window.show_all
|
55
|
+
else
|
56
|
+
window.destroy
|
57
|
+
end
|
58
|
+
|
59
|
+
window
|
60
|
+
end
|
61
|
+
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# This is licensed under the terms of the GNU Lesser General Public
|
5
5
|
# License, version 2.1 or (at your option) later.
|
6
6
|
#
|
7
|
-
# Copyright (C) 2014 Ruby-GNOME2 Project Team
|
7
|
+
# Copyright (C) 2014-2015 Ruby-GNOME2 Project Team
|
8
8
|
#
|
9
9
|
# This library is free software; you can redistribute it and/or
|
10
10
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -30,19 +30,23 @@ of GTK+ are used for certain effects: primary toolbars,
|
|
30
30
|
inline toolbars and linked buttons.
|
31
31
|
=end
|
32
32
|
|
33
|
-
|
33
|
+
module ThemingStyleClassesDemo
|
34
|
+
def self.run_demo(main_window)
|
35
|
+
window = Gtk::Window.new(:toplevel)
|
36
|
+
window.screen = main_window.screen
|
37
|
+
window.set_title("Style Classes")
|
38
|
+
window.set_border_width(12)
|
34
39
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
self.border_width = 12
|
40
|
+
builder = Gtk::Builder.new(:resource => "/theming_style_classes/theming.ui")
|
41
|
+
grid = builder["grid"]
|
42
|
+
grid.show_all
|
43
|
+
window.add(grid)
|
40
44
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
add(grid)
|
45
|
+
if !window.visible?
|
46
|
+
window.show_all
|
47
|
+
else
|
48
|
+
window.destroy
|
46
49
|
end
|
50
|
+
window
|
47
51
|
end
|
48
52
|
end
|