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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gtk3/rb-gtk3-private.h +1 -0
  3. data/ext/gtk3/rb-gtk3-spin-button.c +85 -0
  4. data/ext/gtk3/rb-gtk3.c +3 -0
  5. data/lib/2.2/gtk3.so +0 -0
  6. data/lib/2.3/gtk3.so +0 -0
  7. data/lib/gtk3/deprecated.rb +0 -8
  8. data/lib/gtk3/loader.rb +1 -7
  9. data/lib/gtk3/tree-model.rb +2 -0
  10. data/sample/gtk-demo/TODO +10 -10
  11. data/sample/gtk-demo/assistant.rb +44 -39
  12. data/sample/gtk-demo/builder.rb +71 -50
  13. data/sample/gtk-demo/button_box.rb +39 -28
  14. data/sample/gtk-demo/clipboard.rb +139 -46
  15. data/sample/gtk-demo/colorsel.rb +50 -36
  16. data/sample/gtk-demo/css_accordion.rb +18 -17
  17. data/sample/gtk-demo/css_basics.rb +60 -47
  18. data/sample/gtk-demo/css_multiplebgs.rb +92 -71
  19. data/sample/gtk-demo/css_pixbufs.rb +61 -48
  20. data/sample/gtk-demo/css_shadows.rb +63 -50
  21. data/sample/gtk-demo/cursors.rb +95 -64
  22. data/sample/gtk-demo/dialog.rb +95 -78
  23. data/sample/gtk-demo/drawingarea.rb +138 -171
  24. data/sample/gtk-demo/editable_cells.rb +169 -130
  25. data/sample/gtk-demo/entry_buffer.rb +15 -13
  26. data/sample/gtk-demo/entry_completion.rb +22 -17
  27. data/sample/gtk-demo/expander.rb +39 -31
  28. data/sample/gtk-demo/filtermodel.rb +67 -63
  29. data/sample/gtk-demo/font_features.rb +91 -60
  30. data/sample/gtk-demo/glarea.rb +277 -0
  31. data/sample/gtk-demo/headerbar.rb +17 -15
  32. data/sample/gtk-demo/hypertext.rb +146 -167
  33. data/sample/gtk-demo/iconview.rb +132 -91
  34. data/sample/gtk-demo/iconview_edit.rb +49 -38
  35. data/sample/gtk-demo/infobar.rb +81 -62
  36. data/sample/gtk-demo/links.rb +35 -30
  37. data/sample/gtk-demo/list_store.rb +169 -114
  38. data/sample/gtk-demo/listbox.rb +183 -0
  39. data/sample/gtk-demo/main.rb +32 -21
  40. data/sample/gtk-demo/markup.rb +65 -52
  41. data/sample/gtk-demo/menus.rb +57 -58
  42. data/sample/gtk-demo/modelbutton.rb +11 -9
  43. data/sample/gtk-demo/modelbutton.ui +3 -0
  44. data/sample/gtk-demo/overlay.rb +39 -32
  45. data/sample/gtk-demo/overlay2.rb +68 -54
  46. data/sample/gtk-demo/panes.rb +56 -68
  47. data/sample/gtk-demo/pickers.rb +46 -45
  48. data/sample/gtk-demo/pixbufs.rb +27 -25
  49. data/sample/gtk-demo/popover.rb +70 -63
  50. data/sample/gtk-demo/printing.rb +94 -69
  51. data/sample/gtk-demo/revealer.rb +46 -38
  52. data/sample/gtk-demo/rotated_text.rb +75 -54
  53. data/sample/gtk-demo/scale.rb +10 -8
  54. data/sample/gtk-demo/search_entry.rb +195 -0
  55. data/sample/gtk-demo/search_entry2.rb +71 -59
  56. data/sample/gtk-demo/sidebar.rb +20 -19
  57. data/sample/gtk-demo/sizegroup.rb +36 -35
  58. data/sample/gtk-demo/spinbutton.rb +128 -0
  59. data/sample/gtk-demo/spinner.rb +55 -40
  60. data/sample/gtk-demo/stack.rb +11 -8
  61. data/sample/gtk-demo/textmask.rb +14 -13
  62. data/sample/gtk-demo/textscroll.rb +16 -12
  63. data/sample/gtk-demo/theming_style_classes.rb +14 -12
  64. data/sample/gtk-demo/transparent.rb +17 -13
  65. data/sample/misc/treemodelfilter.rb +1 -1
  66. metadata +24 -19
@@ -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
@@ -7,47 +7,55 @@
7
7
  GtkRevealer is a container that animates showing and hiding
8
8
  of its sole child with nice transitions.
9
9
  =end
10
- module RevealerDemo
11
- def self.run_demo(main_window)
12
- builder = Gtk::Builder.new(:resource => "/revealer/revealer.ui")
13
- builder.connect_signals {}
14
-
15
- timeout = nil
16
- count = 0
17
-
18
- window = builder["window"]
19
- window.screen = main_window.screen
20
- window.signal_connect "destroy" do
21
- if timeout
22
- GLib::Source.remove(timeout)
23
- timeout = nil
10
+ class RevealerDemo
11
+ def initialize(main_window)
12
+ @builder = Gtk::Builder.new(:resource => "/revealer/revealer.ui")
13
+ @builder.connect_signals {}
14
+
15
+ @timeout = nil
16
+ @count = 0
17
+
18
+ @window = @builder["window"]
19
+ @window.screen = main_window.screen
20
+ @window.signal_connect "destroy" do
21
+ if @timeout
22
+ GLib::Source.remove(@timeout)
23
+ @timeout = nil
24
24
  end
25
25
  end
26
+ end
26
27
 
27
- if !window.visible?
28
- timeout = GLib::Timeout.add(690) do
29
- name = "revealer#{count}"
30
-
31
- revealer = builder[name]
32
- revealer.set_reveal_child(true)
33
-
34
- revealer.signal_connect "notify::child-revealed" do |widget|
35
- revealed = widget.child_revealed?
36
- widget.set_reveal_child(!revealed)
37
- end
38
-
39
- count += 1
40
- if count >= 9
41
- timeout = nil
42
- false
43
- else
44
- true
45
- end
46
- end
47
- window.show_all
28
+ def run
29
+ if !@window.visible?
30
+ add_timeout
31
+ @window.show_all
48
32
  else
49
- window.destroy
33
+ @window.destroy
34
+ end
35
+ @window
36
+ end
37
+
38
+ private
39
+
40
+ def add_timeout
41
+ @timeout = GLib::Timeout.add(690) do
42
+ name = "revealer#{@count}"
43
+
44
+ revealer = @builder[name]
45
+ revealer.reveal_child = true
46
+
47
+ revealer.signal_connect "notify::child-revealed" do |widget|
48
+ revealed = widget.child_revealed?
49
+ widget.reveal_child = revealed
50
+ end
51
+
52
+ @count += 1
53
+ if @count >= 9
54
+ @timeout = nil
55
+ false
56
+ else
57
+ true
58
+ end
50
59
  end
51
- window
52
60
  end
53
61
  end
@@ -11,22 +11,22 @@
11
11
  a red heard using cairo drawing operations instead of the Unicode heart
12
12
  character.
13
13
  =end
14
- module RotatedTextDemo
14
+ class RotatedTextDemo
15
15
  HEART = "♥"
16
16
  RADIUS = 150
17
17
  N_WORDS = 5
18
18
  FONT = "Serif 18"
19
19
  TEXT = "I ♥ GTK+"
20
20
 
21
- def self.run_demo(main_window)
22
- window = Gtk::Window.new(:toplevel)
23
- window.screen = main_window.screen
24
- window.title = "Rotated Text"
25
- window.set_default_size(4 * RADIUS, 2 * RADIUS)
21
+ def initialize(main_window)
22
+ @window = Gtk::Window.new(:toplevel)
23
+ @window.screen = main_window.screen
24
+ @window.title = "Rotated Text"
25
+ @window.set_default_size(4 * RADIUS, 2 * RADIUS)
26
26
 
27
27
  box = Gtk::Box.new(:horizontal, 0)
28
28
  box.homogeneous = true
29
- window.add(box)
29
+ @window.add(box)
30
30
 
31
31
  # Add adrawing area
32
32
  drawing_area = Gtk::DrawingArea.new
@@ -34,47 +34,13 @@ module RotatedTextDemo
34
34
  drawing_area.style_context.add_class("view")
35
35
 
36
36
  drawing_area.signal_connect "draw" do |widget, cr|
37
- # Create a cairo context and set up a transformation matrix so that the
38
- # user space coordinates for the centered square where we draw are
39
- # [-RADIUS, RADIUS], [-RADIUS, RADIUS].
40
- # We first center, then change the scale.
41
- width = widget.allocated_width
42
- height = widget.allocated_width
43
- device_radius = [width, height].min / 2
44
- cr.translate(device_radius + (width - 2 * device_radius) / 2,
45
- device_radius + (height - 2 * device_radius) / 2)
46
- cr.scale(device_radius / RADIUS, device_radius / RADIUS)
47
-
48
- # Create a subtle gradient source and use it
49
- pattern = Cairo::LinearPattern.new(-RADIUS, -RADIUS, RADIUS, RADIUS)
50
- pattern.add_color_stop_rgb(0, 0.5, 0, 0)
51
- pattern.add_color_stop_rgb(1, 0, 0, 0.5)
52
- cr.set_source(pattern)
53
-
54
- # Create a PangoContext and set up our shape renderer
55
- context = widget.create_pango_context
56
- context.set_shape_renderer do |cairo, attr, do_path|
57
- fancy_shape_renderer(cairo, attr, do_path)
58
- end
59
-
60
- # Create a PangoLayout, set the text, font and attributes
61
- layout = Pango::Layout.new(context)
62
- layout.text = TEXT
63
- desc = Pango::FontDescription.new(FONT)
64
- layout.font_description = desc
65
-
66
- attrs = create_fancy_attr_list_for_layout(layout)
67
- layout.attributes = attrs
68
-
69
- # Draw the layout N_WORDS times in a circle
70
- N_WORDS.times do
71
- # inform Pango to re-layout the text with the new transformation matrix
72
- cr.update_pango_layout(layout)
73
- w, = layout.pixel_size
74
- cr.move_to(- w / 2, - RADIUS * 0.9)
75
- cr.show_pango_layout(layout)
76
- cr.rotate(Math::PI * 2 / N_WORDS)
77
- end
37
+ translate_and_scale(widget, cr)
38
+
39
+ add_gradient(cr)
40
+
41
+ layout = initialize_da_pango_layout(widget)
42
+
43
+ draw_the_rotated_texts(cr, layout)
78
44
 
79
45
  false
80
46
  end
@@ -91,16 +57,20 @@ module RotatedTextDemo
91
57
  end
92
58
 
93
59
  layout.attributes = create_fancy_attr_list_for_layout(layout)
60
+ end
94
61
 
95
- if !window.visible?
96
- window.show_all
62
+ def run
63
+ if !@window.visible?
64
+ @window.show_all
97
65
  else
98
- window.destroy
66
+ @window.destroy
99
67
  end
100
- window
68
+ @window
101
69
  end
102
70
 
103
- def self.fancy_shape_renderer(cr, attr, do_path)
71
+ private
72
+
73
+ def fancy_shape_renderer(cr, attr, do_path)
104
74
  x, y = cr.current_point
105
75
  cr.translate(x, y)
106
76
  cr.scale(attr.ink_rect.width / Pango::SCALE,
@@ -120,7 +90,7 @@ module RotatedTextDemo
120
90
  end
121
91
  end
122
92
 
123
- def self.create_fancy_attr_list_for_layout(layout)
93
+ def create_fancy_attr_list_for_layout(layout)
124
94
  metrics = layout.context.get_metrics(layout.font_description)
125
95
  ascent = metrics.ascent
126
96
  logical_rect = Pango::Rectangle.new(0, -ascent, ascent, ascent)
@@ -133,4 +103,55 @@ module RotatedTextDemo
133
103
  attrs.insert(attr)
134
104
  attrs
135
105
  end
106
+
107
+ def translate_and_scale(widget, cr)
108
+ # Create a cairo context and set up a transformation matrix so that the
109
+ # user space coordinates for the centered square where we draw are
110
+ # [-RADIUS, RADIUS], [-RADIUS, RADIUS].
111
+ # We first center, then change the scale.
112
+ width = widget.allocated_width
113
+ height = widget.allocated_width
114
+ device_radius = [width, height].min / 2
115
+ cr.translate(device_radius + (width - 2 * device_radius) / 2,
116
+ device_radius + (height - 2 * device_radius) / 2)
117
+ cr.scale(device_radius / RADIUS, device_radius / RADIUS)
118
+ end
119
+
120
+ def add_gradient(cr)
121
+ # Create a subtle gradient source and use it
122
+ pattern = Cairo::LinearPattern.new(-RADIUS, -RADIUS, RADIUS, RADIUS)
123
+ pattern.add_color_stop_rgb(0, 0.5, 0, 0)
124
+ pattern.add_color_stop_rgb(1, 0, 0, 0.5)
125
+ cr.set_source(pattern)
126
+ end
127
+
128
+ def initialize_da_pango_layout(widget)
129
+ # Create a PangoContext and set up our shape renderer
130
+ context = widget.create_pango_context
131
+ context.set_shape_renderer do |cairo, attr, do_path|
132
+ fancy_shape_renderer(cairo, attr, do_path)
133
+ end
134
+
135
+ # Create a PangoLayout, set the text, font and attributes
136
+ layout = Pango::Layout.new(context)
137
+ layout.text = TEXT
138
+ desc = Pango::FontDescription.new(FONT)
139
+ layout.font_description = desc
140
+
141
+ attrs = create_fancy_attr_list_for_layout(layout)
142
+ layout.attributes = attrs
143
+ layout
144
+ end
145
+
146
+ def draw_the_rotated_texts(cr, layout)
147
+ # Draw the layout N_WORDS times in a circle
148
+ N_WORDS.times do
149
+ # inform Pango to re-layout the text with the new transformation matrix
150
+ cr.update_pango_layout(layout)
151
+ w, = layout.pixel_size
152
+ cr.move_to(- w / 2, - RADIUS * 0.9)
153
+ cr.show_pango_layout(layout)
154
+ cr.rotate(Math::PI * 2 / N_WORDS)
155
+ end
156
+ end
136
157
  end
@@ -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,17 +10,19 @@ and they can also restrict the values that can be
10
10
  chosen.
11
11
  =end
12
12
 
13
- module ScaleDemo
14
- def self.run_demo(main_window)
13
+ class ScaleDemo
14
+ def initialize(main_window)
15
15
  builder = Gtk::Builder.new(:resource => "/scale/scale.ui")
16
16
  builder.connect_signals {}
17
- window = builder["window1"]
18
- window.screen = main_window.screen
17
+ @window = builder["window1"]
18
+ @window.screen = main_window.screen
19
+ end
19
20
 
20
- if !window.visible?
21
- window.show_all
21
+ def run
22
+ if !@window.visible?
23
+ @window.show_all
22
24
  else
23
- window.destroy
25
+ @window.destroy
24
26
  end
25
27
  end
26
28
  end
@@ -0,0 +1,195 @@
1
+ # Copyright (c) 2016 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Entry/Search Entry
6
+
7
+ GtkEntry allows to display icons and progress information.
8
+ This demo shows how to use these features in a search entry.
9
+ =end
10
+ class SearchEntryDemo
11
+ def initialize(main_window)
12
+ @main_window = main_window
13
+
14
+ initialize_window
15
+ initialize_box
16
+ initialize_entry
17
+ initialize_menu
18
+ @menu.attach_to_widget(@entry)
19
+ initialize_notebook
20
+ @window.signal_connect("destroy") { finish_search }
21
+ end
22
+
23
+ def run
24
+ if !@window.visible?
25
+ @window.show_all
26
+ else
27
+ @window.destroy
28
+ end
29
+ @window
30
+ end
31
+
32
+ private
33
+
34
+ def initialize_window
35
+ @window = Gtk::Window.new(:toplevel)
36
+ @window.screen = @main_window.screen
37
+ @window.title = "Search Entry"
38
+ end
39
+
40
+ def initialize_box
41
+ @vbox = Gtk::Box.new(:vertical, 5)
42
+ @window.add(@vbox)
43
+ @vbox.border_width = 5
44
+
45
+ label = Gtk::Label.new("")
46
+ label.markup = "Search entry demo"
47
+ @vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
48
+
49
+ @hbox = Gtk::Box.new(:horizontal, 10)
50
+ @vbox.pack_start(@hbox, :expand => true, :fill => true, :padding => 0)
51
+ @hbox.border_width = 0
52
+ end
53
+
54
+ def initialize_entry
55
+ # Create our entry
56
+ @entry = Gtk::SearchEntry.new
57
+ @hbox.pack_start(@entry, :expand => false, :fill => false, :padding => 0)
58
+
59
+ # add accessible alternatives for icon functionality
60
+ @entry.set_property("populate-all", true)
61
+ @entry.signal_connect "populate-popup" do |widget, menu|
62
+ item = Gtk::SeparatorMenuItem.new
63
+ item.show
64
+ menu.append(item)
65
+
66
+ item = Gtk::MenuItem.new(:label => "C_lear", :use_underline => true)
67
+ item.show
68
+
69
+ item.signal_connect("activate") { widget.text = "" }
70
+ menu.append(item)
71
+ item.sensitive = !widget.text.empty?
72
+
73
+ item = Gtk::MenuItem.new(:label => "Search by")
74
+ item.show
75
+ initialize_menu
76
+ item.submenu = @menu
77
+ menu.append(item)
78
+ end
79
+ end
80
+
81
+ def initialize_notebook
82
+ # Create the find and cancel buttons
83
+ @notebook = Gtk::Notebook.new
84
+ @notebook.show_tabs = false
85
+ @notebook.show_border = false
86
+ @hbox.pack_start(@notebook, :expand => false, :fill => false, :padding => 0)
87
+
88
+ @search_progress_id = nil
89
+ @finish_progress_id = nil
90
+
91
+ find_button = Gtk::Button.new(:label => "Find")
92
+ find_button.signal_connect("clicked") { start_search }
93
+ @notebook.append_page(find_button)
94
+ find_button.show
95
+
96
+ cancel_button = Gtk::Button.new(:label => "Cancel")
97
+ cancel_button.signal_connect "clicked" do
98
+ if @finish_search_id
99
+ GLib::Source.remove(@finish_search_id)
100
+ @finish_search_id = nil
101
+ end
102
+ finish_search
103
+ end
104
+ @notebook.append_page(cancel_button)
105
+ cancel_button.show
106
+
107
+ @entry.set_icon_tooltip_text(:primary, <<-TOOLTIP)
108
+ Search by name
109
+ Click here to change the search type.
110
+ TOOLTIP
111
+ @entry.placeholder_text = "name"
112
+
113
+ @entry.signal_connect "icon-press" do |_widget, position, event|
114
+ @menu.popup(nil, nil, event.button, event.time) if position == :primary
115
+ end
116
+
117
+ @entry.signal_connect "activate" do
118
+ start_search unless @search_progress_id
119
+ end
120
+ end
121
+
122
+ def show_find_page
123
+ @notebook.current_page = 0
124
+ end
125
+
126
+ def show_cancel_page
127
+ @notebook.current_page = 1
128
+ end
129
+
130
+ def start_search
131
+ show_cancel_page
132
+ @search_progress_id = GLib::Timeout.add_seconds(1) do
133
+ @search_progress_id = GLib::Timeout.add(100) do
134
+ @entry.progress_pulse
135
+ GLib::Source::CONTINUE
136
+ end
137
+ GLib::Source::REMOVE
138
+ end
139
+
140
+ @finish_search_id = GLib::Timeout.add_seconds(15) do
141
+ finish_search
142
+ end
143
+ end
144
+
145
+ def finish_search
146
+ show_find_page
147
+ if @search_progress_id
148
+ GLib::Source.remove(@search_progress_id)
149
+ @search_progress_id = nil
150
+ @entry.progress_fraction = 0.0
151
+ end
152
+ GLib::Source::REMOVE
153
+ end
154
+
155
+ def initialize_menu
156
+ @menu = Gtk::Menu.new
157
+
158
+ item = Gtk::MenuItem.new(:label => "Search by _name",
159
+ :use_underline => true)
160
+ item.signal_connect("activate") do
161
+ @entry.set_icon_tooltip_text(:primary, <<-TOOLTIP)
162
+ Search by name
163
+ Click here to change the search type
164
+ TOOLTIP
165
+ @entry.placeholder_text = "name"
166
+ end
167
+ @menu.append(item)
168
+
169
+ item = Gtk::MenuItem.new(:label => "Search by _description",
170
+ :use_underline => true)
171
+ item.signal_connect("activate") do
172
+ @entry.set_icon_tooltip_text(:primary, <<-TOOLTIP)
173
+ Search by description
174
+ Click here to change the search type
175
+ TOOLTIP
176
+ @entry.placeholder_text = "description"
177
+ end
178
+ @menu.append(item)
179
+
180
+ @menu.show_all
181
+ item = Gtk::MenuItem.new(:label => "Search by _file",
182
+ :use_underline => true)
183
+ item.signal_connect("activate") do
184
+ @entry.set_icon_tooltip_text(:primary, <<-TOOLTIP)
185
+ Search by file
186
+ Click here to change the search type
187
+ TOOLTIP
188
+
189
+ @entry.placeholder_text = "file"
190
+ end
191
+ @menu.append(item)
192
+
193
+ @menu.show_all
194
+ end
195
+ end