gtk3 3.0.9-x86-mingw32 → 3.1.0-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/rb-gtk3-private.h +1 -0
- data/ext/gtk3/rb-gtk3-spin-button.c +85 -0
- data/ext/gtk3/rb-gtk3.c +3 -0
- data/lib/2.2/gtk3.so +0 -0
- data/lib/2.3/gtk3.so +0 -0
- data/lib/gtk3/deprecated.rb +0 -8
- data/lib/gtk3/loader.rb +1 -7
- data/lib/gtk3/tree-model.rb +2 -0
- data/sample/gtk-demo/TODO +10 -10
- data/sample/gtk-demo/assistant.rb +44 -39
- data/sample/gtk-demo/builder.rb +71 -50
- data/sample/gtk-demo/button_box.rb +39 -28
- data/sample/gtk-demo/clipboard.rb +139 -46
- data/sample/gtk-demo/colorsel.rb +50 -36
- data/sample/gtk-demo/css_accordion.rb +18 -17
- data/sample/gtk-demo/css_basics.rb +60 -47
- data/sample/gtk-demo/css_multiplebgs.rb +92 -71
- data/sample/gtk-demo/css_pixbufs.rb +61 -48
- data/sample/gtk-demo/css_shadows.rb +63 -50
- data/sample/gtk-demo/cursors.rb +95 -64
- data/sample/gtk-demo/dialog.rb +95 -78
- data/sample/gtk-demo/drawingarea.rb +138 -171
- data/sample/gtk-demo/editable_cells.rb +169 -130
- data/sample/gtk-demo/entry_buffer.rb +15 -13
- data/sample/gtk-demo/entry_completion.rb +22 -17
- data/sample/gtk-demo/expander.rb +39 -31
- data/sample/gtk-demo/filtermodel.rb +67 -63
- data/sample/gtk-demo/font_features.rb +91 -60
- data/sample/gtk-demo/glarea.rb +277 -0
- data/sample/gtk-demo/headerbar.rb +17 -15
- data/sample/gtk-demo/hypertext.rb +146 -167
- data/sample/gtk-demo/iconview.rb +132 -91
- data/sample/gtk-demo/iconview_edit.rb +49 -38
- data/sample/gtk-demo/infobar.rb +81 -62
- data/sample/gtk-demo/links.rb +35 -30
- data/sample/gtk-demo/list_store.rb +169 -114
- data/sample/gtk-demo/listbox.rb +183 -0
- data/sample/gtk-demo/main.rb +32 -21
- data/sample/gtk-demo/markup.rb +65 -52
- data/sample/gtk-demo/menus.rb +57 -58
- data/sample/gtk-demo/modelbutton.rb +11 -9
- data/sample/gtk-demo/modelbutton.ui +3 -0
- data/sample/gtk-demo/overlay.rb +39 -32
- data/sample/gtk-demo/overlay2.rb +68 -54
- data/sample/gtk-demo/panes.rb +56 -68
- data/sample/gtk-demo/pickers.rb +46 -45
- data/sample/gtk-demo/pixbufs.rb +27 -25
- data/sample/gtk-demo/popover.rb +70 -63
- data/sample/gtk-demo/printing.rb +94 -69
- data/sample/gtk-demo/revealer.rb +46 -38
- data/sample/gtk-demo/rotated_text.rb +75 -54
- data/sample/gtk-demo/scale.rb +10 -8
- data/sample/gtk-demo/search_entry.rb +195 -0
- data/sample/gtk-demo/search_entry2.rb +71 -59
- data/sample/gtk-demo/sidebar.rb +20 -19
- data/sample/gtk-demo/sizegroup.rb +36 -35
- data/sample/gtk-demo/spinbutton.rb +128 -0
- data/sample/gtk-demo/spinner.rb +55 -40
- data/sample/gtk-demo/stack.rb +11 -8
- data/sample/gtk-demo/textmask.rb +14 -13
- data/sample/gtk-demo/textscroll.rb +16 -12
- data/sample/gtk-demo/theming_style_classes.rb +14 -12
- data/sample/gtk-demo/transparent.rb +17 -13
- data/sample/misc/treemodelfilter.rb +1 -1
- metadata +24 -19
data/sample/gtk-demo/main.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Copyright (C) 2006-
|
3
|
+
# Copyright (C) 2006-2016 Ruby-GNOME2 Project Team
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -128,10 +128,10 @@ def get_demo_name_from_filename(filename)
|
|
128
128
|
File.basename(filename, ".rb").tr("-", "_")
|
129
129
|
end
|
130
130
|
|
131
|
-
def
|
131
|
+
def get_class_name_from_filename(filename)
|
132
132
|
pattern = get_demo_name_from_filename(filename)
|
133
|
-
|
134
|
-
|
133
|
+
class_name = pattern.split("_").map(&:capitalize).join
|
134
|
+
class_name << "Demo"
|
135
135
|
end
|
136
136
|
|
137
137
|
def list_demos(source, is_child = false)
|
@@ -173,20 +173,30 @@ def get_demo_filename_from_name(name)
|
|
173
173
|
end
|
174
174
|
|
175
175
|
def run_demo_from_file(filename, window)
|
176
|
-
|
176
|
+
class_name = get_class_name_from_filename(filename)
|
177
177
|
|
178
|
-
unless
|
179
|
-
|
180
|
-
|
178
|
+
require filename unless Object.const_defined?(class_name)
|
179
|
+
|
180
|
+
klass = Object.const_get(class_name)
|
181
|
+
demo = klass.new(window)
|
182
|
+
demo_window = demo.run
|
181
183
|
|
182
|
-
|
183
|
-
|
184
|
+
if demo_window && demo_window.is_a?(Gtk::Window)
|
185
|
+
demo_window.set_transient_for(window)
|
186
|
+
demo_window.modal = true
|
187
|
+
end
|
188
|
+
demo_window
|
189
|
+
end
|
184
190
|
|
185
|
-
|
186
|
-
|
187
|
-
|
191
|
+
def select_treeview_item(treeview, filename)
|
192
|
+
to_select = nil
|
193
|
+
treeview.model.each do |model, path, iter|
|
194
|
+
if iter[FILENAME_COLUMN] == filename
|
195
|
+
to_select = path
|
196
|
+
break
|
197
|
+
end
|
188
198
|
end
|
189
|
-
|
199
|
+
treeview.set_cursor(to_select, treeview.columns[FILENAME_COLUMN])
|
190
200
|
end
|
191
201
|
|
192
202
|
class Demo < Gtk::Application
|
@@ -210,8 +220,7 @@ class Demo < Gtk::Application
|
|
210
220
|
"comments" => "Program to demonstrate GTK+ widgets",
|
211
221
|
"authors" => ["The GTK+ Team"],
|
212
222
|
"logo_icon_name" => "gtk3-demo",
|
213
|
-
"title" => "About GTK+ Demo"
|
214
|
-
)
|
223
|
+
"title" => "About GTK+ Demo")
|
215
224
|
end
|
216
225
|
|
217
226
|
add_action(action)
|
@@ -235,8 +244,7 @@ class Demo < Gtk::Application
|
|
235
244
|
"foreground" => "ForestGreen")
|
236
245
|
@source_buffer.create_tag("string",
|
237
246
|
"foreground" => "RosyBrown",
|
238
|
-
"weight" => Pango::FontDescription::WEIGHT_BOLD
|
239
|
-
)
|
247
|
+
"weight" => Pango::FontDescription::WEIGHT_BOLD)
|
240
248
|
@source_buffer.create_tag("reserved",
|
241
249
|
"foreground" => "purple")
|
242
250
|
end
|
@@ -338,7 +346,7 @@ class Demo < Gtk::Application
|
|
338
346
|
|
339
347
|
@menu.show_all
|
340
348
|
|
341
|
-
scrollbar.signal_connect "popup-menu" do |
|
349
|
+
scrollbar.signal_connect "popup-menu" do |_widget, _button, _activate_time|
|
342
350
|
@menu.popup(nil, nil, 0, Gtk.current_event_time)
|
343
351
|
end
|
344
352
|
|
@@ -365,7 +373,10 @@ class Demo < Gtk::Application
|
|
365
373
|
|
366
374
|
if @options[:name]
|
367
375
|
filename = get_demo_filename_from_name(@options[:name])
|
368
|
-
|
376
|
+
if filename
|
377
|
+
select_treeview_item(@treeview, filename)
|
378
|
+
run_demo_from_file(filename, windows.first)
|
379
|
+
end
|
369
380
|
end
|
370
381
|
|
371
382
|
if @options[:autoquit]
|
@@ -436,7 +447,7 @@ class Demo < Gtk::Application
|
|
436
447
|
end
|
437
448
|
|
438
449
|
def fontify(start_iter = @source_buffer.start_iter,
|
439
|
-
|
450
|
+
end_iter = @source_buffer.end_iter)
|
440
451
|
str = @source_buffer.get_text(start_iter, end_iter, true)
|
441
452
|
tokenizer = RubyTokenizer.new
|
442
453
|
tokenizer.tokenize(str, start_iter.offset) do |tag, start, last|
|
data/sample/gtk-demo/markup.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (c) 2015-2016 Ruby-GNOME2 Project Team
|
2
2
|
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
3
|
#
|
4
4
|
=begin
|
@@ -10,28 +10,73 @@ that Gtk::TextBuffer can load Pango markup and automatically generate
|
|
10
10
|
suitable tags.
|
11
11
|
|
12
12
|
=end
|
13
|
-
|
13
|
+
class MarkupDemo
|
14
|
+
def initialize(main_window)
|
15
|
+
@window = Gtk::Window.new(:toplevel)
|
16
|
+
@window.screen = main_window.screen
|
17
|
+
@window.title = "Markup"
|
18
|
+
@window.set_default_size(450, 450)
|
19
|
+
|
20
|
+
initialize_stack
|
21
|
+
initialize_show_source
|
22
|
+
initialize_headerbar
|
23
|
+
|
24
|
+
sw = generate_sourceview
|
25
|
+
@view = sw.child
|
26
|
+
@stack.add_named(sw, "formatted")
|
27
|
+
|
28
|
+
sw = generate_sourceview
|
29
|
+
@view2 = sw.child
|
30
|
+
@stack.add_named(sw, "source")
|
31
|
+
|
32
|
+
populate_sourceviews
|
33
|
+
end
|
14
34
|
|
15
|
-
def
|
16
|
-
window
|
17
|
-
|
18
|
-
|
35
|
+
def run
|
36
|
+
if !@window.visible?
|
37
|
+
@window.show_all
|
38
|
+
else
|
39
|
+
@window.destroy
|
40
|
+
end
|
41
|
+
end
|
19
42
|
|
20
|
-
|
21
|
-
stack.show
|
22
|
-
window.add(stack)
|
43
|
+
private
|
23
44
|
|
24
|
-
|
25
|
-
|
45
|
+
def initialize_stack
|
46
|
+
@stack = Gtk::Stack.new
|
47
|
+
@stack.show
|
48
|
+
@window.add(@stack)
|
49
|
+
end
|
26
50
|
|
51
|
+
def initialize_headerbar
|
27
52
|
header = Gtk::HeaderBar.new
|
28
|
-
header.pack_start(show_source)
|
53
|
+
header.pack_start(@show_source)
|
29
54
|
header.show_close_button = true
|
30
55
|
header.show_all
|
31
|
-
window.titlebar = header
|
56
|
+
@window.titlebar = header
|
57
|
+
end
|
58
|
+
|
59
|
+
def show_source_toggled_signal
|
60
|
+
@show_source.signal_connect "toggled" do |button|
|
61
|
+
if button.active?
|
62
|
+
@stack.visible_child_name = "source"
|
63
|
+
else
|
64
|
+
buffer = @view2.buffer
|
65
|
+
markup = buffer.get_text(buffer.start_iter, buffer.end_iter, false)
|
66
|
+
buffer = @view.buffer
|
67
|
+
buffer.insert_markup(buffer.start_iter, markup, -1)
|
68
|
+
@stack.visible_child_name = "formatted"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
32
72
|
|
33
|
-
|
73
|
+
def initialize_show_source
|
74
|
+
@show_source = Gtk::CheckButton.new("Source")
|
75
|
+
@show_source.valign = :center
|
76
|
+
show_source_toggled_signal
|
77
|
+
end
|
34
78
|
|
79
|
+
def generate_sourceview
|
35
80
|
view = Gtk::TextView.new
|
36
81
|
view.wrap_mode = :word
|
37
82
|
view.left_margin = 10
|
@@ -42,50 +87,18 @@ module MarkupDemo
|
|
42
87
|
|
43
88
|
sw.add(view)
|
44
89
|
sw.show_all
|
90
|
+
sw
|
91
|
+
end
|
45
92
|
|
46
|
-
|
47
|
-
|
48
|
-
view2 = Gtk::TextView.new
|
49
|
-
view2.wrap_mode = :word
|
50
|
-
view2.left_margin = 10
|
51
|
-
view2.right_margin = 10
|
52
|
-
|
53
|
-
sw = Gtk::ScrolledWindow.new(nil, nil)
|
54
|
-
sw.set_policy(:automatic, :automatic)
|
55
|
-
|
56
|
-
sw.add(view2)
|
57
|
-
sw.show_all
|
58
|
-
|
59
|
-
stack.add_named(sw, "source")
|
60
|
-
|
93
|
+
def populate_sourceviews
|
61
94
|
markup = Gio::Resources.lookup_data("/markup/markup.txt", 0)
|
62
95
|
|
63
|
-
|
64
|
-
if button.active?
|
65
|
-
stack.visible_child_name = "source"
|
66
|
-
else
|
67
|
-
buffer = view2.buffer
|
68
|
-
markup = buffer.get_text(buffer.start_iter,
|
69
|
-
buffer.end_iter,
|
70
|
-
false)
|
71
|
-
buffer = view.buffer
|
72
|
-
buffer.insert_markup(buffer.start_iter, markup, -1)
|
73
|
-
stack.visible_child_name = "formatted"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
buffer = view.buffer
|
96
|
+
buffer = @view.buffer
|
78
97
|
buffer.insert_markup(buffer.start_iter, markup, -1)
|
79
98
|
|
80
|
-
buffer = view2.buffer
|
99
|
+
buffer = @view2.buffer
|
81
100
|
buffer.insert(buffer.start_iter, markup)
|
82
101
|
|
83
|
-
stack.show
|
84
|
-
|
85
|
-
if !window.visible?
|
86
|
-
window.show_all
|
87
|
-
else
|
88
|
-
window.destroy
|
89
|
-
end
|
102
|
+
@stack.show
|
90
103
|
end
|
91
104
|
end
|
data/sample/gtk-demo/menus.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (c) 2015-2016 Ruby-GNOME2 Project Team
|
2
2
|
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
3
|
#
|
4
4
|
=begin
|
@@ -23,83 +23,52 @@
|
|
23
23
|
up when the menu item is selected. Typically, all menu items in a menu bar
|
24
24
|
have submenus.
|
25
25
|
=end
|
26
|
-
|
27
|
-
def
|
28
|
-
window = Gtk::Window.new(:toplevel)
|
29
|
-
window.screen = main_window.screen
|
30
|
-
window.title = "Menus"
|
26
|
+
class MenusDemo
|
27
|
+
def initialize(main_window)
|
28
|
+
@window = Gtk::Window.new(:toplevel)
|
29
|
+
@window.screen = main_window.screen
|
30
|
+
@window.title = "Menus"
|
31
|
+
@window.border_width = 0
|
31
32
|
|
32
33
|
accel_group = Gtk::AccelGroup.new
|
33
|
-
window.add_accel_group(accel_group)
|
34
|
-
window.border_width = 0
|
34
|
+
@window.add_accel_group(accel_group)
|
35
35
|
|
36
36
|
box = Gtk::Box.new(:horizontal, 0)
|
37
|
-
window.add(box)
|
38
|
-
box.show
|
37
|
+
@window.add(box)
|
39
38
|
|
40
39
|
box1 = Gtk::Box.new(:horizontal, 0)
|
41
40
|
box.add(box1)
|
42
|
-
box1.show
|
43
41
|
|
44
|
-
menubar = Gtk::MenuBar.new
|
45
|
-
menubar.expand = true
|
46
|
-
box1.pack_start(menubar, :expand => false, :fill => true, :padding => 0)
|
47
|
-
menubar.show
|
42
|
+
@menubar = Gtk::MenuBar.new
|
43
|
+
@menubar.expand = true
|
44
|
+
box1.pack_start(@menubar, :expand => false, :fill => true, :padding => 0)
|
48
45
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
menuitem.submenu = menu
|
53
|
-
menubar.append(menuitem)
|
54
|
-
menuitem.show
|
55
|
-
|
56
|
-
menuitem = Gtk::MenuItem.new(:label => "foo")
|
57
|
-
menuitem.submenu = create_menu(3)
|
58
|
-
menubar.append(menuitem)
|
59
|
-
menuitem.show
|
60
|
-
|
61
|
-
menuitem = Gtk::MenuItem.new(:label => "bar")
|
62
|
-
menuitem.submenu = create_menu(4)
|
63
|
-
menubar.append(menuitem)
|
64
|
-
menuitem.show
|
46
|
+
{ "test\nline2" => 2, "foo" => 3, "bar" => 4 }.each do |k, v|
|
47
|
+
create_menu_item(k, v)
|
48
|
+
end
|
65
49
|
|
66
50
|
box2 = Gtk::Box.new(:vertical, 10)
|
67
51
|
box2.border_width = 10
|
68
52
|
box1.pack_start(box2, :expand => false, :fill => true, :padding => 0)
|
69
|
-
box2.show
|
70
|
-
|
71
|
-
button = Gtk::Button.new(:label => "Flip")
|
72
|
-
button.signal_connect("clicked") do |_widget|
|
73
|
-
parent = menubar.parent
|
74
|
-
orientation = parent.orientation.to_i
|
75
|
-
parent.orientation = 1 - orientation
|
76
53
|
|
77
|
-
|
78
|
-
menubar.set_property("pack-direction", Gtk::PackDirection::TTB)
|
79
|
-
else
|
80
|
-
menubar.set_property("pack-direction", Gtk::PackDirection::LTR)
|
81
|
-
end
|
82
|
-
end
|
54
|
+
button = generate_flip_button
|
83
55
|
box2.pack_start(button, :expand => true, :fill => true, :padding => 0)
|
84
|
-
button
|
85
|
-
button = Gtk::Button.new(:label => "Close")
|
86
|
-
button.signal_connect("clicked") do |_widget|
|
87
|
-
window.destroy
|
88
|
-
end
|
56
|
+
button = generate_close_button
|
89
57
|
box2.pack_start(button, :expand => true, :fill => true, :padding => 0)
|
90
|
-
|
91
|
-
button.grab_default
|
92
|
-
button.show
|
58
|
+
end
|
93
59
|
|
94
|
-
|
95
|
-
|
60
|
+
def run
|
61
|
+
if !@window.visible?
|
62
|
+
@window.show_all
|
96
63
|
else
|
97
|
-
window.destroy
|
64
|
+
@window.destroy
|
98
65
|
end
|
99
|
-
window
|
66
|
+
@window
|
100
67
|
end
|
101
68
|
|
102
|
-
|
69
|
+
private
|
70
|
+
|
71
|
+
def create_menu(depth)
|
103
72
|
return nil if depth < 1
|
104
73
|
|
105
74
|
menu = Gtk::Menu.new
|
@@ -111,11 +80,41 @@ module MenusDemo
|
|
111
80
|
menu_item.join_group(last_item) if last_item
|
112
81
|
last_item = menu_item
|
113
82
|
menu.append(menu_item)
|
114
|
-
menu_item.show
|
115
83
|
menu_item.sensitive = false if i == 3
|
116
84
|
menu_item.submenu = create_menu(depth - 1)
|
117
85
|
end
|
118
86
|
|
119
87
|
menu
|
120
88
|
end
|
89
|
+
|
90
|
+
def create_menu_item(label, depth)
|
91
|
+
menuitem = Gtk::MenuItem.new(:label => label)
|
92
|
+
menuitem.submenu = create_menu(depth)
|
93
|
+
@menubar.append(menuitem)
|
94
|
+
end
|
95
|
+
|
96
|
+
def generate_flip_button
|
97
|
+
button = Gtk::Button.new(:label => "Flip")
|
98
|
+
button.signal_connect("clicked") do |_widget|
|
99
|
+
parent = @menubar.parent
|
100
|
+
orientation = parent.orientation.to_i
|
101
|
+
parent.orientation = 1 - orientation
|
102
|
+
|
103
|
+
if orientation == Gtk::Orientation::VERTICAL
|
104
|
+
@menubar.set_property("pack-direction", Gtk::PackDirection::TTB)
|
105
|
+
else
|
106
|
+
@menubar.set_property("pack-direction", Gtk::PackDirection::LTR)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
button
|
111
|
+
end
|
112
|
+
|
113
|
+
def generate_close_button
|
114
|
+
button = Gtk::Button.new(:label => "Close")
|
115
|
+
button.signal_connect("clicked") { @window.destroy }
|
116
|
+
button.can_default = true
|
117
|
+
button.grab_default
|
118
|
+
button
|
119
|
+
end
|
121
120
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2008-
|
1
|
+
# Copyright (c) 2008-2016 Ruby-GNOME2 Project Team
|
2
2
|
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
3
|
#
|
4
4
|
=begin
|
@@ -15,8 +15,8 @@ case, you should set the "role" attribute yourself, and connect to the
|
|
15
15
|
A common use of GtkModelButton is to implement menu-like content
|
16
16
|
in popovers.
|
17
17
|
=end
|
18
|
-
|
19
|
-
def
|
18
|
+
class ModelbuttonDemo
|
19
|
+
def initialize(main_window)
|
20
20
|
builder = Gtk::Builder.new(:resource => "/modelbutton/modelbutton.ui")
|
21
21
|
|
22
22
|
builder.connect_signals do |name|
|
@@ -26,8 +26,8 @@ module ModelbuttonDemo
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
|
-
window = builder["window1"]
|
30
|
-
window.screen = main_window.screen
|
29
|
+
@window = builder["window1"]
|
30
|
+
@window.screen = main_window.screen
|
31
31
|
actions = Gio::SimpleActionGroup.new
|
32
32
|
actions.add_actions([
|
33
33
|
{ :name => "color", :parameter_type => "s", :state => "'red'" },
|
@@ -36,12 +36,14 @@ module ModelbuttonDemo
|
|
36
36
|
{ :name => "sprinkles" }
|
37
37
|
])
|
38
38
|
|
39
|
-
window.insert_action_group("win", actions)
|
39
|
+
@window.insert_action_group("win", actions)
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
def run
|
43
|
+
if !@window.visible?
|
44
|
+
@window.show_all
|
43
45
|
else
|
44
|
-
window.destroy
|
46
|
+
@window.destroy
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|