gtk2 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (281) hide show
  1. data/ChangeLog +6664 -0
  2. data/README +33 -0
  3. data/Rakefile +71 -0
  4. data/extconf.rb +116 -0
  5. data/src/global.h +33 -0
  6. data/src/init.c +39 -0
  7. data/src/lib/gtk2.rb +13 -0
  8. data/src/lib/gtk2/base.rb +95 -0
  9. data/src/makeinits.rb +57 -0
  10. data/src/makekeysyms.rb +5 -0
  11. data/src/rbgdk.c +395 -0
  12. data/src/rbgdk.h +50 -0
  13. data/src/rbgdkatom.c +122 -0
  14. data/src/rbgdkcairo.c +100 -0
  15. data/src/rbgdkcolor.c +151 -0
  16. data/src/rbgdkcolormap.c +142 -0
  17. data/src/rbgdkconst.c +29 -0
  18. data/src/rbgdkconversions.h +18 -0
  19. data/src/rbgdkcursor.c +115 -0
  20. data/src/rbgdkdevice.c +235 -0
  21. data/src/rbgdkdisplay.c +634 -0
  22. data/src/rbgdkdisplaymanager.c +50 -0
  23. data/src/rbgdkdragcontext.c +280 -0
  24. data/src/rbgdkdraw.c +487 -0
  25. data/src/rbgdkevent.c +1020 -0
  26. data/src/rbgdkgc.c +456 -0
  27. data/src/rbgdkgeometry.c +272 -0
  28. data/src/rbgdkimage.c +155 -0
  29. data/src/rbgdkinput.c +70 -0
  30. data/src/rbgdkkeymap.c +153 -0
  31. data/src/rbgdkkeysyms.h +2174 -0
  32. data/src/rbgdkkeyval.c +105 -0
  33. data/src/rbgdkpango.c +171 -0
  34. data/src/rbgdkpangorenderer.c +132 -0
  35. data/src/rbgdkpixbuf.c +178 -0
  36. data/src/rbgdkpixmap.c +255 -0
  37. data/src/rbgdkproperty.c +342 -0
  38. data/src/rbgdkrectangle.c +146 -0
  39. data/src/rbgdkregion.c +242 -0
  40. data/src/rbgdkrgb.c +197 -0
  41. data/src/rbgdkscreen.c +535 -0
  42. data/src/rbgdkselection.c +161 -0
  43. data/src/rbgdkthreads.c +68 -0
  44. data/src/rbgdktimecoord.c +118 -0
  45. data/src/rbgdkvisual.c +273 -0
  46. data/src/rbgdkwindow.c +1302 -0
  47. data/src/rbgdkwindowattr.c +213 -0
  48. data/src/rbgdkx11.c +256 -0
  49. data/src/rbgtk.c +93 -0
  50. data/src/rbgtk.h +121 -0
  51. data/src/rbgtkaboutdialog.c +195 -0
  52. data/src/rbgtkaccelerator.c +78 -0
  53. data/src/rbgtkaccelgroup.c +216 -0
  54. data/src/rbgtkaccelgroupentry.c +85 -0
  55. data/src/rbgtkaccelkey.c +116 -0
  56. data/src/rbgtkaccellabel.c +46 -0
  57. data/src/rbgtkaccelmap.c +162 -0
  58. data/src/rbgtkaccessible.c +29 -0
  59. data/src/rbgtkaction.c +277 -0
  60. data/src/rbgtkactiongroup.c +377 -0
  61. data/src/rbgtkadjustment.c +153 -0
  62. data/src/rbgtkalignment.c +71 -0
  63. data/src/rbgtkallocation.c +171 -0
  64. data/src/rbgtkarrow.c +47 -0
  65. data/src/rbgtkaspectframe.c +46 -0
  66. data/src/rbgtkassistant.c +230 -0
  67. data/src/rbgtkbbox.c +47 -0
  68. data/src/rbgtkbin.c +31 -0
  69. data/src/rbgtkbindingset.c +192 -0
  70. data/src/rbgtkborder.c +80 -0
  71. data/src/rbgtkbox.c +142 -0
  72. data/src/rbgtkbuildable.c +115 -0
  73. data/src/rbgtkbuilder.c +154 -0
  74. data/src/rbgtkbutton.c +151 -0
  75. data/src/rbgtkcalendar.c +159 -0
  76. data/src/rbgtkcelleditable.c +49 -0
  77. data/src/rbgtkcelllayout.c +144 -0
  78. data/src/rbgtkcellrenderer.c +139 -0
  79. data/src/rbgtkcellrendereraccel.c +42 -0
  80. data/src/rbgtkcellrenderercombo.c +37 -0
  81. data/src/rbgtkcellrendererpixbuf.c +33 -0
  82. data/src/rbgtkcellrendererprogress.c +37 -0
  83. data/src/rbgtkcellrendererspin.c +38 -0
  84. data/src/rbgtkcellrenderertext.c +45 -0
  85. data/src/rbgtkcellrenderertoggle.c +32 -0
  86. data/src/rbgtkcellview.c +134 -0
  87. data/src/rbgtkcheckbutton.c +55 -0
  88. data/src/rbgtkcheckmenuitem.c +56 -0
  89. data/src/rbgtkclipboard.c +473 -0
  90. data/src/rbgtkcolorbutton.c +63 -0
  91. data/src/rbgtkcolorsel.c +175 -0
  92. data/src/rbgtkcolorselectiondialog.c +72 -0
  93. data/src/rbgtkcombo.c +117 -0
  94. data/src/rbgtkcombobox.c +240 -0
  95. data/src/rbgtkcomboboxentry.c +60 -0
  96. data/src/rbgtkconst.c +163 -0
  97. data/src/rbgtkcontainer.c +776 -0
  98. data/src/rbgtkconversions.h +26 -0
  99. data/src/rbgtkcurve.c +105 -0
  100. data/src/rbgtkdialog.c +244 -0
  101. data/src/rbgtkdrag.c +436 -0
  102. data/src/rbgtkdrawingarea.c +31 -0
  103. data/src/rbgtkeditable.c +152 -0
  104. data/src/rbgtkentry.c +161 -0
  105. data/src/rbgtkentrycompletion.c +167 -0
  106. data/src/rbgtkeventbox.c +31 -0
  107. data/src/rbgtkexpander.c +67 -0
  108. data/src/rbgtkfilechooser.c +403 -0
  109. data/src/rbgtkfilechooserbutton.c +72 -0
  110. data/src/rbgtkfilechooserdialog.c +58 -0
  111. data/src/rbgtkfilechooserwidget.c +50 -0
  112. data/src/rbgtkfilefilter.c +139 -0
  113. data/src/rbgtkfilesel.c +155 -0
  114. data/src/rbgtkfixed.c +72 -0
  115. data/src/rbgtkfontbutton.c +69 -0
  116. data/src/rbgtkfontselection.c +30 -0
  117. data/src/rbgtkfontselectiondialog.c +106 -0
  118. data/src/rbgtkframe.c +64 -0
  119. data/src/rbgtkgamma.c +47 -0
  120. data/src/rbgtkhandlebox.c +42 -0
  121. data/src/rbgtkhbbox.c +31 -0
  122. data/src/rbgtkhbox.c +38 -0
  123. data/src/rbgtkhpaned.c +31 -0
  124. data/src/rbgtkhruler.c +31 -0
  125. data/src/rbgtkhscale.c +45 -0
  126. data/src/rbgtkhscrollbar.c +38 -0
  127. data/src/rbgtkhseparator.c +30 -0
  128. data/src/rbgtkiconfactory.c +80 -0
  129. data/src/rbgtkiconinfo.c +118 -0
  130. data/src/rbgtkiconset.c +87 -0
  131. data/src/rbgtkiconsize.c +90 -0
  132. data/src/rbgtkiconsource.c +176 -0
  133. data/src/rbgtkicontheme.c +309 -0
  134. data/src/rbgtkiconview.c +351 -0
  135. data/src/rbgtkimage.c +152 -0
  136. data/src/rbgtkimagemenuitem.c +52 -0
  137. data/src/rbgtkimcontext.c +134 -0
  138. data/src/rbgtkimcontextsimple.c +48 -0
  139. data/src/rbgtkimmulticontext.c +38 -0
  140. data/src/rbgtkinits.c +473 -0
  141. data/src/rbgtkinputdialog.c +30 -0
  142. data/src/rbgtkinvisible.c +68 -0
  143. data/src/rbgtkitem.c +51 -0
  144. data/src/rbgtkitemfactory.c +312 -0
  145. data/src/rbgtklabel.c +168 -0
  146. data/src/rbgtklayout.c +91 -0
  147. data/src/rbgtklinkbutton.c +68 -0
  148. data/src/rbgtkliststore.c +412 -0
  149. data/src/rbgtkmacros.h +26 -0
  150. data/src/rbgtkmain.c +532 -0
  151. data/src/rbgtkmenu.c +272 -0
  152. data/src/rbgtkmenubar.c +48 -0
  153. data/src/rbgtkmenuitem.c +171 -0
  154. data/src/rbgtkmenushell.c +128 -0
  155. data/src/rbgtkmenutoolbutton.c +74 -0
  156. data/src/rbgtkmessagedialog.c +102 -0
  157. data/src/rbgtkmisc.c +63 -0
  158. data/src/rbgtknotebook.c +484 -0
  159. data/src/rbgtkobject.c +186 -0
  160. data/src/rbgtkoptionmenu.c +65 -0
  161. data/src/rbgtkpagesetup.c +196 -0
  162. data/src/rbgtkpagesetupunixdialog.c +80 -0
  163. data/src/rbgtkpaned.c +114 -0
  164. data/src/rbgtkpapersize.c +186 -0
  165. data/src/rbgtkplug.c +84 -0
  166. data/src/rbgtkprintcontext.c +124 -0
  167. data/src/rbgtkprinter.c +155 -0
  168. data/src/rbgtkprintjob.c +151 -0
  169. data/src/rbgtkprintoperation.c +152 -0
  170. data/src/rbgtkprintoperationpreview.c +54 -0
  171. data/src/rbgtkprintsettings.c +794 -0
  172. data/src/rbgtkprintunixdialog.c +98 -0
  173. data/src/rbgtkprogress.c +21 -0
  174. data/src/rbgtkprogressbar.c +72 -0
  175. data/src/rbgtkradioaction.c +102 -0
  176. data/src/rbgtkradiobutton.c +83 -0
  177. data/src/rbgtkradiomenuitem.c +115 -0
  178. data/src/rbgtkradiotoolbutton.c +99 -0
  179. data/src/rbgtkrange.c +98 -0
  180. data/src/rbgtkrc.c +228 -0
  181. data/src/rbgtkrcstyle.c +184 -0
  182. data/src/rbgtkrecentaction.c +52 -0
  183. data/src/rbgtkrecentchooser.c +276 -0
  184. data/src/rbgtkrecentchooserdialog.c +59 -0
  185. data/src/rbgtkrecentchoosermenu.c +55 -0
  186. data/src/rbgtkrecentchooserwidget.c +45 -0
  187. data/src/rbgtkrecentdata.c +152 -0
  188. data/src/rbgtkrecentfilter.c +180 -0
  189. data/src/rbgtkrecentfilterinfo.c +197 -0
  190. data/src/rbgtkrecentinfo.c +232 -0
  191. data/src/rbgtkrecentmanager.c +164 -0
  192. data/src/rbgtkruler.c +82 -0
  193. data/src/rbgtkscale.c +47 -0
  194. data/src/rbgtkscalebutton.c +115 -0
  195. data/src/rbgtkscrollbar.c +21 -0
  196. data/src/rbgtkscrolledwindow.c +160 -0
  197. data/src/rbgtkselection.c +171 -0
  198. data/src/rbgtkselectiondata.c +333 -0
  199. data/src/rbgtkseparator.c +21 -0
  200. data/src/rbgtkseparatormenuitem.c +28 -0
  201. data/src/rbgtkseparatortoolitem.c +40 -0
  202. data/src/rbgtksettings.c +225 -0
  203. data/src/rbgtksizegroup.c +74 -0
  204. data/src/rbgtksocket.c +72 -0
  205. data/src/rbgtkspinbutton.c +138 -0
  206. data/src/rbgtkstatusbar.c +90 -0
  207. data/src/rbgtkstatusicon.c +120 -0
  208. data/src/rbgtkstock.c +264 -0
  209. data/src/rbgtkstyle.c +722 -0
  210. data/src/rbgtktable.c +190 -0
  211. data/src/rbgtktargetlist.c +148 -0
  212. data/src/rbgtktearoffmenuitem.c +30 -0
  213. data/src/rbgtktextappearance.c +173 -0
  214. data/src/rbgtktextattributes.c +209 -0
  215. data/src/rbgtktextbuffer.c +993 -0
  216. data/src/rbgtktextchild.c +49 -0
  217. data/src/rbgtktextiter.c +553 -0
  218. data/src/rbgtktextmark.c +87 -0
  219. data/src/rbgtktexttag.c +66 -0
  220. data/src/rbgtktexttagtable.c +94 -0
  221. data/src/rbgtktextview.c +351 -0
  222. data/src/rbgtktoggleaction.c +76 -0
  223. data/src/rbgtktogglebutton.c +84 -0
  224. data/src/rbgtktoggletoolbutton.c +70 -0
  225. data/src/rbgtktoolbar.c +373 -0
  226. data/src/rbgtktoolbutton.c +75 -0
  227. data/src/rbgtktoolitem.c +184 -0
  228. data/src/rbgtktooltip.c +76 -0
  229. data/src/rbgtktooltips.c +107 -0
  230. data/src/rbgtktreedragdest.c +19 -0
  231. data/src/rbgtktreedragsource.c +19 -0
  232. data/src/rbgtktreeiter.c +259 -0
  233. data/src/rbgtktreemodel.c +256 -0
  234. data/src/rbgtktreemodelfilter.c +214 -0
  235. data/src/rbgtktreemodelsort.c +113 -0
  236. data/src/rbgtktreepath.c +195 -0
  237. data/src/rbgtktreerowreference.c +168 -0
  238. data/src/rbgtktreeselection.c +235 -0
  239. data/src/rbgtktreesortable.c +127 -0
  240. data/src/rbgtktreestore.c +379 -0
  241. data/src/rbgtktreeview.c +881 -0
  242. data/src/rbgtktreeviewcolumn.c +331 -0
  243. data/src/rbgtkuimanager.c +210 -0
  244. data/src/rbgtkvbbox.c +31 -0
  245. data/src/rbgtkvbox.c +38 -0
  246. data/src/rbgtkviewport.c +33 -0
  247. data/src/rbgtkvolumebutton.c +36 -0
  248. data/src/rbgtkvpaned.c +31 -0
  249. data/src/rbgtkvruler.c +30 -0
  250. data/src/rbgtkvscale.c +45 -0
  251. data/src/rbgtkvscrollbar.c +38 -0
  252. data/src/rbgtkvseparator.c +30 -0
  253. data/src/rbgtkwidget.c +1414 -0
  254. data/src/rbgtkwindow.c +822 -0
  255. data/src/rbgtkwindowgroup.c +48 -0
  256. data/test/gtk-test-utils.rb +15 -0
  257. data/test/run-test.rb +30 -0
  258. data/test/test_gc.rb +25 -0
  259. data/test/test_gdk.rb +18 -0
  260. data/test/test_gdk_color.rb +10 -0
  261. data/test/test_gdk_display.rb +37 -0
  262. data/test/test_gdk_event.rb +11 -0
  263. data/test/test_gdk_gc.rb +7 -0
  264. data/test/test_gdk_keymap.rb +8 -0
  265. data/test/test_gdk_pango.rb +9 -0
  266. data/test/test_gdk_selection_data.rb +17 -0
  267. data/test/test_gdk_window.rb +29 -0
  268. data/test/test_gdk_window_attribute.rb +9 -0
  269. data/test/test_gtk_about_dialog.rb +14 -0
  270. data/test/test_gtk_buildable.rb +66 -0
  271. data/test/test_gtk_builder.rb +188 -0
  272. data/test/test_gtk_entry.rb +18 -0
  273. data/test/test_gtk_icon_theme.rb +30 -0
  274. data/test/test_gtk_image.rb +8 -0
  275. data/test/test_gtk_list_store.rb +65 -0
  276. data/test/test_gtk_menu_item.rb +13 -0
  277. data/test/test_gtk_rc_style.rb +14 -0
  278. data/test/test_gtk_tree_path.rb +20 -0
  279. data/test/test_gtk_unix_print.rb +14 -0
  280. data/test/test_gtk_widget.rb +32 -0
  281. metadata +393 -0
@@ -0,0 +1,114 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkpaned.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:31 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+
17
+ #define _SELF(self) (GTK_PANED(RVAL2GOBJ(self)))
18
+ #define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w)))
19
+
20
+
21
+ static VALUE
22
+ paned_add1(self, child)
23
+ VALUE self, child;
24
+ {
25
+ gtk_paned_add1(_SELF(self), RVAL2WIDGET(child));
26
+ return self;
27
+ }
28
+
29
+ static VALUE
30
+ paned_add2(self, child)
31
+ VALUE self, child;
32
+ {
33
+ gtk_paned_add2(_SELF(self), RVAL2WIDGET(child));
34
+ return self;
35
+ }
36
+
37
+ static VALUE
38
+ paned_pack1(self, child, resize, shrink)
39
+ VALUE self, child, resize, shrink;
40
+ {
41
+ gtk_paned_pack1(_SELF(self), RVAL2WIDGET(child),
42
+ RVAL2CBOOL(resize), RVAL2CBOOL(shrink));
43
+ return self;
44
+ }
45
+
46
+ static VALUE
47
+ paned_pack2(self, child, resize, shrink)
48
+ VALUE self, child, resize, shrink;
49
+ {
50
+ gtk_paned_pack2(_SELF(self), RVAL2WIDGET(child),
51
+ RVAL2CBOOL(resize), RVAL2CBOOL(shrink));
52
+ return self;
53
+ }
54
+
55
+ static VALUE
56
+ paned_child1(self)
57
+ VALUE self;
58
+ {
59
+ GtkWidget *child = _SELF(self)->child1;
60
+ return (child == NULL) ? Qnil : GOBJ2RVAL(child);
61
+ }
62
+
63
+ static VALUE
64
+ paned_child2(self)
65
+ VALUE self;
66
+ {
67
+ GtkWidget *child = _SELF(self)->child2;
68
+ return (child == NULL) ? Qnil : GOBJ2RVAL(child);
69
+ }
70
+
71
+ static VALUE
72
+ paned_child1_resize(self)
73
+ VALUE self;
74
+ {
75
+ return CBOOL2RVAL(_SELF(self)->child1_resize);
76
+ }
77
+
78
+ static VALUE
79
+ paned_child1_shrink(self)
80
+ VALUE self;
81
+ {
82
+ return CBOOL2RVAL(_SELF(self)->child1_shrink);
83
+ }
84
+
85
+ static VALUE
86
+ paned_child2_resize(self)
87
+ VALUE self;
88
+ {
89
+ return CBOOL2RVAL(_SELF(self)->child2_resize);
90
+ }
91
+
92
+ static VALUE
93
+ paned_child2_shrink(self)
94
+ VALUE self;
95
+ {
96
+ return CBOOL2RVAL(_SELF(self)->child2_shrink);
97
+ }
98
+
99
+ void
100
+ Init_gtk_paned()
101
+ {
102
+ VALUE gPaned = G_DEF_CLASS(GTK_TYPE_PANED, "Paned", mGtk);
103
+
104
+ rb_define_method(gPaned, "add1", paned_add1, 1);
105
+ rb_define_method(gPaned, "add2", paned_add2, 1);
106
+ rb_define_method(gPaned, "pack1", paned_pack1, 3);
107
+ rb_define_method(gPaned, "pack2", paned_pack2, 3);
108
+ rb_define_method(gPaned, "child1", paned_child1, 0);
109
+ rb_define_method(gPaned, "child2", paned_child2, 0);
110
+ rb_define_method(gPaned, "child1_resize?", paned_child1_resize, 0);
111
+ rb_define_method(gPaned, "child1_shrink?", paned_child1_shrink, 0);
112
+ rb_define_method(gPaned, "child2_resize?", paned_child2_resize, 0);
113
+ rb_define_method(gPaned, "child2_shrink?", paned_child2_shrink, 0);
114
+ }
@@ -0,0 +1,186 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkpapersize.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:31 $
8
+
9
+ Copyright (C) 2006 Ruby-GNOME2 Project Team
10
+ ************************************************/
11
+
12
+ #include "global.h"
13
+
14
+ #if GTK_CHECK_VERSION(2,10,0)
15
+
16
+ #define _SELF(s) (RVAL2BOXED(s, GTK_TYPE_PAPER_SIZE))
17
+ #define SIZE2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_PAPER_SIZE))
18
+
19
+ #define RVAL2UNIT(o) (RVAL2GENUM(o, GTK_TYPE_UNIT))
20
+
21
+ static VALUE
22
+ ps_initialize(int argc, VALUE *argv, VALUE self)
23
+ {
24
+ GtkPaperSize *size;
25
+
26
+ if (argc <= 1) {
27
+ VALUE name;
28
+ rb_scan_args(argc, argv, "01", &name);
29
+ size = gtk_paper_size_new(RVAL2CSTR2(name));
30
+ } else if (argc == 4) {
31
+ size = gtk_paper_size_new_from_ppd(RVAL2CSTR(argv[0]),
32
+ RVAL2CSTR(argv[1]),
33
+ NUM2DBL(argv[2]),
34
+ NUM2DBL(argv[3]));
35
+ } else if (argc == 5) {
36
+ size = gtk_paper_size_new_custom(RVAL2CSTR(argv[0]),
37
+ RVAL2CSTR(argv[1]),
38
+ NUM2DBL(argv[2]),
39
+ NUM2DBL(argv[3]),
40
+ RVAL2UNIT(argv[4]));
41
+ } else {
42
+ rb_raise(rb_eArgError,
43
+ "wrong number of arguments (%d for 0, 1, 4 or 5)", argc);
44
+ }
45
+
46
+ G_INITIALIZE(self, size);
47
+ return Qnil;
48
+ }
49
+
50
+ static VALUE
51
+ ps_is_equal(VALUE self, VALUE other)
52
+ {
53
+ return CBOOL2RVAL(RVAL2CBOOL(rb_equal(rb_obj_class(self), rb_obj_class(other))) &&
54
+ gtk_paper_size_is_equal(_SELF(self), _SELF(other)));
55
+ }
56
+
57
+ /* The width is always the shortest side, measure in mm */
58
+ static VALUE
59
+ ps_get_name(VALUE self)
60
+ {
61
+ return CSTR2RVAL(gtk_paper_size_get_name(_SELF(self)));
62
+ }
63
+
64
+ static VALUE
65
+ ps_get_display_name(VALUE self)
66
+ {
67
+ return CSTR2RVAL(gtk_paper_size_get_display_name(_SELF(self)));
68
+ }
69
+
70
+ static VALUE
71
+ ps_get_ppd_name(VALUE self)
72
+ {
73
+ return CSTR2RVAL(gtk_paper_size_get_ppd_name(_SELF(self)));
74
+ }
75
+
76
+ static VALUE
77
+ ps_get_width(VALUE self, VALUE unit)
78
+ {
79
+ return rb_float_new(gtk_paper_size_get_width(_SELF(self), RVAL2UNIT(unit)));
80
+ }
81
+
82
+ static VALUE
83
+ ps_get_height(VALUE self, VALUE unit)
84
+ {
85
+ return rb_float_new(gtk_paper_size_get_height(_SELF(self), RVAL2UNIT(unit)));
86
+ }
87
+
88
+ static VALUE
89
+ ps_is_custom(VALUE self)
90
+ {
91
+ return CBOOL2RVAL(gtk_paper_size_is_custom(_SELF(self)));
92
+ }
93
+
94
+ /* Only for custom sizes: */
95
+ static VALUE
96
+ ps_set_size(VALUE self, VALUE width, VALUE height, VALUE unit)
97
+ {
98
+ gtk_paper_size_set_size(_SELF(self), NUM2DBL(width), NUM2DBL(height),
99
+ RVAL2UNIT(unit));
100
+ return self;
101
+ }
102
+
103
+
104
+ static VALUE
105
+ ps_get_default_top_margin(VALUE self, VALUE unit)
106
+ {
107
+ return rb_float_new(gtk_paper_size_get_default_top_margin(_SELF(self),
108
+ RVAL2UNIT(unit)));
109
+ }
110
+
111
+ static VALUE
112
+ ps_get_default_bottom_margin(VALUE self, VALUE unit)
113
+ {
114
+ return rb_float_new(gtk_paper_size_get_default_bottom_margin(_SELF(self),
115
+ RVAL2UNIT(unit)));
116
+ }
117
+
118
+ static VALUE
119
+ ps_get_default_left_margin(VALUE self, VALUE unit)
120
+ {
121
+ return rb_float_new(gtk_paper_size_get_default_left_margin(_SELF(self),
122
+ RVAL2UNIT(unit)));
123
+ }
124
+
125
+ static VALUE
126
+ ps_get_default_right_margin(VALUE self, VALUE unit)
127
+ {
128
+ return rb_float_new(gtk_paper_size_get_default_right_margin(_SELF(self),
129
+ RVAL2UNIT(unit)));
130
+ }
131
+
132
+ static VALUE
133
+ ps_s_get_default(VALUE self)
134
+ {
135
+ return CSTR2RVAL(gtk_paper_size_get_default());
136
+ }
137
+ #endif
138
+
139
+ void
140
+ Init_gtk_paper_size()
141
+ {
142
+ #if GTK_CHECK_VERSION(2,10,0)
143
+ VALUE gPaperSize = G_DEF_CLASS(GTK_TYPE_PAPER_SIZE, "PaperSize", mGtk);
144
+
145
+ rb_define_singleton_method(gPaperSize, "default", ps_s_get_default, 0);
146
+
147
+ rb_define_const(gPaperSize, "A3", rb_str_new2(GTK_PAPER_NAME_A3));
148
+ rb_define_const(gPaperSize, "A4", rb_str_new2(GTK_PAPER_NAME_A4));
149
+ rb_define_const(gPaperSize, "A5", rb_str_new2(GTK_PAPER_NAME_A5));
150
+ rb_define_const(gPaperSize, "B5", rb_str_new2(GTK_PAPER_NAME_B5));
151
+ rb_define_const(gPaperSize, "LETTER", rb_str_new2(GTK_PAPER_NAME_LETTER));
152
+ rb_define_const(gPaperSize, "EXECUTIVE",
153
+ rb_str_new2(GTK_PAPER_NAME_EXECUTIVE));
154
+ rb_define_const(gPaperSize, "LEGAL", rb_str_new2(GTK_PAPER_NAME_LEGAL));
155
+
156
+ rb_define_method(gPaperSize, "initialize", ps_initialize, -1);
157
+ rb_define_method(gPaperSize, "==", ps_is_equal, 1);
158
+
159
+ rb_define_method(gPaperSize, "name", ps_get_name, 0);
160
+ rb_define_method(gPaperSize, "display_name", ps_get_display_name, 0);
161
+ rb_define_method(gPaperSize, "ppd_name", ps_get_ppd_name, 0);
162
+
163
+ rb_define_method(gPaperSize, "get_width", ps_get_width, 1);
164
+ rb_define_method(gPaperSize, "get_height", ps_get_height, 1);
165
+
166
+ rb_define_method(gPaperSize, "custom?", ps_is_custom, 0);
167
+
168
+ rb_define_method(gPaperSize, "set_size", ps_set_size, 3);
169
+
170
+ rb_define_method(gPaperSize, "get_default_top_margin",
171
+ ps_get_default_top_margin, 1);
172
+ rb_define_method(gPaperSize, "get_default_bottom_margin",
173
+ ps_get_default_bottom_margin, 1);
174
+ rb_define_method(gPaperSize, "get_default_left_margin",
175
+ ps_get_default_left_margin, 1);
176
+ rb_define_method(gPaperSize, "get_default_right_margin",
177
+ ps_get_default_right_margin, 1);
178
+
179
+ G_DEF_SETTERS(gPaperSize);
180
+
181
+ /* GtkUnit */
182
+ G_DEF_CLASS(GTK_TYPE_UNIT, "Unit", gPaperSize);
183
+ G_DEF_CONSTANTS(gPaperSize, GTK_TYPE_UNIT, "GTK_");
184
+
185
+ #endif
186
+ }
@@ -0,0 +1,84 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgdkplug.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/05/27 10:59:22 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 2002 Neil Conway
11
+ ************************************************/
12
+
13
+ #include "global.h"
14
+
15
+ #ifdef HAVE_GTK_PLUG_GET_TYPE
16
+
17
+ static VALUE
18
+ plug_initialize(argc, argv, self)
19
+ int argc;
20
+ VALUE *argv;
21
+ VALUE self;
22
+ {
23
+ VALUE socket_id;
24
+ GdkNativeWindow id;
25
+
26
+ if (rb_scan_args(argc, argv, "01", &socket_id) == 0)
27
+ id = 0;
28
+ else {
29
+ #ifdef GDK_NATIVE_WINDOW_POINTER
30
+ id = GUINT_TO_POINTER(NUM2ULONG(socket_id));
31
+ #else
32
+ id = NUM2UINT(socket_id);
33
+ #endif
34
+ }
35
+
36
+ RBGTK_INITIALIZE(self, gtk_plug_new(id));
37
+ return Qnil;
38
+ }
39
+
40
+ /*
41
+ GtkWidget* gtk_plug_new_for_display (GdkDisplay *display,
42
+ GdkNativeWindow socket_id);
43
+ void gtk_plug_construct_for_display (GtkPlug *plug,
44
+ GdkDisplay *display,
45
+ GdkNativeWindow socket_id);
46
+ */
47
+
48
+ static VALUE
49
+ plug_construct(self, socket_id)
50
+ VALUE self, socket_id;
51
+ {
52
+ #ifdef GDK_NATIVE_WINDOW_POINTER
53
+ gtk_plug_construct(GTK_PLUG(RVAL2GOBJ(self)), GUINT_TO_POINTER(NUM2ULONG(socket_id)));
54
+ #else
55
+ gtk_plug_construct(GTK_PLUG(RVAL2GOBJ(self)), (guint32)NUM2UINT(socket_id));
56
+ #endif
57
+ return self;
58
+ }
59
+
60
+ static VALUE
61
+ plug_get_id(self)
62
+ VALUE self;
63
+ {
64
+ GdkNativeWindow id = gtk_plug_get_id(GTK_PLUG(RVAL2GOBJ(self)));
65
+ #ifdef GDK_NATIVE_WINDOW_POINTER
66
+ return UINT2NUM(GPOINTER_TO_UINT(id));
67
+ #else
68
+ return UINT2NUM(id);
69
+ #endif
70
+ }
71
+
72
+ #endif /* HAVE_GTK_PLUG_GET_TYPE */
73
+
74
+ void
75
+ Init_gtk_plug()
76
+ {
77
+ #ifdef HAVE_GTK_PLUG_GET_TYPE
78
+ VALUE gPlug = G_DEF_CLASS(GTK_TYPE_PLUG, "Plug", mGtk);
79
+
80
+ rb_define_method(gPlug, "initialize", plug_initialize, -1);
81
+ rb_define_method(gPlug, "construct", plug_construct, 1);
82
+ rb_define_method(gPlug, "id", plug_get_id, 0);
83
+ #endif
84
+ }
@@ -0,0 +1,124 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkprintcontext.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2006/11/03 19:40:44 $
8
+
9
+ Copyright (C) 2006 Ruby-GNOME2 Project Team
10
+ ************************************************/
11
+
12
+ #include "global.h"
13
+
14
+ #if GTK_CHECK_VERSION(2,10,0)
15
+
16
+ #define _SELF(s) (GTK_PRINT_CONTEXT(RVAL2GOBJ(s)))
17
+
18
+ # ifdef HAVE_RB_CAIRO_H
19
+ #include <rb_cairo.h>
20
+
21
+ /* Rendering */
22
+ static VALUE
23
+ pc_get_cairo_context(VALUE self)
24
+ {
25
+ return CRCONTEXT2RVAL(gtk_print_context_get_cairo_context(_SELF(self)));
26
+ }
27
+ # endif
28
+
29
+ static VALUE
30
+ pc_get_page_setup(VALUE self)
31
+ {
32
+ return GOBJ2RVAL(gtk_print_context_get_page_setup(_SELF(self)));
33
+ }
34
+
35
+ static VALUE
36
+ pc_get_width(VALUE self)
37
+ {
38
+ return rb_float_new(gtk_print_context_get_width(_SELF(self)));
39
+ }
40
+
41
+ static VALUE
42
+ pc_get_height(VALUE self)
43
+ {
44
+ return rb_float_new(gtk_print_context_get_height(_SELF(self)));
45
+ }
46
+
47
+ static VALUE
48
+ pc_get_dpi_x(VALUE self)
49
+ {
50
+ return rb_float_new(gtk_print_context_get_dpi_x(_SELF(self)));
51
+ }
52
+
53
+ static VALUE
54
+ pc_get_dpi_y(VALUE self)
55
+ {
56
+ return rb_float_new(gtk_print_context_get_dpi_y(_SELF(self)));
57
+ }
58
+
59
+ /* Fonts */
60
+ static VALUE
61
+ pc_get_pango_fontmap(VALUE self)
62
+ {
63
+ return GOBJ2RVAL(gtk_print_context_get_pango_fontmap(_SELF(self)));
64
+ }
65
+
66
+ static VALUE
67
+ pc_create_pango_context(VALUE self)
68
+ {
69
+ return GOBJ2RVALU(gtk_print_context_create_pango_context(_SELF(self)));
70
+ }
71
+
72
+ static VALUE
73
+ pc_create_pango_layout(VALUE self)
74
+ {
75
+ return GOBJ2RVALU(gtk_print_context_create_pango_layout(_SELF(self)));
76
+ }
77
+
78
+ /* Needed for preview implementations */
79
+ # ifdef HAVE_RB_CAIRO_H
80
+ static VALUE
81
+ pc_set_cairo_context(VALUE self, VALUE cr, VALUE dpi_x, VALUE dpi_y)
82
+ {
83
+ gtk_print_context_set_cairo_context(_SELF(self),
84
+ RVAL2CRCONTEXT(cr),
85
+ NUM2DBL(dpi_x),
86
+ NUM2DBL(dpi_y));
87
+ return self;
88
+ }
89
+ # endif
90
+ #endif
91
+
92
+ void
93
+ Init_gtk_print_context()
94
+ {
95
+ #if GTK_CHECK_VERSION(2,10,0)
96
+ VALUE gPrintContext = G_DEF_CLASS(GTK_TYPE_PRINT_CONTEXT,
97
+ "PrintContext", mGtk);
98
+
99
+ /* Rendering */
100
+ # ifdef HAVE_RB_CAIRO_H
101
+ rb_define_method(gPrintContext, "cairo_context", pc_get_cairo_context, 0);
102
+ # endif
103
+ rb_define_method(gPrintContext, "page_setup", pc_get_page_setup, 0);
104
+ rb_define_method(gPrintContext, "width", pc_get_width, 0);
105
+ rb_define_method(gPrintContext, "height", pc_get_height, 0);
106
+ rb_define_method(gPrintContext, "dpi_x", pc_get_dpi_x, 0);
107
+ rb_define_method(gPrintContext, "dpi_y", pc_get_dpi_y, 0);
108
+
109
+ /* Fonts */
110
+ rb_define_method(gPrintContext, "pango_fontmap", pc_get_pango_fontmap, 0);
111
+ rb_define_method(gPrintContext, "create_pango_context",
112
+ pc_create_pango_context, 0);
113
+ rb_define_method(gPrintContext, "create_pango_layout",
114
+ pc_create_pango_layout, 0);
115
+
116
+ /* Needed for preview implementations */
117
+ # ifdef HAVE_RB_CAIRO_H
118
+ rb_define_method(gPrintContext, "set_cairo_context",
119
+ pc_set_cairo_context, 3);
120
+ # endif
121
+
122
+ G_DEF_SETTERS(gPrintContext);
123
+ #endif
124
+ }