gtk3 2.2.0-x86-mingw32 → 2.2.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gtk3/extconf.rb +3 -2
  3. data/ext/gtk3/rbgtk-color-button.c +7 -1
  4. data/ext/gtk3/rbgtk-dialog.c +26 -6
  5. data/ext/gtk3/rbgtk-image.c +1 -0
  6. data/ext/gtk3/rbgtk-selection-data.c +4 -5
  7. data/ext/gtk3/rbgtk-stack-switcher.c +41 -0
  8. data/ext/gtk3/rbgtk-window.c +8 -0
  9. data/ext/gtk3/rbgtk.c +158 -0
  10. data/ext/gtk3/rbgtk3.h +33 -0
  11. data/ext/gtk3/rbgtk3conversions.h +60 -1
  12. data/ext/gtk3/rbgtk3private.h +1 -1
  13. data/lib/2.0/gtk3.so +0 -0
  14. data/lib/gtk3.rb +1 -0
  15. data/sample/gtk-demo/cairo-arc-negative.rb +1 -1
  16. data/sample/gtk-demo/cairo-arc.rb +1 -1
  17. data/sample/gtk-demo/cairo-clip-image.rb +6 -6
  18. data/sample/gtk-demo/cairo-clip-rectangle.rb +2 -2
  19. data/sample/gtk-demo/cairo-curve-rectangle.rb +2 -2
  20. data/sample/gtk-demo/cairo-curve-to.rb +2 -2
  21. data/sample/gtk-demo/cairo-dash.rb +1 -1
  22. data/sample/gtk-demo/cairo-fill-and-stroke.rb +1 -1
  23. data/sample/gtk-demo/cairo-fill-and-stroke2.rb +2 -2
  24. data/sample/gtk-demo/cairo-gradient.rb +1 -1
  25. data/sample/gtk-demo/cairo-image-pattern.rb +5 -5
  26. data/sample/gtk-demo/cairo-image.rb +4 -4
  27. data/sample/gtk-demo/cairo-line-cap.rb +8 -8
  28. data/sample/gtk-demo/cairo-line-join.rb +3 -3
  29. data/sample/gtk-demo/cairo-long-lines.rb +3 -3
  30. data/sample/gtk-demo/cairo-pattern-fill.rb +11 -11
  31. data/sample/gtk-demo/cairo-self-intersect.rb +2 -2
  32. data/sample/gtk-demo/cairo-text-align-center.rb +4 -4
  33. data/sample/gtk-demo/cairo-text-extents.rb +5 -5
  34. data/sample/gtk-demo/cairo-text.rb +3 -3
  35. data/sample/gtk-demo/common.rb +0 -1
  36. data/sample/gtk-demo/dialog.rb +23 -23
  37. data/sample/gtk-demo/drawingarea.rb +5 -1
  38. data/sample/gtk-demo/editable_cells.rb +28 -28
  39. data/sample/gtk-demo/entry_completion.rb +3 -3
  40. data/sample/gtk-demo/images.rb +75 -75
  41. data/sample/gtk-demo/item_factory.rb +40 -40
  42. data/sample/gtk-demo/list_store.rb +13 -13
  43. data/sample/gtk-demo/menus.rb +34 -34
  44. data/sample/gtk-demo/panes.rb +28 -28
  45. data/sample/gtk-demo/rotated_text.rb +41 -53
  46. data/sample/gtk-demo/sizegroup.rb +17 -17
  47. data/sample/gtk-demo/spinner.rb +1 -1
  48. data/sample/gtk-demo/textview.rb +137 -137
  49. data/sample/gtk-demo/theming.ui +319 -0
  50. data/sample/gtk-demo/theming_style_classes.rb +48 -0
  51. data/sample/gtk-demo/tree_store.rb +127 -127
  52. data/sample/misc/assistant.rb +6 -66
  53. data/sample/misc/bindings.rb +22 -32
  54. data/sample/misc/button.rb +8 -5
  55. data/sample/misc/buttonbox.rb +2 -2
  56. data/sample/misc/checkbutton.rb +4 -1
  57. data/sample/misc/colorselection.rb +7 -10
  58. data/sample/misc/combo_check.rb +34 -26
  59. data/sample/misc/combobox.rb +10 -11
  60. data/sample/misc/cursor.rb +3 -1
  61. data/sample/misc/dialog.rb +12 -12
  62. data/sample/misc/dialog2.rb +13 -16
  63. data/sample/misc/drawing.rb +40 -21
  64. data/sample/misc/statusicon.rb +28 -45
  65. data/sample/misc/threads.rb +16 -18
  66. data/sample/misc/tree_progress.rb +10 -12
  67. data/test/run-test.rb +17 -9
  68. data/test/test_gtk_search_bar.rb +1 -1
  69. data/test/test_gtk_stack_switcher.rb +30 -0
  70. metadata +26 -24
  71. data/lib/1.9/gtk3.so +0 -0
  72. data/lib/2.1/gtk3.so +0 -0
@@ -7,15 +7,17 @@
7
7
  $Id: cursor.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
8
8
  =end
9
9
 
10
- require 'gtk3'
10
+ require "gtk3"
11
11
 
12
12
  window = Gtk::Window.new("Gdk::Cursor sample")
13
+ window.signal_connect('destroy') {Gtk.main_quit}
13
14
  window.realize
14
15
 
15
16
  button = Gtk::Button.new(:label => "Click!")
16
17
  button.use_underline = false
17
18
 
18
19
  cursors = Gdk::Cursor::Type.values - [Gdk::Cursor::Type::CURSOR_IS_PIXMAP]
20
+ cursors -= [Gdk::Cursor::Type::LAST_CURSOR]
19
21
 
20
22
  cnt = 0
21
23
  button.signal_connect('clicked') do
@@ -8,30 +8,30 @@
8
8
  $Id: dialog.rb,v 1.6 2006/06/17 13:18:12 mutoh Exp $
9
9
  =end
10
10
 
11
- require 'gtk3'
11
+ require "gtk3"
12
12
 
13
13
  window = Gtk::Window.new("Gtk::Dialog sample")
14
- button = Gtk::Button.new("Create Dialog")
15
- button.signal_connect("clicked") do
14
+ button = Gtk::Button.new(:label => "Create Dialog")
15
+ button.signal_connect("clicked") do
16
16
  dialog = Gtk::Dialog.new
17
17
  dialog.title = "Gtk::Dialog Sample"
18
18
  dialog.transient_for = window
19
19
  dialog.set_default_size(300, 300)
20
- dialog.vbox.add(Gtk::Label.new("Gtk::Dialog Sample"))
20
+ dialog.child.add(Gtk::Label.new("Gtk::Dialog Sample"))
21
21
 
22
22
 
23
- dialog.add_button("OK", Gtk::Dialog::RESPONSE_OK)
24
- dialog.add_button(Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL)
25
- dialog.add_button(Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_CLOSE)
26
- dialog.set_default_response(Gtk::Dialog::RESPONSE_CANCEL)
23
+ dialog.add_button("OK", Gtk::ResponseType::OK)
24
+ dialog.add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL)
25
+ dialog.add_button(Gtk::Stock::CLOSE, Gtk::ResponseType::CLOSE)
26
+ dialog.set_default_response(Gtk::ResponseType::CANCEL)
27
27
 
28
28
  dialog.signal_connect("response") do |widget, response|
29
29
  case response
30
- when Gtk::Dialog::RESPONSE_OK
30
+ when Gtk::ResponseType::OK
31
31
  p "OK"
32
- when Gtk::Dialog::RESPONSE_CANCEL
32
+ when Gtk::ResponseType::CANCEL
33
33
  p "Cancel"
34
- when Gtk::Dialog::RESPONSE_CLOSE
34
+ when Gtk::ResponseType::CLOSE
35
35
  p "Close"
36
36
  dialog.destroy
37
37
  end
@@ -39,6 +39,6 @@ button.signal_connect("clicked") do
39
39
  dialog.show_all
40
40
  end
41
41
 
42
- window.add(button).show_all.signal_connect("destroy"){Gtk.main_quit}
42
+ window.add(button).show_all.signal_connect("destroy") {Gtk.main_quit}
43
43
 
44
44
  Gtk.main
@@ -8,32 +8,29 @@
8
8
  $Id: dialog2.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
9
9
  =end
10
10
 
11
- require 'gtk3'
11
+ require "gtk3"
12
12
 
13
13
  window = Gtk::Window.new("Gtk::Dialog sample2")
14
- button = Gtk::Button.new("Create Dialog")
15
- button.signal_connect("clicked") do
16
- dialog = Gtk::Dialog.new("Gtk::Dialog Sample 2", window,
17
- Gtk::Dialog::MODAL|Gtk::Dialog::NO_SEPARATOR,
18
- [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK],
19
- [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL])
20
- dialog.vbox.add(Gtk::Label.new("Gtk::Dialog Sample 2"))
14
+ button = Gtk::Button.new(:label => "Create Dialog")
15
+ button.signal_connect("clicked") do
16
+ dialog = Gtk::Dialog.new(:title =>"Gtk::Dialog Sample 2",
17
+ :parent => window,
18
+ :flags => Gtk::Dialog::Flags::MODAL,
19
+ :buttons => [[Gtk::Stock::OK, Gtk::ResponseType::OK],
20
+ [Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL]])
21
+ dialog.child.add(Gtk::Label.new("Gtk::Dialog Sample 2"))
21
22
  dialog.set_default_size(300, 300)
22
- dialog.vbox.show_all
23
+ dialog.child.show_all
23
24
  result = dialog.run
24
25
  case result
25
- when Gtk::Dialog::RESPONSE_OK
26
+ when Gtk::ResponseType::OK
26
27
  p "OK"
27
- when Gtk::Dialog::RESPONSE_CANCEL
28
+ when Gtk::ResponseType::CANCEL
28
29
  p "Cancel"
29
30
  end
30
31
  dialog.destroy
31
32
  end
32
33
 
33
- window.add(button).show_all.signal_connect("destroy"){Gtk.main_quit}
34
+ window.add(button).show_all.signal_connect("destroy") {Gtk.main_quit}
34
35
 
35
36
  Gtk.main
36
-
37
-
38
-
39
-
@@ -12,17 +12,24 @@ require 'gtk3'
12
12
  class Canvas < Gtk::DrawingArea
13
13
  def initialize
14
14
  super
15
- signal_connect("draw") { |w,e| expose_event(w,e) }
16
- signal_connect("configure_event") { |w, e| configure_event(w,e) }
15
+ signal_connect("draw") do |w, e|
16
+ expose_event(w, e)
17
+ end
18
+ signal_connect("configure_event") do |w, e|
19
+ configure_event(w, e)
20
+ end
17
21
  @buffer = nil
18
22
  @bgc = nil
19
23
  end
20
24
 
21
- def expose_event(w,e)
25
+ def expose_event(w, e)
22
26
  unless @buffer.nil?
23
27
  rec = e.area
24
- w.window.draw_drawable(@bgc, @buffer, rec.x, rec.y,
25
- rec.x, rec.y, rec.width, rec.height)
28
+ w.window.draw_drawable(@bgc,
29
+ @buffer,
30
+ rec.x, rec.y,
31
+ rec.x, rec.y,
32
+ rec.width, rec.height)
26
33
  end
27
34
  false
28
35
  end
@@ -33,18 +40,22 @@ class Canvas < Gtk::DrawingArea
33
40
  g = b.size
34
41
  @bgc = self.style.bg_gc(self.state) if @bgc.nil?
35
42
  if (g[0] > 0 && g[1] > 0)
36
- b.draw_rectangle(@bgc, true, 0,0, g[0], g[1])
43
+ b.draw_rectangle(@bgc, true, 0, 0, g[0], g[1])
37
44
  end
38
45
  end
39
46
 
40
- def configure_event(w,e)
47
+ def configure_event(w, e)
41
48
  g = w.window.geometry
42
49
  if (g[2] > 0 && g[3] > 0)
43
50
  b = Gdk::Pixmap::new(w.window, g[2], g[3], -1)
44
51
  clear(b)
45
52
  if not @buffer.nil?
46
- g = @buffer.size
47
- b.draw_drawable(@bgc, @buffer, 0, 0, 0, 0, g[0], g[1])
53
+ g = @buffer.size
54
+ b.draw_drawable(@bgc,
55
+ @buffer,
56
+ 0, 0,
57
+ 0, 0,
58
+ g[0], g[1])
48
59
  end
49
60
  @buffer = b
50
61
  end
@@ -55,24 +66,30 @@ end
55
66
  class A < Canvas
56
67
  def initialize
57
68
  super
58
- signal_connect("button_press_event") { |w,e| pressed(w,e) }
69
+ signal_connect("button_press_event") do |w, e|
70
+ pressed(w, e)
71
+ end
59
72
  set_events(Gdk::Event::BUTTON_PRESS_MASK)
60
73
  end
61
74
 
62
75
  def pressed(widget, ev)
63
76
  if not @last.nil?
64
77
  @buffer.draw_line(widget.style.fg_gc(widget.state),
65
- @last.x, @last.y, ev.x, ev.y)
78
+ @last.x, @last.y,
79
+ ev.x, ev.y)
66
80
 
67
- x1,x2 = if (@last.x < ev.x)
68
- then [@last.x, ev.x]
69
- else [ev.x, @last.x]
70
- end
71
- y1,y2 = if (@last.y < ev.y)
72
- then [@last.y, ev.y]
73
- else [ev.y, @last.y]
74
- end
75
- widget.queue_draw_area(x1, y1, x2 - x1 + 1, y2 - y1 + 1)
81
+ x1, x2 = if (@last.x < ev.x)
82
+ [@last.x, ev.x]
83
+ else
84
+ [ev.x, @last.x]
85
+ end
86
+ y1, y2 = if (@last.y < ev.y)
87
+ [@last.y, ev.y]
88
+ else
89
+ [ev.y, @last.y]
90
+ end
91
+ widget.queue_draw_area(x1, y1,
92
+ x2 - x1 + 1, y2 - y1 + 1)
76
93
  end
77
94
  @last = nil
78
95
  @last = ev
@@ -81,7 +98,9 @@ class A < Canvas
81
98
  end
82
99
 
83
100
  window = Gtk::Window.new("drawing test")
84
- window.signal_connect("destroy") { Gtk.main_quit }
101
+ window.signal_connect("destroy") do
102
+ Gtk.main_quit
103
+ end
85
104
 
86
105
  canvas = A.new
87
106
  window.add(canvas)
@@ -10,10 +10,10 @@
10
10
  $Id: statusicon.rb,v 1.1 2006/11/17 18:12:41 mutoh Exp $
11
11
  =end
12
12
 
13
- require 'gtk3'
13
+ require "gtk3"
14
14
 
15
- if str = Gtk.check_version(2, 10, 0)
16
- puts "This sample requires GTK+ 2.10.0 or later"
15
+ if str = Gtk.check_version(3, 10, 7)
16
+ puts "This sample requires GTK+ 3.10.7 or later"
17
17
  puts str
18
18
  exit
19
19
  end
@@ -27,44 +27,35 @@ class StatusIconSample < Gtk::StatusIcon
27
27
  @status = STATUS_INFO
28
28
  update_icon
29
29
 
30
- set_blinking(true)
31
- signal_connect("activate"){
32
- icon_activated
33
- }
34
- signal_connect("popup-menu"){|w, button, activate_time|
30
+ signal_connect("activate") {icon_activated}
31
+ signal_connect("popup-menu") do |w, button, activate_time|
35
32
  menu = Gtk::Menu.new
36
- checkmenuitem = Gtk::CheckMenuItem.new("Blink")
37
- checkmenuitem.active = blinking?
38
- checkmenuitem.signal_connect("activate"){|w|
39
- set_blinking(w.active?)
40
- }
41
- menu.append(checkmenuitem)
42
33
 
43
34
  menuitem = Gtk::MenuItem.new("Quit")
44
- menuitem.signal_connect("activate"){
35
+ menuitem.signal_connect("activate") do
45
36
  set_visible(false)
46
37
  Gtk.main_quit
47
- }
38
+ end
48
39
  menu.append(menuitem)
49
40
  menu.show_all
50
41
  menu.popup(nil, nil, button, activate_time)
51
- }
42
+ end
52
43
 
53
- timeout_func
44
+ @timeout = timeout_func
54
45
  end
55
46
 
56
47
  def update_icon
57
48
  if @status == STATUS_INFO
58
- set_icon_name(Gtk::Stock::DIALOG_INFO)
59
- set_tooltip("Some Information ...")
49
+ self.stock = Gtk::Stock::DIALOG_INFO
50
+ set_tooltip_text("Some Information ...")
60
51
  else
61
- set_icon_name(Gtk::Stock::DIALOG_QUESTION)
62
- set_tooltip("Some Question ...")
52
+ self.stock = Gtk::Stock::DIALOG_QUESTION
53
+ set_tooltip_text("Some Question ...")
63
54
  end
64
55
  end
65
56
 
66
57
  def timeout_func
67
- GLib::Timeout.add(2000) {
58
+ GLib::Timeout.add(2000) do
68
59
  if @status == STATUS_INFO
69
60
  @status = STATUS_QUESTION
70
61
  else
@@ -72,50 +63,42 @@ class StatusIconSample < Gtk::StatusIcon
72
63
  end
73
64
  update_icon
74
65
  true
75
- }
66
+ end
76
67
  end
77
68
 
78
69
  def icon_activated
79
70
  unless @dialog
80
- @dialog = Gtk::MessageDialog.new(nil, 0,
81
- Gtk::MessageDialog::QUESTION,
82
- Gtk::MessageDialog::BUTTONS_CLOSE,
83
- "You wanna test the status icon?")
84
- @dialog.window_position = Gtk::Window::POS_CENTER
71
+ @dialog = Gtk::MessageDialog.new(:parent => nil, :flags => 0,
72
+ :type => Gtk::MessageType::QUESTION,
73
+ :buttons_type => Gtk::MessageDialog::ButtonsType::CLOSE,
74
+ :message => "You wanna test the status icon?")
75
+ @dialog.window_position = Gtk::Window::Position::CENTER
85
76
 
86
- @dialog.signal_connect("response"){ @dialog.hide }
87
- @dialog.signal_connect("delete_event"){ @dialog.hide_on_delete }
77
+ @dialog.signal_connect("response") {@dialog.hide}
78
+ @dialog.signal_connect("delete_event") {@dialog.hide_on_delete}
88
79
 
89
80
  toggle = Gtk::ToggleButton.new("_Show the icon")
90
- @dialog.vbox.pack_end(toggle, true, true, 6)
81
+ @dialog.child.pack_end(toggle, :expand => true, :fill => true, :padding => 6)
91
82
  toggle.active = visible?
92
- toggle.signal_connect("toggled"){|w|
83
+ toggle.signal_connect("toggled") do |w|
93
84
  set_visible(w.active?)
94
- }
85
+ end
95
86
 
96
- toggle = Gtk::ToggleButton.new("_Blink the icon")
97
- @dialog.vbox.pack_end(toggle, true, true, 6)
98
- toggle.active = blinking?
99
- toggle.signal_connect("toggled"){|w|
100
- set_blinking(w.active?)
101
- }
102
-
103
87
  toggle = Gtk::ToggleButton.new("_Change the icon")
104
- @dialog.vbox.pack_end(toggle, true, true, 6)
88
+ @dialog.child.pack_end(toggle, :expand => true, :fill => true, :padding => 6)
105
89
  toggle.active = (@timeout != 0)
106
- toggle.signal_connect("toggled"){
90
+ toggle.signal_connect("toggled") do
107
91
  if @timeout and @timeout > 0
108
92
  GLib::Source.remove(@timeout)
109
93
  @timeout = 0
110
94
  else
111
95
  @timeout = timeout_func
112
96
  end
113
- }
97
+ end
114
98
  end
115
99
  @dialog.show_all
116
100
  @dialog.present
117
101
  end
118
-
119
102
  end
120
103
 
121
104
  StatusIconSample.new
@@ -8,39 +8,39 @@
8
8
  $Id: threads.rb,v 1.5 2006/06/17 13:18:12 mutoh Exp $
9
9
  =end
10
10
 
11
- require 'gtk3'
12
- require 'thread'
11
+ require "gtk3"
12
+ require "thread"
13
13
 
14
14
  label = Gtk::Label.new
15
15
 
16
- Thread.new {
17
- (0...1000).each { |cnt|
16
+ Thread.new do
17
+ (0...1000).each do |cnt|
18
18
  p "A:" + cnt.to_s
19
19
  label.label = "A:" + cnt.to_s
20
20
  sleep(2)
21
- }
22
- }
21
+ end
22
+ end
23
23
 
24
24
  start_button = Gtk::Button.new("start")
25
25
  stop_button = Gtk::Button.new("stop")
26
26
 
27
27
  start_button.signal_connect("clicked") do
28
- start_button.sensitive=false
29
- @th = Thread.new {
30
- (0...10).each { |cnt|
28
+ start_button.sensitive = false
29
+ @th = Thread.new do
30
+ (0...10).each do |cnt|
31
31
  p "B:" + cnt.to_s
32
32
  label.label = "B:" + cnt.to_s
33
33
  sleep(2)
34
- }
34
+ end
35
35
  @th = nil
36
36
  start_button.sensitive = true
37
37
  start_button.grab_focus
38
38
  stop_button.sensitive = false
39
- }
39
+ end
40
40
  stop_button.sensitive = true
41
41
  stop_button.grab_focus
42
42
  end
43
-
43
+
44
44
  stop_button.signal_connect("clicked") do
45
45
  if @th
46
46
  @th.kill
@@ -54,8 +54,8 @@ end
54
54
 
55
55
  stop_button.sensitive = false
56
56
 
57
- box = Gtk::VBox.new.
58
- set_size_request(100,100)
57
+ box = Gtk::VBox.new
58
+ box.set_size_request(100, 100)
59
59
 
60
60
  box << label << start_button << stop_button
61
61
 
@@ -63,10 +63,8 @@ win = Gtk::Window.new << box
63
63
 
64
64
  win.show_all.signal_connect("delete_event") do
65
65
  p "Exiting..."
66
- Gtk.main_quit
67
- Thread.list.each {|t| t.kill }
66
+ Gtk.main_quit
67
+ Thread.list.each {|t| t.kill}
68
68
  end
69
69
 
70
70
  Gtk.main
71
-
72
-
@@ -9,7 +9,7 @@
9
9
  =end
10
10
 
11
11
 
12
- require 'gtk3'
12
+ require "gtk3"
13
13
 
14
14
  win = Gtk::Window.new("Gtk::CellRendererProgress sample")
15
15
  win.set_default_size(300, 50)
@@ -36,28 +36,26 @@ prenderer = Gtk::CellRendererProgress.new
36
36
  pcol = Gtk::TreeViewColumn.new("Progress", prenderer, :value => 1)
37
37
  view.append_column(pcol)
38
38
 
39
- win.signal_connect("delete_event"){
39
+ win.signal_connect("delete_event") do
40
40
  Gtk.main_quit
41
- }
41
+ end
42
42
 
43
43
  win.add(view)
44
44
  win.show_all
45
45
 
46
46
  dir = 1
47
47
  thr = Thread.new do
48
- loop {
49
- prog2[1] += dir
50
- if prog2[1] > 100
51
- prog2[1] = 100
48
+ loop do
49
+ value = prog2[1] + dir
50
+ if value > 100
52
51
  dir = - dir
53
52
  end
54
- if prog2[1] < 0
55
- prog2[1] = 0
53
+ if value < 0
56
54
  dir = - dir
57
55
  end
58
- sleep 0.01
59
- }
56
+ prog2[1] += dir
57
+ sleep 0.1
58
+ end
60
59
  end
61
60
 
62
61
  Gtk.main
63
-