gtk2 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (281) hide show
  1. data/ChangeLog +6664 -0
  2. data/README +33 -0
  3. data/Rakefile +71 -0
  4. data/extconf.rb +116 -0
  5. data/src/global.h +33 -0
  6. data/src/init.c +39 -0
  7. data/src/lib/gtk2.rb +13 -0
  8. data/src/lib/gtk2/base.rb +95 -0
  9. data/src/makeinits.rb +57 -0
  10. data/src/makekeysyms.rb +5 -0
  11. data/src/rbgdk.c +395 -0
  12. data/src/rbgdk.h +50 -0
  13. data/src/rbgdkatom.c +122 -0
  14. data/src/rbgdkcairo.c +100 -0
  15. data/src/rbgdkcolor.c +151 -0
  16. data/src/rbgdkcolormap.c +142 -0
  17. data/src/rbgdkconst.c +29 -0
  18. data/src/rbgdkconversions.h +18 -0
  19. data/src/rbgdkcursor.c +115 -0
  20. data/src/rbgdkdevice.c +235 -0
  21. data/src/rbgdkdisplay.c +634 -0
  22. data/src/rbgdkdisplaymanager.c +50 -0
  23. data/src/rbgdkdragcontext.c +280 -0
  24. data/src/rbgdkdraw.c +487 -0
  25. data/src/rbgdkevent.c +1020 -0
  26. data/src/rbgdkgc.c +456 -0
  27. data/src/rbgdkgeometry.c +272 -0
  28. data/src/rbgdkimage.c +155 -0
  29. data/src/rbgdkinput.c +70 -0
  30. data/src/rbgdkkeymap.c +153 -0
  31. data/src/rbgdkkeysyms.h +2174 -0
  32. data/src/rbgdkkeyval.c +105 -0
  33. data/src/rbgdkpango.c +171 -0
  34. data/src/rbgdkpangorenderer.c +132 -0
  35. data/src/rbgdkpixbuf.c +178 -0
  36. data/src/rbgdkpixmap.c +255 -0
  37. data/src/rbgdkproperty.c +342 -0
  38. data/src/rbgdkrectangle.c +146 -0
  39. data/src/rbgdkregion.c +242 -0
  40. data/src/rbgdkrgb.c +197 -0
  41. data/src/rbgdkscreen.c +535 -0
  42. data/src/rbgdkselection.c +161 -0
  43. data/src/rbgdkthreads.c +68 -0
  44. data/src/rbgdktimecoord.c +118 -0
  45. data/src/rbgdkvisual.c +273 -0
  46. data/src/rbgdkwindow.c +1302 -0
  47. data/src/rbgdkwindowattr.c +213 -0
  48. data/src/rbgdkx11.c +256 -0
  49. data/src/rbgtk.c +93 -0
  50. data/src/rbgtk.h +121 -0
  51. data/src/rbgtkaboutdialog.c +195 -0
  52. data/src/rbgtkaccelerator.c +78 -0
  53. data/src/rbgtkaccelgroup.c +216 -0
  54. data/src/rbgtkaccelgroupentry.c +85 -0
  55. data/src/rbgtkaccelkey.c +116 -0
  56. data/src/rbgtkaccellabel.c +46 -0
  57. data/src/rbgtkaccelmap.c +162 -0
  58. data/src/rbgtkaccessible.c +29 -0
  59. data/src/rbgtkaction.c +277 -0
  60. data/src/rbgtkactiongroup.c +377 -0
  61. data/src/rbgtkadjustment.c +153 -0
  62. data/src/rbgtkalignment.c +71 -0
  63. data/src/rbgtkallocation.c +171 -0
  64. data/src/rbgtkarrow.c +47 -0
  65. data/src/rbgtkaspectframe.c +46 -0
  66. data/src/rbgtkassistant.c +230 -0
  67. data/src/rbgtkbbox.c +47 -0
  68. data/src/rbgtkbin.c +31 -0
  69. data/src/rbgtkbindingset.c +192 -0
  70. data/src/rbgtkborder.c +80 -0
  71. data/src/rbgtkbox.c +142 -0
  72. data/src/rbgtkbuildable.c +115 -0
  73. data/src/rbgtkbuilder.c +154 -0
  74. data/src/rbgtkbutton.c +151 -0
  75. data/src/rbgtkcalendar.c +159 -0
  76. data/src/rbgtkcelleditable.c +49 -0
  77. data/src/rbgtkcelllayout.c +144 -0
  78. data/src/rbgtkcellrenderer.c +139 -0
  79. data/src/rbgtkcellrendereraccel.c +42 -0
  80. data/src/rbgtkcellrenderercombo.c +37 -0
  81. data/src/rbgtkcellrendererpixbuf.c +33 -0
  82. data/src/rbgtkcellrendererprogress.c +37 -0
  83. data/src/rbgtkcellrendererspin.c +38 -0
  84. data/src/rbgtkcellrenderertext.c +45 -0
  85. data/src/rbgtkcellrenderertoggle.c +32 -0
  86. data/src/rbgtkcellview.c +134 -0
  87. data/src/rbgtkcheckbutton.c +55 -0
  88. data/src/rbgtkcheckmenuitem.c +56 -0
  89. data/src/rbgtkclipboard.c +473 -0
  90. data/src/rbgtkcolorbutton.c +63 -0
  91. data/src/rbgtkcolorsel.c +175 -0
  92. data/src/rbgtkcolorselectiondialog.c +72 -0
  93. data/src/rbgtkcombo.c +117 -0
  94. data/src/rbgtkcombobox.c +240 -0
  95. data/src/rbgtkcomboboxentry.c +60 -0
  96. data/src/rbgtkconst.c +163 -0
  97. data/src/rbgtkcontainer.c +776 -0
  98. data/src/rbgtkconversions.h +26 -0
  99. data/src/rbgtkcurve.c +105 -0
  100. data/src/rbgtkdialog.c +244 -0
  101. data/src/rbgtkdrag.c +436 -0
  102. data/src/rbgtkdrawingarea.c +31 -0
  103. data/src/rbgtkeditable.c +152 -0
  104. data/src/rbgtkentry.c +161 -0
  105. data/src/rbgtkentrycompletion.c +167 -0
  106. data/src/rbgtkeventbox.c +31 -0
  107. data/src/rbgtkexpander.c +67 -0
  108. data/src/rbgtkfilechooser.c +403 -0
  109. data/src/rbgtkfilechooserbutton.c +72 -0
  110. data/src/rbgtkfilechooserdialog.c +58 -0
  111. data/src/rbgtkfilechooserwidget.c +50 -0
  112. data/src/rbgtkfilefilter.c +139 -0
  113. data/src/rbgtkfilesel.c +155 -0
  114. data/src/rbgtkfixed.c +72 -0
  115. data/src/rbgtkfontbutton.c +69 -0
  116. data/src/rbgtkfontselection.c +30 -0
  117. data/src/rbgtkfontselectiondialog.c +106 -0
  118. data/src/rbgtkframe.c +64 -0
  119. data/src/rbgtkgamma.c +47 -0
  120. data/src/rbgtkhandlebox.c +42 -0
  121. data/src/rbgtkhbbox.c +31 -0
  122. data/src/rbgtkhbox.c +38 -0
  123. data/src/rbgtkhpaned.c +31 -0
  124. data/src/rbgtkhruler.c +31 -0
  125. data/src/rbgtkhscale.c +45 -0
  126. data/src/rbgtkhscrollbar.c +38 -0
  127. data/src/rbgtkhseparator.c +30 -0
  128. data/src/rbgtkiconfactory.c +80 -0
  129. data/src/rbgtkiconinfo.c +118 -0
  130. data/src/rbgtkiconset.c +87 -0
  131. data/src/rbgtkiconsize.c +90 -0
  132. data/src/rbgtkiconsource.c +176 -0
  133. data/src/rbgtkicontheme.c +309 -0
  134. data/src/rbgtkiconview.c +351 -0
  135. data/src/rbgtkimage.c +152 -0
  136. data/src/rbgtkimagemenuitem.c +52 -0
  137. data/src/rbgtkimcontext.c +134 -0
  138. data/src/rbgtkimcontextsimple.c +48 -0
  139. data/src/rbgtkimmulticontext.c +38 -0
  140. data/src/rbgtkinits.c +473 -0
  141. data/src/rbgtkinputdialog.c +30 -0
  142. data/src/rbgtkinvisible.c +68 -0
  143. data/src/rbgtkitem.c +51 -0
  144. data/src/rbgtkitemfactory.c +312 -0
  145. data/src/rbgtklabel.c +168 -0
  146. data/src/rbgtklayout.c +91 -0
  147. data/src/rbgtklinkbutton.c +68 -0
  148. data/src/rbgtkliststore.c +412 -0
  149. data/src/rbgtkmacros.h +26 -0
  150. data/src/rbgtkmain.c +532 -0
  151. data/src/rbgtkmenu.c +272 -0
  152. data/src/rbgtkmenubar.c +48 -0
  153. data/src/rbgtkmenuitem.c +171 -0
  154. data/src/rbgtkmenushell.c +128 -0
  155. data/src/rbgtkmenutoolbutton.c +74 -0
  156. data/src/rbgtkmessagedialog.c +102 -0
  157. data/src/rbgtkmisc.c +63 -0
  158. data/src/rbgtknotebook.c +484 -0
  159. data/src/rbgtkobject.c +186 -0
  160. data/src/rbgtkoptionmenu.c +65 -0
  161. data/src/rbgtkpagesetup.c +196 -0
  162. data/src/rbgtkpagesetupunixdialog.c +80 -0
  163. data/src/rbgtkpaned.c +114 -0
  164. data/src/rbgtkpapersize.c +186 -0
  165. data/src/rbgtkplug.c +84 -0
  166. data/src/rbgtkprintcontext.c +124 -0
  167. data/src/rbgtkprinter.c +155 -0
  168. data/src/rbgtkprintjob.c +151 -0
  169. data/src/rbgtkprintoperation.c +152 -0
  170. data/src/rbgtkprintoperationpreview.c +54 -0
  171. data/src/rbgtkprintsettings.c +794 -0
  172. data/src/rbgtkprintunixdialog.c +98 -0
  173. data/src/rbgtkprogress.c +21 -0
  174. data/src/rbgtkprogressbar.c +72 -0
  175. data/src/rbgtkradioaction.c +102 -0
  176. data/src/rbgtkradiobutton.c +83 -0
  177. data/src/rbgtkradiomenuitem.c +115 -0
  178. data/src/rbgtkradiotoolbutton.c +99 -0
  179. data/src/rbgtkrange.c +98 -0
  180. data/src/rbgtkrc.c +228 -0
  181. data/src/rbgtkrcstyle.c +184 -0
  182. data/src/rbgtkrecentaction.c +52 -0
  183. data/src/rbgtkrecentchooser.c +276 -0
  184. data/src/rbgtkrecentchooserdialog.c +59 -0
  185. data/src/rbgtkrecentchoosermenu.c +55 -0
  186. data/src/rbgtkrecentchooserwidget.c +45 -0
  187. data/src/rbgtkrecentdata.c +152 -0
  188. data/src/rbgtkrecentfilter.c +180 -0
  189. data/src/rbgtkrecentfilterinfo.c +197 -0
  190. data/src/rbgtkrecentinfo.c +232 -0
  191. data/src/rbgtkrecentmanager.c +164 -0
  192. data/src/rbgtkruler.c +82 -0
  193. data/src/rbgtkscale.c +47 -0
  194. data/src/rbgtkscalebutton.c +115 -0
  195. data/src/rbgtkscrollbar.c +21 -0
  196. data/src/rbgtkscrolledwindow.c +160 -0
  197. data/src/rbgtkselection.c +171 -0
  198. data/src/rbgtkselectiondata.c +333 -0
  199. data/src/rbgtkseparator.c +21 -0
  200. data/src/rbgtkseparatormenuitem.c +28 -0
  201. data/src/rbgtkseparatortoolitem.c +40 -0
  202. data/src/rbgtksettings.c +225 -0
  203. data/src/rbgtksizegroup.c +74 -0
  204. data/src/rbgtksocket.c +72 -0
  205. data/src/rbgtkspinbutton.c +138 -0
  206. data/src/rbgtkstatusbar.c +90 -0
  207. data/src/rbgtkstatusicon.c +120 -0
  208. data/src/rbgtkstock.c +264 -0
  209. data/src/rbgtkstyle.c +722 -0
  210. data/src/rbgtktable.c +190 -0
  211. data/src/rbgtktargetlist.c +148 -0
  212. data/src/rbgtktearoffmenuitem.c +30 -0
  213. data/src/rbgtktextappearance.c +173 -0
  214. data/src/rbgtktextattributes.c +209 -0
  215. data/src/rbgtktextbuffer.c +993 -0
  216. data/src/rbgtktextchild.c +49 -0
  217. data/src/rbgtktextiter.c +553 -0
  218. data/src/rbgtktextmark.c +87 -0
  219. data/src/rbgtktexttag.c +66 -0
  220. data/src/rbgtktexttagtable.c +94 -0
  221. data/src/rbgtktextview.c +351 -0
  222. data/src/rbgtktoggleaction.c +76 -0
  223. data/src/rbgtktogglebutton.c +84 -0
  224. data/src/rbgtktoggletoolbutton.c +70 -0
  225. data/src/rbgtktoolbar.c +373 -0
  226. data/src/rbgtktoolbutton.c +75 -0
  227. data/src/rbgtktoolitem.c +184 -0
  228. data/src/rbgtktooltip.c +76 -0
  229. data/src/rbgtktooltips.c +107 -0
  230. data/src/rbgtktreedragdest.c +19 -0
  231. data/src/rbgtktreedragsource.c +19 -0
  232. data/src/rbgtktreeiter.c +259 -0
  233. data/src/rbgtktreemodel.c +256 -0
  234. data/src/rbgtktreemodelfilter.c +214 -0
  235. data/src/rbgtktreemodelsort.c +113 -0
  236. data/src/rbgtktreepath.c +195 -0
  237. data/src/rbgtktreerowreference.c +168 -0
  238. data/src/rbgtktreeselection.c +235 -0
  239. data/src/rbgtktreesortable.c +127 -0
  240. data/src/rbgtktreestore.c +379 -0
  241. data/src/rbgtktreeview.c +881 -0
  242. data/src/rbgtktreeviewcolumn.c +331 -0
  243. data/src/rbgtkuimanager.c +210 -0
  244. data/src/rbgtkvbbox.c +31 -0
  245. data/src/rbgtkvbox.c +38 -0
  246. data/src/rbgtkviewport.c +33 -0
  247. data/src/rbgtkvolumebutton.c +36 -0
  248. data/src/rbgtkvpaned.c +31 -0
  249. data/src/rbgtkvruler.c +30 -0
  250. data/src/rbgtkvscale.c +45 -0
  251. data/src/rbgtkvscrollbar.c +38 -0
  252. data/src/rbgtkvseparator.c +30 -0
  253. data/src/rbgtkwidget.c +1414 -0
  254. data/src/rbgtkwindow.c +822 -0
  255. data/src/rbgtkwindowgroup.c +48 -0
  256. data/test/gtk-test-utils.rb +15 -0
  257. data/test/run-test.rb +30 -0
  258. data/test/test_gc.rb +25 -0
  259. data/test/test_gdk.rb +18 -0
  260. data/test/test_gdk_color.rb +10 -0
  261. data/test/test_gdk_display.rb +37 -0
  262. data/test/test_gdk_event.rb +11 -0
  263. data/test/test_gdk_gc.rb +7 -0
  264. data/test/test_gdk_keymap.rb +8 -0
  265. data/test/test_gdk_pango.rb +9 -0
  266. data/test/test_gdk_selection_data.rb +17 -0
  267. data/test/test_gdk_window.rb +29 -0
  268. data/test/test_gdk_window_attribute.rb +9 -0
  269. data/test/test_gtk_about_dialog.rb +14 -0
  270. data/test/test_gtk_buildable.rb +66 -0
  271. data/test/test_gtk_builder.rb +188 -0
  272. data/test/test_gtk_entry.rb +18 -0
  273. data/test/test_gtk_icon_theme.rb +30 -0
  274. data/test/test_gtk_image.rb +8 -0
  275. data/test/test_gtk_list_store.rb +65 -0
  276. data/test/test_gtk_menu_item.rb +13 -0
  277. data/test/test_gtk_rc_style.rb +14 -0
  278. data/test/test_gtk_tree_path.rb +20 -0
  279. data/test/test_gtk_unix_print.rb +14 -0
  280. data/test/test_gtk_widget.rb +32 -0
  281. metadata +393 -0
@@ -0,0 +1,31 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkvbbox.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/02/01 16:46:24 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+
17
+ static VALUE
18
+ vbbox_initialize(self)
19
+ VALUE self;
20
+ {
21
+ RBGTK_INITIALIZE(self, gtk_vbutton_box_new());
22
+ return Qnil;
23
+ }
24
+
25
+ void
26
+ Init_gtk_vbutton_box()
27
+ {
28
+ VALUE gVBBox = G_DEF_CLASS(GTK_TYPE_VBUTTON_BOX, "VButtonBox", mGtk);
29
+
30
+ rb_define_method(gVBBox, "initialize", vbbox_initialize, 0);
31
+ }
@@ -0,0 +1,38 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkvbox.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:32 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+
17
+ static VALUE
18
+ vbox_initialize(argc, argv, self)
19
+ int argc;
20
+ VALUE *argv;
21
+ VALUE self;
22
+ {
23
+ VALUE homogeneous, spacing;
24
+
25
+ rb_scan_args(argc, argv, "02", &homogeneous, &spacing);
26
+
27
+ RBGTK_INITIALIZE(self, gtk_vbox_new(RVAL2CBOOL(homogeneous),
28
+ (NIL_P(spacing)?0:NUM2INT(spacing))));
29
+ return Qnil;
30
+ }
31
+
32
+ void
33
+ Init_gtk_vbox()
34
+ {
35
+ VALUE gVBox = G_DEF_CLASS(GTK_TYPE_VBOX, "VBox", mGtk);
36
+
37
+ rb_define_method(gVBox, "initialize", vbox_initialize, -1);
38
+ }
@@ -0,0 +1,33 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkviewport.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/02/01 16:46:24 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+
17
+ static VALUE
18
+ vport_initialize(self, hadj, vadj)
19
+ VALUE self, hadj, vadj;
20
+ {
21
+ GtkAdjustment *h_adj = GTK_ADJUSTMENT(RVAL2GOBJ(hadj));
22
+ GtkAdjustment *v_adj = GTK_ADJUSTMENT(RVAL2GOBJ(vadj));
23
+
24
+ RBGTK_INITIALIZE(self, gtk_viewport_new(h_adj, v_adj));
25
+ return Qnil;
26
+ }
27
+
28
+ void
29
+ Init_gtk_viewport()
30
+ {
31
+ VALUE gViewport = G_DEF_CLASS(GTK_TYPE_VIEWPORT, "Viewport", mGtk);
32
+ rb_define_method(gViewport, "initialize", vport_initialize, 2);
33
+ }
@@ -0,0 +1,36 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkvolumebutton.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/03 15:17:10 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+
17
+ #if GTK_CHECK_VERSION(2,12,0)
18
+
19
+ static VALUE
20
+ volumebutton_initialize(self)
21
+ VALUE self;
22
+ {
23
+ RBGTK_INITIALIZE(self, gtk_volume_button_new());
24
+ return Qnil;
25
+ }
26
+
27
+ #endif
28
+
29
+ void
30
+ Init_gtk_volumebutton()
31
+ {
32
+ #if GTK_CHECK_VERSION(2,12,0)
33
+ VALUE gVolumeButton = G_DEF_CLASS(GTK_TYPE_VOLUME_BUTTON, "VolumeButton", mGtk);
34
+ rb_define_method(gVolumeButton, "initialize", volumebutton_initialize, 0);
35
+ #endif
36
+ }
@@ -0,0 +1,31 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkvpaned.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/02/01 16:46:24 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+
17
+ static VALUE
18
+ vpaned_initialize(self)
19
+ VALUE self;
20
+ {
21
+ RBGTK_INITIALIZE(self, gtk_vpaned_new());
22
+ return Qnil;
23
+ }
24
+
25
+ void
26
+ Init_gtk_vpaned()
27
+ {
28
+ VALUE gVPaned = G_DEF_CLASS(GTK_TYPE_VPANED, "VPaned", mGtk);
29
+
30
+ rb_define_method(gVPaned, "initialize", vpaned_initialize, 0);
31
+ }
@@ -0,0 +1,30 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkvruler.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/02/01 16:46:24 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+
17
+ static VALUE
18
+ vruler_initialize(self)
19
+ VALUE self;
20
+ {
21
+ RBGTK_INITIALIZE(self, gtk_vruler_new());
22
+ return Qnil;
23
+ }
24
+
25
+ void
26
+ Init_gtk_vruler()
27
+ {
28
+ VALUE gVRuler = G_DEF_CLASS(GTK_TYPE_VRULER, "VRuler", mGtk);
29
+ rb_define_method(gVRuler, "initialize", vruler_initialize, 0);
30
+ }
@@ -0,0 +1,45 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkvscale.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/02/01 16:46:24 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+
17
+ static VALUE
18
+ vscale_initialize(argc, argv, self)
19
+ int argc;
20
+ VALUE *argv;
21
+ VALUE self;
22
+ {
23
+ VALUE arg1, arg2, arg3;
24
+ GtkAdjustment *adj = NULL;
25
+ GtkWidget *widget;
26
+
27
+ rb_scan_args(argc, argv, "03", &arg1, &arg2, &arg3);
28
+
29
+ if (NIL_P(arg1) || RVAL2GTYPE(arg1) == GTK_TYPE_ADJUSTMENT){
30
+ if (!NIL_P(arg1)) adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1));
31
+ widget = gtk_vscale_new(adj);
32
+ } else {
33
+ widget = gtk_vscale_new_with_range(NUM2DBL(arg1),
34
+ NUM2DBL(arg2), NUM2DBL(arg3));
35
+ }
36
+ RBGTK_INITIALIZE(self, widget);
37
+ return Qnil;
38
+ }
39
+
40
+ void
41
+ Init_gtk_vscale()
42
+ {
43
+ VALUE gVScale = G_DEF_CLASS(GTK_TYPE_VSCALE, "VScale", mGtk);
44
+ rb_define_method(gVScale, "initialize", vscale_initialize, -1);
45
+ }
@@ -0,0 +1,38 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkvscrollbar.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/02/01 16:46:24 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+
17
+ static VALUE
18
+ vscrollbar_initialize(argc, argv, self)
19
+ int argc;
20
+ VALUE *argv;
21
+ VALUE self;
22
+ {
23
+ VALUE arg1;
24
+ GtkAdjustment *adj = NULL;
25
+
26
+ rb_scan_args(argc, argv, "01", &arg1);
27
+ if (!NIL_P(arg1)) adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1));
28
+
29
+ RBGTK_INITIALIZE(self, gtk_vscrollbar_new(adj));
30
+ return Qnil;
31
+ }
32
+
33
+ void
34
+ Init_gtk_vscrollbar()
35
+ {
36
+ VALUE gVScrollbar = G_DEF_CLASS(GTK_TYPE_VSCROLLBAR, "VScrollbar", mGtk);
37
+ rb_define_method(gVScrollbar, "initialize", vscrollbar_initialize, -1);
38
+ }
@@ -0,0 +1,30 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkvseparator.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2003/02/01 16:46:24 $
8
+
9
+ Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+
17
+ static VALUE
18
+ vsep_initialize(self)
19
+ VALUE self;
20
+ {
21
+ RBGTK_INITIALIZE(self, gtk_vseparator_new());
22
+ return Qnil;
23
+ }
24
+
25
+ void
26
+ Init_gtk_vseparator()
27
+ {
28
+ VALUE gVSeparator = G_DEF_CLASS(GTK_TYPE_VSEPARATOR, "VSeparator", mGtk);
29
+ rb_define_method(gVSeparator, "initialize", vsep_initialize, 0);
30
+ }
@@ -0,0 +1,1414 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkwidget.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:32 $
8
+
9
+ Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+
17
+ #define _SELF(self) (GTK_WIDGET(RVAL2GOBJ(self)))
18
+
19
+ static VALUE style_prop_func_table;
20
+
21
+ static VALUE
22
+ widget_get_flags(self)
23
+ VALUE self;
24
+ {
25
+ return GFLAGS2RVAL(GTK_WIDGET_FLAGS(_SELF(self)), GTK_TYPE_WIDGET_FLAGS);
26
+ }
27
+
28
+ static VALUE
29
+ widget_set_flags(self, flag)
30
+ VALUE self;
31
+ VALUE flag;
32
+ {
33
+ GTK_WIDGET_SET_FLAGS(_SELF(self), RVAL2GFLAGS(flag, GTK_TYPE_WIDGET_FLAGS));
34
+ return self;
35
+ }
36
+
37
+ static VALUE
38
+ widget_unset_flags(self, flag)
39
+ VALUE self;
40
+ VALUE flag;
41
+ {
42
+ GTK_WIDGET_UNSET_FLAGS(_SELF(self), RVAL2GFLAGS(flag, GTK_TYPE_WIDGET_FLAGS));
43
+ return self;
44
+ }
45
+
46
+
47
+ static VALUE
48
+ widget_unparent(self)
49
+ VALUE self;
50
+ {
51
+ gtk_widget_unparent(_SELF(self));
52
+ return self;
53
+ }
54
+
55
+ static VALUE
56
+ widget_show(self)
57
+ VALUE self;
58
+ {
59
+ gtk_widget_show(_SELF(self));
60
+ return self;
61
+ }
62
+
63
+ static VALUE
64
+ widget_show_now(self)
65
+ VALUE self;
66
+ {
67
+ gtk_widget_show_now(_SELF(self));
68
+ return self;
69
+ }
70
+
71
+ static VALUE
72
+ widget_hide(self)
73
+ VALUE self;
74
+ {
75
+ gtk_widget_hide(_SELF(self));
76
+ return self;
77
+ }
78
+
79
+ static VALUE
80
+ widget_show_all(self)
81
+ VALUE self;
82
+ {
83
+ gtk_widget_show_all(_SELF(self));
84
+ return self;
85
+ }
86
+
87
+ static VALUE
88
+ widget_hide_all(self)
89
+ VALUE self;
90
+ {
91
+ gtk_widget_hide_all(_SELF(self));
92
+ return self;
93
+ }
94
+
95
+ static VALUE
96
+ widget_map(self)
97
+ VALUE self;
98
+ {
99
+ gtk_widget_map(_SELF(self));
100
+ return self;
101
+ }
102
+
103
+ static VALUE
104
+ widget_unmap(self)
105
+ VALUE self;
106
+ {
107
+ gtk_widget_unmap(_SELF(self));
108
+ return self;
109
+ }
110
+
111
+ static VALUE
112
+ widget_realize(self)
113
+ VALUE self;
114
+ {
115
+ gtk_widget_realize(_SELF(self));
116
+ return self;
117
+ }
118
+
119
+ static VALUE
120
+ widget_unrealize(self)
121
+ VALUE self;
122
+ {
123
+ gtk_widget_unrealize(_SELF(self));
124
+ return self;
125
+ }
126
+
127
+ static VALUE
128
+ widget_queue_draw(self)
129
+ VALUE self;
130
+ {
131
+ gtk_widget_queue_draw(_SELF(self));
132
+ return self;
133
+ }
134
+
135
+ static VALUE
136
+ widget_queue_resize(self)
137
+ VALUE self;
138
+ {
139
+ gtk_widget_queue_resize(_SELF(self));
140
+ return self;
141
+ }
142
+
143
+ #if GTK_CHECK_VERSION(2,4,0)
144
+ static VALUE
145
+ widget_queue_resize_no_redraw(self)
146
+ VALUE self;
147
+ {
148
+ gtk_widget_queue_resize_no_redraw(_SELF(self));
149
+ return self;
150
+ }
151
+ #endif
152
+
153
+ /* Note this method is not
154
+ gtk_widget_get_size_request */
155
+ static VALUE
156
+ widget_size_request(self)
157
+ VALUE self;
158
+ {
159
+ GtkRequisition req;
160
+ gtk_widget_size_request(_SELF(self), &req);
161
+ return rb_ary_new3(2, INT2NUM(req.width), INT2NUM(req.height));
162
+ }
163
+
164
+ static VALUE
165
+ widget_get_child_requisition(self)
166
+ VALUE self;
167
+ {
168
+ GtkRequisition req;
169
+
170
+ gtk_widget_get_child_requisition(_SELF(self), &req);
171
+ return rb_ary_new3(2, INT2NUM(req.width), INT2NUM(req.height));
172
+ }
173
+
174
+ static VALUE
175
+ widget_size_allocate(self, alloc)
176
+ VALUE self, alloc;
177
+ {
178
+ gtk_widget_size_allocate(_SELF(self), (GtkAllocation*)RVAL2BOXED(alloc, GTK_TYPE_ALLOCATION));
179
+ return self;
180
+ }
181
+
182
+ static VALUE
183
+ widget_add_accelerator(self, sig, accel, key, mod, flag)
184
+ VALUE self, sig, accel, key, mod, flag;
185
+ {
186
+ gtk_widget_add_accelerator(_SELF(self),
187
+ RVAL2CSTR(sig),
188
+ GTK_ACCEL_GROUP(RVAL2GOBJ(accel)),
189
+ NUM2INT(key),
190
+ RVAL2GFLAGS(mod, GDK_TYPE_MODIFIER_TYPE),
191
+ RVAL2GFLAGS(flag, GTK_TYPE_ACCEL_FLAGS));
192
+ return self;
193
+ }
194
+
195
+ static VALUE
196
+ widget_remove_accelerator(self, accel, key, mod)
197
+ VALUE self, accel, key, mod;
198
+ {
199
+ return CBOOL2RVAL(gtk_widget_remove_accelerator(_SELF(self),
200
+ GTK_ACCEL_GROUP(RVAL2GOBJ(accel)),
201
+ NUM2INT(key),
202
+ RVAL2GFLAGS(mod, GDK_TYPE_MODIFIER_TYPE)));
203
+ }
204
+
205
+ static VALUE
206
+ widget_set_accel_path(self, accel_path, accel_group)
207
+ VALUE self, accel_path, accel_group;
208
+ {
209
+ gtk_widget_set_accel_path(_SELF(self), RVAL2CSTR(accel_path),
210
+ GTK_ACCEL_GROUP(RVAL2GOBJ(accel_group)));
211
+ return self;
212
+ }
213
+
214
+ static VALUE
215
+ widget_list_accel_closures(self)
216
+ VALUE self;
217
+ {
218
+ return GLIST2ARY2F(gtk_widget_list_accel_closures(_SELF(self)), G_TYPE_CLOSURE);
219
+ }
220
+
221
+ #if GTK_CHECK_VERSION(2,4,0)
222
+ static VALUE
223
+ widget_can_activate_accel(self, signal_id)
224
+ VALUE self, signal_id;
225
+ {
226
+ return CBOOL2RVAL(gtk_widget_can_activate_accel(_SELF(self), NUM2UINT(signal_id)));
227
+ }
228
+ #endif
229
+
230
+ static VALUE
231
+ widget_event(self, event)
232
+ VALUE self, event;
233
+ {
234
+ return CBOOL2RVAL(gtk_widget_event(_SELF(self), RVAL2GEV(event)));
235
+ }
236
+
237
+ static VALUE
238
+ widget_activate(self)
239
+ VALUE self;
240
+ {
241
+ return CBOOL2RVAL(gtk_widget_activate(_SELF(self)));
242
+ }
243
+
244
+ static VALUE
245
+ widget_reparent(self, parent)
246
+ VALUE self, parent;
247
+ {
248
+ gtk_widget_reparent(_SELF(self), _SELF(parent));
249
+ return self;
250
+ }
251
+
252
+ static VALUE
253
+ widget_intersect(self, area)
254
+ VALUE self, area;
255
+ {
256
+ GdkRectangle intersection;
257
+ gboolean ret = gtk_widget_intersect(_SELF(self),
258
+ (GdkRectangle*)RVAL2BOXED(area, GDK_TYPE_RECTANGLE),
259
+ &intersection);
260
+ return ret ? BOXED2RVAL(&intersection, GDK_TYPE_RECTANGLE) : Qnil;
261
+ }
262
+
263
+ static VALUE
264
+ widget_is_focus(self)
265
+ VALUE self;
266
+ {
267
+ return CBOOL2RVAL(gtk_widget_is_focus(_SELF(self)));
268
+ }
269
+
270
+ static VALUE
271
+ widget_grab_focus(self)
272
+ VALUE self;
273
+ {
274
+ gtk_widget_grab_focus(_SELF(self));
275
+ return self;
276
+ }
277
+
278
+ static VALUE
279
+ widget_grab_default(self)
280
+ VALUE self;
281
+ {
282
+ gtk_widget_grab_default(_SELF(self));
283
+ return self;
284
+ }
285
+
286
+ static VALUE
287
+ widget_set_state(self, state)
288
+ VALUE self, state;
289
+ {
290
+ gtk_widget_set_state(_SELF(self), RVAL2GTKSTATETYPE(state));
291
+ return self;
292
+ }
293
+
294
+ static VALUE
295
+ widget_set_parent_window(self, parent_window)
296
+ VALUE self, parent_window;
297
+ {
298
+ gtk_widget_set_parent_window(_SELF(self),
299
+ GDK_WINDOW(RVAL2GOBJ(parent_window)));
300
+ return self;
301
+ }
302
+
303
+ static VALUE
304
+ widget_get_parent_window(self)
305
+ VALUE self;
306
+ {
307
+ return GOBJ2RVAL(gtk_widget_get_parent_window(_SELF(self)));
308
+ }
309
+
310
+ static VALUE
311
+ widget_add_events(self, events)
312
+ VALUE self, events;
313
+ {
314
+ gtk_widget_add_events(_SELF(self), NUM2INT(events));
315
+ return self;
316
+ }
317
+
318
+ static VALUE
319
+ widget_get_toplevel(self)
320
+ VALUE self;
321
+ {
322
+ return GOBJ2RVAL(gtk_widget_get_toplevel(_SELF(self)));
323
+ }
324
+
325
+ static VALUE
326
+ widget_get_ancestor(self, klass)
327
+ VALUE self, klass;
328
+ {
329
+ return GOBJ2RVAL(gtk_widget_get_ancestor(_SELF(self), CLASS2GTYPE(klass)));
330
+ }
331
+
332
+ static VALUE
333
+ widget_get_colormap(self)
334
+ VALUE self;
335
+ {
336
+ return GOBJ2RVAL(gtk_widget_get_colormap(_SELF(self)));
337
+ }
338
+
339
+ static VALUE
340
+ widget_set_colormap(self, colormap)
341
+ VALUE self, colormap;
342
+ {
343
+ gtk_widget_set_colormap(_SELF(self), GDK_COLORMAP(RVAL2GOBJ(colormap)));
344
+ return self;
345
+ }
346
+
347
+ static VALUE
348
+ widget_get_visual(self)
349
+ VALUE self;
350
+ {
351
+ return GOBJ2RVAL(gtk_widget_get_visual(_SELF(self)));
352
+ }
353
+
354
+ static VALUE
355
+ widget_get_pointer(self)
356
+ VALUE self;
357
+ {
358
+ int x, y;
359
+
360
+ gtk_widget_get_pointer(_SELF(self), &x, &y);
361
+ return rb_assoc_new(INT2FIX(x), INT2FIX(y));
362
+ }
363
+
364
+ static VALUE
365
+ widget_is_ancestor(self, ancestor)
366
+ VALUE self, ancestor;
367
+ {
368
+ return CBOOL2RVAL(gtk_widget_is_ancestor(_SELF(self), _SELF(ancestor)));
369
+ }
370
+
371
+ static VALUE
372
+ widget_translate_coordinates(self, dest_widget, src_x, src_y)
373
+ VALUE self, dest_widget, src_x, src_y;
374
+ {
375
+ gint dest_x, dest_y;
376
+ gboolean ret;
377
+ VALUE result = Qnil;
378
+ ret = gtk_widget_translate_coordinates(_SELF(self), _SELF(dest_widget),
379
+ NUM2INT(src_x), NUM2INT(src_y),
380
+ &dest_x, &dest_y);
381
+ if (ret)
382
+ result = rb_ary_new3(2, INT2FIX(dest_x), INT2FIX(dest_y));
383
+
384
+ return result;
385
+ }
386
+
387
+ static VALUE
388
+ widget_hide_on_delete(self)
389
+ VALUE self;
390
+ {
391
+ return CBOOL2RVAL(gtk_widget_hide_on_delete(_SELF(self)));
392
+ }
393
+
394
+ static VALUE
395
+ widget_ensure_style(self)
396
+ VALUE self;
397
+ {
398
+ gtk_widget_ensure_style(_SELF(self));
399
+ return self;
400
+ }
401
+
402
+ static VALUE
403
+ widget_reset_rc_styles(self)
404
+ VALUE self;
405
+ {
406
+ gtk_widget_reset_rc_styles(_SELF(self));
407
+ return self;
408
+ }
409
+
410
+ static VALUE
411
+ widget_s_push_colormap(self, cmap)
412
+ VALUE self, cmap;
413
+ {
414
+ gtk_widget_push_colormap(GDK_COLORMAP(RVAL2GOBJ(cmap)));
415
+ return cmap;
416
+ }
417
+
418
+ static VALUE
419
+ widget_s_pop_colormap(self)
420
+ VALUE self;
421
+ {
422
+ gtk_widget_pop_colormap();
423
+ return self;
424
+ }
425
+
426
+ static VALUE
427
+ widget_s_set_default_colormap(self, cmap)
428
+ VALUE self, cmap;
429
+ {
430
+ gtk_widget_set_default_colormap(GDK_COLORMAP(RVAL2GOBJ(cmap)));
431
+ return cmap;
432
+ }
433
+
434
+ static VALUE
435
+ widget_s_get_default_style(self)
436
+ VALUE self;
437
+ {
438
+ return GOBJ2RVAL(gtk_widget_get_default_style());
439
+ }
440
+
441
+ static VALUE
442
+ widget_s_get_default_colormap(self)
443
+ VALUE self;
444
+ {
445
+ return GOBJ2RVAL(gtk_widget_get_default_colormap());
446
+ }
447
+
448
+ static VALUE
449
+ widget_s_get_default_visual(self)
450
+ VALUE self;
451
+ {
452
+ return GOBJ2RVAL(gtk_widget_get_default_visual());
453
+ }
454
+
455
+ static VALUE
456
+ widget_set_direction(self, dir)
457
+ VALUE self, dir;
458
+ {
459
+ gtk_widget_set_direction(_SELF(self), RVAL2GENUM(dir, GTK_TYPE_TEXT_DIRECTION));
460
+ return self;
461
+ }
462
+
463
+ static VALUE
464
+ widget_get_direction(self)
465
+ VALUE self;
466
+ {
467
+ return GENUM2RVAL(gtk_widget_get_direction(_SELF(self)), GTK_TYPE_TEXT_DIRECTION);
468
+ }
469
+
470
+ static VALUE
471
+ widget_s_set_default_direction(self, dir)
472
+ VALUE self;
473
+ {
474
+ gtk_widget_set_default_direction(RVAL2GENUM(dir, GTK_TYPE_TEXT_DIRECTION));
475
+ return self;
476
+ }
477
+
478
+ static VALUE
479
+ widget_s_get_default_direction(self)
480
+ VALUE self;
481
+ {
482
+ return GENUM2RVAL(gtk_widget_get_default_direction(), GTK_TYPE_TEXT_DIRECTION);
483
+ }
484
+
485
+ static VALUE
486
+ widget_shape_combine_mask(self, shape_mask, offset_x, offset_y)
487
+ VALUE self, shape_mask, offset_x, offset_y;
488
+ {
489
+ gtk_widget_shape_combine_mask(_SELF(self),
490
+ GDK_BITMAP(RVAL2GOBJ(shape_mask)),
491
+ NUM2INT(offset_x),
492
+ NUM2INT(offset_y));
493
+ return self;
494
+ }
495
+
496
+ #if GTK_CHECK_VERSION(2,10,0)
497
+ static VALUE
498
+ widget_input_shape_combine_mask(self, shape_mask, offset_x, offset_y)
499
+ VALUE self, shape_mask, offset_x, offset_y;
500
+ {
501
+ gtk_widget_input_shape_combine_mask(_SELF(self),
502
+ GDK_BITMAP(RVAL2GOBJ(shape_mask)),
503
+ NUM2INT(offset_x),
504
+ NUM2INT(offset_y));
505
+ return self;
506
+ }
507
+ #endif
508
+
509
+ static VALUE
510
+ widget_path(self)
511
+ VALUE self;
512
+ {
513
+ guint path_length;
514
+ gchar *path;
515
+ gchar *path_reversed;
516
+ VALUE str_path;
517
+ VALUE str_path_reversed;
518
+
519
+ gtk_widget_path(_SELF(self), &path_length, &path, &path_reversed);
520
+ str_path = CSTR2RVAL(path);
521
+ str_path_reversed = CSTR2RVAL(path_reversed);
522
+ g_free(path);
523
+ g_free(path_reversed);
524
+ return rb_ary_new3(2, str_path, str_path_reversed);
525
+ }
526
+
527
+ static VALUE
528
+ widget_class_path(self)
529
+ VALUE self;
530
+ {
531
+ guint path_length;
532
+ gchar *path;
533
+ gchar *path_reversed;
534
+ VALUE str_path;
535
+ VALUE str_path_reversed;
536
+
537
+ gtk_widget_class_path(_SELF(self), &path_length, &path, &path_reversed);
538
+ str_path = CSTR2RVAL(path);
539
+ str_path_reversed = CSTR2RVAL(path_reversed);
540
+ g_free(path);
541
+ g_free(path_reversed);
542
+ return rb_ary_new3(2, str_path, str_path_reversed);
543
+ }
544
+
545
+ static VALUE
546
+ widget_get_composite_name(self)
547
+ VALUE self;
548
+ {
549
+ return CSTR2RVAL(gtk_widget_get_composite_name(_SELF(self)));
550
+ }
551
+
552
+ static VALUE
553
+ widget_modify_style(self, style)
554
+ VALUE self, style;
555
+ {
556
+ gtk_widget_modify_style(_SELF(self),
557
+ GTK_RC_STYLE(RVAL2GOBJ(style)));
558
+ return self;
559
+ }
560
+
561
+ static VALUE
562
+ widget_get_modifier_style(self)
563
+ VALUE self;
564
+ {
565
+ return GOBJ2RVAL(gtk_widget_get_modifier_style(_SELF(self)));
566
+ }
567
+
568
+ static VALUE
569
+ widget_modify_fg(self, state, color)
570
+ VALUE self, state, color;
571
+ {
572
+ gtk_widget_modify_fg(_SELF(self), RVAL2GTKSTATETYPE(state),
573
+ RVAL2GDKCOLOR(color));
574
+ return self;
575
+ }
576
+
577
+ static VALUE
578
+ widget_modify_bg(self, state, color)
579
+ VALUE self, state, color;
580
+ {
581
+ gtk_widget_modify_bg(_SELF(self), RVAL2GTKSTATETYPE(state),
582
+ RVAL2GDKCOLOR(color));
583
+ return self;
584
+ }
585
+
586
+ static VALUE
587
+ widget_modify_text(self, state, color)
588
+ VALUE self, state, color;
589
+ {
590
+ gtk_widget_modify_text(_SELF(self), RVAL2GTKSTATETYPE(state),
591
+ RVAL2GDKCOLOR(color));
592
+ return self;
593
+ }
594
+
595
+ static VALUE
596
+ widget_modify_base(self, state, color)
597
+ VALUE self, state, color;
598
+ {
599
+ gtk_widget_modify_base(_SELF(self), RVAL2GTKSTATETYPE(state),
600
+ RVAL2GDKCOLOR(color));
601
+ return self;
602
+ }
603
+
604
+ static VALUE
605
+ widget_modify_font(self, font_desc)
606
+ VALUE self, font_desc;
607
+ {
608
+ gtk_widget_modify_font(_SELF(self),
609
+ (PangoFontDescription*)RVAL2BOXED(font_desc, PANGO_TYPE_FONT_DESCRIPTION));
610
+ return self;
611
+ }
612
+
613
+ #if GTK_CHECK_VERSION(2,12,0)
614
+ static VALUE
615
+ widget_modify_cursor(self, primary, seconday)
616
+ VALUE self, primary, seconday;
617
+ {
618
+ gtk_widget_modify_cursor(_SELF(self),
619
+ RVAL2BOXED(primary, GDK_TYPE_COLOR),
620
+ RVAL2BOXED(seconday, GDK_TYPE_COLOR));
621
+ return self;
622
+ }
623
+ #endif
624
+
625
+ static VALUE
626
+ widget_create_pango_context(self)
627
+ VALUE self;
628
+ {
629
+ return GOBJ2RVALU(gtk_widget_create_pango_context(_SELF(self)));
630
+ }
631
+
632
+ static VALUE
633
+ widget_get_pango_context(self)
634
+ VALUE self;
635
+ {
636
+ return GOBJ2RVAL(gtk_widget_get_pango_context(_SELF(self)));
637
+ }
638
+
639
+ static VALUE
640
+ widget_create_pango_layout(argc, argv, self)
641
+ int argc;
642
+ VALUE* argv;
643
+ VALUE self;
644
+ {
645
+ VALUE text;
646
+ rb_scan_args(argc, argv, "01", &text);
647
+ return GOBJ2RVALU(gtk_widget_create_pango_layout(_SELF(self), RVAL2CSTR2(text)));
648
+ }
649
+
650
+ static VALUE
651
+ widget_render_icon(argc, argv, self)
652
+ int argc;
653
+ VALUE* argv;
654
+ VALUE self;
655
+ {
656
+ VALUE stock_id, size, detail;
657
+ rb_scan_args(argc, argv, "21", &stock_id, &size, &detail);
658
+ return GOBJ2RVALU(gtk_widget_render_icon(_SELF(self), rb_id2name(SYM2ID(stock_id)),
659
+ RVAL2GENUM(size, GTK_TYPE_ICON_SIZE),
660
+ RVAL2CSTR2(detail)));
661
+ }
662
+
663
+ static VALUE
664
+ widget_s_pop_composite_child(self)
665
+ VALUE self;
666
+ {
667
+ gtk_widget_pop_composite_child();
668
+ return self;
669
+ }
670
+
671
+ static VALUE
672
+ widget_s_push_composite_child(self)
673
+ VALUE self;
674
+ {
675
+ gtk_widget_push_composite_child();
676
+ return self;
677
+ }
678
+
679
+ static VALUE
680
+ widget_queue_draw_area(self, x, y, width, height)
681
+ VALUE self, x, y, width, height;
682
+ {
683
+ gtk_widget_queue_draw_area(_SELF(self), NUM2INT(x), NUM2INT(y),
684
+ NUM2INT(width), NUM2INT(height));
685
+ return self;
686
+ }
687
+
688
+ static VALUE
689
+ widget_reset_shapes(self)
690
+ VALUE self;
691
+ {
692
+ gtk_widget_reset_shapes(_SELF(self));
693
+ return self;
694
+ }
695
+
696
+ static VALUE
697
+ widget_set_double_buffered(self, double_buffered)
698
+ VALUE self, double_buffered;
699
+ {
700
+ gtk_widget_set_double_buffered(_SELF(self), RVAL2CBOOL(double_buffered));
701
+ return self;
702
+ }
703
+
704
+ static VALUE
705
+ widget_set_redraw_on_allocate(self, redraw_on_allocate)
706
+ VALUE self, redraw_on_allocate;
707
+ {
708
+ gtk_widget_set_redraw_on_allocate(_SELF(self), RVAL2CBOOL(redraw_on_allocate));
709
+ return self;
710
+ }
711
+
712
+ static VALUE
713
+ widget_set_composite_name(self, name)
714
+ VALUE self, name;
715
+ {
716
+ gtk_widget_set_composite_name(_SELF(self), RVAL2CSTR(name));
717
+ return self;
718
+ }
719
+
720
+ static VALUE
721
+ widget_set_scroll_adjustments(self, h, v)
722
+ VALUE self, h, v;
723
+ {
724
+ return CBOOL2RVAL(gtk_widget_set_scroll_adjustments(_SELF(self),
725
+ GTK_ADJUSTMENT(_SELF(h)),
726
+ GTK_ADJUSTMENT(_SELF(v))));
727
+ }
728
+
729
+ static VALUE
730
+ widget_mnemonic_activate(self, group_cycling)
731
+ VALUE self, group_cycling;
732
+ {
733
+ return CBOOL2RVAL(gtk_widget_mnemonic_activate(_SELF(self), RVAL2CBOOL(group_cycling)));
734
+ }
735
+
736
+ /*
737
+ * Gtk::Widget.install_style_property(...) do |spec, str|
738
+ * #parse str
739
+ * new_val = .... # parse value from string.
740
+ * new_val # return new_val or nil if you can't convert the value.
741
+ * end
742
+ */
743
+ static gboolean
744
+ rc_property_parser(pspec, rc_string, property_value)
745
+ const GParamSpec *pspec;
746
+ const GString *rc_string;
747
+ GValue *property_value;
748
+ {
749
+ VALUE spec = GOBJ2RVAL((gpointer)pspec);
750
+ VALUE func = rb_hash_aref(style_prop_func_table, spec);
751
+ VALUE ret = rb_funcall(func, id_call, 2, spec, CSTR2RVAL(rc_string->str));
752
+ if (NIL_P(ret)) {
753
+ return FALSE;
754
+ } else if (RVAL2CBOOL(ret)){
755
+ rbgobj_rvalue_to_gvalue(ret, property_value);
756
+ return TRUE;
757
+ } else {
758
+ rb_raise(rb_eArgError, "Gtk::Widget#install_style_property() block should return new value or nil");
759
+ }
760
+ }
761
+
762
+ static VALUE
763
+ widget_s_install_style_property(self, spec)
764
+ VALUE self, spec;
765
+ {
766
+ const RGObjClassInfo* cinfo = rbgobj_lookup_class(self);
767
+ GtkWidgetClass* gclass;
768
+ GParamSpec* pspec = G_PARAM_SPEC(RVAL2GOBJ(spec));
769
+
770
+ if (cinfo->klass != self)
771
+ rb_raise(rb_eTypeError, "%s isn't registered class",
772
+ rb_class2name(self));
773
+
774
+ gclass = (GtkWidgetClass *)g_type_class_ref(cinfo->gtype);
775
+ if (rb_block_given_p()){
776
+ VALUE func = rb_block_proc();
777
+ rb_hash_aset(style_prop_func_table, spec, func);
778
+ gtk_widget_class_install_style_property_parser(gclass, pspec,
779
+ (GtkRcPropertyParser)rc_property_parser);
780
+ } else {
781
+ gtk_widget_class_install_style_property(gclass, pspec);
782
+ }
783
+ return self;
784
+ }
785
+
786
+ #if GTK_CHECK_VERSION(2,2,0)
787
+ static VALUE
788
+ widget_s_find_style_property(self, property_name)
789
+ VALUE self, property_name;
790
+ {
791
+ GtkWidgetClass* oclass;
792
+ const char* name;
793
+ GParamSpec* prop;
794
+ VALUE result;
795
+
796
+ if (SYMBOL_P(property_name)) {
797
+ name = rb_id2name(SYM2ID(property_name));
798
+ } else {
799
+ StringValue(property_name);
800
+ name = StringValuePtr(property_name);
801
+ }
802
+
803
+ oclass = (GtkWidgetClass*)g_type_class_ref(CLASS2GTYPE(self));
804
+
805
+ prop = gtk_widget_class_find_style_property(oclass, name);
806
+ if (!prop){
807
+ g_type_class_unref(oclass);
808
+ rb_raise(rb_eval_string("GLib::NoPropertyError"), "no such property: %s", name);
809
+ }
810
+
811
+ result = GOBJ2RVAL(prop);
812
+ g_type_class_unref(oclass);
813
+ return result;
814
+ }
815
+
816
+ static VALUE
817
+ widget_s_style_properties(argc, argv, self)
818
+ int argc;
819
+ VALUE* argv;
820
+ VALUE self;
821
+ {
822
+ GtkWidgetClass* oclass = g_type_class_ref(CLASS2GTYPE(self));
823
+ guint n_properties;
824
+ GParamSpec** props;
825
+ VALUE inherited_too;
826
+ VALUE ary;
827
+ int i;
828
+
829
+ if (rb_scan_args(argc, argv, "01", &inherited_too) == 0)
830
+ inherited_too = Qtrue;
831
+
832
+ props = gtk_widget_class_list_style_properties(oclass, &n_properties);
833
+
834
+ ary = rb_ary_new();
835
+ for (i = 0; i < n_properties; i++){
836
+ if (RVAL2CBOOL(inherited_too)
837
+ || GTYPE2CLASS(props[i]->owner_type) == self)
838
+ rb_ary_push(ary, CSTR2RVAL(props[i]->name));
839
+ }
840
+
841
+ g_free(props);
842
+ g_type_class_unref(oclass);
843
+ return ary;
844
+ }
845
+ #endif
846
+
847
+ static VALUE
848
+ widget_region_intersect(self, region)
849
+ VALUE self, region;
850
+ {
851
+ return BOXED2RVAL(gtk_widget_region_intersect(_SELF(self),
852
+ (GdkRegion*)RVAL2BOXED(region, GDK_TYPE_REGION)),
853
+ GDK_TYPE_REGION);
854
+ }
855
+
856
+ static VALUE
857
+ widget_send_expose(self, event)
858
+ VALUE self, event;
859
+ {
860
+ return INT2NUM(gtk_widget_send_expose(_SELF(self), RVAL2GEV(event)));
861
+ }
862
+
863
+ /* They are needless method for ruby.
864
+ void gtk_widget_style_get (GtkWidget *widget,
865
+ const gchar *first_property_name,
866
+ ...);
867
+ void gtk_widget_style_get_valist (GtkWidget *widget,
868
+ const gchar *first_property_name,
869
+ va_list var_args);
870
+ */
871
+
872
+ static VALUE
873
+ widget_style_get_property(self, prop_name)
874
+ VALUE self, prop_name;
875
+ {
876
+ GParamSpec* pspec = NULL;
877
+ const char* name;
878
+
879
+ if (SYMBOL_P(prop_name)) {
880
+ name = rb_id2name(SYM2ID(prop_name));
881
+ } else {
882
+ StringValue(prop_name);
883
+ name = StringValuePtr(prop_name);
884
+ }
885
+ #if GTK_CHECK_VERSION(2,2,0)
886
+ pspec = gtk_widget_class_find_style_property((GtkWidgetClass*)g_type_class_ref(RVAL2GTYPE(self)), name);
887
+ #endif
888
+ if (!pspec)
889
+ rb_raise(rb_eval_string("GLib::NoPropertyError"), "No such property: %s", name);
890
+ else {
891
+ // FIXME: use rb_ensure to call g_value_unset()
892
+ GValue gval = {0,};
893
+ VALUE ret;
894
+ g_value_init(&gval, G_PARAM_SPEC_VALUE_TYPE(pspec));
895
+ gtk_widget_style_get_property(GTK_WIDGET(RVAL2GOBJ(self)), name, &gval);
896
+ ret = GVAL2RVAL(&gval);
897
+ g_value_unset(&gval);
898
+ return ret;
899
+ }
900
+ }
901
+
902
+ static VALUE
903
+ widget_get_accessible(self)
904
+ VALUE self;
905
+ {
906
+ return GOBJ2RVAL(_SELF(self));
907
+ }
908
+
909
+ static VALUE
910
+ widget_child_focus(self, direction)
911
+ VALUE self, direction;
912
+ {
913
+ return CBOOL2RVAL(gtk_widget_child_focus(_SELF(self), RVAL2GENUM(direction, GTK_TYPE_DIRECTION_TYPE)));
914
+ }
915
+
916
+ #if GTK_CHECK_VERSION(2,12,0)
917
+ static VALUE
918
+ widget_error_bell(self)
919
+ VALUE self;
920
+ {
921
+ gtk_widget_error_bell(_SELF(self));
922
+ return self;
923
+ }
924
+
925
+ static VALUE
926
+ widget_keynav_failed(self, direction)
927
+ VALUE self, direction;
928
+ {
929
+ return CBOOL2RVAL(gtk_widget_keynav_failed(_SELF(self), RVAL2GENUM(direction, GTK_TYPE_DIRECTION_TYPE)));
930
+ }
931
+ #endif
932
+
933
+ static VALUE
934
+ widget_child_notify(self, child_property)
935
+ VALUE self, child_property;
936
+ {
937
+ gtk_widget_child_notify(_SELF(self), RVAL2CSTR(child_property));
938
+ return self;
939
+ }
940
+
941
+ static VALUE
942
+ widget_freeze_child_notify(self)
943
+ VALUE self;
944
+ {
945
+ gtk_widget_freeze_child_notify(_SELF(self));
946
+ return self;
947
+ }
948
+
949
+ static VALUE
950
+ widget_get_child_visible(self)
951
+ VALUE self;
952
+ {
953
+ return CBOOL2RVAL(gtk_widget_get_child_visible(_SELF(self)));
954
+ }
955
+
956
+ static VALUE
957
+ widget_get_settings(self)
958
+ VALUE self;
959
+ {
960
+ return GOBJ2RVAL(gtk_widget_get_settings(_SELF(self)));
961
+ }
962
+
963
+ #if GTK_CHECK_VERSION(2,2,0)
964
+ static VALUE
965
+ widget_get_clipboard(self, selection)
966
+ VALUE self, selection;
967
+ {
968
+ return CLIPBOARD2RVAL(gtk_widget_get_clipboard(_SELF(self), RVAL2ATOM(selection)));
969
+ }
970
+
971
+ static VALUE
972
+ widget_get_display(self)
973
+ VALUE self;
974
+ {
975
+ return GOBJ2RVAL(gtk_widget_get_display(_SELF(self)));
976
+ }
977
+
978
+ static VALUE
979
+ widget_get_root_window(self)
980
+ VALUE self;
981
+ {
982
+ return GOBJ2RVAL(gtk_widget_get_root_window(_SELF(self)));
983
+ }
984
+
985
+ static VALUE
986
+ widget_get_screen(self)
987
+ VALUE self;
988
+ {
989
+ return GOBJ2RVAL(gtk_widget_get_screen(_SELF(self)));
990
+ }
991
+
992
+ static VALUE
993
+ widget_has_screen(self)
994
+ VALUE self;
995
+ {
996
+ return CBOOL2RVAL(gtk_widget_has_screen(_SELF(self)));
997
+ }
998
+ #endif
999
+
1000
+ /*
1001
+ Note this method is not gtk_widget_size_request()
1002
+ */
1003
+ static VALUE
1004
+ widget_get_size_request(self)
1005
+ VALUE self;
1006
+ {
1007
+ gint width, height;
1008
+ gtk_widget_get_size_request(_SELF(self), &width, &height);
1009
+ return rb_ary_new3(2, INT2NUM(width), INT2NUM(height));
1010
+ }
1011
+
1012
+ static VALUE
1013
+ widget_set_child_visible(self, is_visible)
1014
+ VALUE self, is_visible;
1015
+ {
1016
+ gtk_widget_set_child_visible(_SELF(self), RVAL2CBOOL(is_visible));
1017
+ return self;
1018
+ }
1019
+
1020
+ static VALUE
1021
+ widget_set_size_request(self, width, height)
1022
+ VALUE self, width, height;
1023
+ {
1024
+ gtk_widget_set_size_request(_SELF(self), NUM2INT(width), NUM2INT(height));
1025
+ return self;
1026
+ }
1027
+
1028
+ static VALUE
1029
+ widget_thaw_child_notify(self)
1030
+ VALUE self;
1031
+ {
1032
+ gtk_widget_thaw_child_notify(_SELF(self));
1033
+ return self;
1034
+ }
1035
+
1036
+ #if GTK_CHECK_VERSION(2,4,0)
1037
+ static VALUE
1038
+ widget_set_no_show_all(self, no_show_all)
1039
+ VALUE self, no_show_all;
1040
+ {
1041
+ gtk_widget_set_no_show_all(_SELF(self), RVAL2CBOOL(no_show_all));
1042
+ return self;
1043
+ }
1044
+
1045
+ static VALUE
1046
+ widget_get_no_show_all(self)
1047
+ VALUE self;
1048
+ {
1049
+ return CBOOL2RVAL(gtk_widget_get_no_show_all(_SELF(self)));
1050
+ }
1051
+
1052
+ static VALUE
1053
+ widget_list_mnemonic_labels(self)
1054
+ VALUE self;
1055
+ {
1056
+ return GLIST2ARYF(gtk_widget_list_mnemonic_labels(_SELF(self)));
1057
+ }
1058
+
1059
+ static VALUE
1060
+ widget_add_mnemonic_label(self, label)
1061
+ VALUE self, label;
1062
+ {
1063
+ gtk_widget_add_mnemonic_label(_SELF(self), GTK_WIDGET(RVAL2GOBJ(label)));
1064
+ return self;
1065
+ }
1066
+
1067
+ static VALUE
1068
+ widget_remove_mnemonic_label(self, label)
1069
+ VALUE self, label;
1070
+ {
1071
+ gtk_widget_remove_mnemonic_label(_SELF(self), GTK_WIDGET(RVAL2GOBJ(label)));
1072
+ return self;
1073
+ }
1074
+ #endif
1075
+
1076
+ #if GTK_CHECK_VERSION(2,12,0)
1077
+ static VALUE
1078
+ widget_set_tooltip_window(self, custom_window)
1079
+ VALUE self, custom_window;
1080
+ {
1081
+ gtk_widget_set_tooltip_window(_SELF(self), GTK_WINDOW(RVAL2GOBJ(custom_window)));
1082
+ return self;
1083
+ }
1084
+
1085
+ static VALUE
1086
+ widget_get_tooltip_window(self)
1087
+ VALUE self;
1088
+ {
1089
+ return GOBJ2RVAL(gtk_widget_get_tooltip_window(_SELF(self)));
1090
+ }
1091
+
1092
+ static VALUE
1093
+ widget_trigger_tooltip_query(self)
1094
+ VALUE self;
1095
+ {
1096
+ gtk_widget_trigger_tooltip_query(_SELF(self));
1097
+ return self;
1098
+ }
1099
+
1100
+ #endif
1101
+
1102
+ #if GTK_CHECK_VERSION(2,10,0)
1103
+ static VALUE
1104
+ widget_get_action(self)
1105
+ VALUE self;
1106
+ {
1107
+ return GOBJ2RVAL(gtk_widget_get_action(_SELF(self)));
1108
+ }
1109
+
1110
+ static VALUE
1111
+ widget_is_composited(self)
1112
+ VALUE self;
1113
+ {
1114
+ return CBOOL2RVAL(gtk_widget_is_composited(_SELF(self)));
1115
+ }
1116
+ #endif
1117
+
1118
+ static VALUE
1119
+ widget_window(self)
1120
+ VALUE self;
1121
+ {
1122
+ return GOBJ2RVAL(_SELF(self)->window);
1123
+ }
1124
+
1125
+ static VALUE
1126
+ widget_set_window(VALUE self, VALUE window)
1127
+ {
1128
+ _SELF(self)->window = RVAL2GOBJ(window);
1129
+ return self;
1130
+ }
1131
+
1132
+ #define DEFINE_IS_WIDGET(STATE) \
1133
+ static VALUE \
1134
+ widget_ ## STATE (self) \
1135
+ VALUE self; \
1136
+ { \
1137
+ return( GTK_WIDGET_ ## STATE (_SELF(self))? Qtrue: Qfalse ); \
1138
+ }
1139
+ DEFINE_IS_WIDGET(TOPLEVEL);
1140
+ DEFINE_IS_WIDGET(NO_WINDOW);
1141
+ DEFINE_IS_WIDGET(REALIZED);
1142
+ DEFINE_IS_WIDGET(MAPPED);
1143
+ /*DEFINE_IS_WIDGET(VISIBLE); VISIBLE is defined as property*/
1144
+ DEFINE_IS_WIDGET(DRAWABLE);
1145
+ DEFINE_IS_WIDGET(PARENT_SENSITIVE);
1146
+ DEFINE_IS_WIDGET(IS_SENSITIVE);
1147
+ DEFINE_IS_WIDGET(HAS_GRAB);
1148
+ DEFINE_IS_WIDGET(RC_STYLE);
1149
+ DEFINE_IS_WIDGET(DOUBLE_BUFFERED);
1150
+
1151
+ static VALUE
1152
+ widget_get_allocation(self)
1153
+ VALUE self;
1154
+ {
1155
+ return BOXED2RVAL(&(_SELF(self)->allocation), GTK_TYPE_ALLOCATION);
1156
+ }
1157
+
1158
+ static VALUE
1159
+ widget_set_allocation(self, x,y,w,h)
1160
+ VALUE self, x,y,w,h;
1161
+ {
1162
+ GtkAllocation *a = &(_SELF(self)->allocation);
1163
+ a->x = NUM2INT(x);
1164
+ a->y = NUM2INT(y);
1165
+ a->width = NUM2INT(w);
1166
+ a->height = NUM2INT(h);
1167
+ return self;
1168
+ }
1169
+
1170
+ static VALUE
1171
+ widget_get_requisition(self)
1172
+ VALUE self;
1173
+ {
1174
+ GtkRequisition req = _SELF(self)->requisition;
1175
+ return rb_ary_new3(2, INT2NUM(req.width), INT2NUM(req.height));
1176
+ }
1177
+
1178
+ static VALUE
1179
+ widget_set_requisition(self, w, h)
1180
+ VALUE self, w, h;
1181
+ {
1182
+ GtkRequisition *r = &(_SELF(self)->requisition);
1183
+ r->width = NUM2INT(w);
1184
+ r->height = NUM2INT(h);
1185
+ return self;
1186
+ }
1187
+
1188
+ static VALUE
1189
+ widget_state(self)
1190
+ VALUE self;
1191
+ {
1192
+ return GENUM2RVAL(_SELF(self)->state, GTK_TYPE_STATE_TYPE);
1193
+ }
1194
+
1195
+ static VALUE
1196
+ widget_saved_state(self)
1197
+ VALUE self;
1198
+ {
1199
+ return GENUM2RVAL(_SELF(self)->saved_state, GTK_TYPE_STATE_TYPE);
1200
+ }
1201
+
1202
+ static VALUE
1203
+ widget_signal_size_request(num, values)
1204
+ guint num;
1205
+ const GValue* values;
1206
+ {
1207
+ GtkRequisition* req = (GtkRequisition*)g_value_get_boxed(&values[1]);
1208
+ return rb_ary_new3(2, GVAL2RVAL(&values[0]),
1209
+ rb_ary_new3(2, INT2NUM(req->width), INT2NUM(req->height)));
1210
+ }
1211
+ static VALUE
1212
+ widget_signal_size_allocate(num, values)
1213
+ guint num;
1214
+ const GValue* values;
1215
+ {
1216
+ GtkAllocation* alloc = (GtkAllocation*)g_value_get_boxed(&values[1]);
1217
+ return rb_ary_new3(2, GVAL2RVAL(&values[0]), BOXED2RVAL(alloc, GTK_TYPE_ALLOCATION));
1218
+ }
1219
+
1220
+ void
1221
+ Init_gtk_widget()
1222
+ {
1223
+ VALUE gWidget = G_DEF_CLASS(GTK_TYPE_WIDGET, "Widget", mGtk);
1224
+
1225
+ rb_global_variable(&style_prop_func_table);
1226
+ style_prop_func_table = rb_hash_new();
1227
+
1228
+ /*
1229
+ * instance methods
1230
+ */
1231
+ rb_define_method(gWidget, "flags", widget_get_flags, 0);
1232
+ rb_define_method(gWidget, "set_flags", widget_set_flags, 1);
1233
+ rb_define_method(gWidget, "unset_flags", widget_unset_flags, 1);
1234
+ rb_define_method(gWidget, "unparent", widget_unparent, 0);
1235
+ rb_define_method(gWidget, "show", widget_show, 0);
1236
+ rb_define_method(gWidget, "show_now", widget_show_now, 0);
1237
+ rb_define_method(gWidget, "hide", widget_hide, 0);
1238
+ rb_define_method(gWidget, "show_all", widget_show_all, 0);
1239
+ rb_define_method(gWidget, "hide_all", widget_hide_all, 0);
1240
+ rb_define_method(gWidget, "map", widget_map, 0);
1241
+ rb_define_method(gWidget, "unmap", widget_unmap, 0);
1242
+ rb_define_method(gWidget, "realize", widget_realize, 0);
1243
+ rb_define_method(gWidget, "unrealize", widget_unrealize, 0);
1244
+ rb_define_method(gWidget, "queue_draw", widget_queue_draw, 0);
1245
+ rb_define_method(gWidget, "queue_resize", widget_queue_resize, 0);
1246
+ #if GTK_CHECK_VERSION(2,4,0)
1247
+ rb_define_method(gWidget, "queue_resize_no_redraw", widget_queue_resize_no_redraw, 0);
1248
+ #endif
1249
+ rb_define_method(gWidget, "size_request", widget_size_request, 0);
1250
+ rb_define_method(gWidget, "child_requisition", widget_get_child_requisition, 0);
1251
+ rb_define_method(gWidget, "size_allocate", widget_size_allocate, 1);
1252
+ rb_define_method(gWidget, "add_accelerator", widget_add_accelerator, 5);
1253
+ rb_define_method(gWidget, "remove_accelerator", widget_remove_accelerator, 3);
1254
+ rb_define_method(gWidget, "set_accel_path", widget_set_accel_path, 2);
1255
+ rb_define_method(gWidget, "accel_closures", widget_list_accel_closures, 0);
1256
+ #if GTK_CHECK_VERSION(2,4,0)
1257
+ rb_define_method(gWidget, "can_activate_accel?", widget_can_activate_accel, 1);
1258
+ #endif
1259
+ rb_define_method(gWidget, "event", widget_event, 1);
1260
+ rb_define_method(gWidget, "activate", widget_activate, 0);
1261
+ rb_define_method(gWidget, "reparent", widget_reparent, 1);
1262
+ rb_define_singleton_method(gWidget, "install_style_property", widget_s_install_style_property, 1);
1263
+ #if GTK_CHECK_VERSION(2,2,0)
1264
+ rb_define_singleton_method(gWidget, "style_property", widget_s_find_style_property, 1);
1265
+ rb_define_singleton_method(gWidget, "style_properties", widget_s_style_properties, -1);
1266
+ #endif
1267
+ rb_define_method(gWidget, "intersect", widget_intersect, 1);
1268
+ rb_define_method(gWidget, "focus?", widget_is_focus, 0);
1269
+ rb_define_method(gWidget, "grab_focus", widget_grab_focus, 0);
1270
+ rb_define_method(gWidget, "grab_default", widget_grab_default, 0);
1271
+ rb_define_method(gWidget, "set_state", widget_set_state, 1);
1272
+ rb_define_method(gWidget, "set_parent_window", widget_set_parent_window, 1);
1273
+ rb_define_method(gWidget, "parent_window", widget_get_parent_window, 0);
1274
+ rb_define_method(gWidget, "add_events", widget_add_events, 1);
1275
+ rb_define_method(gWidget, "toplevel", widget_get_toplevel, 0);
1276
+ rb_define_method(gWidget, "get_ancestor", widget_get_ancestor, 1);
1277
+ rb_define_method(gWidget, "colormap", widget_get_colormap, 0);
1278
+ rb_define_method(gWidget, "set_colormap", widget_set_colormap, 1);
1279
+ rb_define_method(gWidget, "visual", widget_get_visual, 0);
1280
+ rb_define_method(gWidget, "pointer", widget_get_pointer, 0);
1281
+ rb_define_method(gWidget, "ancestor?", widget_is_ancestor, 1);
1282
+ rb_define_method(gWidget, "translate_coordinates", widget_translate_coordinates, 3);
1283
+ rb_define_method(gWidget, "hide_on_delete", widget_hide_on_delete, 0);
1284
+ rb_define_method(gWidget, "ensure_style", widget_ensure_style, 0);
1285
+ rb_define_method(gWidget, "reset_rc_styles", widget_reset_rc_styles, 0);
1286
+ rb_define_method(gWidget, "set_direction", widget_set_direction, 1);
1287
+ rb_define_method(gWidget, "direction", widget_get_direction, 0);
1288
+ rb_define_method(gWidget, "shape_combine_mask", widget_shape_combine_mask, 3);
1289
+ #if GTK_CHECK_VERSION(2,10,0)
1290
+ rb_define_method(gWidget, "input_shape_combine_mask", widget_input_shape_combine_mask, 3);
1291
+ #endif
1292
+ rb_define_method(gWidget, "path", widget_path, 0);
1293
+ rb_define_method(gWidget, "class_path", widget_class_path, 0);
1294
+ rb_define_method(gWidget, "composite_name", widget_get_composite_name, 0);
1295
+ rb_define_method(gWidget, "modify_style", widget_modify_style, 1);
1296
+ rb_define_method(gWidget, "modifier_style", widget_get_modifier_style, 0);
1297
+ rb_define_method(gWidget, "modify_fg", widget_modify_fg, 2);
1298
+ rb_define_method(gWidget, "modify_bg", widget_modify_bg, 2);
1299
+ rb_define_method(gWidget, "modify_text", widget_modify_text, 2);
1300
+ rb_define_method(gWidget, "modify_base", widget_modify_base, 2);
1301
+ rb_define_method(gWidget, "modify_font", widget_modify_font, 1);
1302
+ #if GTK_CHECK_VERSION(2,12,0)
1303
+ rb_define_method(gWidget, "modify_cursor", widget_modify_cursor, 2);
1304
+ #endif
1305
+ rb_define_method(gWidget, "create_pango_context", widget_create_pango_context, 0);
1306
+ rb_define_method(gWidget, "pango_context", widget_get_pango_context, 0);
1307
+ rb_define_method(gWidget, "create_pango_layout", widget_create_pango_layout, -1);
1308
+ rb_define_method(gWidget, "render_icon", widget_render_icon, -1);
1309
+ rb_define_method(gWidget, "queue_draw_area", widget_queue_draw_area, 4);
1310
+ rb_define_method(gWidget, "reset_shapes", widget_reset_shapes, 0);
1311
+ rb_define_method(gWidget, "set_double_buffered", widget_set_double_buffered, 1);
1312
+ rb_define_method(gWidget, "set_redraw_on_allocate", widget_set_redraw_on_allocate, 1);
1313
+ rb_define_method(gWidget, "set_composite_name", widget_set_composite_name, 1);
1314
+ rb_define_method(gWidget, "set_scroll_adjustments", widget_set_scroll_adjustments, 2);
1315
+ /* for backward compatibility. */
1316
+ rb_define_alias(gWidget, "set_scroll_adjustment", "set_scroll_adjustments");
1317
+ rb_define_method(gWidget, "mnemonic_activate", widget_mnemonic_activate, 1);
1318
+ rb_define_method(gWidget, "region_intersect", widget_region_intersect, 1);
1319
+ rb_define_method(gWidget, "send_expose", widget_send_expose, 1);
1320
+ rb_define_method(gWidget, "style_get_property", widget_style_get_property, 1);
1321
+ rb_define_method(gWidget, "accessible", widget_get_accessible, 0);
1322
+ rb_define_method(gWidget, "child_focus", widget_child_focus, 1);
1323
+ #if GTK_CHECK_VERSION(2,12,0)
1324
+ rb_define_method(gWidget, "error_bell", widget_error_bell, 0);
1325
+ rb_define_method(gWidget, "keynav_failed", widget_keynav_failed, 0);
1326
+ #endif
1327
+ rb_define_method(gWidget, "child_notify", widget_child_notify, 1);
1328
+ rb_define_method(gWidget, "freeze_child_notify", widget_freeze_child_notify, 0);
1329
+ rb_define_method(gWidget, "child_visible?", widget_get_child_visible, 0);
1330
+ rb_define_method(gWidget, "settings", widget_get_settings, 0);
1331
+ #if GTK_CHECK_VERSION(2,2,0)
1332
+ rb_define_method(gWidget, "get_clipboard", widget_get_clipboard, 1);
1333
+ rb_define_method(gWidget, "display", widget_get_display, 0);
1334
+ rb_define_method(gWidget, "root_window", widget_get_root_window, 0);
1335
+ rb_define_method(gWidget, "screen", widget_get_screen, 0);
1336
+ rb_define_method(gWidget, "has_screen?", widget_has_screen, 0);
1337
+ #endif
1338
+ rb_define_method(gWidget, "set_child_visible", widget_set_child_visible, 1);
1339
+ rb_define_method(gWidget, "get_size_request", widget_get_size_request, 0);
1340
+ rb_define_method(gWidget, "set_size_request", widget_set_size_request, 2);
1341
+ rb_define_method(gWidget, "thaw_child_notify", widget_thaw_child_notify, 0);
1342
+ #if GTK_CHECK_VERSION(2,4,0)
1343
+ rb_define_method(gWidget, "set_no_show_all", widget_set_no_show_all, 1);
1344
+ rb_define_method(gWidget, "no_show_all?", widget_get_no_show_all, 0);
1345
+ rb_define_method(gWidget, "mnemonic_labels", widget_list_mnemonic_labels, 0);
1346
+ rb_define_method(gWidget, "add_mnemonic_label", widget_add_mnemonic_label, 1);
1347
+ rb_define_method(gWidget, "remove_mnemonic_label", widget_remove_mnemonic_label, 1);
1348
+ #endif
1349
+ #if GTK_CHECK_VERSION(2,12,0)
1350
+ rb_define_method(gWidget, "set_tooltip_window", widget_set_tooltip_window, 1);
1351
+ rb_define_method(gWidget, "tooltip_window", widget_get_tooltip_window, 0);
1352
+ rb_define_method(gWidget, "trigger_tooltip_query", widget_trigger_tooltip_query, 0);
1353
+ #endif
1354
+ #if GTK_CHECK_VERSION(2,10,0)
1355
+ rb_define_method(gWidget, "action", widget_get_action, 0);
1356
+ rb_define_method(gWidget, "composited?", widget_is_composited, 0);
1357
+ #endif
1358
+ rb_define_method(gWidget, "window", widget_window, 0);
1359
+ rb_define_method(gWidget, "set_window", widget_set_window, 1);
1360
+ rb_define_method(gWidget, "allocation", widget_get_allocation, 0);
1361
+ rb_define_method(gWidget, "set_allocation", widget_set_allocation, 4);
1362
+ rb_define_method(gWidget, "requisition", widget_get_requisition, 0);
1363
+ rb_define_method(gWidget, "set_requisition", widget_set_requisition, 2);
1364
+ rb_define_method(gWidget, "state", widget_state, 0);
1365
+ rb_define_method(gWidget, "saved_state", widget_saved_state, 0);
1366
+
1367
+ rb_define_method(gWidget, "toplevel?", widget_TOPLEVEL, 0);
1368
+ rb_define_method(gWidget, "no_window?", widget_NO_WINDOW, 0);
1369
+ rb_define_method(gWidget, "realized?", widget_REALIZED, 0);
1370
+ rb_define_method(gWidget, "mapped?", widget_MAPPED, 0);
1371
+ rb_define_method(gWidget, "drawable?", widget_DRAWABLE, 0);
1372
+ rb_define_method(gWidget, "parent_sensitive?", widget_PARENT_SENSITIVE, 0);
1373
+ /* This method's name avoid to sensitive? of a property variables. */
1374
+ rb_define_method(gWidget, "sensitive_with_parent?", widget_IS_SENSITIVE, 0);
1375
+ rb_define_method(gWidget, "has_grab?", widget_HAS_GRAB, 0);
1376
+ rb_define_method(gWidget, "rc_style?", widget_RC_STYLE, 0);
1377
+ rb_define_method(gWidget, "double_buffered?", widget_DOUBLE_BUFFERED, 0);
1378
+
1379
+ /*
1380
+ * singleton methods
1381
+ */
1382
+ rb_define_singleton_method(gWidget, "push_colormap", widget_s_push_colormap, 1);
1383
+ rb_define_singleton_method(gWidget, "pop_colormap", widget_s_pop_colormap, 0);
1384
+ rb_define_singleton_method(gWidget, "set_default_colormap", widget_s_set_default_colormap, 1);
1385
+ rb_define_singleton_method(gWidget, "default_style", widget_s_get_default_style, 0);
1386
+ rb_define_singleton_method(gWidget, "default_colormap", widget_s_get_default_colormap, 0);
1387
+ rb_define_singleton_method(gWidget, "default_visual", widget_s_get_default_visual, 0);
1388
+ rb_define_singleton_method(gWidget, "set_default_direction",widget_s_set_default_direction, 1);
1389
+ rb_define_singleton_method(gWidget, "default_direction",widget_s_get_default_direction, 0);
1390
+ rb_define_singleton_method(gWidget, "pop_composite_child",widget_s_pop_composite_child, 0);
1391
+ rb_define_singleton_method(gWidget, "push_composite_child",widget_s_push_composite_child, 0);
1392
+
1393
+ G_DEF_SETTERS(gWidget);
1394
+
1395
+ /*
1396
+ * constants
1397
+ */
1398
+ /* GtkWidgetFlags */
1399
+ G_DEF_CLASS(GTK_TYPE_WIDGET_FLAGS, "Flags", gWidget);
1400
+ G_DEF_CONSTANTS(gWidget, GTK_TYPE_WIDGET_FLAGS, "GTK_");
1401
+
1402
+ /* GtkWidgetHelpType */
1403
+ G_DEF_CLASS(GTK_TYPE_WIDGET_HELP_TYPE, "HelpType", gWidget);
1404
+ G_DEF_CONSTANTS(gWidget, GTK_TYPE_WIDGET_HELP_TYPE, "GTK_WIDGET_");
1405
+
1406
+ /* GtkTextDirection */
1407
+ G_DEF_CLASS(GTK_TYPE_TEXT_DIRECTION, "TextDirection", gWidget);
1408
+ G_DEF_CONSTANTS(gWidget, GTK_TYPE_TEXT_DIRECTION, "GTK_");
1409
+
1410
+ /* Special signals */
1411
+ G_DEF_SIGNAL_FUNC(gWidget, "size-request", (GValToRValSignalFunc)widget_signal_size_request);
1412
+ G_DEF_SIGNAL_FUNC(gWidget, "size-allocate", (GValToRValSignalFunc)widget_signal_size_allocate);
1413
+
1414
+ }