gtk3 2.2.4-x64-mingw32

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