gtk3 3.1.8-x64-mingw32 → 3.1.9-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d62124c8fb676816866cec2dab51c811c87adb94
4
- data.tar.gz: 4a5b573632c9c17f552c1d63712835720c4d0094
3
+ metadata.gz: 8be6dc339f5c972b0c8fd62d41e28813bab98582
4
+ data.tar.gz: 9b13d7c9fd4dc061b59c4bbcd6e7808f08c9a337
5
5
  SHA512:
6
- metadata.gz: cb95dc065481c514ede4cf49c7a70c6676d310e34c6b808643e84e66066a0cd49b00237cde81433f61ff2cedf7abcd2893d8c678ac1a89c31de7de9cb706a654
7
- data.tar.gz: c82920e19aa408746883d48d87ae515e28c7de2ec2e0bad61a4fe6af75e099abfe0eb7542db0b2d8d3ea803400a653fcd2780985cfbb5758a9eaab080565ae7e
6
+ metadata.gz: ca1e4dfc27ad0a7d6f8a937013c63cb0fd17db0c4fcb30d931a8e577e195c56ddd8bdece88dc32faf74f2721f5ba3e0b2a6ddea8a0b9a90e07a13de491827258
7
+ data.tar.gz: a277fe84fac0145539ec6e1614e41f444241a2e781873dbfb06e432ee0a9926bbb505fb368f8a6bd72fdadb43fd4f8b0f6bee23c6b914288dae6a165f2d905a8
data/lib/2.2/gtk3.so CHANGED
Binary file
data/lib/2.3/gtk3.so CHANGED
Binary file
data/lib/2.4/gtk3.so CHANGED
Binary file
@@ -31,6 +31,16 @@ module Gtk
31
31
  end
32
32
  alias_method :<<, :add
33
33
 
34
+ def add_child(*args, &block)
35
+ if defined?(super)
36
+ super
37
+ else
38
+ add(*args, &block)
39
+ end
40
+ end
41
+
42
+ alias_method :remove_child, :remove
43
+
34
44
  alias_method :focus_chain_raw, :focus_chain
35
45
  def focus_chain
36
46
  set_explicitly, widgets = focus_chain_raw
@@ -93,6 +93,12 @@ module Gtk
93
93
  define_deprecated_singleton_method :idle_remove, :warn => "Use 'GLib::Source.remove'." do |_self, id|
94
94
  GLib::Source.remove(id)
95
95
  end
96
+ define_deprecated_singleton_method :grab_add, :warn => "Use 'Gtk::Widget#grab_add'." do |_self, widget|
97
+ widget.grab_add
98
+ end
99
+ define_deprecated_singleton_method :grab_remove, :warn => "Use 'Gtk::Widget#grab_remove'." do |_self, widget|
100
+ widget.grab_remove
101
+ end
96
102
 
97
103
  class AboutDialog
98
104
  extend GLib::Deprecatable
data/sample/gtk-demo/TODO CHANGED
@@ -55,15 +55,15 @@ transparent.c ok ok
55
55
  images.c ok ok
56
56
  textview.c ok ok
57
57
  event_axes.c ok ok
58
+ combobox.c ok ok
59
+ css_blendmodes.c ok ok
60
+ fishbowl.c ok ok
61
+ flowbox.c ok ok
58
62
 
59
63
  Remains :
60
64
 
61
65
  application.c no no
62
66
  changedisplay.c ok no
63
- combobox.c no no
64
- css_blendmodes.c no no
65
- fishbowl.c no no
66
- flowbox.c no no
67
67
  foreigndrawing no no
68
68
  gestures.c no no
69
69
  shortcuts.c no no
@@ -0,0 +1,281 @@
1
+ # Copyright (c) 2017 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Combo Boxes
6
+
7
+ The GtkComboBox widget allows to select one option out of a list.
8
+ The GtkComboBoxEntry additionally allows the user to enter a value
9
+ that is not in the list of options.
10
+
11
+ How the options are displayed is controlled by cell renderers.
12
+ =end
13
+
14
+ Icon = Struct.new(:name, :label)
15
+ CapitalItem = Struct.new(:group, :name)
16
+
17
+ class ComboboxDemo
18
+ ICON_NAME_COL = 0
19
+ TEXT_COL = 1
20
+
21
+ def initialize(main_window)
22
+ @window = Gtk::Window.new(:toplevel)
23
+ @window.screen = main_window.screen
24
+ @window.title = "Combo Boxes"
25
+ vbox = Gtk::Box.new(:vertical, 2)
26
+ vbox.margin = 10
27
+ @window.add(vbox)
28
+
29
+ # A combobox demonstrating cell renderers, separators and
30
+ # insensitive rows.
31
+
32
+ frame = Gtk::Frame.new("Items with icons")
33
+ vbox.pack_start(frame, :expand => false, :fill => false, :padding => 0)
34
+
35
+ box = Gtk::Box.new(:vertical, 0)
36
+ box.margin = 5
37
+ frame.add(box)
38
+
39
+ store = create_icon_store
40
+ combo = Gtk::ComboBox.new(:model => store)
41
+ box.add(combo)
42
+
43
+ renderer = Gtk::CellRendererPixbuf.new
44
+ combo.pack_start(renderer, false)
45
+ combo.set_attributes(renderer, "icon-name" => ICON_NAME_COL)
46
+
47
+ combo.set_cell_data_func(renderer) do |_layout, cell_renderer, model, iter|
48
+ set_sensitive(cell_renderer, model, iter)
49
+ end
50
+
51
+ renderer = Gtk::CellRendererText.new
52
+ combo.pack_start(renderer, true)
53
+ combo.set_attributes(renderer, "text" => TEXT_COL)
54
+
55
+ combo.set_cell_data_func(renderer) do |_layout, cell_renderer, model, iter|
56
+ set_sensitive(cell_renderer, model, iter)
57
+ end
58
+
59
+ combo.set_row_separator_func do |model, iter|
60
+ separator?(model, iter)
61
+ end
62
+
63
+ combo.active = 0
64
+
65
+ # A combobox demonstrating trees
66
+ frame = Gtk::Frame.new("Where are we?")
67
+ vbox.pack_start(frame, :expand => false, :fill => false, :padding => 0)
68
+
69
+ box = Gtk::Box.new(:vertical, 0)
70
+ box.margin = 5
71
+ frame.add(box)
72
+
73
+ store = create_capital_store
74
+ combo = Gtk::ComboBox.new(:model => store)
75
+ box.add(combo)
76
+
77
+ renderer = Gtk::CellRendererText.new
78
+ combo.pack_start(renderer, true)
79
+ combo.set_attributes(renderer, "text" => 0)
80
+ combo.set_cell_data_func(renderer) do |_layout, cell_renderer, model, iter|
81
+ capital_sensitive?(cell_renderer, model, iter)
82
+ end
83
+
84
+ path = Gtk::TreePath.new([0, 8, -1])
85
+ iter = store.get_iter(path)
86
+ combo.set_active_iter(iter)
87
+
88
+ # A GtkComboBoxEntry with validation
89
+ frame = Gtk::Frame.new("Editable")
90
+ vbox.pack_start(frame, :expand => true, :fill => true, :padding => 0)
91
+ box = Gtk::Box.new(:vertical, 0)
92
+ box.margin = 5
93
+ frame.add(box)
94
+
95
+ combo = Gtk::ComboBoxText.new(:entry => true)
96
+ fill_combo_entry(combo)
97
+ box.add(combo)
98
+
99
+ entry = MaskEntry.new
100
+ entry.mask = "^([0-9]*|One|Two|2\302\275|Three)$"
101
+
102
+ combo.remove_child(combo.child)
103
+ combo.add_child(entry)
104
+
105
+ # A combobox with string IDs
106
+ frame = Gtk::Frame.new("String IDs")
107
+ vbox.pack_start(frame, :expand => false, :fill => false, :padding => 0)
108
+
109
+ box = Gtk::Box.new(:vertical, 0)
110
+ box.margin = 5
111
+ frame.add(box)
112
+
113
+ combo = Gtk::ComboBoxText.new
114
+ combo.append("never", "Not visible")
115
+ combo.append("when-active", "Visible")
116
+ combo.append("always", "Always visible")
117
+ box.add(combo)
118
+
119
+ entry = Gtk::Entry.new
120
+ combo.bind_property("active-id", entry, "text", :bidirectional)
121
+ box.add(entry)
122
+ end
123
+
124
+ def run
125
+ if !@window.visible?
126
+ @window.show_all
127
+ else
128
+ @window.destroy
129
+ end
130
+ @window
131
+ end
132
+
133
+ private
134
+
135
+ def create_icon_store
136
+ icons = []
137
+ icons << Icon.new("dialog-warning", "Warning")
138
+ icons << Icon.new("process-stop", "Stop")
139
+ icons << Icon.new("document-new", "New")
140
+ icons << Icon.new("edit-clear", "Clear")
141
+ icons << Icon.new(nil, nil)
142
+ icons << Icon.new("document-open", "Open")
143
+ model = Gtk::ListStore.new(String, String)
144
+
145
+ icons.each do |icon|
146
+ iter = model.append
147
+ if icon.name
148
+ iter[ICON_NAME_COL] = icon.name
149
+ iter[TEXT_COL] = icon.label
150
+ else
151
+ iter[ICON_NAME_COL] = nil
152
+ iter[TEXT_COL] = "separator"
153
+ end
154
+ end
155
+ model
156
+ end
157
+
158
+ # A GtkCellLayoutDataFunc that demonstrates how one can control
159
+ # sensitivity of rows. This particular function does nothing
160
+ # useful and just makes the second row insensitive.
161
+
162
+ def set_sensitive(cell_renderer, model, iter)
163
+ path = model.get_path(iter)
164
+ indices = path.indices
165
+ cell_renderer.sensitive = indices[0] != 1
166
+ end
167
+
168
+ def separator?(model, iter)
169
+ path = model.get_path(iter)
170
+ path.indices[0] == 4
171
+ end
172
+
173
+ def create_capital_store
174
+ capitals = []
175
+ capitals << CapitalItem.new("A - B", nil)
176
+ capitals << CapitalItem.new(nil, "Albany")
177
+ capitals << CapitalItem.new(nil, "Annapolis")
178
+ capitals << CapitalItem.new(nil, "Atlanta")
179
+ capitals << CapitalItem.new(nil, "Augusta")
180
+ capitals << CapitalItem.new(nil, "Austin")
181
+ capitals << CapitalItem.new(nil, "Baton Rouge")
182
+ capitals << CapitalItem.new(nil, "Bismarck")
183
+ capitals << CapitalItem.new(nil, "Boise")
184
+ capitals << CapitalItem.new(nil, "Boston")
185
+ capitals << CapitalItem.new("C - D", nil)
186
+ capitals << CapitalItem.new(nil, "Carson City")
187
+ capitals << CapitalItem.new(nil, "Charleston")
188
+ capitals << CapitalItem.new(nil, "Cheyenne")
189
+ capitals << CapitalItem.new(nil, "Columbia")
190
+ capitals << CapitalItem.new(nil, "Columbus")
191
+ capitals << CapitalItem.new(nil, "Concord")
192
+ capitals << CapitalItem.new(nil, "Denver")
193
+ capitals << CapitalItem.new(nil, "Des Moines")
194
+ capitals << CapitalItem.new(nil, "Dover")
195
+ capitals << CapitalItem.new("E - J", nil)
196
+ capitals << CapitalItem.new(nil, "Frankfort")
197
+ capitals << CapitalItem.new(nil, "Harrisburg")
198
+ capitals << CapitalItem.new(nil, "Hartford")
199
+ capitals << CapitalItem.new(nil, "Helena")
200
+ capitals << CapitalItem.new(nil, "Honolulu")
201
+ capitals << CapitalItem.new(nil, "Indianapolis")
202
+ capitals << CapitalItem.new(nil, "Jackson")
203
+ capitals << CapitalItem.new(nil, "Jefferson City")
204
+ capitals << CapitalItem.new(nil, "Juneau")
205
+ capitals << CapitalItem.new("K - O", nil)
206
+ capitals << CapitalItem.new(nil, "Lansing")
207
+ capitals << CapitalItem.new(nil, "Lincoln")
208
+ capitals << CapitalItem.new(nil, "Little Rock")
209
+ capitals << CapitalItem.new(nil, "Madison")
210
+ capitals << CapitalItem.new(nil, "Montgomery")
211
+ capitals << CapitalItem.new(nil, "Montpelier")
212
+ capitals << CapitalItem.new(nil, "Nashville")
213
+ capitals << CapitalItem.new(nil, "Oklahoma City")
214
+ capitals << CapitalItem.new(nil, "Olympia")
215
+ capitals << CapitalItem.new(nil, "P - S")
216
+ capitals << CapitalItem.new(nil, "Phoenix")
217
+ capitals << CapitalItem.new(nil, "Pierre")
218
+ capitals << CapitalItem.new(nil, "Providence")
219
+ capitals << CapitalItem.new(nil, "Raleigh")
220
+ capitals << CapitalItem.new(nil, "Richmond")
221
+ capitals << CapitalItem.new(nil, "Sacramento")
222
+ capitals << CapitalItem.new(nil, "Salem")
223
+ capitals << CapitalItem.new(nil, "Salt Lake City")
224
+ capitals << CapitalItem.new(nil, "Santa Fe")
225
+ capitals << CapitalItem.new(nil, "Springfield")
226
+ capitals << CapitalItem.new(nil, "St. Paul")
227
+ capitals << CapitalItem.new("T - Z", nil)
228
+ capitals << CapitalItem.new(nil, "Tallahassee")
229
+ capitals << CapitalItem.new(nil, "Topeka")
230
+ capitals << CapitalItem.new(nil, "Trenton")
231
+ model = Gtk::TreeStore.new(String)
232
+ iter = nil
233
+ iter2 = nil
234
+ capitals.each do |capital|
235
+ if capital.group
236
+ iter = model.append(nil)
237
+ iter[0] = capital.group
238
+ else
239
+ iter2 = model.append(iter)
240
+ iter2[0] = capital.name
241
+ end
242
+ end
243
+ model
244
+ end
245
+
246
+ def capital_sensitive?(cell, tree_model, iter)
247
+ sensitive = !tree_model.iter_has_child(iter)
248
+ cell.sensitive = sensitive
249
+ end
250
+
251
+ def fill_combo_entry(combo)
252
+ combo.append_text("One")
253
+ combo.append_text("Two")
254
+ combo.append_text("2\302\275")
255
+ combo.append_text("Three")
256
+ end
257
+ end
258
+
259
+ class MaskEntry < Gtk::Entry
260
+ type_register
261
+ attr_writer :mask
262
+ def initialize
263
+ super
264
+ signal_connect "changed" do
265
+ set_background
266
+ end
267
+ end
268
+
269
+ private
270
+
271
+ def set_background
272
+ return unless @mask
273
+ if !GLib::Regex.match?(@mask, text)
274
+ attrs = Pango::AttrList.new
275
+ attrs.insert(Pango::AttrForeground.new(65_535, 32_767, 32_767))
276
+ set_attributes(attrs)
277
+ else
278
+ set_attributes(nil)
279
+ end
280
+ end
281
+ end
@@ -0,0 +1,89 @@
1
+ # Copyright (c) 2017 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Theming/CSS Blend Modes
6
+
7
+ You can blend multiple backgrounds using the CSS blend modes available.
8
+ =end
9
+
10
+ BlendMode = Struct.new(:name, :id)
11
+
12
+ class CssBlendmodesDemo
13
+ def initialize(main_window)
14
+ @builder = Gtk::Builder.new(:resource => "/css_blendmodes/blendmodes.ui")
15
+ @window = @builder["window"]
16
+ @window.transient_for = main_window
17
+
18
+ # Setup the CSS provider for window
19
+ @provider = Gtk::CssProvider.new
20
+ Gtk::StyleContext.add_provider_for_screen(Gdk::Screen.default,
21
+ @provider,
22
+ Gtk::StyleProvider::PRIORITY_APPLICATION)
23
+
24
+ initialize_blend_modes
25
+ setup_listbox
26
+ end
27
+
28
+ def run
29
+ if !@window.visible?
30
+ @window.show_all
31
+ else
32
+ @window.destroy
33
+ end
34
+ @window
35
+ end
36
+
37
+ private
38
+
39
+ def initialize_blend_modes
40
+ @blend_modes = []
41
+ @blend_modes << BlendMode.new("Color", "color")
42
+ @blend_modes << BlendMode.new("Color (burn)", "color-burn")
43
+ @blend_modes << BlendMode.new("Color (dodge)", "color-dodge")
44
+ @blend_modes << BlendMode.new("Darken", "darken")
45
+ @blend_modes << BlendMode.new("Difference", "difference")
46
+ @blend_modes << BlendMode.new("Exclusion", "exclusion")
47
+ @blend_modes << BlendMode.new("Hard Light", "hard-light")
48
+ @blend_modes << BlendMode.new("Hue", "hue")
49
+ @blend_modes << BlendMode.new("Lighten", "lighten")
50
+ @blend_modes << BlendMode.new("Luminosity", "luminosity")
51
+ @blend_modes << BlendMode.new("Multiply", "multiply")
52
+ @blend_modes << BlendMode.new("Normal", "normal")
53
+ @blend_modes << BlendMode.new("Overlay", "overlay")
54
+ @blend_modes << BlendMode.new("Saturate", "saturate")
55
+ @blend_modes << BlendMode.new("Screen", "screen")
56
+ @blend_modes << BlendMode.new("Soft Light", "soft-light")
57
+ end
58
+
59
+ def setup_listbox
60
+ normal_row = nil
61
+ listbox = Gtk::ListBox.new
62
+ @builder["scrolledwindow"].add(listbox)
63
+
64
+ listbox.signal_connect "row-activated" do |_widget, w_row, _provider|
65
+ blend_mode = @blend_modes[w_row.index].id
66
+ update_css_for_blend_mode(blend_mode)
67
+ end
68
+
69
+ @blend_modes.each do |blend_mode|
70
+ row = Gtk::ListBoxRow.new
71
+ label = Gtk::Label.new(blend_mode.name)
72
+ label.xalign = 0
73
+ row.add(label)
74
+ listbox.add(row)
75
+ normal_row = row if blend_mode.id == "normal"
76
+ end
77
+
78
+ # select the "normal" row
79
+ listbox.select_row(normal_row)
80
+ normal_row.signal_emit("activate")
81
+ normal_row.grab_focus
82
+ end
83
+
84
+ def update_css_for_blend_mode(blend_mode)
85
+ raw_css = Gio::Resources.lookup_data("/css_blendmodes/css_blendmodes.css", 0)
86
+ css = format(raw_css, blend_mode, blend_mode, blend_mode)
87
+ @provider.load_from_data(css)
88
+ end
89
+ end
@@ -73,8 +73,8 @@ class CssShadowsDemo
73
73
 
74
74
  def initialize_text_buffer
75
75
  @text = Gtk::TextBuffer.new
76
- @text.create_tag("warning", "underline" => Pango::UNDERLINE_SINGLE)
77
- @text.create_tag("error", "underline" => Pango::UNDERLINE_ERROR)
76
+ @text.create_tag("warning", "underline" => :single)
77
+ @text.create_tag("error", "underline" => :error)
78
78
  @text.text = @default_css
79
79
  text_buffer_signal_connect_changed
80
80
  end
@@ -0,0 +1,189 @@
1
+ # Copyright (c) 2017 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Benchmark/Fishbowl
6
+
7
+ This demo models the fishbowl demos seen on the web in a GTK way.
8
+ It's also a neat little tool to see how fast your computer (or
9
+ your GTK version) is.
10
+ =end
11
+
12
+ STATS_UPDATE_TIME = 1_000_000 # G_USEC_PER_SEC
13
+ N_STATS = 5
14
+
15
+ class Stats
16
+ attr_accessor :last_stats, :last_frame, :last_suggestion, :frame_counter_max,
17
+ :stats_index, :frame_counter, :item_counter
18
+
19
+ def initialize(widget)
20
+ @widget = widget
21
+ @stats_index = 0
22
+ @frame_counter_max = 0
23
+ @last_frame = @widget.frame_clock.frame_time
24
+ @last_stats = @last_frame
25
+ @frame_counter = Array.new(N_STATS, 0)
26
+ @item_counter = Array.new(N_STATS, 0)
27
+ @last_suggestion = 0
28
+ end
29
+ end
30
+
31
+ class Fish < Gtk::Image
32
+ attr_accessor :x, :y, :x_speed, :y_speed
33
+ def initialize
34
+ super(:icon_name => random_icon_name, :size => :dialog)
35
+ @x = 10
36
+ @y = 10
37
+ @x_speed = rand(1..200)
38
+ @y_speed = rand(1..200)
39
+ end
40
+
41
+ private
42
+
43
+ def random_icon_name
44
+ theme = Gtk::IconTheme.default
45
+ icon_list = theme.icons
46
+ icons = icon_list.reject { |e| e.include?("symbolic") }
47
+ icons[rand(icons.size)]
48
+ end
49
+ end
50
+
51
+ class FishbowlDemo
52
+ def initialize(main_window)
53
+ builder = Gtk::Builder.new(:resource => "/fishbowl/fishbowl.ui")
54
+ @window = builder["window"]
55
+ @bowl = builder["bowl"]
56
+ @info_label = builder["info_label"]
57
+ @changes_prevent = builder["changes_prevent"]
58
+ @changes_prevent.image = Gtk::Image.new(:icon_name => "changes-prevent")
59
+ @changes_allow = builder["changes_allow"]
60
+ @changes_allow.image = Gtk::Image.new(:icon_name => "changes-allow")
61
+ @window.screen = main_window.screen
62
+ @window.realize
63
+ @bowl.add_tick_callback do
64
+ move_fish
65
+ end
66
+ end
67
+
68
+ def run
69
+ if !@window.visible?
70
+ @window.show
71
+ else
72
+ @window.destroy
73
+ end
74
+ @window
75
+ end
76
+
77
+ private
78
+
79
+ def move_fish
80
+ elapsed, suggested_change = do_stats
81
+ @bowl.each do |widget|
82
+ move_one_fish(widget, elapsed)
83
+ end
84
+
85
+ if suggested_change > 0
86
+ add_fish(suggested_change)
87
+ elsif suggested_change < 0
88
+ remove_fish(-suggested_change)
89
+ end
90
+
91
+ GLib::Source::CONTINUE
92
+ end
93
+
94
+ def do_stats
95
+ @stats ||= Stats.new(@bowl)
96
+ frame_time = @bowl.frame_clock.frame_time
97
+ elapsed = frame_time - @stats.last_frame
98
+ n_frames = 0
99
+
100
+ if @stats.last_stats + STATS_UPDATE_TIME < frame_time
101
+ @stats.frame_counter.each do |f|
102
+ n_frames += f
103
+ end
104
+
105
+ index = @stats.stats_index
106
+ fps = STATS_UPDATE_TIME * n_frames / (N_STATS * STATS_UPDATE_TIME)
107
+ new_label = format("%u icons - %.1f fps", @stats.item_counter[index], fps)
108
+ @info_label.label = new_label
109
+
110
+ if @stats.frame_counter[index] >= 19 * @stats.frame_counter_max / 20
111
+ if @stats.last_suggestion > 0
112
+ @stats.last_suggestion *= 2
113
+ else
114
+ @stats.last_suggestion = 1
115
+ end
116
+ else
117
+ if @stats.last_suggestion < 0
118
+ @stats.last_suggestion -= 1
119
+ else
120
+ @stats.last_suggestion = -1
121
+ end
122
+ @stats.last_suggestion = [@stats.last_suggestion,
123
+ 1 - @stats.item_counter[index]].max
124
+ end
125
+
126
+ @stats.stats_index = (@stats.stats_index + 1) % N_STATS
127
+ @stats.frame_counter[@stats.stats_index] = 0
128
+ @stats.item_counter[@stats.stats_index] = @stats.item_counter[(@stats.stats_index + N_STATS - 1) % N_STATS]
129
+ @stats.last_stats = frame_time
130
+
131
+ if @changes_allow.active?
132
+ @stats.last_suggestion = 0
133
+ end
134
+ suggested_change = @stats.last_suggestion
135
+ else
136
+ suggested_change = 0
137
+ end
138
+
139
+ @stats.last_frame = frame_time
140
+ @stats.frame_counter[@stats.stats_index] += 1
141
+ @stats.frame_counter_max = [@stats.frame_counter_max,
142
+ @stats.frame_counter[@stats.stats_index]].max
143
+ [elapsed, suggested_change]
144
+ end
145
+
146
+ def add_fish(n_fish)
147
+ (1..n_fish).each do
148
+ new_fish = Fish.new
149
+ new_fish.show
150
+ @bowl.put(new_fish, 10, 10)
151
+ stats_update(n_fish)
152
+ end
153
+ end
154
+
155
+ def stats_update(n_items)
156
+ index = @stats.stats_index
157
+ @stats.item_counter[index] += n_items
158
+ end
159
+
160
+ def remove_fish(n_fish)
161
+ (0..(n_fish - 1)).each do
162
+ @bowl.children.shift
163
+ end
164
+ stats_update(- n_fish)
165
+ end
166
+
167
+ def move_one_fish(fish, elapsed)
168
+ fish.x += (fish.x_speed * elapsed / STATS_UPDATE_TIME)
169
+ fish.y += (fish.y_speed * elapsed / STATS_UPDATE_TIME)
170
+
171
+ if fish.x <= 0
172
+ fish.x = 0
173
+ fish.x_speed = - rand(1..200) * (fish.x_speed > 0 ? 1 : - 1)
174
+ elsif fish.x > fish.parent.allocated_width - fish.allocated_width
175
+ fish.x = fish.parent.allocated_width - fish.allocated_width
176
+ fish.x_speed = - rand(1..200) * (fish.x_speed > 0 ? 1 : - 1)
177
+ end
178
+
179
+ if fish.y <= 0
180
+ fish.y = 0
181
+ fish.y_speed = - rand(1..200) * (fish.y_speed > 0 ? 1 : - 1)
182
+ elsif fish.y > fish.parent.allocated_height - fish.allocated_height
183
+ fish.y = fish.parent.allocated_height - fish.allocated_height
184
+ fish.y_speed = - rand(1..200) * (fish.y_speed > 0 ? 1 : - 1)
185
+ end
186
+
187
+ fish.parent.move(fish, fish.x, fish.y)
188
+ end
189
+ end
@@ -20,7 +20,6 @@
20
20
  <object class="GtkToggleButton" id="changes_allow">
21
21
  <property name="active">False</property>
22
22
  <property name="visible" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean">True</property>
23
- <property name="icon-name">changes-allow</property>
24
23
  <property name="relief">none</property>
25
24
  </object>
26
25
  <packing>
@@ -31,7 +30,6 @@
31
30
  <object class="GtkToggleButton" id="changes_prevent">
32
31
  <property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean">True</property>
33
32
  <property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean">False</property>
34
- <property name="icon-name">changes-prevent</property>
35
33
  <property name="relief">none</property>
36
34
  </object>
37
35
  <packing>
@@ -0,0 +1,150 @@
1
+ # Copyright (c) 2017 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Flow Box
6
+
7
+ GtkFlowBox allows flexible and responsive grids which reflow
8
+ as needed and support sorting and filtering.
9
+
10
+ The children of a GtkFlowBox are regular widgets
11
+ =end
12
+ class ColorSwatch < Gtk::Button
13
+ def initialize(color)
14
+ super(:label => nil)
15
+
16
+ area = Gtk::DrawingArea.new
17
+ area.set_size_request(24, 24)
18
+ area.signal_connect "draw" do |_widget, cr|
19
+ rgba = Gdk::RGBA.parse(color)
20
+
21
+ if rgba
22
+ cr.set_source_rgba(rgba.to_a)
23
+ cr.paint
24
+ end
25
+ end
26
+ add(area)
27
+ show_all
28
+ end
29
+ end
30
+
31
+ class FlowboxDemo
32
+ def initialize(main_window)
33
+ @window = Gtk::Window.new(:toplevel)
34
+ @window.screen = main_window.screen
35
+ @window.title = "Flow Box"
36
+ @window.set_default_size(400, 600)
37
+
38
+ scrolled = Gtk::ScrolledWindow.new
39
+ scrolled.set_policy(:never, :automatic)
40
+
41
+ flowbox = Gtk::FlowBox.new
42
+ flowbox.valign = :start
43
+ flowbox.max_children_per_line = 36
44
+ flowbox.selection_mode = :none
45
+ scrolled.add(flowbox)
46
+ @window.add(scrolled)
47
+
48
+ COLORS.each do |color|
49
+ flowbox.add(ColorSwatch.new(color))
50
+ end
51
+
52
+ scrolled.show_all
53
+ end
54
+
55
+ def run
56
+ if !@window.visible?
57
+ @window.show_all
58
+ else
59
+ @window.destroy
60
+ end
61
+ @window
62
+ end
63
+
64
+ COLORS =%w(AliceBlue AntiqueWhite AntiqueWhite1 AntiqueWhite2 AntiqueWhite3
65
+ AntiqueWhite4 aqua aquamarine aquamarine1 aquamarine2 aquamarine3
66
+ aquamarine4 azure azure1 azure2 azure3 azure4 beige bisque bisque1 bisque2
67
+ bisque3 bisque4 black BlanchedAlmond blue blue1 blue2 blue3 blue4 BlueViolet
68
+ brown brown1 brown2 brown3 brown4 burlywood burlywood1 burlywood2 burlywood3
69
+ burlywood4 CadetBlue CadetBlue1 CadetBlue2 CadetBlue3 CadetBlue4 chartreuse
70
+ chartreuse1 chartreuse2 chartreuse3 chartreuse4 chocolate chocolate1
71
+ chocolate2 chocolate3 chocolate4 coral coral1 coral2 coral3 coral4
72
+ CornflowerBlue cornsilk cornsilk1 cornsilk2 cornsilk3 cornsilk4 crimson
73
+ cyan cyan1 cyan2 cyan3 cyan4 DarkBlue DarkCyan DarkGoldenrod DarkGoldenrod1
74
+ DarkGoldenrod2 DarkGoldenrod3 DarkGoldenrod4 DarkGray DarkGreen DarkGrey
75
+ DarkKhaki DarkMagenta DarkOliveGreen DarkOliveGreen1 DarkOliveGreen2
76
+ DarkOliveGreen3 DarkOliveGreen4 DarkOrange DarkOrange1 DarkOrange2
77
+ DarkOrange3 DarkOrange4 DarkOrchid DarkOrchid1 DarkOrchid2 DarkOrchid3
78
+ DarkOrchid4 DarkRed DarkSalmon DarkSeaGreen DarkSeaGreen1 DarkSeaGreen2
79
+ DarkSeaGreen3 DarkSeaGreen4 DarkSlateBlue DarkSlateGray DarkSlateGray1
80
+ DarkSlateGray2 DarkSlateGray3 DarkSlateGray4 DarkSlateGrey DarkTurquoise
81
+ DarkViolet DeepPink DeepPink1 DeepPink2 DeepPink3 DeepPink4 DeepSkyBlue
82
+ DeepSkyBlue1 DeepSkyBlue2 DeepSkyBlue3 DeepSkyBlue4 DimGray DimGrey
83
+ DodgerBlue DodgerBlue1 DodgerBlue2 DodgerBlue3 DodgerBlue4 firebrick
84
+ firebrick1 firebrick2 firebrick3 firebrick4 FloralWhite ForestGreen
85
+ fuchsia gainsboro GhostWhite gold gold1 gold2 gold3 gold4 goldenrod
86
+ goldenrod1 goldenrod2 goldenrod3 goldenrod4 gray gray0 gray1 gray10 gray100
87
+ gray11 gray12 gray13 gray14 gray15 gray16 gray17 gray18 gray19 gray2
88
+ gray20 gray21 gray22 gray23 gray24 gray25 gray26 gray27 gray28 gray29 gray3
89
+ gray30 gray31 gray32 gray33 gray34 gray35 gray36 gray37 gray38 gray39 gray4
90
+ gray40 gray41 gray42 gray43 gray44 gray45 gray46 gray47 gray48 gray49 gray5
91
+ gray50 gray51 gray52 gray53 gray54 gray55 gray56 gray57 gray58 gray59 gray6
92
+ gray60 gray61 gray62 gray63 gray64 gray65 gray66 gray67 gray68 gray69 gray7
93
+ gray70 gray71 gray72 gray73 gray74 gray75 gray76 gray77 gray78 gray79 gray8
94
+ gray80 gray81 gray82 gray83 gray84 gray85 gray86 gray87 gray88 gray89 gray9
95
+ gray90 gray91 gray92 gray93 gray94 gray95 gray96 gray97 gray98 gray99 green
96
+ green1 green2 green3 green4 GreenYellow grey grey0 grey1 grey10 grey100
97
+ grey11 grey12 grey13 grey14 grey15 grey16 grey17 grey18 grey19 grey2
98
+ grey20 grey21 grey22 grey23 grey24 grey25 grey26 grey27 grey28 grey29 grey3
99
+ grey30 grey31 grey32 grey33 grey34 grey35 grey36 grey37 grey38 grey39 grey4
100
+ grey40 grey41 grey42 grey43 grey44 grey45 grey46 grey47 grey48 grey49 grey5
101
+ grey50 grey51 grey52 grey53 grey54 grey55 grey56 grey57 grey58 grey59 grey6
102
+ grey60 grey61 grey62 grey63 grey64 grey65 grey66 grey67 grey68 grey69 grey7
103
+ grey70 grey71 grey72 grey73 grey74 grey75 grey76 grey77 grey78 grey79 grey8
104
+ grey80 grey81 grey82 grey83 grey84 grey85 grey86 grey87 grey88 grey89 grey9
105
+ grey90 grey91 grey92 grey93 grey94 grey95 grey96 grey97 grey98 grey99
106
+ honeydew honeydew1 honeydew2 honeydew3 honeydew4 HotPink HotPink1 HotPink2
107
+ HotPink3 HotPink4 IndianRed IndianRed1 IndianRed2 IndianRed3 IndianRed4
108
+ indigo ivory ivory1 ivory2 ivory3 ivory4 khaki khaki1 khaki2 khaki3 khaki4
109
+ lavender LavenderBlush LavenderBlush1 LavenderBlush2 LavenderBlush3
110
+ LavenderBlush4 LawnGreen LemonChiffon LemonChiffon1 LemonChiffon2
111
+ LemonChiffon3 LemonChiffon4 LightBlue LightBlue1 LightBlue2 LightBlue3
112
+ LightBlue4 LightCoral LightCyan LightCyan1 LightCyan2 LightCyan3 LightCyan4
113
+ LightGoldenrod LightGoldenrod1 LightGoldenrod2 LightGoldenrod3
114
+ LightGoldenrod4 LightGoldenrodYellow LightGray LightGreen LightGrey
115
+ LightPink LightPink1 LightPink2 LightPink3 LightPink4 LightSalmon
116
+ LightSalmon1 LightSalmon2 LightSalmon3 LightSalmon4 LightSeaGreen
117
+ LightSkyBlue LightSkyBlue1 LightSkyBlue2 LightSkyBlue3 LightSkyBlue4
118
+ LightSlateBlue LightSlateGray LightSlateGrey LightSteelBlue LightSteelBlue1
119
+ LightSteelBlue2 LightSteelBlue3 LightSteelBlue4 LightYellow LightYellow1
120
+ LightYellow2 LightYellow3 LightYellow4 lime LimeGreen linen magenta
121
+ magenta1 magenta2 magenta3 magenta4 maroon maroon1 maroon2 maroon3 maroon4
122
+ MediumAquamarine MediumBlue MediumOrchid MediumOrchid1 MediumOrchid2
123
+ MediumOrchid3 MediumOrchid4 MediumPurple MediumPurple1 MediumPurple2
124
+ MediumPurple3 MediumPurple4 MediumSeaGreen MediumSlateBlue MediumSpringGreen
125
+ MediumTurquoise MediumVioletRed MidnightBlue MintCream MistyRose
126
+ MistyRose1 MistyRose2 MistyRose3 MistyRose4 moccasin NavajoWhite NavajoWhite1
127
+ NavajoWhite2 NavajoWhite3 NavajoWhite4 navy NavyBlue OldLace olive OliveDrab
128
+ OliveDrab1 OliveDrab2 OliveDrab3 OliveDrab4 orange orange1 orange2 orange3
129
+ orange4 OrangeRed OrangeRed1 OrangeRed2 OrangeRed3 OrangeRed4 orchid orchid1
130
+ orchid2 orchid3 orchid4 PaleGoldenrod PaleGreen PaleGreen1 PaleGreen2
131
+ PaleGreen3 PaleGreen4 PaleTurquoise PaleTurquoise1 PaleTurquoise2
132
+ PaleTurquoise3 PaleTurquoise4 PaleVioletRed PaleVioletRed1 PaleVioletRed2
133
+ PaleVioletRed3 PaleVioletRed4 PapayaWhip PeachPuff PeachPuff1 PeachPuff2
134
+ PeachPuff3 PeachPuff4 peru pink pink1 pink2 pink3 pink4 plum plum1 plum2
135
+ plum3 plum4 PowderBlue purple purple1 purple2 purple3 purple4 red red1 red2
136
+ red3 red4 RosyBrown RosyBrown1 RosyBrown2 RosyBrown3 RosyBrown4 RoyalBlue
137
+ RoyalBlue1 RoyalBlue2 RoyalBlue3 RoyalBlue4 SaddleBrown salmon salmon1
138
+ salmon2 salmon3 salmon4 SandyBrown SeaGreen SeaGreen1 SeaGreen2 SeaGreen3
139
+ SeaGreen4 seashell seashell1 seashell2 seashell3 seashell4 sienna sienna1
140
+ sienna2 sienna3 sienna4 silver SkyBlue SkyBlue1 SkyBlue2 SkyBlue3 SkyBlue4
141
+ SlateBlue SlateBlue1 SlateBlue2 SlateBlue3 SlateBlue4 SlateGray SlateGray1
142
+ SlateGray2 SlateGray3 SlateGray4 SlateGrey snow snow1 snow2 snow3 snow4
143
+ SpringGreen SpringGreen1 SpringGreen2 SpringGreen3 SpringGreen4 SteelBlue
144
+ SteelBlue1 SteelBlue2 SteelBlue3 SteelBlue4 tan tan1 tan2 tan3 tan4 teal
145
+ thistle thistle1 thistle2 thistle3 thistle4 tomato tomato1 tomato2 tomato3
146
+ tomato4 turquoise turquoise1 turquoise2 turquoise3 turquoise4 violet
147
+ VioletRed VioletRed1 VioletRed2 VioletRed3 VioletRed4 wheat wheat1 wheat2
148
+ wheat3 wheat4 white WhiteSmoke yellow yellow1 yellow2 yellow3 yellow4
149
+ YellowGreen)
150
+ end
@@ -1,4 +1,4 @@
1
- #!/usr/local/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
  =begin
3
3
  button2.rb - Ruby/GTK2 sample script.
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk3
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.8
4
+ version: 3.1.9
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-15 00:00:00.000000000 Z
11
+ date: 2017-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glib2
@@ -16,112 +16,112 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.8
19
+ version: 3.1.9
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.1.8
26
+ version: 3.1.9
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: gio2
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.1.8
33
+ version: 3.1.9
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.1.8
40
+ version: 3.1.9
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: atk
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 3.1.8
47
+ version: 3.1.9
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 3.1.8
54
+ version: 3.1.9
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pango
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 3.1.8
61
+ version: 3.1.9
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 3.1.8
68
+ version: 3.1.9
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: gdk_pixbuf2
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 3.1.8
75
+ version: 3.1.9
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 3.1.8
82
+ version: 3.1.9
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: gdk3
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 3.1.8
89
+ version: 3.1.9
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 3.1.8
96
+ version: 3.1.9
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: gobject-introspection
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 3.1.8
103
+ version: 3.1.9
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 3.1.8
110
+ version: 3.1.9
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rsvg2
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 3.1.8
117
+ version: 3.1.9
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 3.1.8
124
+ version: 3.1.9
125
125
  description: Ruby/GTK3 is a Ruby binding of GTK+-3.x.
126
126
  email: ruby-gnome2-devel-en@lists.sourceforge.net
127
127
  executables: []
@@ -239,6 +239,7 @@ files:
239
239
  - sample/gtk-demo/cmy.jpg
240
240
  - sample/gtk-demo/col_resize_cursor.png
241
241
  - sample/gtk-demo/colorsel.rb
242
+ - sample/gtk-demo/combobox.rb
242
243
  - sample/gtk-demo/context_menu_cursor.png
243
244
  - sample/gtk-demo/copy_cursor.png
244
245
  - sample/gtk-demo/crosshair_cursor.png
@@ -247,6 +248,7 @@ files:
247
248
  - sample/gtk-demo/css_basics.css
248
249
  - sample/gtk-demo/css_basics.rb
249
250
  - sample/gtk-demo/css_blendmodes.css
251
+ - sample/gtk-demo/css_blendmodes.rb
250
252
  - sample/gtk-demo/css_multiplebgs.css
251
253
  - sample/gtk-demo/css_multiplebgs.rb
252
254
  - sample/gtk-demo/css_pixbufs.css
@@ -288,8 +290,10 @@ files:
288
290
  - sample/gtk-demo/expander.rb
289
291
  - sample/gtk-demo/filtermodel.rb
290
292
  - sample/gtk-demo/filtermodel.ui
293
+ - sample/gtk-demo/fishbowl.rb
291
294
  - sample/gtk-demo/fishbowl.ui
292
295
  - sample/gtk-demo/floppybuddy.gif
296
+ - sample/gtk-demo/flowbox.rb
293
297
  - sample/gtk-demo/font-features.ui
294
298
  - sample/gtk-demo/font_features.rb
295
299
  - sample/gtk-demo/glarea-gl.fs.glsl