gtk3 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gtk3/extconf.rb +1 -1
  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/gtk3.rb +1 -0
  14. data/sample/gtk-demo/cairo-arc-negative.rb +1 -1
  15. data/sample/gtk-demo/cairo-arc.rb +1 -1
  16. data/sample/gtk-demo/cairo-clip-image.rb +6 -6
  17. data/sample/gtk-demo/cairo-clip-rectangle.rb +2 -2
  18. data/sample/gtk-demo/cairo-curve-rectangle.rb +2 -2
  19. data/sample/gtk-demo/cairo-curve-to.rb +2 -2
  20. data/sample/gtk-demo/cairo-dash.rb +1 -1
  21. data/sample/gtk-demo/cairo-fill-and-stroke.rb +1 -1
  22. data/sample/gtk-demo/cairo-fill-and-stroke2.rb +2 -2
  23. data/sample/gtk-demo/cairo-gradient.rb +1 -1
  24. data/sample/gtk-demo/cairo-image-pattern.rb +5 -5
  25. data/sample/gtk-demo/cairo-image.rb +4 -4
  26. data/sample/gtk-demo/cairo-line-cap.rb +8 -8
  27. data/sample/gtk-demo/cairo-line-join.rb +3 -3
  28. data/sample/gtk-demo/cairo-long-lines.rb +3 -3
  29. data/sample/gtk-demo/cairo-pattern-fill.rb +11 -11
  30. data/sample/gtk-demo/cairo-self-intersect.rb +2 -2
  31. data/sample/gtk-demo/cairo-text-align-center.rb +4 -4
  32. data/sample/gtk-demo/cairo-text-extents.rb +5 -5
  33. data/sample/gtk-demo/cairo-text.rb +3 -3
  34. data/sample/gtk-demo/common.rb +0 -1
  35. data/sample/gtk-demo/dialog.rb +23 -23
  36. data/sample/gtk-demo/drawingarea.rb +5 -1
  37. data/sample/gtk-demo/editable_cells.rb +28 -28
  38. data/sample/gtk-demo/entry_completion.rb +3 -3
  39. data/sample/gtk-demo/images.rb +75 -75
  40. data/sample/gtk-demo/item_factory.rb +40 -40
  41. data/sample/gtk-demo/list_store.rb +13 -13
  42. data/sample/gtk-demo/menus.rb +34 -34
  43. data/sample/gtk-demo/panes.rb +28 -28
  44. data/sample/gtk-demo/rotated_text.rb +41 -53
  45. data/sample/gtk-demo/sizegroup.rb +17 -17
  46. data/sample/gtk-demo/spinner.rb +1 -1
  47. data/sample/gtk-demo/textview.rb +137 -137
  48. data/sample/gtk-demo/theming.ui +319 -0
  49. data/sample/gtk-demo/theming_style_classes.rb +48 -0
  50. data/sample/gtk-demo/tree_store.rb +127 -127
  51. data/sample/misc/assistant.rb +6 -66
  52. data/sample/misc/bindings.rb +22 -32
  53. data/sample/misc/button.rb +8 -5
  54. data/sample/misc/buttonbox.rb +2 -2
  55. data/sample/misc/checkbutton.rb +4 -1
  56. data/sample/misc/colorselection.rb +7 -10
  57. data/sample/misc/combo_check.rb +34 -26
  58. data/sample/misc/combobox.rb +10 -11
  59. data/sample/misc/cursor.rb +3 -1
  60. data/sample/misc/dialog.rb +12 -12
  61. data/sample/misc/dialog2.rb +13 -16
  62. data/sample/misc/drawing.rb +40 -21
  63. data/sample/misc/statusicon.rb +28 -45
  64. data/sample/misc/threads.rb +16 -18
  65. data/sample/misc/tree_progress.rb +10 -12
  66. data/test/run-test.rb +17 -9
  67. data/test/test_gtk_search_bar.rb +1 -1
  68. data/test/test_gtk_stack_switcher.rb +30 -0
  69. metadata +25 -21
@@ -35,7 +35,6 @@
35
35
  #include <cairo-gobject.h>
36
36
  #include <rbpango.h>
37
37
  #include <rbgdk-pixbuf.h>
38
- #include <rbgdk3.h>
39
38
  #include "rbgtk3.h"
40
39
  #include "rbgtk3util.h"
41
40
 
@@ -242,6 +241,7 @@ G_GNUC_INTERNAL void Init_gtk_spin_button(VALUE mGtk);
242
241
  G_GNUC_INTERNAL void Init_gtk_spinner(VALUE mGtk);
243
242
  #if GTK_CHECK_VERSION(3, 10, 0)
244
243
  G_GNUC_INTERNAL void Init_gtk_stack(VALUE mGtk);
244
+ G_GNUC_INTERNAL void Init_gtk_stack_switcher(VALUE mGtk);
245
245
  #endif
246
246
  G_GNUC_INTERNAL void Init_gtk_statusbar(VALUE mGtk);
247
247
  G_GNUC_INTERNAL void Init_gtk_status_icon(VALUE mGtk);
@@ -7,4 +7,5 @@
7
7
  require 'gtk3/base'
8
8
  require 'gtk3/deprecated'
9
9
 
10
+ Gdk.init if Gdk.respond_to?(:init)
10
11
  Gtk.init
@@ -25,7 +25,7 @@ module Demo
25
25
  def draw(cr)
26
26
  cr.arc_negative(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE2)
27
27
  cr.stroke
28
-
28
+
29
29
  # draw helping lines
30
30
  cr.set_source_rgba(1, 0.2, 0.2, 0.6)
31
31
  cr.arc(CENTER_X, CENTER_Y, 0.05, 0, 2 * Math::PI)
@@ -25,7 +25,7 @@ module Demo
25
25
  def draw(cr)
26
26
  cr.arc(CENTER_X, CENTER_Y, RADIUS, ANGLE1, ANGLE2)
27
27
  cr.stroke
28
-
28
+
29
29
  # draw helping lines
30
30
  cr.set_source_rgba(1, 0.2, 0.2, 0.6)
31
31
  cr.arc(CENTER_X, CENTER_Y, 0.05, 0, 2 * Math::PI)
@@ -20,16 +20,16 @@ module Demo
20
20
  cr.save do
21
21
  cr.arc(0.5, 0.5, 0.4, 0, 2 * Math::PI)
22
22
  cr.clip
23
-
23
+
24
24
  cr.new_path
25
-
25
+
26
26
  loader = Gdk::PixbufLoader.new
27
27
  File.open("background.jpg", "rb") do |f|
28
28
  loader.last_write(f.read)
29
29
  end
30
30
  pixbuf = loader.pixbuf
31
31
  cr.scale(1.0 / pixbuf.width, 1.0 / pixbuf.height)
32
-
32
+
33
33
  cr.set_source_pixbuf(pixbuf, 0, 0)
34
34
  cr.paint
35
35
  end
@@ -37,12 +37,12 @@ module Demo
37
37
  cr.save do
38
38
  cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI)
39
39
  cr.clip
40
-
40
+
41
41
  cr.new_path
42
-
42
+
43
43
  image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png")
44
44
  cr.scale(1.0 / image.width, 1.0 / image.height)
45
-
45
+
46
46
  cr.set_source(image, 0, 0)
47
47
  cr.paint
48
48
  end
@@ -24,9 +24,9 @@ module Demo
24
24
  cr.line_to(0.75, 0.25)
25
25
  cr.line_to(0.25, 0.25)
26
26
  cr.close_path
27
-
27
+
28
28
  cr.clip
29
-
29
+
30
30
  cr.move_to(0, 0)
31
31
  cr.line_to(1, 1)
32
32
  cr.stroke
@@ -28,7 +28,7 @@ module Demo
28
28
 
29
29
  def draw(cr)
30
30
  return if (RECT_WIDTH <= 0 || RECT_HEIGHT <= 0)
31
-
31
+
32
32
  if (RECT_WIDTH / 2 < RADIUS)
33
33
  if (RECT_HEIGHT / 2 < RADIUS)
34
34
  cr.move_to(X0, (Y0 + Y1) / 2)
@@ -64,7 +64,7 @@ module Demo
64
64
  cr.curve_to(X0, Y1, X0, Y1, X0, Y1- RADIUS)
65
65
  end
66
66
  end
67
-
67
+
68
68
  cr.close_path
69
69
 
70
70
  cr.set_source_rgba(0.5,0.5,1)
@@ -28,9 +28,9 @@ module Demo
28
28
  def draw(cr)
29
29
  cr.move_to(X, Y)
30
30
  cr.curve_to(X1, Y1, X2, Y2, X3, Y3)
31
-
31
+
32
32
  cr.stroke
33
-
33
+
34
34
  cr.set_source_rgba(1, 0.2, 0.2, 0.6)
35
35
  cr.set_line_width(0.03)
36
36
  cr.move_to(X, Y)
@@ -32,7 +32,7 @@ module Demo
32
32
  cr.line_to(0.9, 0.9)
33
33
  cr.rel_line_to(-0.4, 0.0)
34
34
  cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5)
35
-
35
+
36
36
  cr.stroke
37
37
  end
38
38
  end
@@ -22,7 +22,7 @@ module Demo
22
22
  cr.rel_line_to(-0.4, 0.0)
23
23
  cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5)
24
24
  cr.close_path
25
-
25
+
26
26
  cr.set_source_rgba(0, 0, 1)
27
27
  cr.fill_preserve
28
28
  cr.set_source_rgba(0, 0, 0)
@@ -22,13 +22,13 @@ module Demo
22
22
  cr.rel_line_to(-0.4, 0.0)
23
23
  cr.curve_to(0.2, 0.9, 0.2, 0.5, 0.5, 0.5)
24
24
  cr.close_path
25
-
25
+
26
26
  cr.move_to(0.25, 0.1)
27
27
  cr.rel_line_to(0.2, 0.2)
28
28
  cr.rel_line_to(-0.2, 0.2)
29
29
  cr.rel_line_to(-0.2, -0.2)
30
30
  cr.close_path
31
-
31
+
32
32
  cr.set_source_rgba(0, 0, 1)
33
33
  cr.fill_preserve
34
34
  cr.set_source_rgba(0, 0, 0)
@@ -23,7 +23,7 @@ module Demo
23
23
  cr.rectangle(0, 0, 1, 1)
24
24
  cr.set_source(pat)
25
25
  cr.fill
26
-
26
+
27
27
  pat = Cairo::RadialPattern.new(0.45, 0.4, 0.1, 0.4, 0.4, 0.5)
28
28
  pat.add_color_stop_rgba(0, 1, 1, 1, 0.8)
29
29
  pat.add_color_stop_rgba(1, 0, 0, 0)
@@ -18,20 +18,20 @@ module Demo
18
18
 
19
19
  def draw(cr)
20
20
  image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png")
21
-
21
+
22
22
  pattern = Cairo::SurfacePattern.new(image)
23
23
  pattern.set_extend(Cairo::EXTEND_REPEAT)
24
-
24
+
25
25
  cr.translate(0.5, 0.5)
26
26
  cr.rotate(Math::PI / 4)
27
27
  cr.scale(1 / Math.sqrt(2), 1 / Math.sqrt(2))
28
28
  cr.translate(-0.5, -0.5)
29
-
29
+
30
30
  matrix = Cairo::Matrix.scale(image.width * 5, image.height * 5)
31
31
  pattern.set_matrix(matrix)
32
-
32
+
33
33
  cr.set_source(pattern)
34
-
34
+
35
35
  cr.rectangle(0, 0, 1.0, 1.0)
36
36
  cr.fill
37
37
  end
@@ -23,24 +23,24 @@ module Demo
23
23
  loader.last_write(f.read)
24
24
  end
25
25
  pixbuf = loader.pixbuf
26
-
26
+
27
27
  cr.translate(0.5, 0.5)
28
28
  cr.rotate(45 * Math::PI / 180)
29
29
  cr.scale(1.0 / pixbuf.width, 1.0 / pixbuf.height)
30
30
  cr.translate(-0.5 * pixbuf.width, -0.5 * pixbuf.height)
31
-
31
+
32
32
  cr.set_source_pixbuf(pixbuf, 0, 0)
33
33
  cr.paint
34
34
  end
35
35
 
36
36
  cr.save do
37
37
  image = Cairo::ImageSurface.from_png("ruby-gnome2-logo.png")
38
-
38
+
39
39
  cr.translate(0.5, 0.5)
40
40
  cr.rotate(60 * Math::PI / 180)
41
41
  cr.scale(0.8 / image.width, 0.8 / image.height)
42
42
  cr.translate(-0.5 * image.width, -0.5 * image.height)
43
-
43
+
44
44
  cr.set_source(image, 0, 0)
45
45
  cr.paint
46
46
  end
@@ -18,35 +18,35 @@ module Demo
18
18
 
19
19
  def draw(cr)
20
20
  cr.set_line_width(0.12)
21
-
21
+
22
22
  cr.set_line_cap(Cairo::LINE_CAP_BUTT) # default
23
23
  cr.move_to(0.25, 0.2)
24
24
  cr.line_to(0.25, 0.8)
25
25
  cr.stroke
26
-
26
+
27
27
  cr.set_line_cap(Cairo::LINE_CAP_ROUND)
28
28
  cr.move_to(0.5, 0.2)
29
29
  cr.line_to(0.5, 0.8)
30
30
  cr.stroke
31
-
31
+
32
32
  cr.set_line_cap(Cairo::LINE_CAP_SQUARE)
33
33
  cr.move_to(0.75, 0.2)
34
34
  cr.line_to(0.75, 0.8)
35
35
  cr.stroke
36
-
36
+
37
37
  # draw helping lines
38
38
  cr.set_source_rgba(1, 0.2, 0.2)
39
39
  cr.set_line_width(0.01)
40
-
40
+
41
41
  cr.move_to(0.25, 0.2)
42
42
  cr.line_to(0.25, 0.8)
43
-
43
+
44
44
  cr.move_to(0.5, 0.2)
45
45
  cr.line_to(0.5, 0.8)
46
-
46
+
47
47
  cr.move_to(0.75, 0.2)
48
48
  cr.line_to(0.75, 0.8)
49
-
49
+
50
50
  cr.stroke
51
51
  end
52
52
  end
@@ -18,19 +18,19 @@ module Demo
18
18
 
19
19
  def draw(cr)
20
20
  cr.set_line_width(0.16)
21
-
21
+
22
22
  cr.move_to(0.3, 0.33)
23
23
  cr.rel_line_to(0.2, -0.2)
24
24
  cr.rel_line_to(0.2, 0.2)
25
25
  cr.set_line_join(Cairo::LINE_JOIN_MITER) # default
26
26
  cr.stroke
27
-
27
+
28
28
  cr.move_to(0.3, 0.63)
29
29
  cr.rel_line_to(0.2, -0.2)
30
30
  cr.rel_line_to(0.2, 0.2)
31
31
  cr.set_line_join(Cairo::LINE_JOIN_BEVEL)
32
32
  cr.stroke
33
-
33
+
34
34
  cr.move_to(0.3, 0.93)
35
35
  cr.rel_line_to(0.2, -0.2)
36
36
  cr.rel_line_to(0.2, 0.2)
@@ -21,17 +21,17 @@ module Demo
21
21
  cr.line_to(0.1, 50)
22
22
  cr.set_source_rgba(1, 0, 0)
23
23
  cr.stroke
24
-
24
+
25
25
  cr.move_to(0.2, -60)
26
26
  cr.line_to(0.2, 60)
27
27
  cr.set_source_rgba(1, 1, 0)
28
28
  cr.stroke
29
-
29
+
30
30
  cr.move_to(0.3, -70)
31
31
  cr.line_to(0.3, 70)
32
32
  cr.set_source_rgba(0, 1, 0)
33
33
  cr.stroke
34
-
34
+
35
35
  cr.move_to(0.4, -80)
36
36
  cr.line_to(0.4, 80)
37
37
  cr.set_source_rgba(0, 0, 1)
@@ -14,13 +14,13 @@ module Demo
14
14
  class CairoPatternFill < CairoWindow
15
15
  X_FUZZ = 0.08
16
16
  Y_FUZZ = 0.08
17
-
17
+
18
18
  X_INNER_RADIUS = 0.3
19
19
  Y_INNER_RADIUS = 0.2
20
-
20
+
21
21
  X_OUTER_RADIUS = 0.45
22
22
  Y_OUTER_RADIUS = 0.35
23
-
23
+
24
24
  SPIKES = 10
25
25
 
26
26
  TEXT = "Ruby!"
@@ -31,31 +31,31 @@ module Demo
31
31
 
32
32
  def draw(cr)
33
33
  srand(45)
34
-
34
+
35
35
  cr.set_line_width(0.01)
36
36
 
37
37
  x = y = nil
38
38
  0.step(SPIKES * 2 - 1, 2) do |i|
39
39
  x = x_position(i, X_INNER_RADIUS)
40
40
  y = y_position(i, Y_INNER_RADIUS)
41
-
41
+
42
42
  if (i == 0)
43
43
  cr.move_to(x, y)
44
44
  else
45
45
  cr.line_to(x, y)
46
46
  end
47
-
47
+
48
48
  i += 1
49
-
49
+
50
50
  x = x_position(i, X_OUTER_RADIUS)
51
51
  y = y_position(i, Y_OUTER_RADIUS)
52
-
52
+
53
53
  cr.line_to(x, y)
54
54
  end
55
55
 
56
56
  cr.close_path
57
57
  cr.stroke
58
-
58
+
59
59
  cr.select_font_face("Sans",
60
60
  Cairo::FONT_SLANT_NORMAL,
61
61
  Cairo::FONT_WEIGHT_BOLD)
@@ -65,7 +65,7 @@ module Demo
65
65
  cr.text_path(TEXT)
66
66
  cr.set_source_rgba(1, 0, 0.5)
67
67
  cr.fill
68
-
68
+
69
69
  cr.set_font_size(0.2)
70
70
  extents = cr.text_extents(TEXT)
71
71
  x = 0.5 - (extents.width / 2 + extents.x_bearing)
@@ -82,7 +82,7 @@ module Demo
82
82
  end
83
83
 
84
84
  def y_position(i, radius)
85
- 0.5 + Math.sin(Math::PI * i / SPIKES) * radius + rand * Y_FUZZ
85
+ 0.5 + Math.sin(Math::PI * i / SPIKES) * radius + rand * Y_FUZZ
86
86
  end
87
87
  end
88
88
  end
@@ -19,10 +19,10 @@ module Demo
19
19
  def draw(cr)
20
20
  cr.move_to(0.3, 0.3)
21
21
  cr.line_to(0.7, 0.3)
22
-
22
+
23
23
  cr.line_to(0.5, 0.3)
24
24
  cr.line_to(0.5, 0.7)
25
-
25
+
26
26
  cr.set_line_width(0.22)
27
27
  cr.set_line_cap(Cairo::LINE_CAP_ROUND)
28
28
  cr.set_line_join(Cairo::LINE_JOIN_ROUND)
@@ -13,7 +13,7 @@ require 'common'
13
13
  module Demo
14
14
  class CairoTextAlignCenter < CairoWindow
15
15
  TEXT = "Ruby"
16
-
16
+
17
17
  def initialize
18
18
  super('cairo text align center')
19
19
  end
@@ -22,15 +22,15 @@ module Demo
22
22
  cr.select_font_face("Sans",
23
23
  Cairo::FONT_SLANT_NORMAL,
24
24
  Cairo::FONT_WEIGHT_NORMAL)
25
-
25
+
26
26
  cr.set_font_size(0.2)
27
27
  extents = cr.text_extents(TEXT)
28
28
  x = 0.5 - (extents.width / 2 + extents.x_bearing)
29
29
  y = 0.5 - (extents.height / 2 + extents.y_bearing)
30
-
30
+
31
31
  cr.move_to(x, y)
32
32
  cr.show_text(TEXT)
33
-
33
+
34
34
  # draw helping lines
35
35
  cr.set_source_rgba(1, 0.2, 0.2, 0.6)
36
36
  cr.arc(x, y, 0.05, 0, 2 * Math::PI)
@@ -13,7 +13,7 @@ require 'common'
13
13
  module Demo
14
14
  class CairoTextExtents < CairoWindow
15
15
  TEXT = "Ruby"
16
-
16
+
17
17
  def initialize
18
18
  super('cairo text')
19
19
  end
@@ -22,16 +22,16 @@ module Demo
22
22
  cr.select_font_face("Sans",
23
23
  Cairo::FONT_SLANT_NORMAL,
24
24
  Cairo::FONT_WEIGHT_NORMAL)
25
-
25
+
26
26
  cr.set_font_size(0.3)
27
27
  extents = cr.text_extents(TEXT)
28
-
28
+
29
29
  x = 0.1
30
30
  y = 0.6
31
-
31
+
32
32
  cr.move_to(x, y)
33
33
  cr.show_text(TEXT)
34
-
34
+
35
35
  # draw helping lines
36
36
  cr.set_source_rgba(1, 0.2, 0.2, 0.6)
37
37
  cr.arc(x, y, 0.05, 0, 2 * Math::PI)