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,161 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgdkselection.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:31 $
8
+
9
+ Copyright (C) 2002-2004 Masao Mutoh
10
+ ************************************************/
11
+
12
+
13
+ #include "global.h"
14
+
15
+ #define GATOM2RVAL(g) (BOXED2RVAL(g, GDK_TYPE_ATOM))
16
+
17
+ static VALUE
18
+ gdkselection_owner_set(argc, argv, self)
19
+ int argc;
20
+ VALUE *argv;
21
+ VALUE self;
22
+ {
23
+ VALUE owner, selection, time, send_event;
24
+ int ret;
25
+
26
+ if (argc == 4){
27
+ rb_scan_args(argc, argv, "40", &owner, &selection, &time, &send_event);
28
+ ret = gdk_selection_owner_set(GDK_WINDOW(RVAL2GOBJ(owner)),
29
+ RVAL2ATOM(selection),
30
+ NUM2UINT(time), RVAL2CBOOL(send_event));
31
+ } else {
32
+ #if GTK_CHECK_VERSION(2,2,0)
33
+ VALUE display = Qnil;
34
+ rb_scan_args(argc, argv, "50", &display, &owner, &selection, &time, &send_event);
35
+ ret = gdk_selection_owner_set_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
36
+ GDK_WINDOW(RVAL2GOBJ(owner)),
37
+ RVAL2ATOM(selection),
38
+ NUM2UINT(time), RVAL2CBOOL(send_event));
39
+ #else
40
+ rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
41
+ #endif
42
+
43
+ }
44
+ return CBOOL2RVAL(ret);
45
+ }
46
+
47
+ static VALUE
48
+ gdkselection_owner_get(argc, argv, self)
49
+ int argc;
50
+ VALUE *argv;
51
+ VALUE self;
52
+ {
53
+ VALUE selection;
54
+
55
+ if (argc == 1) {
56
+ rb_scan_args(argc, argv, "10", &selection);
57
+ return GOBJ2RVAL(gdk_selection_owner_get(RVAL2ATOM(selection)));
58
+ } else {
59
+ #if GTK_CHECK_VERSION(2,2,0)
60
+ VALUE display = Qnil;
61
+ rb_scan_args(argc, argv, "20", &display, &selection);
62
+ return GOBJ2RVAL(gdk_selection_owner_get_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
63
+ RVAL2ATOM(selection)));
64
+ #else
65
+ rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
66
+ #endif
67
+ }
68
+ }
69
+
70
+ static VALUE
71
+ gdkselection_convert(self, requestor, selection, target, time)
72
+ VALUE self, requestor, selection, target, time;
73
+ {
74
+ gdk_selection_convert(GDK_WINDOW(RVAL2GOBJ(requestor)),
75
+ RVAL2ATOM(selection),
76
+ RVAL2ATOM(target), NUM2INT(time));
77
+ return self;
78
+ }
79
+
80
+ static VALUE
81
+ gdkselection_property_get(self, requestor)
82
+ VALUE self, requestor;
83
+ {
84
+ guchar *data;
85
+ GdkAtom prop_type;
86
+ gint prop_format;
87
+ VALUE ary;
88
+
89
+ gdk_selection_property_get(GDK_WINDOW(RVAL2GOBJ(requestor)), &data,
90
+ &prop_type, &prop_format);
91
+
92
+ ary = rb_ary_new3(3, CSTR2RVAL((const char*)data), GATOM2RVAL(prop_type),
93
+ INT2NUM(prop_format));
94
+ g_free(data);
95
+ return ary;
96
+ }
97
+
98
+ static VALUE
99
+ gdkselection_send_notify(argc, argv, self)
100
+ int argc;
101
+ VALUE *argv;
102
+ VALUE self;
103
+ {
104
+ VALUE requestor, selection, target, property, time;
105
+
106
+ if (argc == 5) {
107
+ rb_scan_args(argc, argv, "50", &requestor, &selection, &target, &property, &time);
108
+ gdk_selection_send_notify(NUM2UINT(requestor), RVAL2ATOM(selection),
109
+ RVAL2ATOM(target),
110
+ NIL_P(property) ? GDK_NONE : RVAL2ATOM(property),
111
+ NUM2INT(time));
112
+ } else {
113
+ #if GTK_CHECK_VERSION(2,2,0)
114
+ VALUE display = Qnil;
115
+ rb_scan_args(argc, argv, "60", &display, &requestor, &selection, &target, &property, &time);
116
+ gdk_selection_send_notify_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
117
+ NUM2UINT(requestor), RVAL2ATOM(selection),
118
+ RVAL2ATOM(target),
119
+ NIL_P(property) ? GDK_NONE : RVAL2ATOM(property),
120
+ NUM2INT(time));
121
+ #else
122
+ rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
123
+ #endif
124
+ }
125
+ return self;
126
+ }
127
+
128
+ void
129
+ Init_gtk_gdk_selection()
130
+ {
131
+ VALUE mGdkSelection = rb_define_module_under(mGdk, "Selection");
132
+
133
+ rb_define_module_function(mGdkSelection, "owner_set", gdkselection_owner_set, -1);
134
+ rb_define_module_function(mGdkSelection, "owner_get", gdkselection_owner_get, -1);
135
+ rb_define_module_function(mGdkSelection, "convert", gdkselection_convert, 4);
136
+ rb_define_module_function(mGdkSelection, "property_get", gdkselection_property_get, 1);
137
+ rb_define_module_function(mGdkSelection, "send_notify", gdkselection_send_notify, -1);
138
+
139
+ /* Constants */
140
+ rb_define_const(mGdkSelection, "PRIMARY", GATOM2RVAL(GDK_SELECTION_PRIMARY));
141
+ rb_define_const(mGdkSelection, "SECONDARY", GATOM2RVAL(GDK_SELECTION_SECONDARY));
142
+ rb_define_const(mGdkSelection, "CLIPBOARD", GATOM2RVAL(GDK_SELECTION_CLIPBOARD));
143
+
144
+ /* GdkSelectionType */
145
+ rb_define_const(mGdkSelection, "TYPE_ATOM", GATOM2RVAL(GDK_SELECTION_TYPE_ATOM));
146
+ rb_define_const(mGdkSelection, "TYPE_BITMAP", GATOM2RVAL(GDK_SELECTION_TYPE_BITMAP));
147
+ rb_define_const(mGdkSelection, "TYPE_COLORMAP", GATOM2RVAL(GDK_SELECTION_TYPE_COLORMAP));
148
+ rb_define_const(mGdkSelection, "TYPE_DRAWABLE", GATOM2RVAL(GDK_SELECTION_TYPE_DRAWABLE));
149
+ rb_define_const(mGdkSelection, "TYPE_INTEGER", GATOM2RVAL(GDK_SELECTION_TYPE_INTEGER));
150
+ rb_define_const(mGdkSelection, "TYPE_PIXMAP", GATOM2RVAL(GDK_SELECTION_TYPE_PIXMAP));
151
+ rb_define_const(mGdkSelection, "TYPE_WINDOW", GATOM2RVAL(GDK_SELECTION_TYPE_WINDOW));
152
+ rb_define_const(mGdkSelection, "TYPE_STRING", GATOM2RVAL(GDK_SELECTION_TYPE_STRING));
153
+
154
+ /* GdkTarget */
155
+ rb_define_const(mGdkSelection, "TARGET_BITMAP", GATOM2RVAL(GDK_TARGET_BITMAP));
156
+ rb_define_const(mGdkSelection, "TARGET_COLORMAP", GATOM2RVAL(GDK_TARGET_COLORMAP));
157
+ rb_define_const(mGdkSelection, "TARGET_DRAWABLE", GATOM2RVAL(GDK_TARGET_DRAWABLE));
158
+ rb_define_const(mGdkSelection, "TARGET_PIXMAP", GATOM2RVAL(GDK_TARGET_PIXMAP));
159
+ rb_define_const(mGdkSelection, "TARGET_STRING", GATOM2RVAL(GDK_TARGET_STRING));
160
+
161
+ }
@@ -0,0 +1,68 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkthreads.c -
5
+
6
+ $Author: sakai $
7
+ $Date: 2007/07/08 03:00:50 $
8
+
9
+ Copyright (C) 2003-2005 Masao Mutoh
10
+ ************************************************/
11
+
12
+ #include "global.h"
13
+
14
+ #ifdef G_THREADS_ENABLED
15
+ static VALUE
16
+ rbgdk_threads_init(self)
17
+ VALUE self;
18
+ {
19
+ #ifndef GDK_WINDOWING_WIN32
20
+ if (!g_thread_supported()){
21
+ g_thread_init(NULL);
22
+ }
23
+ gdk_threads_init();
24
+ #endif
25
+ return self;
26
+ }
27
+
28
+ static VALUE
29
+ rbgdk_threads_enter(self)
30
+ VALUE self;
31
+ {
32
+ gdk_threads_enter();
33
+ return self;
34
+ }
35
+
36
+ static VALUE
37
+ rbgdk_threads_leave(self)
38
+ VALUE self;
39
+ {
40
+ gdk_threads_leave();
41
+ return self;
42
+ }
43
+
44
+ static VALUE
45
+ rbgdk_threads_synchronize(self)
46
+ VALUE self;
47
+ {
48
+ VALUE func = rb_block_proc();
49
+ gdk_threads_enter();
50
+ func = rb_block_proc();
51
+ rb_funcall(func, id_call, 0);
52
+ gdk_threads_leave();
53
+ return Qnil;
54
+ }
55
+ #endif
56
+
57
+ void
58
+ Init_gtk_gdk_threads()
59
+ {
60
+ #ifdef G_THREADS_ENABLED
61
+ VALUE mGdkThreads = rb_define_module_under(mGdk, "Threads");
62
+
63
+ rb_define_module_function(mGdkThreads, "init", rbgdk_threads_init, 0);
64
+ rb_define_module_function(mGdkThreads, "enter", rbgdk_threads_enter, 0);
65
+ rb_define_module_function(mGdkThreads, "leave", rbgdk_threads_leave, 0);
66
+ rb_define_module_function(mGdkThreads, "synchronize", rbgdk_threads_synchronize, 0);
67
+ #endif
68
+ }
@@ -0,0 +1,118 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgdktimecoord.c -
5
+
6
+ $Author: sakai $
7
+ $Date: 2006/05/26 14:18:22 $
8
+
9
+ Copyright (C) 2003 Masao Mutoh
10
+ ************************************************/
11
+ #include "global.h"
12
+
13
+ #define _SELF(s) ((GdkTimeCoord*)RVAL2BOXED(s, GDK_TYPE_TIME_COORD))
14
+
15
+ /**********************************/
16
+ static GdkTimeCoord*
17
+ timecoord_copy(const GdkTimeCoord* val)
18
+ {
19
+ GdkTimeCoord* new_val;
20
+ g_return_val_if_fail (val != NULL, NULL);
21
+ new_val = g_new(GdkTimeCoord, 1);
22
+ *new_val = *val;
23
+ return new_val;
24
+ }
25
+
26
+ GType
27
+ gdk_timecoord_get_type(void)
28
+ {
29
+ static GType our_type = 0;
30
+
31
+ if (our_type == 0)
32
+ our_type = g_boxed_type_register_static ("GdkTimeCoord",
33
+ (GBoxedCopyFunc)timecoord_copy,
34
+ (GBoxedFreeFunc)g_free);
35
+ return our_type;
36
+ }
37
+ /**********************************/
38
+
39
+ static VALUE
40
+ timecoord_initialize(self, time, axes)
41
+ VALUE self, time, axes;
42
+ {
43
+ GdkTimeCoord coord;
44
+ int i;
45
+ coord.time = NUM2UINT(time);
46
+
47
+ if (RARRAY_LEN(axes) > GDK_MAX_TIMECOORD_AXES){
48
+ rb_raise(rb_eArgError, "axes: Out of range: %ld", RARRAY_LEN(axes));
49
+ }
50
+
51
+ for (i = 0; i < RARRAY_LEN(axes); i++){
52
+ coord.axes[i] = NUM2DBL(RARRAY_PTR(axes)[i]);
53
+ }
54
+
55
+ G_INITIALIZE(self, &coord);
56
+
57
+ return Qnil;
58
+ }
59
+
60
+ static VALUE
61
+ timecoord_time(self)
62
+ VALUE self;
63
+ {
64
+ return UINT2NUM(_SELF(self)->time);
65
+ }
66
+
67
+ static VALUE
68
+ timecoord_set_time(self, time)
69
+ VALUE self, time;
70
+ {
71
+ _SELF(self)->time = NUM2UINT(time);
72
+ return self;
73
+ }
74
+
75
+ static VALUE
76
+ timecoord_axes(self)
77
+ VALUE self;
78
+ {
79
+ VALUE ary = rb_ary_new();
80
+ int i;
81
+ for (i = 0; i < GDK_MAX_TIMECOORD_AXES; i++){
82
+ rb_ary_push(ary, rb_float_new(_SELF(self)->axes[i]));
83
+ }
84
+ return ary;
85
+ }
86
+
87
+ static VALUE
88
+ timecoord_set_axes(self, axes)
89
+ VALUE self, axes;
90
+ {
91
+ int i;
92
+ GdkTimeCoord* coord = _SELF(self);
93
+
94
+ if (RARRAY_LEN(axes) > GDK_MAX_TIMECOORD_AXES){
95
+ rb_raise(rb_eArgError, "axes: Out of range: %ld", RARRAY_LEN(axes));
96
+ }
97
+
98
+ for (i = 0; i < RARRAY_LEN(axes); i++){
99
+ coord->axes[i] = NUM2DBL(RARRAY_PTR(axes)[i]);
100
+ }
101
+ return self;
102
+ }
103
+
104
+ void
105
+ Init_gtk_gdk_timecoord()
106
+ {
107
+ VALUE tc = G_DEF_CLASS(GDK_TYPE_TIME_COORD, "TimeCoord", mGdk);
108
+
109
+ rb_define_method(tc, "initialize", timecoord_initialize, 2);
110
+ rb_define_method(tc, "time", timecoord_time, 0);
111
+ rb_define_method(tc, "set_time", timecoord_set_time, 1);
112
+ rb_define_method(tc, "axes", timecoord_axes, 0);
113
+ rb_define_method(tc, "set_axes", timecoord_set_axes, 1);
114
+
115
+ G_DEF_SETTERS(tc);
116
+
117
+ rb_define_const(tc, "MAX_AXES", INT2NUM(GDK_MAX_TIMECOORD_AXES));
118
+ }
@@ -0,0 +1,273 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgdkvisual.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2004/08/01 07:10:03 $
8
+
9
+ Copyright (C) 2002-2004 Masao Mutoh
10
+
11
+ This file is devided from rbgdkcolor.c.
12
+ rbgdkcolor.c -
13
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
14
+ Daisuke Kanda,
15
+ Hiroshi Igarashi
16
+ ************************************************/
17
+
18
+ #include "global.h"
19
+
20
+ #define _SELF(self) (GDK_VISUAL(RVAL2GOBJ(self)))
21
+
22
+ static VALUE
23
+ gdkvisual_s_query_depths(self)
24
+ VALUE self;
25
+ {
26
+ gint *depth;
27
+ gint count;
28
+ VALUE ary;
29
+ int i;
30
+
31
+ gdk_query_depths(&depth, &count);
32
+ ary = rb_ary_new2(count);
33
+ for (i = 0; i < count; i++) {
34
+ rb_ary_push(ary, INT2NUM((depth)[i]));
35
+ }
36
+ return ary;
37
+ }
38
+
39
+ static VALUE
40
+ gdkvisual_s_query_visual_types(self)
41
+ VALUE self;
42
+ {
43
+ GdkVisualType *visual_types;
44
+ gint count;
45
+ VALUE ary;
46
+ int i;
47
+
48
+ gdk_query_visual_types(&visual_types, &count);
49
+ ary = rb_ary_new2(count);
50
+ for (i = 0; i < count; i++) {
51
+ rb_ary_push(ary, GENUM2RVAL((visual_types)[i], GDK_TYPE_VISUAL_TYPE));
52
+ }
53
+ return ary;
54
+ }
55
+
56
+ static VALUE
57
+ gdkvisual_s_list_visuals(self)
58
+ VALUE self;
59
+ {
60
+ GList *list = gdk_list_visuals(), *cur;
61
+ VALUE ary = rb_ary_new();
62
+
63
+ for (cur = list; cur != NULL; cur = cur->next) {
64
+ rb_ary_push(ary, GOBJ2RVAL((GdkVisual *)cur->data));
65
+ }
66
+ g_list_free(list);
67
+ return ary;
68
+ }
69
+
70
+ static VALUE
71
+ gdkvisual_s_get_best_depth(self)
72
+ VALUE self;
73
+ {
74
+ return INT2NUM(gdk_visual_get_best_depth());
75
+ }
76
+
77
+ static VALUE
78
+ gdkvisual_s_get_best_type(self)
79
+ VALUE self;
80
+ {
81
+ return INT2NUM(gdk_visual_get_best_type());
82
+ }
83
+
84
+ static VALUE
85
+ gdkvisual_s_get_system(self)
86
+ VALUE self;
87
+ {
88
+ return GOBJ2RVAL(gdk_visual_get_system());
89
+ }
90
+
91
+ static VALUE
92
+ gdkvisual_s_get_best(self)
93
+ VALUE self;
94
+ {
95
+ return GOBJ2RVAL(gdk_visual_get_best());
96
+ }
97
+
98
+ static VALUE
99
+ gdkvisual_s_get_best_with_depth(self, depth)
100
+ VALUE self, depth;
101
+ {
102
+ return GOBJ2RVAL(gdk_visual_get_best_with_depth(NUM2INT(depth)));
103
+ }
104
+
105
+ static VALUE
106
+ gdkvisual_s_get_best_with_type(self, type)
107
+ VALUE self, type;
108
+ {
109
+ return GOBJ2RVAL(gdk_visual_get_best_with_depth(
110
+ (GdkVisualType)GENUM2RVAL(type, GDK_TYPE_VISUAL_TYPE)));
111
+ }
112
+
113
+ static VALUE
114
+ gdkvisual_s_get_best_with_both(self, depth, type)
115
+ VALUE self, depth, type;
116
+ {
117
+ return GOBJ2RVAL(gdk_visual_get_best_with_both(
118
+ NUM2INT(depth),
119
+ (GdkVisualType)RVAL2GENUM(type, GDK_TYPE_VISUAL_TYPE)));
120
+ }
121
+
122
+ #if GTK_CHECK_VERSION(2,2,0)
123
+ static VALUE
124
+ gdkvisual_get_screen(self)
125
+ VALUE self;
126
+ {
127
+ return GOBJ2RVAL(gdk_visual_get_screen(_SELF(self)));
128
+ }
129
+ #endif
130
+
131
+ /* Structure accessors */
132
+ static VALUE
133
+ gdkvisual_type(self)
134
+ VALUE self;
135
+ {
136
+ return GENUM2RVAL(_SELF(self)->type, GDK_TYPE_VISUAL_TYPE);
137
+ }
138
+
139
+ static VALUE
140
+ gdkvisual_depth(self)
141
+ VALUE self;
142
+ {
143
+ return INT2FIX(_SELF(self)->depth);
144
+ }
145
+
146
+ static VALUE
147
+ gdkvisual_byte_order(self)
148
+ VALUE self;
149
+ {
150
+ return GENUM2RVAL(_SELF(self)->byte_order, GDK_TYPE_BYTE_ORDER);
151
+ }
152
+
153
+ static VALUE
154
+ gdkvisual_colormap_size(self)
155
+ VALUE self;
156
+ {
157
+ return INT2FIX(_SELF(self)->colormap_size);
158
+ }
159
+
160
+ static VALUE
161
+ gdkvisual_bits_per_rgb(self)
162
+ VALUE self;
163
+ {
164
+ return INT2FIX(_SELF(self)->bits_per_rgb);
165
+ }
166
+
167
+ static VALUE
168
+ gdkvisual_red_mask(self)
169
+ VALUE self;
170
+ {
171
+ return INT2FIX(_SELF(self)->red_mask);
172
+ }
173
+
174
+ static VALUE
175
+ gdkvisual_red_shift(self)
176
+ VALUE self;
177
+ {
178
+ return INT2FIX(_SELF(self)->red_shift);
179
+ }
180
+
181
+ static VALUE
182
+ gdkvisual_red_prec(self)
183
+ VALUE self;
184
+ {
185
+ return INT2FIX(_SELF(self)->red_prec);
186
+ }
187
+
188
+ static VALUE
189
+ gdkvisual_green_mask(self)
190
+ VALUE self;
191
+ {
192
+ return INT2FIX(_SELF(self)->green_mask);
193
+ }
194
+
195
+ static VALUE
196
+ gdkvisual_green_shift(self)
197
+ VALUE self;
198
+ {
199
+ return INT2FIX(_SELF(self)->green_shift);
200
+ }
201
+
202
+ static VALUE
203
+ gdkvisual_green_prec(self)
204
+ VALUE self;
205
+ {
206
+ return INT2FIX(_SELF(self)->green_prec);
207
+ }
208
+
209
+ static VALUE
210
+ gdkvisual_blue_mask(self)
211
+ VALUE self;
212
+ {
213
+ return INT2FIX(_SELF(self)->blue_mask);
214
+ }
215
+
216
+ static VALUE
217
+ gdkvisual_blue_shift(self)
218
+ VALUE self;
219
+ {
220
+ return INT2FIX(_SELF(self)->blue_shift);
221
+ }
222
+
223
+ static VALUE
224
+ gdkvisual_blue_prec(self)
225
+ VALUE self;
226
+ {
227
+ return INT2FIX(_SELF(self)->blue_prec);
228
+ }
229
+
230
+ void
231
+ Init_gtk_gdk_visual()
232
+ {
233
+ VALUE gdkVisual = G_DEF_CLASS(GDK_TYPE_VISUAL, "Visual", mGdk);
234
+
235
+ /* class methods */
236
+ rb_define_singleton_method(gdkVisual, "query_depths", gdkvisual_s_query_depths, 0);
237
+ rb_define_singleton_method(gdkVisual, "query_visual_types", gdkvisual_s_query_visual_types, 0);
238
+ rb_define_singleton_method(gdkVisual, "visuals", gdkvisual_s_list_visuals, 0);
239
+ rb_define_singleton_method(gdkVisual, "best_depth", gdkvisual_s_get_best_depth, 0);
240
+ rb_define_singleton_method(gdkVisual, "best_type", gdkvisual_s_get_best_type, 0);
241
+ rb_define_singleton_method(gdkVisual, "system", gdkvisual_s_get_system, 0);
242
+ rb_define_singleton_method(gdkVisual, "best", gdkvisual_s_get_best, 0);
243
+ rb_define_singleton_method(gdkVisual, "best_with_depth", gdkvisual_s_get_best_with_depth, 1);
244
+ rb_define_singleton_method(gdkVisual, "best_with_type", gdkvisual_s_get_best_with_type, 1);
245
+ rb_define_singleton_method(gdkVisual, "best_with_both", gdkvisual_s_get_best_with_both, 2);
246
+
247
+ /* instance methods */
248
+ #if GTK_CHECK_VERSION(2,2,0)
249
+ rb_define_method(gdkVisual, "screen", gdkvisual_get_screen, 0);
250
+ #endif
251
+ rb_define_method(gdkVisual, "visual_type", gdkvisual_type, 0);
252
+ rb_define_method(gdkVisual, "depth", gdkvisual_depth, 0);
253
+ rb_define_method(gdkVisual, "byte_order", gdkvisual_byte_order, 0);
254
+ rb_define_method(gdkVisual, "colormap_size", gdkvisual_colormap_size, 0);
255
+ rb_define_method(gdkVisual, "bits_per_rgb", gdkvisual_bits_per_rgb, 0);
256
+ rb_define_method(gdkVisual, "red_mask", gdkvisual_red_mask, 0);
257
+ rb_define_method(gdkVisual, "red_shift", gdkvisual_red_shift, 0);
258
+ rb_define_method(gdkVisual, "red_prec", gdkvisual_red_prec, 0);
259
+ rb_define_method(gdkVisual, "green_mask", gdkvisual_green_mask, 0);
260
+ rb_define_method(gdkVisual, "green_shift", gdkvisual_green_shift, 0);
261
+ rb_define_method(gdkVisual, "green_prec", gdkvisual_green_prec, 0);
262
+ rb_define_method(gdkVisual, "blue_mask", gdkvisual_blue_mask, 0);
263
+ rb_define_method(gdkVisual, "blue_shift", gdkvisual_blue_shift, 0);
264
+ rb_define_method(gdkVisual, "blue_prec", gdkvisual_blue_prec, 0);
265
+
266
+ /* GdkVisualType */
267
+ G_DEF_CLASS(GDK_TYPE_VISUAL_TYPE, "Type", gdkVisual);
268
+ G_DEF_CONSTANTS(gdkVisual, GDK_TYPE_VISUAL_TYPE, "GDK_VISUAL_");
269
+
270
+ /* GdkByteOrder */
271
+ G_DEF_CLASS(GDK_TYPE_BYTE_ORDER, "ByteOrder", gdkVisual);
272
+ G_DEF_CONSTANTS(gdkVisual, GDK_TYPE_BYTE_ORDER, "GDK_");
273
+ }