gtk3 3.0.9-x64-mingw32 → 3.1.0-x64-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
@@ -9,67 +9,98 @@
9
9
  when the searched operation is slow such as loads of entries
10
10
  to search, or online searches.
11
11
  =end
12
- module SearchEntry2Demo
13
- def self.run_demo(main_window)
14
- window = Gtk::Window.new(:toplevel)
15
- window.title = "Delayed Search Entry"
16
- window.transient_for = main_window
17
- window.resizable = true
18
- window.set_size_request(200, -1)
19
-
20
- vbox = Gtk::Box.new(:vertical, 0)
21
- window.add(vbox)
22
- vbox.border_width = 0
23
-
24
- entry = Gtk::SearchEntry.new
25
- container = Gtk::Box.new(:horizontal, 10)
26
- container.halign = :center
27
- container.pack_start(entry, :expand => false, :fill => false, :padding => 0)
12
+ class SearchEntry2Demo
13
+ def initialize(main_window)
14
+ @window = Gtk::Window.new(:toplevel)
15
+ @window.title = "Delayed Search Entry"
16
+ @window.transient_for = main_window
17
+ @window.resizable = true
18
+ @window.set_size_request(200, -1)
19
+
20
+ initialize_vbox
28
21
 
29
- searchbar = Gtk::SearchBar.new
30
- searchbar.connect_entry(entry)
31
- searchbar.show_close_button = false
32
- searchbar.add(container)
33
- vbox.pack_start(searchbar, :expand => false, :fill => false, :padding => 0)
22
+ @entry = Gtk::SearchEntry.new
23
+ initialize_search_bar
24
+ @vbox.pack_start(@searchbar,
25
+ :expand => false, :fill => false, :padding => 0)
34
26
 
35
27
  # Hook the search bar to key presses
36
- window.signal_connect("key-press-event") do |_widget, event|
37
- searchbar.handle_event(event)
28
+ @window.signal_connect("key-press-event") do |_widget, event|
29
+ @searchbar.handle_event(event)
30
+ end
31
+
32
+ initialize_help_label
33
+ initialize_toggle_button
34
+ initialize_result_hbox
35
+ initialize_signal_hbox
36
+ end
37
+
38
+ def run
39
+ if !@window.visible?
40
+ @window.show_all
41
+ else
42
+ @window.destroy
38
43
  end
44
+ @window
45
+ end
46
+
47
+ private
39
48
 
49
+ def initialize_search_bar
50
+ container = Gtk::Box.new(:horizontal, 10)
51
+ container.halign = :center
52
+ container.pack_start(@entry,
53
+ :expand => false, :fill => false, :padding => 0)
54
+
55
+ @searchbar = Gtk::SearchBar.new
56
+ @searchbar.connect_entry(@entry)
57
+ @searchbar.show_close_button = false
58
+ @searchbar.add(container)
59
+ end
60
+
61
+ def initialize_vbox
62
+ @vbox = Gtk::Box.new(:vertical, 0)
63
+ @window.add(@vbox)
64
+ @vbox.border_width = 0
65
+ end
66
+
67
+ def initialize_help_label
40
68
  # Help
41
69
  label = Gtk::Label.new("Start Typing to search")
42
- vbox.pack_start(label, :expand => true, :fill => true, :padding => 0)
70
+ @vbox.pack_start(label, :expand => true, :fill => true, :padding => 0)
71
+ end
43
72
 
73
+ def initialize_toggle_button
44
74
  # Toggle button
45
75
  button = Gtk::ToggleButton.new(:label => "Search")
46
- button.bind_property("active", searchbar, "search-mode-enabled", :bidirectional)
47
- vbox.pack_start(button, :expand => true, :fill => true, :padding => 0)
76
+ button.bind_property("active", @searchbar, "search-mode-enabled",
77
+ :bidirectional)
78
+ @vbox.pack_start(button, :expand => true, :fill => true, :padding => 0)
79
+ end
48
80
 
49
- # Result
81
+ def initialize_result_hbox
50
82
  hbox = Gtk::Box.new(:horizontal, 10)
51
- vbox.pack_start(hbox, :expand => true, :fill => true, :padding => 0)
83
+ @vbox.pack_start(hbox, :expand => true, :fill => true, :padding => 0)
52
84
  hbox.border_width = 0
53
85
 
86
+ # Result
54
87
  label = Gtk::Label.new("Result:")
55
88
  label.xalign = 0.0
56
89
  label.margin_start = 6
57
90
  hbox.pack_start(label, :expand => true, :fill => true, :padding => 0)
58
-
59
91
  label = Gtk::Label.new("")
60
92
  hbox.pack_start(label, :expand => true, :fill => true, :padding => 0)
61
93
 
62
- entry.signal_connect("search-changed") do |widget|
94
+ @entry.signal_connect("search-changed") do |widget|
63
95
  puts "search changed: #{widget.text || ''}"
64
96
  label.text = widget.text || ""
65
97
  end
98
+ @entry.signal_connect("changed") { puts "changed: #{label.text || ''}" }
99
+ end
66
100
 
67
- entry.signal_connect("changed") do |_widget|
68
- puts "changed: #{label.text || ''}"
69
- end
70
-
101
+ def initialize_signal_hbox
71
102
  hbox = Gtk::Box.new(:horizontal, 10)
72
- vbox.pack_start(hbox, :expand => true, :fill => true, :padding => 0)
103
+ @vbox.pack_start(hbox, :expand => true, :fill => true, :padding => 0)
73
104
  hbox.border_width = 0
74
105
 
75
106
  label = Gtk::Label.new("Signal:")
@@ -80,28 +111,9 @@ module SearchEntry2Demo
80
111
  label = Gtk::Label.new("")
81
112
  hbox.pack_start(label, :expand => true, :fill => true, :padding => 0)
82
113
 
83
- entry.signal_connect("search-changed") do |widget|
84
- puts "search changed: #{widget.text || ''}"
85
- label.text = widget.text || ""
86
- end
87
-
88
- entry.signal_connect("next-match") do |_widget|
89
- label.text = "next-match"
90
- end
91
-
92
- entry.signal_connect("previous-match") do |_widget|
93
- label.text = "previous-match"
94
- end
95
-
96
- entry.signal_connect("stop-search") do |_widget|
97
- label.text = "stop-search"
98
- end
99
-
100
- if !window.visible?
101
- window.show_all
102
- else
103
- window.destroy
104
- end
105
- window
114
+ @entry.signal_connect("search-changed") { label.text = "search-changed" }
115
+ @entry.signal_connect("next-match") { label.text = "next-match" }
116
+ @entry.signal_connect("previous-match") { label.text = "previous-match" }
117
+ @entry.signal_connect("stop-search") { label.text = "stop-search" }
106
118
  end
107
119
  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
@@ -9,24 +9,24 @@ navigation of a GtkStack object. This widget automatically updates it
9
9
  content based on what is presently available in the GtkStack object,
10
10
  and using the "title" child property to set the display labels.
11
11
  =end
12
- module SidebarDemo
13
- def self.run_demo(_main_window)
14
- window = Gtk::Window.new(:toplevel)
15
- window.set_resizable(true)
16
- window.set_size_request(500, 350)
12
+ class SidebarDemo
13
+ def initialize(_main_window)
14
+ @window = Gtk::Window.new(:toplevel)
15
+ @window.resizable = true
16
+ @window.set_size_request(500, 350)
17
17
 
18
18
  header = Gtk::HeaderBar.new
19
- header.set_show_close_button(true)
20
- window.set_titlebar(header)
21
- window.set_title("Stack Sidebar")
19
+ header.show_close_button = true
20
+ @window.titlebar = header
21
+ @window.title = "Stack Sidebar"
22
22
 
23
23
  box = Gtk::Box.new(:horizontal, 0)
24
24
  sidebar = Gtk::StackSidebar.new
25
25
  box.pack_start(sidebar, :expand => false, :fill => false, :padding => 0)
26
26
 
27
27
  stack = Gtk::Stack.new
28
- stack.set_transition_type(:slide_up_down)
29
- sidebar.set_stack(stack)
28
+ stack.transition_type = :slide_up_down
29
+ sidebar.stack = stack
30
30
 
31
31
  widget = Gtk::Separator.new(:vertical)
32
32
  box.pack_start(widget, :expand => false, :fill => false, :padding => 0)
@@ -41,14 +41,13 @@ module SidebarDemo
41
41
  "Page 6",
42
42
  "Page 7",
43
43
  "Page 8",
44
- "Page 9"
45
- ]
44
+ "Page 9"]
46
45
 
47
46
  pages.each_with_index do |page_string, i|
48
47
  child = nil
49
- if i == 0
48
+ if i.zero?
50
49
  child = Gtk::Image.new(:icon_name => "help-about", :size => :menu)
51
- child.set_pixel_size(256)
50
+ child.pixel_size = 256
52
51
  else
53
52
  child = Gtk::Label.new(page_string)
54
53
  end
@@ -57,12 +56,14 @@ module SidebarDemo
57
56
  stack.child_set_property(child, "title", page_string)
58
57
  end
59
58
 
60
- window.add(box)
59
+ @window.add(box)
60
+ end
61
61
 
62
- if !window.visible?
63
- window.show_all
62
+ def run
63
+ if !@window.visible?
64
+ @window.show_all
64
65
  else
65
- window.destroy
66
+ @window.destroy
66
67
  end
67
68
  end
68
69
  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
@@ -16,53 +16,38 @@
16
16
  and not more. For example, if you are packing your widgets
17
17
  into a table, you would not include the GTK_FILL flag.
18
18
  =end
19
- module SizegroupDemo
20
- def self.run_demo(main_window)
19
+ class SizegroupDemo
20
+ def initialize(main_window)
21
21
  color_options = %w(Red Green Blue)
22
22
  dash_options = %w(Solid Dashed Dotted)
23
23
  end_options = %w(Square Round Double Arrow)
24
24
 
25
- window = Gtk::Window.new(:toplevel)
26
- window.screen = main_window.screen
27
- window.set_title("Size Groups")
28
- window.set_resizable(false)
25
+ @window = Gtk::Window.new(:toplevel)
26
+ @window.screen = main_window.screen
27
+ @window.title = "Size Groups"
28
+ @window.resizable = false
29
29
 
30
- vbox = Gtk::Box.new(:vertical, 5)
31
- window.add(vbox)
32
- vbox.set_border_width(5)
30
+ @vbox = Gtk::Box.new(:vertical, 5)
31
+ @window.add(@vbox)
32
+ @vbox.border_width = 5
33
33
 
34
34
  size_group = Gtk::SizeGroup.new(:horizontal)
35
35
 
36
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
-
37
+ table = initialize_frame("Color Options")
46
38
  add_row(table, 0, size_group, "_Foreground", color_options)
47
39
  add_row(table, 1, size_group, "_Background", color_options)
48
40
 
49
41
  # 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
-
42
+ table = initialize_frame("Line Options")
59
43
  add_row(table, 0, size_group, "_Dashing", dash_options)
60
44
  add_row(table, 1, size_group, "_Line ends", end_options)
61
45
 
62
46
  # And a check button to turn grouping on and off
63
47
  check_button = Gtk::CheckButton.new("_Enable grouping")
64
48
  check_button.set_use_underline(true)
65
- vbox.pack_start(check_button, :expand => false, :fill => false, :padding => 0)
49
+ @vbox.pack_start(check_button,
50
+ :expand => false, :fill => false, :padding => 0)
66
51
 
67
52
  check_button.signal_connect("toggled") do |widget|
68
53
  if widget.active?
@@ -71,16 +56,32 @@ module SizegroupDemo
71
56
  size_group.set_mode(:none)
72
57
  end
73
58
  end
59
+ end
74
60
 
75
- if !window.visible?
76
- window.show_all
61
+ def run
62
+ if !@window.visible?
63
+ @window.show_all
77
64
  else
78
- window.destroy
65
+ @window.destroy
79
66
  end
80
- window
67
+ @window
68
+ end
69
+
70
+ private
71
+
72
+ def initialize_frame(title)
73
+ frame = Gtk::Frame.new(title)
74
+ @vbox.pack_start(frame, :expand => false, :fill => false, :padding => 0)
75
+
76
+ table = Gtk::Grid.new
77
+ table.set_border_width(5)
78
+ table.set_row_spacing(5)
79
+ table.set_column_spacing(10)
80
+ frame.add(table)
81
+ table
81
82
  end
82
83
 
83
- def self.add_row(table, row, size_group, label_text, options)
84
+ def add_row(table, row, size_group, label_text, options)
84
85
  label = Gtk::Label.new(label_text, :use_underline => true)
85
86
  label.set_halign(:start)
86
87
  label.set_valign(:baseline)
@@ -95,7 +96,7 @@ module SizegroupDemo
95
96
  table.attach(combo_box, 1, row, 1, 1)
96
97
  end
97
98
 
98
- def self.create_combo_box(options)
99
+ def create_combo_box(options)
99
100
  combo_box = Gtk::ComboBoxText.new
100
101
  options.each do |o|
101
102
  combo_box.append_text(o)
@@ -0,0 +1,128 @@
1
+ # Copyright (c) 2016 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Spin Button
6
+
7
+ GtkSpinButton provides convenient ways to input data
8
+ that can be seen as a value in a range. The examples
9
+ here show that this does not necessarily mean numeric
10
+ values, and it can include custom formatting.
11
+ =end
12
+ require "date"
13
+
14
+ class SpinbuttonDemo
15
+ def initialize(main_window)
16
+ builder = Gtk::Builder.new(:resource => "/spinbutton/spinbutton.ui")
17
+ builder.connect_signals do |name|
18
+ case name
19
+ when "hex_spin_input"
20
+ proc do |button|
21
+ hex_spin_input(button)
22
+ end
23
+ when "hex_spin_output"
24
+ proc do |button|
25
+ hex_spin_output(button)
26
+ end
27
+ when "time_spin_input"
28
+ proc do |button|
29
+ time_spin_input(button)
30
+ end
31
+ when "time_spin_output"
32
+ proc do |button|
33
+ time_spin_output(button)
34
+ end
35
+ when "month_spin_input"
36
+ proc do |button|
37
+ month_spin_input(button)
38
+ end
39
+ when "month_spin_output"
40
+ proc do |button|
41
+ month_spin_output(button)
42
+ end
43
+ else
44
+ end
45
+ end
46
+ @window = builder["window"]
47
+ @window.screen = main_window.screen
48
+ @window.title = "Spin Buttons"
49
+ @window.resizable = false
50
+
51
+ value_to_label = proc do |value|
52
+ value.to_s
53
+ end
54
+
55
+ adj = builder["basic_adjustment"]
56
+ basic_label = builder["basic_label"]
57
+ adj.bind_property("value", basic_label, "label", :sync_create,
58
+ :transform_to => value_to_label)
59
+
60
+ hex_adj = builder["hex_adjustment"]
61
+ hex_label = builder["hex_label"]
62
+ hex_adj.bind_property("value", hex_label, "label", :sync_create,
63
+ :transform_to => value_to_label)
64
+
65
+ adj = builder["time_adjustment"]
66
+ time_label = builder["time_label"]
67
+ adj.bind_property("value", time_label, "label", :sync_create,
68
+ :transform_to => value_to_label)
69
+
70
+ adj = builder["month_adjustment"]
71
+ month_label = builder["month_label"]
72
+ adj.bind_property("value", month_label, "label", :sync_create,
73
+ :transform_to => value_to_label)
74
+
75
+ end
76
+
77
+ def run
78
+ if !@window.visible?
79
+ @window.show_all
80
+ else
81
+ @window.destroy
82
+ end
83
+ @window
84
+ end
85
+
86
+ private
87
+
88
+ def hex_spin_input(button)
89
+ value = button.text.to_i(16)
90
+ value = 0 if value < 1e-5
91
+ value
92
+ end
93
+
94
+ def hex_spin_output(button)
95
+ value = button.value
96
+ button.text = sprintf("0x%.2X", value)
97
+ button.text = "0x00" if value.abs < 1e-5
98
+ true
99
+ end
100
+
101
+ def time_spin_input(button)
102
+ str = button.text.split(":")
103
+ hours = str[0].to_i
104
+ minutes = str[1].to_i
105
+ value = 0
106
+ if (0..24).include?(hours) && (0..60).include?(minutes)
107
+ value = hours * 60 + minutes
108
+ end
109
+ value
110
+ end
111
+
112
+ def time_spin_output(button)
113
+ hours = button.value / 60.0
114
+ minutes = (hours - hours.floor) * 60.0
115
+ button.text = sprintf("%02.0f:%02.0f", hours.floor, (minutes + 0.5).floor)
116
+ true
117
+ end
118
+
119
+ def month_spin_input(button)
120
+ Date::MONTHNAMES.index(button.text) || 1
121
+ end
122
+
123
+ def month_spin_output(button)
124
+ value = button.adjustment.value || 1
125
+ button.text = Date::MONTHNAMES[value]
126
+ true
127
+ end
128
+ end