gtk3 0.0.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (425) hide show
  1. data/Rakefile +32 -0
  2. data/ext/gtk3/conversions.c +34 -0
  3. data/ext/gtk3/depend +11 -0
  4. data/ext/gtk3/extconf.rb +108 -0
  5. data/ext/gtk3/gtk3.def +10 -0
  6. data/ext/gtk3/init.c +38 -0
  7. data/ext/gtk3/rbgdkdisplay.c +39 -0
  8. data/ext/gtk3/rbgdkdragcontext.c +108 -0
  9. data/ext/gtk3/rbgdkevent.c +38 -0
  10. data/ext/gtk3/rbgdkscreen.c +61 -0
  11. data/ext/gtk3/rbgtk.c +625 -0
  12. data/ext/gtk3/rbgtk3.h +57 -0
  13. data/ext/gtk3/rbgtk3conversions.h +347 -0
  14. data/ext/gtk3/rbgtk3private.h +282 -0
  15. data/ext/gtk3/rbgtk3util.c +67 -0
  16. data/ext/gtk3/rbgtk3util.h +32 -0
  17. data/ext/gtk3/rbgtkaboutdialog.c +117 -0
  18. data/ext/gtk3/rbgtkaccelerator.c +78 -0
  19. data/ext/gtk3/rbgtkaccelgroup.c +199 -0
  20. data/ext/gtk3/rbgtkaccelgroupentry.c +93 -0
  21. data/ext/gtk3/rbgtkaccelkey.c +119 -0
  22. data/ext/gtk3/rbgtkaccellabel.c +55 -0
  23. data/ext/gtk3/rbgtkaccelmap.c +135 -0
  24. data/ext/gtk3/rbgtkaccessible.c +56 -0
  25. data/ext/gtk3/rbgtkaction.c +205 -0
  26. data/ext/gtk3/rbgtkactiongroup.c +466 -0
  27. data/ext/gtk3/rbgtkactivatable.c +30 -0
  28. data/ext/gtk3/rbgtkadjustment.c +98 -0
  29. data/ext/gtk3/rbgtkalignment.c +75 -0
  30. data/ext/gtk3/rbgtkallocation.c +166 -0
  31. data/ext/gtk3/rbgtkappchooser.c +47 -0
  32. data/ext/gtk3/rbgtkappchooserbutton.c +70 -0
  33. data/ext/gtk3/rbgtkappchooserdialog.c +68 -0
  34. data/ext/gtk3/rbgtkappchooserwidget.c +40 -0
  35. data/ext/gtk3/rbgtkapplication.c +69 -0
  36. data/ext/gtk3/rbgtkarrow.c +56 -0
  37. data/ext/gtk3/rbgtkaspectframe.c +56 -0
  38. data/ext/gtk3/rbgtkassistant.c +218 -0
  39. data/ext/gtk3/rbgtkbin.c +42 -0
  40. data/ext/gtk3/rbgtkbindingset.c +164 -0
  41. data/ext/gtk3/rbgtkborder.c +119 -0
  42. data/ext/gtk3/rbgtkbox.c +146 -0
  43. data/ext/gtk3/rbgtkbuildable.c +96 -0
  44. data/ext/gtk3/rbgtkbuilder.c +166 -0
  45. data/ext/gtk3/rbgtkbutton.c +93 -0
  46. data/ext/gtk3/rbgtkbuttonbox.c +87 -0
  47. data/ext/gtk3/rbgtkcalendar.c +118 -0
  48. data/ext/gtk3/rbgtkcelleditable.c +57 -0
  49. data/ext/gtk3/rbgtkcelllayout.c +144 -0
  50. data/ext/gtk3/rbgtkcellrenderer.c +116 -0
  51. data/ext/gtk3/rbgtkcellrendereraccel.c +41 -0
  52. data/ext/gtk3/rbgtkcellrenderercombo.c +38 -0
  53. data/ext/gtk3/rbgtkcellrendererpixbuf.c +41 -0
  54. data/ext/gtk3/rbgtkcellrendererprogress.c +38 -0
  55. data/ext/gtk3/rbgtkcellrendererspin.c +39 -0
  56. data/ext/gtk3/rbgtkcellrendererspinner.c +38 -0
  57. data/ext/gtk3/rbgtkcellrenderertext.c +48 -0
  58. data/ext/gtk3/rbgtkcellrenderertoggle.c +39 -0
  59. data/ext/gtk3/rbgtkcellview.c +109 -0
  60. data/ext/gtk3/rbgtkcheckbutton.c +64 -0
  61. data/ext/gtk3/rbgtkcheckmenuitem.c +64 -0
  62. data/ext/gtk3/rbgtkclipboard.c +389 -0
  63. data/ext/gtk3/rbgtkcolorbutton.c +49 -0
  64. data/ext/gtk3/rbgtkcolorselection.c +219 -0
  65. data/ext/gtk3/rbgtkcolorselectiondialog.c +56 -0
  66. data/ext/gtk3/rbgtkcombobox.c +147 -0
  67. data/ext/gtk3/rbgtkcomboboxtext.c +138 -0
  68. data/ext/gtk3/rbgtkconst.c +79 -0
  69. data/ext/gtk3/rbgtkcontainer.c +784 -0
  70. data/ext/gtk3/rbgtkcssprovider.c +110 -0
  71. data/ext/gtk3/rbgtkdialog.c +186 -0
  72. data/ext/gtk3/rbgtkdrag.c +93 -0
  73. data/ext/gtk3/rbgtkdrawingarea.c +42 -0
  74. data/ext/gtk3/rbgtkeditable.c +149 -0
  75. data/ext/gtk3/rbgtkentry.c +198 -0
  76. data/ext/gtk3/rbgtkentrybuffer.c +87 -0
  77. data/ext/gtk3/rbgtkentrycompletion.c +122 -0
  78. data/ext/gtk3/rbgtkeventbox.c +42 -0
  79. data/ext/gtk3/rbgtkexpander.c +49 -0
  80. data/ext/gtk3/rbgtkfilechooser.c +384 -0
  81. data/ext/gtk3/rbgtkfilechooserbutton.c +50 -0
  82. data/ext/gtk3/rbgtkfilechooserdialog.c +62 -0
  83. data/ext/gtk3/rbgtkfilechooserwidget.c +40 -0
  84. data/ext/gtk3/rbgtkfilefilter.c +128 -0
  85. data/ext/gtk3/rbgtkfilesystemerror.c +48 -0
  86. data/ext/gtk3/rbgtkfixed.c +61 -0
  87. data/ext/gtk3/rbgtkfontbutton.c +49 -0
  88. data/ext/gtk3/rbgtkfontchooser.c +78 -0
  89. data/ext/gtk3/rbgtkfontchooserdialog.c +56 -0
  90. data/ext/gtk3/rbgtkfontchooserwidget.c +45 -0
  91. data/ext/gtk3/rbgtkframe.c +69 -0
  92. data/ext/gtk3/rbgtkgrid.c +105 -0
  93. data/ext/gtk3/rbgtkhandlebox.c +45 -0
  94. data/ext/gtk3/rbgtkhsv.c +102 -0
  95. data/ext/gtk3/rbgtkiconfactory.c +85 -0
  96. data/ext/gtk3/rbgtkiconinfo.c +115 -0
  97. data/ext/gtk3/rbgtkiconset.c +84 -0
  98. data/ext/gtk3/rbgtkiconsize.c +91 -0
  99. data/ext/gtk3/rbgtkiconsource.c +184 -0
  100. data/ext/gtk3/rbgtkicontheme.c +268 -0
  101. data/ext/gtk3/rbgtkiconview.c +270 -0
  102. data/ext/gtk3/rbgtkimage.c +96 -0
  103. data/ext/gtk3/rbgtkimagemenuitem.c +67 -0
  104. data/ext/gtk3/rbgtkimcontext.c +133 -0
  105. data/ext/gtk3/rbgtkimcontextsimple.c +69 -0
  106. data/ext/gtk3/rbgtkimmulticontext.c +48 -0
  107. data/ext/gtk3/rbgtkinfobar.c +121 -0
  108. data/ext/gtk3/rbgtkinvisible.c +49 -0
  109. data/ext/gtk3/rbgtklabel.c +139 -0
  110. data/ext/gtk3/rbgtklayout.c +93 -0
  111. data/ext/gtk3/rbgtklinkbutton.c +55 -0
  112. data/ext/gtk3/rbgtkliststore.c +408 -0
  113. data/ext/gtk3/rbgtklockbutton.c +50 -0
  114. data/ext/gtk3/rbgtkmenu.c +168 -0
  115. data/ext/gtk3/rbgtkmenubar.c +43 -0
  116. data/ext/gtk3/rbgtkmenuitem.c +95 -0
  117. data/ext/gtk3/rbgtkmenushell.c +106 -0
  118. data/ext/gtk3/rbgtkmenutoolbutton.c +81 -0
  119. data/ext/gtk3/rbgtkmessagedialog.c +74 -0
  120. data/ext/gtk3/rbgtkmisc.c +70 -0
  121. data/ext/gtk3/rbgtknotebook.c +383 -0
  122. data/ext/gtk3/rbgtknumerableicon.c +50 -0
  123. data/ext/gtk3/rbgtkorientable.c +27 -0
  124. data/ext/gtk3/rbgtkoverlay.c +53 -0
  125. data/ext/gtk3/rbgtkpagesetup.c +195 -0
  126. data/ext/gtk3/rbgtkpagesetupunixdialog.c +94 -0
  127. data/ext/gtk3/rbgtkpaned.c +114 -0
  128. data/ext/gtk3/rbgtkpapersize.c +179 -0
  129. data/ext/gtk3/rbgtkplug.c +85 -0
  130. data/ext/gtk3/rbgtkprintcontext.c +125 -0
  131. data/ext/gtk3/rbgtkprinter.c +155 -0
  132. data/ext/gtk3/rbgtkprintjob.c +148 -0
  133. data/ext/gtk3/rbgtkprintoperation.c +149 -0
  134. data/ext/gtk3/rbgtkprintoperationpreview.c +59 -0
  135. data/ext/gtk3/rbgtkprintsettings.c +807 -0
  136. data/ext/gtk3/rbgtkprintunixdialog.c +90 -0
  137. data/ext/gtk3/rbgtkprogressbar.c +72 -0
  138. data/ext/gtk3/rbgtkradioaction.c +122 -0
  139. data/ext/gtk3/rbgtkradiobutton.c +89 -0
  140. data/ext/gtk3/rbgtkradiomenuitem.c +147 -0
  141. data/ext/gtk3/rbgtkradiotoolbutton.c +131 -0
  142. data/ext/gtk3/rbgtkrange.c +68 -0
  143. data/ext/gtk3/rbgtkrecentaction.c +64 -0
  144. data/ext/gtk3/rbgtkrecentchooser.c +198 -0
  145. data/ext/gtk3/rbgtkrecentchooserdialog.c +66 -0
  146. data/ext/gtk3/rbgtkrecentchoosermenu.c +50 -0
  147. data/ext/gtk3/rbgtkrecentchooserwidget.c +48 -0
  148. data/ext/gtk3/rbgtkrecentdata.c +187 -0
  149. data/ext/gtk3/rbgtkrecentfilter.c +169 -0
  150. data/ext/gtk3/rbgtkrecentfilterinfo.c +200 -0
  151. data/ext/gtk3/rbgtkrecentinfo.c +213 -0
  152. data/ext/gtk3/rbgtkrecentmanager.c +134 -0
  153. data/ext/gtk3/rbgtkscale.c +97 -0
  154. data/ext/gtk3/rbgtkscalebutton.c +84 -0
  155. data/ext/gtk3/rbgtkscrollable.c +31 -0
  156. data/ext/gtk3/rbgtkscrollbar.c +52 -0
  157. data/ext/gtk3/rbgtkscrolledwindow.c +122 -0
  158. data/ext/gtk3/rbgtkselection.c +168 -0
  159. data/ext/gtk3/rbgtkselectiondata.c +282 -0
  160. data/ext/gtk3/rbgtkseparator.c +44 -0
  161. data/ext/gtk3/rbgtkseparatormenuitem.c +39 -0
  162. data/ext/gtk3/rbgtkseparatortoolitem.c +38 -0
  163. data/ext/gtk3/rbgtksettings.c +229 -0
  164. data/ext/gtk3/rbgtksizegroup.c +66 -0
  165. data/ext/gtk3/rbgtksocket.c +82 -0
  166. data/ext/gtk3/rbgtkspinbutton.c +132 -0
  167. data/ext/gtk3/rbgtkspinner.c +55 -0
  168. data/ext/gtk3/rbgtkstatusbar.c +77 -0
  169. data/ext/gtk3/rbgtkstatusicon.c +122 -0
  170. data/ext/gtk3/rbgtkstock.c +213 -0
  171. data/ext/gtk3/rbgtkstylecontext.c +411 -0
  172. data/ext/gtk3/rbgtkstyleproperties.c +119 -0
  173. data/ext/gtk3/rbgtkstyleprovider.c +68 -0
  174. data/ext/gtk3/rbgtkswitch.c +40 -0
  175. data/ext/gtk3/rbgtktable.c +190 -0
  176. data/ext/gtk3/rbgtktargetlist.c +125 -0
  177. data/ext/gtk3/rbgtktearoffmenuitem.c +41 -0
  178. data/ext/gtk3/rbgtktextappearance.c +236 -0
  179. data/ext/gtk3/rbgtktextattributes.c +326 -0
  180. data/ext/gtk3/rbgtktextbuffer.c +899 -0
  181. data/ext/gtk3/rbgtktextchildanchor.c +56 -0
  182. data/ext/gtk3/rbgtktextiter.c +732 -0
  183. data/ext/gtk3/rbgtktextmark.c +71 -0
  184. data/ext/gtk3/rbgtktexttag.c +68 -0
  185. data/ext/gtk3/rbgtktexttagtable.c +96 -0
  186. data/ext/gtk3/rbgtktextview.c +336 -0
  187. data/ext/gtk3/rbgtkthemingengine.c +257 -0
  188. data/ext/gtk3/rbgtktoggleaction.c +61 -0
  189. data/ext/gtk3/rbgtktogglebutton.c +87 -0
  190. data/ext/gtk3/rbgtktoggletoolbutton.c +61 -0
  191. data/ext/gtk3/rbgtktoolbar.c +118 -0
  192. data/ext/gtk3/rbgtktoolbutton.c +66 -0
  193. data/ext/gtk3/rbgtktoolitem.c +200 -0
  194. data/ext/gtk3/rbgtktoolitemgroup.c +70 -0
  195. data/ext/gtk3/rbgtktoolshell.c +96 -0
  196. data/ext/gtk3/rbgtktooltip.c +100 -0
  197. data/ext/gtk3/rbgtktreedragdest.c +28 -0
  198. data/ext/gtk3/rbgtktreedragsource.c +28 -0
  199. data/ext/gtk3/rbgtktreeiter.c +258 -0
  200. data/ext/gtk3/rbgtktreemodel.c +236 -0
  201. data/ext/gtk3/rbgtktreemodelfilter.c +197 -0
  202. data/ext/gtk3/rbgtktreemodelsort.c +111 -0
  203. data/ext/gtk3/rbgtktreepath.c +191 -0
  204. data/ext/gtk3/rbgtktreerowreference.c +140 -0
  205. data/ext/gtk3/rbgtktreeselection.c +205 -0
  206. data/ext/gtk3/rbgtktreesortable.c +122 -0
  207. data/ext/gtk3/rbgtktreestore.c +330 -0
  208. data/ext/gtk3/rbgtktreeview.c +715 -0
  209. data/ext/gtk3/rbgtktreeviewcolumn.c +256 -0
  210. data/ext/gtk3/rbgtkuimanager.c +189 -0
  211. data/ext/gtk3/rbgtkviewport.c +44 -0
  212. data/ext/gtk3/rbgtkvolumebutton.c +41 -0
  213. data/ext/gtk3/rbgtkwidget.c +1564 -0
  214. data/ext/gtk3/rbgtkwidgetpath.c +229 -0
  215. data/ext/gtk3/rbgtkwindow.c +557 -0
  216. data/ext/gtk3/rbgtkwindowgroup.c +80 -0
  217. data/extconf.rb +49 -0
  218. data/lib/gtk3.rb +10 -0
  219. data/lib/gtk3/base.rb +67 -0
  220. data/lib/gtk3/deprecated.rb +1001 -0
  221. data/sample/gtk-demo/README +7 -0
  222. data/sample/gtk-demo/alphatest.png +0 -0
  223. data/sample/gtk-demo/apple-red.png +0 -0
  224. data/sample/gtk-demo/appwindow.rb +233 -0
  225. data/sample/gtk-demo/background.jpg +0 -0
  226. data/sample/gtk-demo/builder.rb +51 -0
  227. data/sample/gtk-demo/button_box.rb +84 -0
  228. data/sample/gtk-demo/cairo-arc-negative.rb +41 -0
  229. data/sample/gtk-demo/cairo-arc.rb +41 -0
  230. data/sample/gtk-demo/cairo-clip-image.rb +51 -0
  231. data/sample/gtk-demo/cairo-clip-rectangle.rb +35 -0
  232. data/sample/gtk-demo/cairo-clip.rb +35 -0
  233. data/sample/gtk-demo/cairo-curve-rectangle.rb +76 -0
  234. data/sample/gtk-demo/cairo-curve-to.rb +43 -0
  235. data/sample/gtk-demo/cairo-dash.rb +39 -0
  236. data/sample/gtk-demo/cairo-fill-and-stroke.rb +32 -0
  237. data/sample/gtk-demo/cairo-fill-and-stroke2.rb +38 -0
  238. data/sample/gtk-demo/cairo-gradient.rb +35 -0
  239. data/sample/gtk-demo/cairo-image-pattern.rb +39 -0
  240. data/sample/gtk-demo/cairo-image.rb +49 -0
  241. data/sample/gtk-demo/cairo-line-cap.rb +53 -0
  242. data/sample/gtk-demo/cairo-line-join.rb +41 -0
  243. data/sample/gtk-demo/cairo-long-lines.rb +41 -0
  244. data/sample/gtk-demo/cairo-operator.rb +83 -0
  245. data/sample/gtk-demo/cairo-path.rb +28 -0
  246. data/sample/gtk-demo/cairo-pattern-fill.rb +88 -0
  247. data/sample/gtk-demo/cairo-self-intersect.rb +32 -0
  248. data/sample/gtk-demo/cairo-text-align-center.rb +45 -0
  249. data/sample/gtk-demo/cairo-text-extents.rb +46 -0
  250. data/sample/gtk-demo/cairo-text.rb +43 -0
  251. data/sample/gtk-demo/changedisplay.rb +408 -0
  252. data/sample/gtk-demo/clipboard.rb +72 -0
  253. data/sample/gtk-demo/colorsel.rb +84 -0
  254. data/sample/gtk-demo/common.rb +88 -0
  255. data/sample/gtk-demo/demo.ui +258 -0
  256. data/sample/gtk-demo/dialog.rb +137 -0
  257. data/sample/gtk-demo/drawingarea.rb +226 -0
  258. data/sample/gtk-demo/editable_cells.rb +172 -0
  259. data/sample/gtk-demo/entry_completion.rb +63 -0
  260. data/sample/gtk-demo/expander.rb +40 -0
  261. data/sample/gtk-demo/floppybuddy.gif +0 -0
  262. data/sample/gtk-demo/gnome-applets.png +0 -0
  263. data/sample/gtk-demo/gnome-calendar.png +0 -0
  264. data/sample/gtk-demo/gnome-foot.png +0 -0
  265. data/sample/gtk-demo/gnome-fs-directory.png +0 -0
  266. data/sample/gtk-demo/gnome-fs-regular.png +0 -0
  267. data/sample/gtk-demo/gnome-gimp.png +0 -0
  268. data/sample/gtk-demo/gnome-gmush.png +0 -0
  269. data/sample/gtk-demo/gnome-gsame.png +0 -0
  270. data/sample/gtk-demo/gnu-keys.png +0 -0
  271. data/sample/gtk-demo/gtk-logo-rgb.gif +0 -0
  272. data/sample/gtk-demo/hypertext.rb +211 -0
  273. data/sample/gtk-demo/iconview.rb +109 -0
  274. data/sample/gtk-demo/images.rb +197 -0
  275. data/sample/gtk-demo/item_factory.rb +94 -0
  276. data/sample/gtk-demo/list_store.rb +138 -0
  277. data/sample/gtk-demo/main.rb +382 -0
  278. data/sample/gtk-demo/menus.rb +172 -0
  279. data/sample/gtk-demo/panes.rb +156 -0
  280. data/sample/gtk-demo/pixbufs.rb +176 -0
  281. data/sample/gtk-demo/printing.rb +128 -0
  282. data/sample/gtk-demo/rotated_text.rb +84 -0
  283. data/sample/gtk-demo/ruby-gnome2-logo.png +0 -0
  284. data/sample/gtk-demo/sizegroup.rb +118 -0
  285. data/sample/gtk-demo/stock_browser.rb +235 -0
  286. data/sample/gtk-demo/textview.rb +436 -0
  287. data/sample/gtk-demo/tree_store.rb +270 -0
  288. data/sample/misc/aboutdialog.rb +42 -0
  289. data/sample/misc/aboutdialog2.rb +42 -0
  290. data/sample/misc/alpha-demo.rb +70 -0
  291. data/sample/misc/assistant.rb +347 -0
  292. data/sample/misc/bindings.rb +107 -0
  293. data/sample/misc/button.rb +69 -0
  294. data/sample/misc/button2.rb +28 -0
  295. data/sample/misc/buttonbox.rb +93 -0
  296. data/sample/misc/cairo-pong.rb +215 -0
  297. data/sample/misc/calendar.rb +66 -0
  298. data/sample/misc/checkbutton.rb +46 -0
  299. data/sample/misc/colorselection.rb +25 -0
  300. data/sample/misc/combo_check.rb +71 -0
  301. data/sample/misc/combobox.rb +86 -0
  302. data/sample/misc/composited-windows.rb +113 -0
  303. data/sample/misc/cursor.rb +32 -0
  304. data/sample/misc/dialog.rb +44 -0
  305. data/sample/misc/dialog2.rb +39 -0
  306. data/sample/misc/dnd.rb +64 -0
  307. data/sample/misc/dndtreeview.rb +56 -0
  308. data/sample/misc/drag-move.rb +131 -0
  309. data/sample/misc/drawing.rb +90 -0
  310. data/sample/misc/entry.rb +34 -0
  311. data/sample/misc/entrycompletion.rb +33 -0
  312. data/sample/misc/expander.rb +27 -0
  313. data/sample/misc/filechooser.rb +41 -0
  314. data/sample/misc/frame.rb +69 -0
  315. data/sample/misc/gdkscreen.rb +32 -0
  316. data/sample/misc/gnome-logo-icon.png +0 -0
  317. data/sample/misc/helloworld.rb +35 -0
  318. data/sample/misc/iconview.rb +38 -0
  319. data/sample/misc/image.rb +42 -0
  320. data/sample/misc/itemfactory.rb +73 -0
  321. data/sample/misc/itemfactory2.rb +74 -0
  322. data/sample/misc/keyboard_grab.rb +29 -0
  323. data/sample/misc/label.rb +33 -0
  324. data/sample/misc/linkbutton.rb +42 -0
  325. data/sample/misc/listview.rb +92 -0
  326. data/sample/misc/menu.rb +81 -0
  327. data/sample/misc/misc_button.rb +49 -0
  328. data/sample/misc/mouse-gesture.rb +465 -0
  329. data/sample/misc/pangorenderer.rb +66 -0
  330. data/sample/misc/pointer_grab.rb +34 -0
  331. data/sample/misc/print.rb +247 -0
  332. data/sample/misc/properties.rb +85 -0
  333. data/sample/misc/radiobutton.rb +47 -0
  334. data/sample/misc/recentchooserdialog.rb +52 -0
  335. data/sample/misc/rgtk+cairo.rb +42 -0
  336. data/sample/misc/scalebutton.rb +19 -0
  337. data/sample/misc/settings.rb +41 -0
  338. data/sample/misc/statusicon.rb +123 -0
  339. data/sample/misc/stock.rb +36 -0
  340. data/sample/misc/style_property.rb +67 -0
  341. data/sample/misc/style_property.rc +19 -0
  342. data/sample/misc/t-gtkplug.rb +58 -0
  343. data/sample/misc/t-gtksocket.rb +65 -0
  344. data/sample/misc/test.xpm +92 -0
  345. data/sample/misc/textbuffer_serialize.rb +130 -0
  346. data/sample/misc/threads.rb +72 -0
  347. data/sample/misc/to_drawable.rb +42 -0
  348. data/sample/misc/togglebutton.rb +34 -0
  349. data/sample/misc/toolbar.rb +55 -0
  350. data/sample/misc/tooltips.rb +204 -0
  351. data/sample/misc/tree_combo.rb +79 -0
  352. data/sample/misc/tree_progress.rb +63 -0
  353. data/sample/misc/treemodelfilter.rb +49 -0
  354. data/sample/misc/treeview.rb +71 -0
  355. data/sample/misc/uimanager.rb +148 -0
  356. data/sample/misc/uimanager2.rb +91 -0
  357. data/sample/misc/uimanager2.xml +36 -0
  358. data/sample/misc/window.rb +24 -0
  359. data/sample/misc/xbm_cursor.rb +43 -0
  360. data/sample/testgtk/3DRings.xpm +116 -0
  361. data/sample/testgtk/FilesQueue.xpm +98 -0
  362. data/sample/testgtk/Modeller.xpm +117 -0
  363. data/sample/testgtk/README +14 -0
  364. data/sample/testgtk/button.rb +124 -0
  365. data/sample/testgtk/buttonbox.rb +100 -0
  366. data/sample/testgtk/check-n.xpm +21 -0
  367. data/sample/testgtk/check-y.xpm +21 -0
  368. data/sample/testgtk/checkbutton.rb +67 -0
  369. data/sample/testgtk/circles.xbm +46 -0
  370. data/sample/testgtk/colorselect.rb +33 -0
  371. data/sample/testgtk/dialog.rb +48 -0
  372. data/sample/testgtk/entry.rb +73 -0
  373. data/sample/testgtk/filesel.rb +65 -0
  374. data/sample/testgtk/fontselection.rb +56 -0
  375. data/sample/testgtk/labels.rb +74 -0
  376. data/sample/testgtk/layout.rb +108 -0
  377. data/sample/testgtk/marble.xpm +408 -0
  378. data/sample/testgtk/menu.rb +79 -0
  379. data/sample/testgtk/notebook.rb +280 -0
  380. data/sample/testgtk/pixmap.rb +58 -0
  381. data/sample/testgtk/progressbar.rb +173 -0
  382. data/sample/testgtk/radiobutton.rb +61 -0
  383. data/sample/testgtk/range.rb +65 -0
  384. data/sample/testgtk/reparent.rb +91 -0
  385. data/sample/testgtk/sample.rb +80 -0
  386. data/sample/testgtk/savedposition.rb +87 -0
  387. data/sample/testgtk/scrolledwindow.rb +67 -0
  388. data/sample/testgtk/shapedwindow.rb +99 -0
  389. data/sample/testgtk/spinbutton.rb +181 -0
  390. data/sample/testgtk/statusbar.rb +89 -0
  391. data/sample/testgtk/test.xpm +92 -0
  392. data/sample/testgtk/testgtk.rb +176 -0
  393. data/sample/testgtk/testgtkrc +146 -0
  394. data/sample/testgtk/testgtkrc2 +21 -0
  395. data/sample/testgtk/togglebutton.rb +53 -0
  396. data/sample/testgtk/toolbar.rb +82 -0
  397. data/sample/testgtk/tooltips.rb +41 -0
  398. data/sample/testgtk/wmhints.rb +40 -0
  399. data/test/gtk-test-utils.rb +15 -0
  400. data/test/run-test.rb +32 -0
  401. data/test/test_gc.rb +25 -0
  402. data/test/test_gdk.rb +18 -0
  403. data/test/test_gdk_color.rb +10 -0
  404. data/test/test_gdk_display.rb +37 -0
  405. data/test/test_gdk_event.rb +11 -0
  406. data/test/test_gdk_gc.rb +7 -0
  407. data/test/test_gdk_keymap.rb +8 -0
  408. data/test/test_gdk_pango.rb +9 -0
  409. data/test/test_gdk_selection_data.rb +17 -0
  410. data/test/test_gdk_window.rb +29 -0
  411. data/test/test_gdk_window_attribute.rb +9 -0
  412. data/test/test_gtk_about_dialog.rb +14 -0
  413. data/test/test_gtk_buildable.rb +66 -0
  414. data/test/test_gtk_builder.rb +188 -0
  415. data/test/test_gtk_entry.rb +18 -0
  416. data/test/test_gtk_icon_theme.rb +30 -0
  417. data/test/test_gtk_image.rb +8 -0
  418. data/test/test_gtk_list_store.rb +65 -0
  419. data/test/test_gtk_menu_item.rb +13 -0
  420. data/test/test_gtk_rc_style.rb +14 -0
  421. data/test/test_gtk_tree_path.rb +20 -0
  422. data/test/test_gtk_unix_print.rb +14 -0
  423. data/test/test_gtk_widget.rb +32 -0
  424. metadata +553 -94
  425. data/LICENSE +0 -19
@@ -0,0 +1,41 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 1998-2000 Yukihiro Matsumoto,
6
+ * Daisuke Kanda,
7
+ * Hiroshi Igarashi
8
+ *
9
+ * This library is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU Lesser General Public
11
+ * License as published by the Free Software Foundation; either
12
+ * version 2.1 of the License, or (at your option) any later version.
13
+ *
14
+ * This library is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
+ * Lesser General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU Lesser General Public
20
+ * License along with this library; if not, write to the Free Software
21
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
+ * MA 02110-1301 USA
23
+ */
24
+
25
+ #include "rbgtk3private.h"
26
+
27
+ #define RG_TARGET_NAMESPACE cVolumeButton
28
+
29
+ static VALUE
30
+ rg_initialize(VALUE self)
31
+ {
32
+ RBGTK_INITIALIZE(self, gtk_volume_button_new());
33
+ return Qnil;
34
+ }
35
+
36
+ void
37
+ Init_gtk_volumebutton(VALUE mGtk)
38
+ {
39
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VOLUME_BUTTON, "VolumeButton", mGtk);
40
+ RG_DEF_METHOD(initialize, 0);
41
+ }
@@ -0,0 +1,1564 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 1998-2000 Yukihiro Matsumoto,
6
+ * Daisuke Kanda,
7
+ * Hiroshi Igarashi
8
+ *
9
+ * This library is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU Lesser General Public
11
+ * License as published by the Free Software Foundation; either
12
+ * version 2.1 of the License, or (at your option) any later version.
13
+ *
14
+ * This library is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
+ * Lesser General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU Lesser General Public
20
+ * License along with this library; if not, write to the Free Software
21
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
+ * MA 02110-1301 USA
23
+ */
24
+
25
+ #include "rbgtk3private.h"
26
+
27
+ #define RG_TARGET_NAMESPACE cWidget
28
+ #define _SELF(self) (RVAL2GTKWIDGET(self))
29
+
30
+ static VALUE style_prop_func_table;
31
+
32
+ static VALUE
33
+ rg_unparent(VALUE self)
34
+ {
35
+ gtk_widget_unparent(_SELF(self));
36
+ return self;
37
+ }
38
+
39
+ static VALUE
40
+ rg_show(VALUE self)
41
+ {
42
+ gtk_widget_show(_SELF(self));
43
+ return self;
44
+ }
45
+
46
+ static VALUE
47
+ rg_show_now(VALUE self)
48
+ {
49
+ gtk_widget_show_now(_SELF(self));
50
+ return self;
51
+ }
52
+
53
+ static VALUE
54
+ rg_hide(VALUE self)
55
+ {
56
+ gtk_widget_hide(_SELF(self));
57
+ return self;
58
+ }
59
+
60
+ static VALUE
61
+ rg_show_all(VALUE self)
62
+ {
63
+ gtk_widget_show_all(_SELF(self));
64
+ return self;
65
+ }
66
+
67
+ static VALUE
68
+ rg_map(VALUE self)
69
+ {
70
+ gtk_widget_map(_SELF(self));
71
+ return self;
72
+ }
73
+
74
+ static VALUE
75
+ rg_unmap(VALUE self)
76
+ {
77
+ gtk_widget_unmap(_SELF(self));
78
+ return self;
79
+ }
80
+
81
+ static VALUE
82
+ rg_realize(VALUE self)
83
+ {
84
+ gtk_widget_realize(_SELF(self));
85
+ return self;
86
+ }
87
+
88
+ static VALUE
89
+ rg_unrealize(VALUE self)
90
+ {
91
+ gtk_widget_unrealize(_SELF(self));
92
+ return self;
93
+ }
94
+
95
+ static VALUE
96
+ rg_queue_draw(VALUE self)
97
+ {
98
+ gtk_widget_queue_draw(_SELF(self));
99
+ return self;
100
+ }
101
+
102
+ static VALUE
103
+ rg_queue_resize(VALUE self)
104
+ {
105
+ gtk_widget_queue_resize(_SELF(self));
106
+ return self;
107
+ }
108
+
109
+ static VALUE
110
+ rg_queue_resize_no_redraw(VALUE self)
111
+ {
112
+ gtk_widget_queue_resize_no_redraw(_SELF(self));
113
+ return self;
114
+ }
115
+
116
+ static VALUE
117
+ rg_size_allocate(VALUE self, VALUE alloc)
118
+ {
119
+ gtk_widget_size_allocate(_SELF(self), RVAL2GTKALLOCATION(alloc));
120
+ return self;
121
+ }
122
+
123
+ static VALUE
124
+ rg_add_accelerator(VALUE self, VALUE sig, VALUE accel, VALUE key, VALUE mod, VALUE flag)
125
+ {
126
+ gtk_widget_add_accelerator(_SELF(self),
127
+ RVAL2CSTR(sig),
128
+ RVAL2GTKACCELGROUP(accel),
129
+ NUM2INT(key),
130
+ RVAL2GDKMODIFIERTYPE(mod),
131
+ RVAL2GTKACCELFLAGS(flag));
132
+ return self;
133
+ }
134
+
135
+ static VALUE
136
+ rg_remove_accelerator(VALUE self, VALUE accel, VALUE key, VALUE mod)
137
+ {
138
+ return CBOOL2RVAL(gtk_widget_remove_accelerator(_SELF(self),
139
+ RVAL2GTKACCELGROUP(accel),
140
+ NUM2INT(key),
141
+ RVAL2GDKMODIFIERTYPE(mod)));
142
+ }
143
+
144
+ static VALUE
145
+ rg_set_accel_path(VALUE self, VALUE accel_path, VALUE accel_group)
146
+ {
147
+ gtk_widget_set_accel_path(_SELF(self), RVAL2CSTR(accel_path),
148
+ RVAL2GTKACCELGROUP(accel_group));
149
+ return self;
150
+ }
151
+
152
+ static VALUE
153
+ rg_accel_closures(VALUE self)
154
+ {
155
+ return BOXEDGLIST2RVAL_FREE(gtk_widget_list_accel_closures(_SELF(self)),
156
+ G_TYPE_CLOSURE,
157
+ g_list_free, NULL);
158
+ }
159
+
160
+ static VALUE
161
+ rg_can_activate_accel_p(VALUE self, VALUE signal_id)
162
+ {
163
+ return CBOOL2RVAL(gtk_widget_can_activate_accel(_SELF(self), NUM2UINT(signal_id)));
164
+ }
165
+
166
+ static VALUE
167
+ rg_event(VALUE self, VALUE event)
168
+ {
169
+ return CBOOL2RVAL(gtk_widget_event(_SELF(self), RVAL2GEV(event)));
170
+ }
171
+
172
+ static VALUE
173
+ rg_activate(VALUE self)
174
+ {
175
+ return CBOOL2RVAL(gtk_widget_activate(_SELF(self)));
176
+ }
177
+
178
+ static VALUE
179
+ rg_reparent(VALUE self, VALUE parent)
180
+ {
181
+ gtk_widget_reparent(_SELF(self), _SELF(parent));
182
+ return self;
183
+ }
184
+
185
+ static VALUE
186
+ rg_intersect(VALUE self, VALUE area)
187
+ {
188
+ GdkRectangle intersection;
189
+ gboolean ret = gtk_widget_intersect(_SELF(self),
190
+ RVAL2GDKRECTANGLE(area),
191
+ &intersection);
192
+ return ret ? GDKRECTANGLE2RVAL(&intersection) : Qnil;
193
+ }
194
+
195
+ static VALUE
196
+ rg_grab_default(VALUE self)
197
+ {
198
+ gtk_widget_grab_default(_SELF(self));
199
+ return self;
200
+ }
201
+
202
+ static VALUE
203
+ rg_set_parent_window(VALUE self, VALUE parent_window)
204
+ {
205
+ gtk_widget_set_parent_window(_SELF(self),
206
+ RVAL2GDKWINDOW(parent_window));
207
+ return self;
208
+ }
209
+
210
+ static VALUE
211
+ rg_parent_window(VALUE self)
212
+ {
213
+ return GOBJ2RVAL(gtk_widget_get_parent_window(_SELF(self)));
214
+ }
215
+
216
+ static VALUE
217
+ rg_add_events(VALUE self, VALUE events)
218
+ {
219
+ gtk_widget_add_events(_SELF(self), NUM2INT(events));
220
+ return self;
221
+ }
222
+
223
+ static VALUE
224
+ rg_toplevel(VALUE self)
225
+ {
226
+ return GOBJ2RVAL(gtk_widget_get_toplevel(_SELF(self)));
227
+ }
228
+
229
+ static VALUE
230
+ rg_get_ancestor(VALUE self, VALUE klass)
231
+ {
232
+ return GOBJ2RVAL(gtk_widget_get_ancestor(_SELF(self), CLASS2GTYPE(klass)));
233
+ }
234
+
235
+ static VALUE
236
+ rg_visual(VALUE self)
237
+ {
238
+ return GOBJ2RVAL(gtk_widget_get_visual(_SELF(self)));
239
+ }
240
+
241
+ static VALUE
242
+ rg_pointer(VALUE self)
243
+ {
244
+ int x, y;
245
+
246
+ gtk_widget_get_pointer(_SELF(self), &x, &y);
247
+ return rb_assoc_new(INT2FIX(x), INT2FIX(y));
248
+ }
249
+
250
+ static VALUE
251
+ rg_ancestor_p(VALUE self, VALUE ancestor)
252
+ {
253
+ return CBOOL2RVAL(gtk_widget_is_ancestor(_SELF(self), _SELF(ancestor)));
254
+ }
255
+
256
+ static VALUE
257
+ rg_translate_coordinates(VALUE self, VALUE dest_widget, VALUE src_x, VALUE src_y)
258
+ {
259
+ gint dest_x, dest_y;
260
+ gboolean ret;
261
+ VALUE result = Qnil;
262
+ ret = gtk_widget_translate_coordinates(_SELF(self), _SELF(dest_widget),
263
+ NUM2INT(src_x), NUM2INT(src_y),
264
+ &dest_x, &dest_y);
265
+ if (ret)
266
+ result = rb_ary_new3(2, INT2FIX(dest_x), INT2FIX(dest_y));
267
+
268
+ return result;
269
+ }
270
+
271
+ static VALUE
272
+ rg_hide_on_delete(VALUE self)
273
+ {
274
+ return CBOOL2RVAL(gtk_widget_hide_on_delete(_SELF(self)));
275
+ }
276
+
277
+ static VALUE
278
+ rg_set_direction(VALUE self, VALUE dir)
279
+ {
280
+ gtk_widget_set_direction(_SELF(self), RVAL2GTKTEXTDIRECTION(dir));
281
+ return self;
282
+ }
283
+
284
+ static VALUE
285
+ rg_direction(VALUE self)
286
+ {
287
+ return GTKTEXTDIRECTION2RVAL(gtk_widget_get_direction(_SELF(self)));
288
+ }
289
+
290
+ static VALUE
291
+ rg_s_set_default_direction(VALUE self, VALUE dir)
292
+ {
293
+ gtk_widget_set_default_direction(RVAL2GTKTEXTDIRECTION(dir));
294
+ return self;
295
+ }
296
+
297
+ static VALUE
298
+ rg_s_default_direction(G_GNUC_UNUSED VALUE self)
299
+ {
300
+ return GTKTEXTDIRECTION2RVAL(gtk_widget_get_default_direction());
301
+ }
302
+
303
+ static VALUE
304
+ rg_composite_name(VALUE self)
305
+ {
306
+ return CSTR2RVAL(gtk_widget_get_composite_name(_SELF(self)));
307
+ }
308
+
309
+ static VALUE
310
+ rg_create_pango_context(VALUE self)
311
+ {
312
+ return GOBJ2RVALU(gtk_widget_create_pango_context(_SELF(self)));
313
+ }
314
+
315
+ static VALUE
316
+ rg_pango_context(VALUE self)
317
+ {
318
+ return GOBJ2RVAL(gtk_widget_get_pango_context(_SELF(self)));
319
+ }
320
+
321
+ static VALUE
322
+ rg_create_pango_layout(int argc, VALUE *argv, VALUE self)
323
+ {
324
+ VALUE text;
325
+ rb_scan_args(argc, argv, "01", &text);
326
+ return GOBJ2RVALU(gtk_widget_create_pango_layout(_SELF(self), RVAL2CSTR_ACCEPT_NIL(text)));
327
+ }
328
+
329
+ static VALUE
330
+ rg_s_pop_composite_child(VALUE self)
331
+ {
332
+ gtk_widget_pop_composite_child();
333
+ return self;
334
+ }
335
+
336
+ static VALUE
337
+ rg_s_push_composite_child(VALUE self)
338
+ {
339
+ gtk_widget_push_composite_child();
340
+ return self;
341
+ }
342
+
343
+ static VALUE
344
+ rg_queue_draw_area(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
345
+ {
346
+ gtk_widget_queue_draw_area(_SELF(self), NUM2INT(x), NUM2INT(y),
347
+ NUM2INT(width), NUM2INT(height));
348
+ return self;
349
+ }
350
+
351
+ static VALUE
352
+ rg_set_redraw_on_allocate(VALUE self, VALUE redraw_on_allocate)
353
+ {
354
+ gtk_widget_set_redraw_on_allocate(_SELF(self), RVAL2CBOOL(redraw_on_allocate));
355
+ return self;
356
+ }
357
+
358
+ static VALUE
359
+ rg_set_composite_name(VALUE self, VALUE name)
360
+ {
361
+ gtk_widget_set_composite_name(_SELF(self), RVAL2CSTR(name));
362
+ return self;
363
+ }
364
+
365
+ static VALUE
366
+ rg_mnemonic_activate(VALUE self, VALUE group_cycling)
367
+ {
368
+ return CBOOL2RVAL(gtk_widget_mnemonic_activate(_SELF(self), RVAL2CBOOL(group_cycling)));
369
+ }
370
+
371
+ /*
372
+ * Gtk::Widget.install_style_property(...) do |spec, str|
373
+ * #parse str
374
+ * new_val = .... # parse value from string.
375
+ * new_val # return new_val or nil if you can't convert the value.
376
+ * end
377
+ */
378
+ static gboolean
379
+ rc_property_parser(const GParamSpec *pspec, const GString *rc_string, GValue *property_value)
380
+ {
381
+ VALUE spec = GOBJ2RVAL((gpointer)pspec);
382
+ VALUE func = rb_hash_aref(style_prop_func_table, spec);
383
+ VALUE ret = rb_funcall(func, id_call, 2, spec, CSTR2RVAL(rc_string->str));
384
+ if (NIL_P(ret)) {
385
+ return FALSE;
386
+ } else if (RVAL2CBOOL(ret)){
387
+ rbgobj_rvalue_to_gvalue(ret, property_value);
388
+ return TRUE;
389
+ } else {
390
+ rb_raise(rb_eArgError, "Gtk::Widget#install_style_property() block should return new value or nil");
391
+ }
392
+ }
393
+
394
+ static VALUE
395
+ rg_s_install_style_property(VALUE self, VALUE spec)
396
+ {
397
+ const RGObjClassInfo* cinfo = rbgobj_lookup_class(self);
398
+ GtkWidgetClass* gclass;
399
+ GParamSpec* pspec = RVAL2GPARAMSPEC(spec);
400
+
401
+ if (cinfo->klass != self)
402
+ rb_raise(rb_eTypeError, "%s isn't registered class",
403
+ rb_class2name(self));
404
+
405
+ gclass = (GtkWidgetClass *)g_type_class_ref(cinfo->gtype);
406
+ if (rb_block_given_p()){
407
+ VALUE func = rb_block_proc();
408
+ rb_hash_aset(style_prop_func_table, spec, func);
409
+ gtk_widget_class_install_style_property_parser(gclass, pspec,
410
+ (GtkRcPropertyParser)rc_property_parser);
411
+ } else {
412
+ gtk_widget_class_install_style_property(gclass, pspec);
413
+ }
414
+ return self;
415
+ }
416
+
417
+ static VALUE
418
+ rg_s_style_property(VALUE self, VALUE property_name)
419
+ {
420
+ GtkWidgetClass* oclass;
421
+ const char* name;
422
+ GParamSpec* prop;
423
+ VALUE result;
424
+
425
+ if (SYMBOL_P(property_name)) {
426
+ name = rb_id2name(SYM2ID(property_name));
427
+ } else {
428
+ name = RVAL2CSTR(property_name);
429
+ }
430
+
431
+ oclass = (GtkWidgetClass*)g_type_class_ref(CLASS2GTYPE(self));
432
+
433
+ prop = gtk_widget_class_find_style_property(oclass, name);
434
+ if (!prop){
435
+ g_type_class_unref(oclass);
436
+ rb_raise(rb_eval_string("GLib::NoPropertyError"), "no such property: %s", name);
437
+ }
438
+
439
+ result = GOBJ2RVAL(prop);
440
+ g_type_class_unref(oclass);
441
+ return result;
442
+ }
443
+
444
+ static VALUE
445
+ rg_s_style_properties(int argc, VALUE *argv, VALUE self)
446
+ {
447
+ GtkWidgetClass* oclass = g_type_class_ref(CLASS2GTYPE(self));
448
+ guint n_properties;
449
+ GParamSpec** props;
450
+ VALUE inherited_too;
451
+ VALUE ary;
452
+ guint i;
453
+
454
+ if (rb_scan_args(argc, argv, "01", &inherited_too) == 0)
455
+ inherited_too = Qtrue;
456
+
457
+ props = gtk_widget_class_list_style_properties(oclass, &n_properties);
458
+
459
+ ary = rb_ary_new();
460
+ for (i = 0; i < n_properties; i++){
461
+ if (RVAL2CBOOL(inherited_too)
462
+ || GTYPE2CLASS(props[i]->owner_type) == self)
463
+ rb_ary_push(ary, CSTR2RVAL(props[i]->name));
464
+ }
465
+
466
+ g_free(props);
467
+ g_type_class_unref(oclass);
468
+ return ary;
469
+ }
470
+
471
+ static VALUE
472
+ rg_region_intersect(VALUE self, VALUE region)
473
+ {
474
+ return CRREGION2RVAL(gtk_widget_region_intersect(_SELF(self),
475
+ RVAL2CRREGION(region)));
476
+ }
477
+
478
+ static VALUE
479
+ rg_send_expose(VALUE self, VALUE event)
480
+ {
481
+ return INT2NUM(gtk_widget_send_expose(_SELF(self), RVAL2GEV(event)));
482
+ }
483
+
484
+ static VALUE
485
+ rg_style_get_property(VALUE self, VALUE prop_name)
486
+ {
487
+ GParamSpec* pspec = NULL;
488
+ const char* name;
489
+
490
+ if (SYMBOL_P(prop_name)) {
491
+ name = rb_id2name(SYM2ID(prop_name));
492
+ } else {
493
+ name = RVAL2CSTR(prop_name);
494
+ }
495
+ pspec = gtk_widget_class_find_style_property((GtkWidgetClass*)g_type_class_ref(RVAL2GTYPE(self)), name);
496
+ if (!pspec)
497
+ rb_raise(rb_eval_string("GLib::NoPropertyError"), "No such property: %s", name);
498
+ else {
499
+ // FIXME: use rb_ensure to call g_value_unset()
500
+ GValue gval = G_VALUE_INIT;
501
+ VALUE ret;
502
+ g_value_init(&gval, G_PARAM_SPEC_VALUE_TYPE(pspec));
503
+ gtk_widget_style_get_property(RVAL2GTKWIDGET(self), name, &gval);
504
+ ret = GVAL2RVAL(&gval);
505
+ g_value_unset(&gval);
506
+ return ret;
507
+ }
508
+ }
509
+
510
+ static VALUE
511
+ rg_accessible(VALUE self)
512
+ {
513
+ return GOBJ2RVAL(gtk_widget_get_accessible(_SELF(self)));
514
+ }
515
+
516
+ static VALUE
517
+ rg_child_focus(VALUE self, VALUE direction)
518
+ {
519
+ return CBOOL2RVAL(gtk_widget_child_focus(_SELF(self), RVAL2GTKDIRECTIONTYPE(direction)));
520
+ }
521
+
522
+ static VALUE
523
+ rg_error_bell(VALUE self)
524
+ {
525
+ gtk_widget_error_bell(_SELF(self));
526
+ return self;
527
+ }
528
+
529
+ static VALUE
530
+ rg_keynav_failed(VALUE self, VALUE direction)
531
+ {
532
+ return CBOOL2RVAL(gtk_widget_keynav_failed(_SELF(self), RVAL2GTKDIRECTIONTYPE(direction)));
533
+ }
534
+
535
+ static VALUE
536
+ rg_child_notify(VALUE self, VALUE child_property)
537
+ {
538
+ gtk_widget_child_notify(_SELF(self), RVAL2CSTR(child_property));
539
+ return self;
540
+ }
541
+
542
+ static VALUE
543
+ rg_freeze_child_notify(VALUE self)
544
+ {
545
+ gtk_widget_freeze_child_notify(_SELF(self));
546
+ return self;
547
+ }
548
+
549
+ static VALUE
550
+ rg_child_visible_p(VALUE self)
551
+ {
552
+ return CBOOL2RVAL(gtk_widget_get_child_visible(_SELF(self)));
553
+ }
554
+
555
+ static VALUE
556
+ rg_settings(VALUE self)
557
+ {
558
+ return GOBJ2RVAL(gtk_widget_get_settings(_SELF(self)));
559
+ }
560
+
561
+ static VALUE
562
+ rg_get_clipboard(VALUE self, VALUE selection)
563
+ {
564
+ return GOBJ2RVAL(gtk_widget_get_clipboard(_SELF(self), RVAL2ATOM(selection)));
565
+ }
566
+
567
+ static VALUE
568
+ rg_display(VALUE self)
569
+ {
570
+ return GOBJ2RVAL(gtk_widget_get_display(_SELF(self)));
571
+ }
572
+
573
+ static VALUE
574
+ rg_root_window(VALUE self)
575
+ {
576
+ return GOBJ2RVAL(gtk_widget_get_root_window(_SELF(self)));
577
+ }
578
+
579
+ static VALUE
580
+ rg_screen(VALUE self)
581
+ {
582
+ return GOBJ2RVAL(gtk_widget_get_screen(_SELF(self)));
583
+ }
584
+
585
+ static VALUE
586
+ rg_has_screen_p(VALUE self)
587
+ {
588
+ return CBOOL2RVAL(gtk_widget_has_screen(_SELF(self)));
589
+ }
590
+
591
+ static VALUE
592
+ rg_get_size_request(VALUE self)
593
+ {
594
+ gint width, height;
595
+ gtk_widget_get_size_request(_SELF(self), &width, &height);
596
+ return rb_ary_new3(2, INT2NUM(width), INT2NUM(height));
597
+ }
598
+
599
+ static VALUE
600
+ rg_set_child_visible(VALUE self, VALUE is_visible)
601
+ {
602
+ gtk_widget_set_child_visible(_SELF(self), RVAL2CBOOL(is_visible));
603
+ return self;
604
+ }
605
+
606
+ static VALUE
607
+ rg_set_size_request(VALUE self, VALUE width, VALUE height)
608
+ {
609
+ gtk_widget_set_size_request(_SELF(self), NUM2INT(width), NUM2INT(height));
610
+ return self;
611
+ }
612
+
613
+ static VALUE
614
+ rg_thaw_child_notify(VALUE self)
615
+ {
616
+ gtk_widget_thaw_child_notify(_SELF(self));
617
+ return self;
618
+ }
619
+
620
+ static VALUE
621
+ rg_mnemonic_labels(VALUE self)
622
+ {
623
+ return GOBJGLIST2RVAL_FREE(gtk_widget_list_mnemonic_labels(_SELF(self)),
624
+ g_list_free, NULL);
625
+ }
626
+
627
+ static VALUE
628
+ rg_add_mnemonic_label(VALUE self, VALUE label)
629
+ {
630
+ gtk_widget_add_mnemonic_label(_SELF(self), RVAL2GTKWIDGET(label));
631
+ return self;
632
+ }
633
+
634
+ static VALUE
635
+ rg_remove_mnemonic_label(VALUE self, VALUE label)
636
+ {
637
+ gtk_widget_remove_mnemonic_label(_SELF(self), RVAL2GTKWIDGET(label));
638
+ return self;
639
+ }
640
+
641
+ static VALUE
642
+ rg_set_tooltip_window(VALUE self, VALUE custom_window)
643
+ {
644
+ gtk_widget_set_tooltip_window(_SELF(self), RVAL2GTKWINDOW(custom_window));
645
+ return self;
646
+ }
647
+
648
+ static VALUE
649
+ rg_tooltip_window(VALUE self)
650
+ {
651
+ return GOBJ2RVAL(gtk_widget_get_tooltip_window(_SELF(self)));
652
+ }
653
+
654
+ static VALUE
655
+ rg_trigger_tooltip_query(VALUE self)
656
+ {
657
+ gtk_widget_trigger_tooltip_query(_SELF(self));
658
+ return self;
659
+ }
660
+
661
+ static VALUE
662
+ rg_composited_p(VALUE self)
663
+ {
664
+ return CBOOL2RVAL(gtk_widget_is_composited(_SELF(self)));
665
+ }
666
+
667
+ static VALUE
668
+ rg_set_window(VALUE self, VALUE window)
669
+ {
670
+ gtk_widget_set_window(_SELF(self), RVAL2GDKWINDOW(window));
671
+ return self;
672
+ }
673
+
674
+ static VALUE
675
+ rg_toplevel_p(VALUE self)
676
+ {
677
+ return CBOOL2RVAL(gtk_widget_is_toplevel(_SELF(self)));
678
+ }
679
+
680
+ static VALUE
681
+ rg_realized_p(VALUE self)
682
+ {
683
+ return CBOOL2RVAL(gtk_widget_get_realized(_SELF(self)));
684
+ }
685
+
686
+ static VALUE
687
+ rg_mapped_p(VALUE self)
688
+ {
689
+ return CBOOL2RVAL(gtk_widget_get_mapped(_SELF(self)));
690
+ }
691
+
692
+ static VALUE
693
+ rg_drawable_p(VALUE self)
694
+ {
695
+ return CBOOL2RVAL(gtk_widget_is_drawable(_SELF(self)));
696
+ }
697
+
698
+ static VALUE
699
+ rg_sensitive_with_parent_p(VALUE self)
700
+ {
701
+ return CBOOL2RVAL(gtk_widget_get_sensitive(_SELF(self)));
702
+ }
703
+
704
+ static VALUE
705
+ rg_has_grab_p(VALUE self)
706
+ {
707
+ return CBOOL2RVAL(gtk_widget_has_grab(_SELF(self)));
708
+ }
709
+
710
+ static VALUE
711
+ rg_allocation(VALUE self)
712
+ {
713
+ GtkAllocation alloc;
714
+ gtk_widget_get_allocation(_SELF(self), &alloc);
715
+ return GTKALLOCATION2RVAL(&alloc);
716
+ }
717
+
718
+ static VALUE
719
+ rg_set_allocation(VALUE self, VALUE alloc)
720
+ {
721
+ gtk_widget_set_allocation(_SELF(self), RVAL2GTKALLOCATION(alloc));
722
+ return self;
723
+ }
724
+
725
+ static VALUE
726
+ rg_destroy(VALUE self)
727
+ {
728
+ gtk_widget_destroy(_SELF(self));
729
+ return Qnil;
730
+ }
731
+
732
+ static VALUE
733
+ rg_bindings_activate(VALUE self, VALUE keyval, VALUE modifiers)
734
+ {
735
+ return CBOOL2RVAL(gtk_bindings_activate(RVAL2GOBJ(self),
736
+ NUM2UINT(keyval),
737
+ NUM2UINT(modifiers)));
738
+ }
739
+
740
+ static VALUE
741
+ rg_has_window_p(VALUE self)
742
+ {
743
+ return CBOOL2RVAL(gtk_widget_get_has_window(_SELF(self)));
744
+ }
745
+
746
+ static VALUE
747
+ rg_set_has_window(VALUE self, VALUE has_window)
748
+ {
749
+ gtk_widget_set_has_window(_SELF(self), RVAL2CBOOL(has_window));
750
+ return self;
751
+ }
752
+
753
+ static VALUE
754
+ rg_s_binding_set(VALUE self)
755
+ {
756
+ GType gtype;
757
+ gpointer gclass;
758
+ GtkBindingSet* binding_set;
759
+
760
+ Check_Type(self, T_CLASS);
761
+
762
+ gtype = CLASS2GTYPE(self);
763
+
764
+ if (!G_TYPE_IS_CLASSED(gtype)) {
765
+ rb_raise(rb_eTypeError, "%s is not a classed GType",
766
+ rb_class2name(self));
767
+ }
768
+ gclass = g_type_class_ref(gtype);
769
+ if (!gclass) {
770
+ rb_raise(rb_eRuntimeError, "couldn't get class reference");
771
+ }
772
+ if (!G_IS_OBJECT_CLASS(gclass)) {
773
+ g_type_class_unref(gclass);
774
+ rb_raise(rb_eTypeError, "%s is not a GObject class",
775
+ rb_class2name(self));
776
+ }
777
+
778
+ binding_set = gtk_binding_set_by_class(gclass);
779
+ if (!binding_set) {
780
+ g_type_class_unref(gclass);
781
+ rb_raise(rb_eRuntimeError, "couldn't get BindingSet from %s",
782
+ rb_class2name(self));
783
+ }
784
+ g_type_class_unref(gclass);
785
+
786
+ return GTKBINDINGSET2RVAL(binding_set);
787
+ }
788
+
789
+ static VALUE
790
+ rg_path(VALUE self)
791
+ {
792
+ return GTKWIDGETPATH2RVAL(gtk_widget_get_path(_SELF(self)));
793
+ }
794
+
795
+ static VALUE
796
+ widget_signal_size_request(G_GNUC_UNUSED guint num, const GValue *values)
797
+ {
798
+ GtkRequisition* req = (GtkRequisition*)g_value_get_boxed(&values[1]);
799
+ return rb_ary_new3(2, GVAL2RVAL(&values[0]),
800
+ rb_ary_new3(2, INT2NUM(req->width), INT2NUM(req->height)));
801
+ }
802
+ static VALUE
803
+ widget_signal_size_allocate(G_GNUC_UNUSED guint num, const GValue *values)
804
+ {
805
+ GtkAllocation* alloc = (GtkAllocation*)g_value_get_boxed(&values[1]);
806
+ return rb_ary_new3(2, GVAL2RVAL(&values[0]), GTKALLOCATION2RVAL(alloc));
807
+ }
808
+
809
+ static VALUE
810
+ rg_add_device_events(VALUE self, VALUE device, VALUE events)
811
+ {
812
+ gtk_widget_add_device_events(_SELF(self),
813
+ RVAL2GDKDEVICE(device),
814
+ RVAL2GDKEVENTMASK(events));
815
+
816
+ return self;
817
+ }
818
+
819
+ static VALUE
820
+ rg_compute_expand(VALUE self, VALUE orientation)
821
+ {
822
+ gboolean result;
823
+
824
+ result = gtk_widget_compute_expand(_SELF(self),
825
+ RVAL2GTKORIENTATION(orientation));
826
+
827
+ return CBOOL2RVAL(result);
828
+ }
829
+
830
+ static VALUE
831
+ rg_device_is_shadowed_p(VALUE self, VALUE device)
832
+ {
833
+ return CBOOL2RVAL(gtk_widget_device_is_shadowed(_SELF(self),
834
+ RVAL2GDKDEVICE(device)));
835
+ }
836
+
837
+ static VALUE
838
+ rg_draw(VALUE self, VALUE cr)
839
+ {
840
+ gtk_widget_draw(_SELF(self), RVAL2CRCONTEXT(cr));
841
+
842
+ return self;
843
+ }
844
+
845
+ static VALUE
846
+ rg_allocated_height(VALUE self)
847
+ {
848
+ return INT2NUM(gtk_widget_get_allocated_height(_SELF(self)));
849
+ }
850
+
851
+ static VALUE
852
+ rg_allocated_width(VALUE self)
853
+ {
854
+ return INT2NUM(gtk_widget_get_allocated_width(_SELF(self)));
855
+ }
856
+
857
+ /* TODO: device_enabled_p? */
858
+ static VALUE
859
+ rg_get_device_enabled_p(VALUE self, VALUE device)
860
+ {
861
+ return CBOOL2RVAL(gtk_widget_get_device_enabled(_SELF(self),
862
+ RVAL2GDKDEVICE(device)));
863
+ }
864
+
865
+ static VALUE
866
+ rg_get_device_events(VALUE self, VALUE device)
867
+ {
868
+ GdkEventMask mask;
869
+
870
+ mask = gtk_widget_get_device_events(_SELF(self), RVAL2GDKDEVICE(device));
871
+
872
+ return GDKEVENTMASK2RVAL(mask);
873
+ }
874
+
875
+ static VALUE
876
+ rg_preferred_height(VALUE self)
877
+ {
878
+ gint minimum_height, natural_height;
879
+
880
+ gtk_widget_get_preferred_height(_SELF(self), &minimum_height, &natural_height);
881
+
882
+ return rb_ary_new3(2, INT2NUM(minimum_height), INT2NUM(natural_height));
883
+ }
884
+
885
+ static VALUE
886
+ rg_get_preferred_height_for_width(VALUE self, VALUE width)
887
+ {
888
+ gint minimum_height, natural_height;
889
+
890
+ gtk_widget_get_preferred_height_for_width(_SELF(self), NUM2INT(width),
891
+ &minimum_height, &natural_height);
892
+
893
+ return rb_ary_new3(2, INT2NUM(minimum_height), INT2NUM(natural_height));
894
+ }
895
+
896
+ static VALUE
897
+ rg_preferred_size(VALUE self)
898
+ {
899
+ GtkRequisition minimum_size, natural_size;
900
+
901
+ gtk_widget_get_preferred_size(_SELF(self), &minimum_size, &natural_size);
902
+
903
+ return rb_ary_new3(2,
904
+ rb_ary_new3(2, minimum_size.width, minimum_size.height),
905
+ rb_ary_new3(2, natural_size.width, natural_size.height));
906
+ }
907
+
908
+ static VALUE
909
+ rg_preferred_width(VALUE self)
910
+ {
911
+ gint minimum_width, natural_width;
912
+
913
+ gtk_widget_get_preferred_width(_SELF(self), &minimum_width, &natural_width);
914
+
915
+ return rb_ary_new3(2, INT2NUM(minimum_width), INT2NUM(natural_width));
916
+ }
917
+
918
+ static VALUE
919
+ rg_get_preferred_width_for_height(VALUE self, VALUE height)
920
+ {
921
+ gint minimum_width, natural_width;
922
+
923
+ gtk_widget_get_preferred_width_for_height(_SELF(self), NUM2INT(height),
924
+ &minimum_width, &natural_width);
925
+
926
+ return rb_ary_new3(2, INT2NUM(minimum_width), INT2NUM(natural_width));
927
+ }
928
+
929
+ static VALUE
930
+ rg_request_mode(VALUE self)
931
+ {
932
+ return GTKSIZEREQUESTMODE2RVAL(gtk_widget_get_request_mode(_SELF(self)));
933
+ }
934
+
935
+ static VALUE
936
+ rg_state_flags(VALUE self)
937
+ {
938
+ return GTKSTATEFLAGS2RVAL(gtk_widget_get_state_flags(_SELF(self)));
939
+ }
940
+
941
+ static VALUE
942
+ rg_style_context(VALUE self)
943
+ {
944
+ return GOBJ2RVAL(gtk_widget_get_style_context(_SELF(self)));
945
+ }
946
+
947
+ static VALUE
948
+ rg_support_multidevice_p(VALUE self)
949
+ {
950
+ return CBOOL2RVAL(gtk_widget_get_support_multidevice(_SELF(self)));
951
+ }
952
+
953
+ #if GTK_CHECK_VERSION(3, 2, 0)
954
+ static VALUE
955
+ rg_has_visible_focus_p(VALUE self)
956
+ {
957
+ return CBOOL2RVAL(gtk_widget_has_visible_focus(_SELF(self)));
958
+ }
959
+ #endif
960
+
961
+ static VALUE
962
+ rg_in_destruction_p(VALUE self)
963
+ {
964
+ return CBOOL2RVAL(gtk_widget_in_destruction(_SELF(self)));
965
+ }
966
+
967
+ static VALUE
968
+ rg_input_shape_combine_region(VALUE self, VALUE region)
969
+ {
970
+ gtk_widget_input_shape_combine_region(_SELF(self),
971
+ NIL_P(region) ? NULL : RVAL2CRREGION(region));
972
+
973
+ return self;
974
+ }
975
+
976
+ static VALUE
977
+ rg_override_background_color(VALUE self, VALUE state, VALUE color)
978
+ {
979
+ gtk_widget_override_background_color(_SELF(self),
980
+ RVAL2GTKSTATEFLAGS(state),
981
+ NIL_P(color) ? NULL : RVAL2GDKRGBA(color));
982
+
983
+ return self;
984
+ }
985
+
986
+ static VALUE
987
+ rg_override_color(VALUE self, VALUE state, VALUE color)
988
+ {
989
+ gtk_widget_override_color(_SELF(self),
990
+ RVAL2GTKSTATEFLAGS(state),
991
+ NIL_P(color) ? NULL : RVAL2GDKRGBA(color));
992
+
993
+ return self;
994
+ }
995
+
996
+ static VALUE
997
+ rg_override_cursor(VALUE self, VALUE cursor, VALUE secondary_cursor)
998
+ {
999
+ gtk_widget_override_cursor(_SELF(self),
1000
+ NIL_P(cursor) ? NULL : RVAL2GDKRGBA(cursor),
1001
+ NIL_P(secondary_cursor) ? NULL : RVAL2GDKRGBA(secondary_cursor));
1002
+
1003
+ return self;
1004
+ }
1005
+
1006
+ static VALUE
1007
+ rg_override_font(VALUE self, VALUE font_desc)
1008
+ {
1009
+ gtk_widget_override_font(_SELF(self),
1010
+ NIL_P(font_desc) ? NULL : RVAL2PANGOFONTDESCRIPTION(font_desc));
1011
+
1012
+ return self;
1013
+ }
1014
+
1015
+ static VALUE
1016
+ rg_override_symbolic_color(VALUE self, VALUE name, VALUE color)
1017
+ {
1018
+ gtk_widget_override_symbolic_color(_SELF(self),
1019
+ RVAL2CSTR(name),
1020
+ NIL_P(color) ? NULL : RVAL2GDKRGBA(color));
1021
+
1022
+ return self;
1023
+ }
1024
+
1025
+ static VALUE
1026
+ rg_queue_compute_expand(VALUE self)
1027
+ {
1028
+ gtk_widget_queue_compute_expand(_SELF(self));
1029
+
1030
+ return self;
1031
+ }
1032
+
1033
+ static VALUE
1034
+ rg_queue_draw_region(VALUE self, VALUE region)
1035
+ {
1036
+ gtk_widget_queue_draw_region(_SELF(self), RVAL2CRREGION(region));
1037
+
1038
+ return self;
1039
+ }
1040
+
1041
+ static VALUE
1042
+ rg_render_icon_pixbuf(VALUE self, VALUE stock_id, VALUE size)
1043
+ {
1044
+ VALUE buffer;
1045
+ GdkPixbuf *pixbuf;
1046
+
1047
+ pixbuf = gtk_widget_render_icon_pixbuf(_SELF(self),
1048
+ RVAL2GLIBID(stock_id, buffer),
1049
+ RVAL2GTKICONSIZE(size));
1050
+
1051
+ return GOBJ2RVAL_UNREF(pixbuf);
1052
+ }
1053
+
1054
+ static VALUE
1055
+ rg_reset_style(VALUE self)
1056
+ {
1057
+ gtk_widget_reset_style(_SELF(self));
1058
+
1059
+ return self;
1060
+ }
1061
+
1062
+ static VALUE
1063
+ rg_send_focus_change(VALUE self, VALUE event)
1064
+ {
1065
+ gboolean result;
1066
+
1067
+ result = gtk_widget_send_focus_change(_SELF(self), RVAL2GDKEVENT(event));
1068
+
1069
+ return CBOOL2RVAL(result);
1070
+ }
1071
+
1072
+ static VALUE
1073
+ rg_set_device_enabled(VALUE self, VALUE device, VALUE enabled)
1074
+ {
1075
+ gtk_widget_set_device_enabled(_SELF(self),
1076
+ RVAL2GDKDEVICE(device),
1077
+ RVAL2CBOOL(enabled));
1078
+
1079
+ return self;
1080
+ }
1081
+
1082
+ static VALUE
1083
+ rg_set_device_events(VALUE self, VALUE device, VALUE events)
1084
+ {
1085
+ gtk_widget_set_device_events(_SELF(self),
1086
+ RVAL2GDKDEVICE(device),
1087
+ RVAL2GDKEVENTMASK(events));
1088
+
1089
+ return self;
1090
+ }
1091
+
1092
+ static VALUE
1093
+ rg_set_mapped(VALUE self, VALUE mapped)
1094
+ {
1095
+ gtk_widget_set_mapped(_SELF(self), RVAL2CBOOL(mapped));
1096
+
1097
+ return self;
1098
+ }
1099
+
1100
+ static VALUE
1101
+ rg_set_realized(VALUE self, VALUE realized)
1102
+ {
1103
+ gtk_widget_set_realized(_SELF(self), RVAL2CBOOL(realized));
1104
+
1105
+ return self;
1106
+ }
1107
+
1108
+ static VALUE
1109
+ rg_set_state_flags(VALUE self, VALUE flags, VALUE clear)
1110
+ {
1111
+ gtk_widget_set_state_flags(_SELF(self),
1112
+ RVAL2GTKSTATEFLAGS(flags),
1113
+ RVAL2CBOOL(clear));
1114
+
1115
+ return self;
1116
+ }
1117
+
1118
+ static VALUE
1119
+ rg_set_support_multidevice(VALUE self, VALUE support_multidevice)
1120
+ {
1121
+ gtk_widget_set_support_multidevice(_SELF(self), RVAL2CBOOL(support_multidevice));
1122
+
1123
+ return self;
1124
+ }
1125
+
1126
+ static VALUE
1127
+ rg_set_visual(VALUE self, VALUE visual)
1128
+ {
1129
+ gtk_widget_set_visual(_SELF(self), RVAL2GDKVISUAL(visual));
1130
+
1131
+ return self;
1132
+ }
1133
+
1134
+ static VALUE
1135
+ rg_shape_combine_region(VALUE self, VALUE region)
1136
+ {
1137
+ gtk_widget_shape_combine_region(_SELF(self),
1138
+ NIL_P(region) ? NULL : RVAL2CRREGION(region));
1139
+
1140
+ return self;
1141
+ }
1142
+
1143
+ static VALUE
1144
+ rg_unset_state_flags(VALUE self, VALUE flags)
1145
+ {
1146
+ gtk_widget_unset_state_flags(_SELF(self),
1147
+ RVAL2GTKSTATEFLAGS(flags));
1148
+
1149
+ return self;
1150
+ }
1151
+
1152
+ static VALUE
1153
+ rg_drag_dest_set(VALUE self, VALUE flags, VALUE targets, VALUE actions)
1154
+ {
1155
+ GtkDestDefaults flg = RVAL2GTKDESTDEFAULTS(flags);
1156
+ GdkDragAction acts = RVAL2GDKDRAGACTION(actions);
1157
+ long n;
1158
+ GtkTargetEntry *entries = RVAL2GTKTARGETENTRIES_ACCEPT_NIL(targets, &n);
1159
+
1160
+ gtk_drag_dest_set(_SELF(self), flg, entries, n, acts);
1161
+
1162
+ g_free(entries);
1163
+
1164
+ return self;
1165
+ }
1166
+
1167
+ static VALUE
1168
+ rg_drag_dest_set_proxy(VALUE self, VALUE proxy_window, VALUE protocol, VALUE use_coordinates)
1169
+ {
1170
+ gtk_drag_dest_set_proxy(_SELF(self),
1171
+ RVAL2GDKWINDOW(proxy_window),
1172
+ RVAL2GDKDRAGPROTOCOL(protocol),
1173
+ RVAL2CBOOL(use_coordinates));
1174
+ return self;
1175
+ }
1176
+
1177
+ static VALUE
1178
+ rg_drag_dest_unset(VALUE self)
1179
+ {
1180
+ gtk_drag_dest_unset(_SELF(self));
1181
+ return self;
1182
+ }
1183
+
1184
+ static VALUE
1185
+ rg_drag_dest_find_target(int argc, VALUE *argv, VALUE self)
1186
+ {
1187
+ VALUE context, target_list;
1188
+ GdkAtom ret;
1189
+ rb_scan_args(argc, argv, "11", &context, &target_list);
1190
+
1191
+ ret = gtk_drag_dest_find_target(_SELF(self),
1192
+ RVAL2GDKDRAGCONTEXT(context),
1193
+ NIL_P(target_list) ? NULL : RVAL2GTKTARGETLIST(target_list));
1194
+
1195
+ return GDKATOM2RVAL(ret);
1196
+ }
1197
+
1198
+ static VALUE
1199
+ rg_drag_dest_get_target_list(VALUE self)
1200
+ {
1201
+ GtkTargetList* list = gtk_drag_dest_get_target_list(_SELF(self));
1202
+ return GTKTARGETLIST2RVAL(list);
1203
+ }
1204
+
1205
+ static VALUE
1206
+ rg_drag_dest_set_target_list(VALUE self, VALUE target_list)
1207
+ {
1208
+ gtk_drag_dest_set_target_list(_SELF(self),
1209
+ NIL_P(target_list) ? NULL : RVAL2GTKTARGETLIST(target_list));
1210
+
1211
+ return self;
1212
+ }
1213
+
1214
+ static VALUE
1215
+ rg_drag_dest_add_text_targets(VALUE self)
1216
+ {
1217
+ gtk_drag_dest_add_text_targets(_SELF(self));
1218
+ return self;
1219
+ }
1220
+
1221
+ static VALUE
1222
+ rg_drag_dest_add_image_targets(VALUE self)
1223
+ {
1224
+ gtk_drag_dest_add_image_targets(_SELF(self));
1225
+ return self;
1226
+ }
1227
+
1228
+ static VALUE
1229
+ rg_drag_dest_add_uri_targets(VALUE self)
1230
+ {
1231
+ gtk_drag_dest_add_uri_targets(_SELF(self));
1232
+ return self;
1233
+ }
1234
+
1235
+ static VALUE
1236
+ rg_drag_dest_set_track_motion(VALUE self, VALUE track_motion)
1237
+ {
1238
+ gtk_drag_dest_set_track_motion(_SELF(self), RVAL2CBOOL(track_motion));
1239
+ return self;
1240
+ }
1241
+
1242
+ static VALUE
1243
+ rg_drag_dest_get_track_motion(VALUE self)
1244
+ {
1245
+ return CBOOL2RVAL(gtk_drag_dest_get_track_motion(_SELF(self)));
1246
+ }
1247
+
1248
+ static VALUE
1249
+ rg_drag_get_data(VALUE self, VALUE context, VALUE target, VALUE time)
1250
+ {
1251
+ gtk_drag_get_data(_SELF(self),
1252
+ RVAL2GDKDRAGCONTEXT(context),
1253
+ RVAL2ATOM(target),
1254
+ NUM2UINT(time));
1255
+ return self;
1256
+ }
1257
+
1258
+ static VALUE
1259
+ rg_drag_highlight(VALUE self)
1260
+ {
1261
+ gtk_drag_highlight(_SELF(self));
1262
+ return self;
1263
+ }
1264
+
1265
+ static VALUE
1266
+ rg_drag_unhighlight(VALUE self)
1267
+ {
1268
+ gtk_drag_unhighlight(_SELF(self));
1269
+ return self;
1270
+ }
1271
+
1272
+ static VALUE
1273
+ rg_drag_begin(VALUE self, VALUE target_list, VALUE actions, VALUE button, VALUE event)
1274
+ {
1275
+ return GOBJ2RVAL(gtk_drag_begin(_SELF(self),
1276
+ RVAL2GTKTARGETLIST(target_list),
1277
+ RVAL2GDKDRAGACTION(actions),
1278
+ NUM2INT(button),
1279
+ RVAL2GEV(event)));
1280
+ }
1281
+
1282
+ static VALUE
1283
+ rg_drag_threshold_p(VALUE self, VALUE start_x, VALUE start_y, VALUE current_x, VALUE current_y)
1284
+ {
1285
+ return CBOOL2RVAL(gtk_drag_check_threshold(_SELF(self),
1286
+ NUM2INT(start_x), NUM2INT(start_y),
1287
+ NUM2INT(current_x), NUM2INT(current_y)));
1288
+ }
1289
+
1290
+ static VALUE
1291
+ rg_drag_source_set(VALUE self, VALUE start_button_mask, VALUE targets, VALUE actions)
1292
+ {
1293
+ GdkModifierType mask = RVAL2GDKMODIFIERTYPE(start_button_mask);
1294
+ GdkDragAction acts = RVAL2GDKDRAGACTION(actions);
1295
+ long n;
1296
+ GtkTargetEntry *entries = RVAL2GTKTARGETENTRIES(targets, &n);
1297
+
1298
+ gtk_drag_source_set(_SELF(self), mask, entries, n, acts);
1299
+
1300
+ g_free(entries);
1301
+
1302
+ return self;
1303
+ }
1304
+
1305
+ static VALUE
1306
+ rg_drag_source_set_icon(VALUE self, VALUE icon)
1307
+ {
1308
+ if (TYPE(icon) == T_HASH) {
1309
+ VALUE stock_id, icon_name, gicon, pixbuf, buffer;
1310
+ rbg_scan_options(icon,
1311
+ "stock_id", &stock_id,
1312
+ "icon_name", &icon_name,
1313
+ "gicon", &gicon,
1314
+ "pixbuf", &pixbuf,
1315
+ NULL);
1316
+
1317
+ if (!NIL_P(stock_id))
1318
+ gtk_drag_source_set_icon_stock(_SELF(self), RVAL2GLIBID(stock_id, buffer));
1319
+ else if (!NIL_P(icon_name))
1320
+ gtk_drag_source_set_icon_name(_SELF(self), RVAL2CSTR(icon_name));
1321
+ #if GTK_CHECK_VERSION(3, 2, 0)
1322
+ else if (!NIL_P(gicon))
1323
+ gtk_drag_source_set_icon_gicon(_SELF(self), RVAL2GICON(gicon));
1324
+ #endif
1325
+ else if (!NIL_P(pixbuf))
1326
+ gtk_drag_source_set_icon_pixbuf(_SELF(self), RVAL2GDKPIXBUF(pixbuf));
1327
+ else
1328
+ rb_raise(rb_eArgError, "Invalid arguments.");
1329
+ } else {
1330
+ GType gtype = RVAL2GTYPE(icon);
1331
+
1332
+ if (gtype == GDK_TYPE_PIXBUF)
1333
+ gtk_drag_source_set_icon_pixbuf(_SELF(self), RVAL2GDKPIXBUF(icon));
1334
+ #if GTK_CHECK_VERSION(3, 2, 0)
1335
+ else if (g_type_is_a(gtype, G_TYPE_ICON))
1336
+ gtk_drag_source_set_icon_gicon(_SELF(self), RVAL2GICON(icon));
1337
+ #endif
1338
+ else
1339
+ rb_raise(rb_eArgError, "Invalid arguments.");
1340
+ }
1341
+
1342
+ return self;
1343
+ }
1344
+
1345
+ static VALUE
1346
+ rg_drag_source_unset(VALUE self)
1347
+ {
1348
+ gtk_drag_source_unset(_SELF(self));
1349
+ return self;
1350
+ }
1351
+
1352
+ static VALUE
1353
+ rg_drag_source_set_target_list(VALUE self, VALUE target_list)
1354
+ {
1355
+ gtk_drag_source_set_target_list(_SELF(self),
1356
+ NIL_P(target_list) ? NULL : RVAL2GTKTARGETLIST(target_list));
1357
+ return self;
1358
+ }
1359
+
1360
+ static VALUE
1361
+ rg_drag_source_get_target_list(VALUE self)
1362
+ {
1363
+ return GTKTARGETLIST2RVAL(gtk_drag_source_get_target_list(_SELF(self)));
1364
+ }
1365
+
1366
+ static VALUE
1367
+ rg_drag_source_add_text_targets(VALUE self)
1368
+ {
1369
+ gtk_drag_source_add_text_targets(_SELF(self));
1370
+ return self;
1371
+ }
1372
+ static VALUE
1373
+ rg_drag_source_add_image_targets(VALUE self)
1374
+ {
1375
+ gtk_drag_source_add_image_targets(_SELF(self));
1376
+ return self;
1377
+ }
1378
+ static VALUE
1379
+ rg_drag_source_add_uri_targets(VALUE self)
1380
+ {
1381
+ gtk_drag_source_add_uri_targets(_SELF(self));
1382
+ return self;
1383
+ }
1384
+
1385
+ void
1386
+ Init_gtk_widget(VALUE mGtk)
1387
+ {
1388
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_WIDGET, "Widget", mGtk);
1389
+
1390
+ rb_global_variable(&style_prop_func_table);
1391
+ style_prop_func_table = rb_hash_new();
1392
+
1393
+ RG_DEF_METHOD(unparent, 0);
1394
+ RG_DEF_METHOD(show, 0);
1395
+ RG_DEF_METHOD(show_now, 0);
1396
+ RG_DEF_METHOD(hide, 0);
1397
+ RG_DEF_METHOD(show_all, 0);
1398
+ RG_DEF_METHOD(map, 0);
1399
+ RG_DEF_METHOD(unmap, 0);
1400
+ RG_DEF_METHOD(realize, 0);
1401
+ RG_DEF_METHOD(unrealize, 0);
1402
+ RG_DEF_METHOD(queue_draw, 0);
1403
+ RG_DEF_METHOD(queue_resize, 0);
1404
+ RG_DEF_METHOD(queue_resize_no_redraw, 0);
1405
+ RG_DEF_METHOD(size_allocate, 1);
1406
+ RG_DEF_METHOD(add_accelerator, 5);
1407
+ RG_DEF_METHOD(remove_accelerator, 3);
1408
+ RG_DEF_METHOD(set_accel_path, 2);
1409
+ RG_DEF_METHOD(accel_closures, 0);
1410
+ RG_DEF_METHOD_P(can_activate_accel, 1);
1411
+ RG_DEF_METHOD(event, 1);
1412
+ RG_DEF_METHOD(activate, 0);
1413
+ RG_DEF_METHOD(reparent, 1);
1414
+ RG_DEF_SMETHOD(install_style_property, 1);
1415
+ RG_DEF_SMETHOD(style_property, 1);
1416
+ RG_DEF_SMETHOD(style_properties, -1);
1417
+ RG_DEF_METHOD(intersect, 1);
1418
+ RG_DEF_METHOD(grab_default, 0);
1419
+ RG_DEF_METHOD(set_parent_window, 1);
1420
+ RG_DEF_METHOD(parent_window, 0);
1421
+ RG_DEF_METHOD(add_events, 1);
1422
+ RG_DEF_METHOD(toplevel, 0);
1423
+ RG_DEF_METHOD(get_ancestor, 1);
1424
+ RG_DEF_METHOD(visual, 0);
1425
+ RG_DEF_METHOD(pointer, 0);
1426
+ RG_DEF_METHOD_P(ancestor, 1);
1427
+ RG_DEF_METHOD(translate_coordinates, 3);
1428
+ RG_DEF_METHOD(hide_on_delete, 0);
1429
+ RG_DEF_METHOD(set_direction, 1);
1430
+ RG_DEF_METHOD(direction, 0);
1431
+ RG_DEF_METHOD(composite_name, 0);
1432
+ RG_DEF_METHOD(create_pango_context, 0);
1433
+ RG_DEF_METHOD(pango_context, 0);
1434
+ RG_DEF_METHOD(create_pango_layout, -1);
1435
+ RG_DEF_METHOD(queue_draw_area, 4);
1436
+ RG_DEF_METHOD(set_redraw_on_allocate, 1);
1437
+ RG_DEF_METHOD(set_composite_name, 1);
1438
+ RG_DEF_METHOD(mnemonic_activate, 1);
1439
+ RG_DEF_METHOD(region_intersect, 1);
1440
+ RG_DEF_METHOD(send_expose, 1);
1441
+ RG_DEF_METHOD(style_get_property, 1);
1442
+ RG_DEF_METHOD(accessible, 0);
1443
+ RG_DEF_METHOD(child_focus, 1);
1444
+ RG_DEF_METHOD(error_bell, 0);
1445
+ RG_DEF_METHOD(keynav_failed, 0);
1446
+ RG_DEF_METHOD(child_notify, 1);
1447
+ RG_DEF_METHOD(freeze_child_notify, 0);
1448
+ RG_DEF_METHOD_P(child_visible, 0);
1449
+ RG_DEF_METHOD(settings, 0);
1450
+ RG_DEF_METHOD(get_clipboard, 1);
1451
+ RG_DEF_METHOD(display, 0);
1452
+ RG_DEF_METHOD(root_window, 0);
1453
+ RG_DEF_METHOD(screen, 0);
1454
+ RG_DEF_METHOD_P(has_screen, 0);
1455
+ RG_DEF_METHOD(set_child_visible, 1);
1456
+ RG_DEF_METHOD(get_size_request, 0);
1457
+ RG_DEF_METHOD(set_size_request, 2);
1458
+ RG_DEF_METHOD(thaw_child_notify, 0);
1459
+ RG_DEF_METHOD(mnemonic_labels, 0);
1460
+ RG_DEF_METHOD(add_mnemonic_label, 1);
1461
+ RG_DEF_METHOD(remove_mnemonic_label, 1);
1462
+ RG_DEF_METHOD(set_tooltip_window, 1);
1463
+ RG_DEF_METHOD(tooltip_window, 0);
1464
+ RG_DEF_METHOD(trigger_tooltip_query, 0);
1465
+ RG_DEF_METHOD_P(composited, 0);
1466
+ RG_DEF_METHOD(set_window, 1);
1467
+ RG_DEF_METHOD(allocation, 0);
1468
+ RG_DEF_METHOD(set_allocation, 1);
1469
+ RG_DEF_METHOD(destroy, 0);
1470
+ RG_DEF_METHOD(bindings_activate, 2);
1471
+
1472
+ RG_DEF_METHOD_P(toplevel, 0);
1473
+ RG_DEF_METHOD_P(realized, 0);
1474
+ RG_DEF_METHOD_P(mapped, 0);
1475
+ RG_DEF_METHOD_P(drawable, 0);
1476
+ RG_DEF_METHOD_P(sensitive_with_parent, 0);
1477
+ RG_DEF_METHOD_P(has_grab, 0);
1478
+
1479
+ RG_DEF_SMETHOD(set_default_direction, 1);
1480
+ RG_DEF_SMETHOD(default_direction, 0);
1481
+ RG_DEF_SMETHOD(pop_composite_child, 0);
1482
+ RG_DEF_SMETHOD(push_composite_child, 0);
1483
+ RG_DEF_SMETHOD(binding_set, 0);
1484
+ RG_DEF_METHOD_P(has_window, 0);
1485
+ RG_DEF_METHOD(set_has_window, 1);
1486
+
1487
+ RG_DEF_METHOD(path, 0);
1488
+
1489
+ RG_DEF_METHOD(add_device_events, 2);
1490
+ RG_DEF_METHOD(compute_expand, 1);
1491
+ RG_DEF_METHOD_P(device_is_shadowed, 1);
1492
+ RG_DEF_METHOD(draw, 1);
1493
+ RG_DEF_METHOD(allocated_height, 0);
1494
+ RG_DEF_METHOD(allocated_width, 0);
1495
+ RG_DEF_METHOD_P(get_device_enabled, 1);
1496
+ RG_DEF_METHOD(get_device_events, 1);
1497
+ RG_DEF_METHOD(preferred_height, 0);
1498
+ RG_DEF_METHOD(get_preferred_height_for_width, 1);
1499
+ RG_DEF_METHOD(preferred_size, 0);
1500
+ RG_DEF_METHOD(preferred_width, 0);
1501
+ RG_DEF_METHOD(get_preferred_width_for_height, 1);
1502
+ RG_DEF_METHOD(request_mode, 0);
1503
+ RG_DEF_METHOD(state_flags, 0);
1504
+ RG_DEF_METHOD(style_context, 0);
1505
+ RG_DEF_METHOD_P(support_multidevice, 0);
1506
+ #if GTK_CHECK_VERSION(3, 2, 0)
1507
+ RG_DEF_METHOD_P(has_visible_focus, 0);
1508
+ #endif
1509
+ RG_DEF_METHOD_P(in_destruction, 0);
1510
+ RG_DEF_METHOD(input_shape_combine_region, 1);
1511
+ RG_DEF_METHOD(override_background_color, 2);
1512
+ RG_DEF_METHOD(override_color, 2);
1513
+ RG_DEF_METHOD(override_cursor, 2);
1514
+ RG_DEF_METHOD(override_font, 1);
1515
+ RG_DEF_METHOD(override_symbolic_color, -1);
1516
+ RG_DEF_METHOD(queue_compute_expand, 0);
1517
+ RG_DEF_METHOD(queue_draw_region, 1);
1518
+ RG_DEF_METHOD(render_icon_pixbuf, 2);
1519
+ RG_DEF_METHOD(reset_style, 0);
1520
+ RG_DEF_METHOD(send_focus_change, 1);
1521
+ RG_DEF_METHOD(set_device_enabled, 2);
1522
+ RG_DEF_METHOD(set_device_events, 2);
1523
+ RG_DEF_METHOD(set_mapped, 1);
1524
+ RG_DEF_METHOD(set_realized, 1);
1525
+ RG_DEF_METHOD(set_state_flags, 2);
1526
+ RG_DEF_METHOD(set_support_multidevice, 1);
1527
+ RG_DEF_METHOD(set_visual, 1);
1528
+ RG_DEF_METHOD(shape_combine_region, 1);
1529
+ RG_DEF_METHOD(unset_state_flags, 1);
1530
+
1531
+ RG_DEF_METHOD(drag_dest_set, 3);
1532
+ RG_DEF_METHOD(drag_dest_set_proxy, 3);
1533
+ RG_DEF_METHOD(drag_dest_unset, 0);
1534
+ RG_DEF_METHOD(drag_dest_find_target, -1);
1535
+ RG_DEF_METHOD(drag_dest_get_target_list, 0);
1536
+ RG_DEF_METHOD(drag_dest_set_target_list, 1);
1537
+ RG_DEF_METHOD(drag_dest_add_text_targets, 0);
1538
+ RG_DEF_METHOD(drag_dest_add_image_targets, 0);
1539
+ RG_DEF_METHOD(drag_dest_add_uri_targets, 0);
1540
+ RG_DEF_METHOD(drag_dest_set_track_motion, 1);
1541
+ RG_DEF_METHOD(drag_dest_get_track_motion, 0);
1542
+ RG_DEF_METHOD(drag_get_data, 3);
1543
+ RG_DEF_METHOD(drag_highlight, 0);
1544
+ RG_DEF_METHOD(drag_unhighlight, 0);
1545
+ RG_DEF_METHOD(drag_begin, 4);
1546
+ RG_DEF_METHOD_P(drag_threshold, 4);
1547
+ RG_DEF_METHOD(drag_source_set, 3);
1548
+ RG_DEF_METHOD(drag_source_set_icon, 1);
1549
+ RG_DEF_METHOD(drag_source_unset, 0);
1550
+ RG_DEF_METHOD(drag_source_set_target_list, 1);
1551
+ RG_DEF_METHOD(drag_source_get_target_list, 0);
1552
+ RG_DEF_METHOD(drag_source_add_text_targets, 0);
1553
+ RG_DEF_METHOD(drag_source_add_image_targets, 0);
1554
+ RG_DEF_METHOD(drag_source_add_uri_targets, 0);
1555
+
1556
+ G_DEF_CLASS(GTK_TYPE_WIDGET_HELP_TYPE, "HelpType", RG_TARGET_NAMESPACE);
1557
+
1558
+ G_DEF_CLASS(GTK_TYPE_TEXT_DIRECTION, "TextDirection", RG_TARGET_NAMESPACE);
1559
+ G_DEF_CLASS(GTK_TYPE_ALIGN, "Align", RG_TARGET_NAMESPACE);
1560
+
1561
+ G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "size-request", (GValToRValSignalFunc)widget_signal_size_request);
1562
+ G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "size-allocate", (GValToRValSignalFunc)widget_signal_size_allocate);
1563
+
1564
+ }