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,456 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgdkgc.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:31 $
8
+
9
+ Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
10
+ Copyright (C) 2002,2003 Masao Mutoh
11
+ Copyright (C) 2001 Neil Conway
12
+ ************************************************/
13
+
14
+ #include "global.h"
15
+
16
+ #define _SELF(s) (GDK_GC(RVAL2GOBJ(s)))
17
+
18
+ static VALUE gdkGC;
19
+ static VALUE gdkDrawable;
20
+
21
+ static VALUE
22
+ gdkgc_initialize(self, win)
23
+ VALUE self, win;
24
+ {
25
+ G_INITIALIZE(self, gdk_gc_new(GDK_DRAWABLE(RVAL2GOBJ(win))));
26
+ return Qnil;
27
+ }
28
+
29
+ /* we don't need them.
30
+ GdkGC* gdk_gc_new_with_values (GdkDrawable *drawable,
31
+ GdkGCValues *values,
32
+ GdkGCValuesMask values_mask);
33
+ void gdk_gc_set_values (GdkGC *gc,
34
+ GdkGCValues *values,
35
+ GdkGCValuesMask values_mask);
36
+ void gdk_gc_get_values (GdkGC *gc,
37
+ GdkGCValues *values);
38
+ */
39
+
40
+ static VALUE
41
+ gdkgc_set_foreground(self, color)
42
+ VALUE self, color;
43
+ {
44
+ gdk_gc_set_foreground(_SELF(self), RVAL2GDKCOLOR(color));
45
+ return self;
46
+ }
47
+
48
+ static VALUE
49
+ gdkgc_set_background(self, color)
50
+ VALUE self, color;
51
+ {
52
+ gdk_gc_set_background(_SELF(self), RVAL2GDKCOLOR(color));
53
+ return self;
54
+ }
55
+
56
+ static VALUE
57
+ gdkgc_set_rgb_fg_color(self, color)
58
+ VALUE self, color;
59
+ {
60
+ gdk_gc_set_rgb_fg_color(_SELF(self), RVAL2GDKCOLOR(color));
61
+ return self;
62
+ }
63
+
64
+ static VALUE
65
+ gdkgc_set_rgb_bg_color(self, color)
66
+ VALUE self, color;
67
+ {
68
+ gdk_gc_set_rgb_bg_color(_SELF(self), RVAL2GDKCOLOR(color));
69
+ return self;
70
+ }
71
+
72
+ static VALUE
73
+ gdkgc_set_function(self, func)
74
+ VALUE self, func;
75
+ {
76
+ GdkFunction f;
77
+ f = (GdkFunction)(RVAL2GENUM(func, GDK_TYPE_FUNCTION));
78
+ if (f > GDK_SET)
79
+ rb_raise(rb_eArgError, "function out of range");
80
+
81
+ gdk_gc_set_function(_SELF(self), f);
82
+ return self;
83
+ }
84
+
85
+ static VALUE
86
+ gdkgc_set_fill(self, fill)
87
+ VALUE self, fill;
88
+ {
89
+ gdk_gc_set_fill(_SELF(self), RVAL2GENUM(fill, GDK_TYPE_FILL));
90
+ return self;
91
+ }
92
+
93
+ static VALUE
94
+ gdkgc_set_tile(self, tile)
95
+ VALUE self, tile;
96
+ {
97
+ gdk_gc_set_tile(_SELF(self), GDK_PIXMAP(RVAL2GOBJ(tile)));
98
+ return self;
99
+ }
100
+
101
+ static VALUE
102
+ gdkgc_set_stipple(self, stipple)
103
+ VALUE self, stipple;
104
+ {
105
+ gdk_gc_set_stipple(_SELF(self), GDK_PIXMAP(RVAL2GOBJ(stipple)));
106
+ return self;
107
+ }
108
+
109
+ static VALUE
110
+ gdkgc_set_ts_origin(self, x, y)
111
+ VALUE self, x, y;
112
+ {
113
+ gdk_gc_set_ts_origin(_SELF(self), NUM2INT(x), NUM2INT(y));
114
+ return self;
115
+ }
116
+
117
+ static VALUE
118
+ gdkgc_set_clip_origin(self, x, y)
119
+ VALUE self, x, y;
120
+ {
121
+ gdk_gc_set_clip_origin(_SELF(self), NUM2INT(x), NUM2INT(y));
122
+ return self;
123
+ }
124
+
125
+ static VALUE
126
+ gdkgc_set_clip_mask(self, mask)
127
+ VALUE self, mask;
128
+ {
129
+ gdk_gc_set_clip_mask(_SELF(self), GDK_BITMAP(RVAL2GOBJ(mask)));
130
+ return self;
131
+ }
132
+
133
+ static VALUE
134
+ gdkgc_set_clip_rectangle(self, rectangle)
135
+ VALUE self, rectangle;
136
+ {
137
+ gdk_gc_set_clip_rectangle(_SELF(self),
138
+ (GdkRectangle*)RVAL2BOXED(rectangle, GDK_TYPE_RECTANGLE));
139
+ return self;
140
+ }
141
+
142
+ static VALUE
143
+ gdkgc_set_clip_region(self, region)
144
+ VALUE self, region;
145
+ {
146
+ gdk_gc_set_clip_region(_SELF(self),
147
+ (GdkRegion*)RVAL2BOXED(region, GDK_TYPE_REGION));
148
+ return self;
149
+ }
150
+
151
+ static VALUE
152
+ gdkgc_set_subwindow(self, mode)
153
+ VALUE self, mode;
154
+ {
155
+ gdk_gc_set_subwindow(_SELF(self), RVAL2GENUM(mode, GDK_TYPE_SUBWINDOW_MODE));
156
+ return self;
157
+ }
158
+
159
+ static VALUE
160
+ gdkgc_set_exposures(self, exposures)
161
+ VALUE self, exposures;
162
+ {
163
+ gdk_gc_set_exposures(_SELF(self), RVAL2CBOOL(exposures));
164
+ return self;
165
+ }
166
+
167
+ static VALUE
168
+ gdkgc_set_line_attributes(self, line_width, line_style, cap_style, join_style)
169
+ VALUE self, line_width, line_style, cap_style, join_style;
170
+ {
171
+ gdk_gc_set_line_attributes(_SELF(self), NUM2INT(line_width),
172
+ RVAL2GENUM(line_style, GDK_TYPE_LINE_STYLE),
173
+ RVAL2GENUM(cap_style, GDK_TYPE_CAP_STYLE),
174
+ RVAL2GENUM(join_style, GDK_TYPE_JOIN_STYLE));
175
+ return self;
176
+ }
177
+
178
+ static VALUE
179
+ gdkgc_set_dashes(self, dash_offset, dash_list)
180
+ VALUE self, dash_offset, dash_list;
181
+ {
182
+ gint8 *buf;
183
+ int i;
184
+
185
+ Check_Type(dash_list, T_ARRAY);
186
+
187
+ buf = ALLOCA_N(gint8, RARRAY_LEN(dash_list));
188
+ for (i = 0; i < RARRAY_LEN(dash_list); i++) {
189
+ Check_Type(RARRAY_PTR(dash_list)[i], T_FIXNUM);
190
+ buf[i] = (gint8)NUM2CHR(RARRAY_PTR(dash_list)[i]);
191
+ }
192
+ gdk_gc_set_dashes(_SELF(self), NUM2INT(dash_offset),
193
+ (gint8*)buf, RARRAY_LEN(dash_list));
194
+
195
+ return self;
196
+ }
197
+
198
+ static VALUE
199
+ gdkgc_copy(self, dst)
200
+ VALUE self, dst;
201
+ {
202
+ if (RVAL2CBOOL(rb_obj_is_kind_of(dst, gdkDrawable))) {
203
+ VALUE args[1];
204
+ args[0] = dst;
205
+ dst = rb_class_new_instance(1, args, gdkGC);
206
+ }
207
+ gdk_gc_copy(_SELF(dst), _SELF(self));
208
+ return dst;
209
+ }
210
+
211
+ static VALUE
212
+ gdkgc_set_colormap(self, colormap)
213
+ VALUE self, colormap;
214
+ {
215
+ gdk_gc_set_colormap(_SELF(self), GDK_COLORMAP(RVAL2GOBJ(self)));
216
+ return self;
217
+ }
218
+
219
+ static VALUE
220
+ gdkgc_get_foreground(self)
221
+ VALUE self;
222
+ {
223
+ GdkGCValues val;
224
+ gdk_gc_get_values(_SELF(self), &val);
225
+
226
+ return BOXED2RVAL(&val.foreground, GDK_TYPE_COLOR);
227
+ }
228
+
229
+ static VALUE
230
+ gdkgc_get_background(self)
231
+ VALUE self;
232
+ {
233
+ GdkGCValues val;
234
+ gdk_gc_get_values(_SELF(self), &val);
235
+
236
+ return BOXED2RVAL(&val.background, GDK_TYPE_COLOR);
237
+ }
238
+
239
+ static VALUE
240
+ gdkgc_get_function(self)
241
+ VALUE self;
242
+ {
243
+ GdkGCValues val;
244
+ gdk_gc_get_values(_SELF(self), &val);
245
+
246
+ return GENUM2RVAL(val.function, GDK_TYPE_FUNCTION);
247
+ }
248
+
249
+ static VALUE
250
+ gdkgc_get_fill(self)
251
+ VALUE self;
252
+ {
253
+ GdkGCValues val;
254
+ gdk_gc_get_values(_SELF(self), &val);
255
+
256
+ return GENUM2RVAL(val.fill, GDK_TYPE_FILL);
257
+ }
258
+
259
+ static VALUE
260
+ gdkgc_get_tile(self)
261
+ VALUE self;
262
+ {
263
+ GdkGCValues val;
264
+ gdk_gc_get_values(_SELF(self), &val);
265
+
266
+ return GOBJ2RVAL(val.tile);
267
+ }
268
+
269
+ static VALUE
270
+ gdkgc_get_stipple(self)
271
+ VALUE self;
272
+ {
273
+ GdkGCValues val;
274
+ gdk_gc_get_values(_SELF(self), &val);
275
+
276
+ return GOBJ2RVAL(val.stipple);
277
+ }
278
+
279
+ static VALUE
280
+ gdkgc_get_ts_origin(self)
281
+ VALUE self;
282
+ {
283
+ GdkGCValues val;
284
+ gdk_gc_get_values(_SELF(self), &val);
285
+
286
+ return rb_ary_new3(2, INT2NUM(val.ts_x_origin),
287
+ INT2NUM(val.ts_y_origin));
288
+ }
289
+
290
+ static VALUE
291
+ gdkgc_get_clip_origin(self)
292
+ VALUE self;
293
+ {
294
+ GdkGCValues val;
295
+ gdk_gc_get_values(_SELF(self), &val);
296
+
297
+ return rb_ary_new3(2, INT2NUM(val.clip_x_origin),
298
+ INT2NUM(val.clip_y_origin));
299
+ }
300
+
301
+ static VALUE
302
+ gdkgc_get_clip_mask(self)
303
+ VALUE self;
304
+ {
305
+ GdkGCValues val;
306
+ gdk_gc_get_values(_SELF(self), &val);
307
+
308
+ return GOBJ2RVAL(val.clip_mask);
309
+ }
310
+
311
+ static VALUE
312
+ gdkgc_get_subwindow(self)
313
+ VALUE self;
314
+ {
315
+ GdkGCValues val;
316
+ gdk_gc_get_values(_SELF(self), &val);
317
+
318
+ return GENUM2RVAL(val.subwindow_mode, GDK_TYPE_SUBWINDOW_MODE);
319
+ }
320
+
321
+ static VALUE
322
+ gdkgc_get_exposures(self)
323
+ VALUE self;
324
+ {
325
+ GdkGCValues val;
326
+ gdk_gc_get_values(_SELF(self), &val);
327
+
328
+ return CBOOL2RVAL(val.graphics_exposures);
329
+ }
330
+
331
+ static VALUE
332
+ gdkgc_get_line_attributes(self)
333
+ VALUE self;
334
+ {
335
+ GdkGCValues val;
336
+ gdk_gc_get_values(_SELF(self), &val);
337
+
338
+ return rb_ary_new3(4, INT2NUM(val.line_width),
339
+ GENUM2RVAL(val.line_style, GDK_TYPE_LINE_STYLE),
340
+ GENUM2RVAL(val.cap_style, GDK_TYPE_CAP_STYLE),
341
+ GENUM2RVAL(val.join_style, GDK_TYPE_JOIN_STYLE));
342
+ }
343
+
344
+ static VALUE
345
+ gdkgc_get_colormap(self)
346
+ VALUE self;
347
+ {
348
+ return GOBJ2RVAL(gdk_gc_get_colormap(_SELF(self)));
349
+ }
350
+
351
+ static VALUE
352
+ gdkgc_offset(self, x, y)
353
+ VALUE self, x, y;
354
+ {
355
+ gdk_gc_offset(_SELF(self), NUM2INT(x), NUM2INT(y));
356
+ return self;
357
+ }
358
+
359
+ #if GTK_CHECK_VERSION(2,2,0)
360
+ static VALUE
361
+ gdkgc_screen(self)
362
+ VALUE self;
363
+ {
364
+ return GOBJ2RVAL(gdk_gc_get_screen(_SELF(self)));
365
+ }
366
+ #endif
367
+
368
+ void
369
+ Init_gtk_gdk_gc()
370
+ {
371
+ gdkGC = G_DEF_CLASS(GDK_TYPE_GC, "GC", mGdk);
372
+ gdkDrawable = rb_const_get(mGdk, rb_intern("Drawable"));
373
+
374
+ rbgobj_add_abstract_but_create_instance_class(GDK_TYPE_GC);
375
+
376
+ rb_define_method(gdkGC, "initialize", gdkgc_initialize, 1);
377
+ rb_define_method(gdkGC, "set_foreground", gdkgc_set_foreground, 1);
378
+ rb_define_method(gdkGC, "set_background", gdkgc_set_background, 1);
379
+ rb_define_method(gdkGC, "set_rgb_fg_color", gdkgc_set_rgb_fg_color, 1);
380
+ rb_define_method(gdkGC, "set_rgb_bg_color", gdkgc_set_rgb_bg_color, 1);
381
+ rb_define_method(gdkGC, "set_function", gdkgc_set_function, 1);
382
+ rb_define_method(gdkGC, "set_fill", gdkgc_set_fill, 1);
383
+ rb_define_method(gdkGC, "set_tile", gdkgc_set_tile, 1);
384
+ rb_define_method(gdkGC, "set_stipple", gdkgc_set_stipple, 1);
385
+ rb_define_method(gdkGC, "set_ts_origin", gdkgc_set_ts_origin, 2);
386
+ rb_define_method(gdkGC, "set_clip_origin", gdkgc_set_clip_origin, 2);
387
+ rb_define_method(gdkGC, "set_clip_mask", gdkgc_set_clip_mask, 1);
388
+ rb_define_method(gdkGC, "set_clip_rectangle", gdkgc_set_clip_rectangle, 1);
389
+ rb_define_method(gdkGC, "set_clip_region", gdkgc_set_clip_region, 1);
390
+ rb_define_method(gdkGC, "set_subwindow_mode", gdkgc_set_subwindow, 1);
391
+ rb_define_method(gdkGC, "set_exposures", gdkgc_set_exposures, 1);
392
+ rb_define_method(gdkGC, "set_line_attributes", gdkgc_set_line_attributes, 4);
393
+ rb_define_method(gdkGC, "set_dashes", gdkgc_set_dashes, 2);
394
+ rb_define_method(gdkGC, "copy", gdkgc_copy, 1);
395
+ rb_define_method(gdkGC, "set_colormap", gdkgc_set_colormap, 1);
396
+
397
+ rb_define_method(gdkGC, "foreground", gdkgc_get_foreground, 0);
398
+ rb_define_method(gdkGC, "background", gdkgc_get_background, 0);
399
+ rb_define_method(gdkGC, "function", gdkgc_get_function, 0);
400
+ rb_define_method(gdkGC, "fill", gdkgc_get_fill, 0);
401
+ rb_define_method(gdkGC, "tile", gdkgc_get_tile, 0);
402
+ rb_define_method(gdkGC, "stipple", gdkgc_get_stipple, 0);
403
+ rb_define_method(gdkGC, "ts_origin", gdkgc_get_ts_origin, 0);
404
+ rb_define_method(gdkGC, "clip_origin", gdkgc_get_clip_origin, 0);
405
+ rb_define_method(gdkGC, "clip_mask", gdkgc_get_clip_mask, 0);
406
+ rb_define_method(gdkGC, "subwindow_mode", gdkgc_get_subwindow, 0);
407
+ rb_define_method(gdkGC, "exposures?", gdkgc_get_exposures, 0);
408
+ rb_define_method(gdkGC, "line_attributes", gdkgc_get_line_attributes, 0);
409
+
410
+ rb_define_method(gdkGC, "colormap", gdkgc_get_colormap, 0);
411
+ rb_define_method(gdkGC, "offset", gdkgc_offset, 2);
412
+
413
+ #if GTK_CHECK_VERSION(2,2,0)
414
+ rb_define_method(gdkGC, "screen", gdkgc_screen, 0);
415
+ #endif
416
+
417
+ G_DEF_SETTERS(gdkGC);
418
+
419
+ /* GdkGCValuesMask */
420
+ /* Don't need them.
421
+ G_DEF_CLASS(GDK_TYPE_GC_VALUES_MASK, "ValuesMask", gdkGC);
422
+ G_DEF_CONSTANTS(gdkGC, GDK_TYPE_GC_VALUES_MASK, "GDK_GC_");
423
+ */
424
+
425
+ /* GdkFunction */
426
+ G_DEF_CLASS(GDK_TYPE_FUNCTION, "Function", gdkGC);
427
+ G_DEF_CONSTANTS(gdkGC, GDK_TYPE_FUNCTION, "GDK_");
428
+
429
+ /* GdkFill */
430
+ G_DEF_CLASS(GDK_TYPE_FILL, "Fill", gdkGC);
431
+ G_DEF_CONSTANTS(gdkGC, GDK_TYPE_FILL, "GDK_");
432
+
433
+ /* GdkSubwindowMode */
434
+ G_DEF_CLASS(GDK_TYPE_SUBWINDOW_MODE, "SubWindowMode", gdkGC);
435
+ G_DEF_CONSTANTS(gdkGC, GDK_TYPE_SUBWINDOW_MODE, "GDK_");
436
+
437
+ /* GdkLineStyle */
438
+ G_DEF_CLASS(GDK_TYPE_LINE_STYLE, "LineStyle", gdkGC);
439
+ G_DEF_CONSTANTS(gdkGC, GDK_TYPE_LINE_STYLE, "GDK_");
440
+
441
+ /* GdkCapStyle */
442
+ G_DEF_CLASS(GDK_TYPE_CAP_STYLE, "CapStyle", gdkGC);
443
+ G_DEF_CONSTANTS(gdkGC, GDK_TYPE_CAP_STYLE, "GDK_");
444
+
445
+ /* GdkJoinStyle */
446
+ G_DEF_CLASS(GDK_TYPE_JOIN_STYLE, "JoinStyle", gdkGC);
447
+ G_DEF_CONSTANTS(gdkGC, GDK_TYPE_JOIN_STYLE, "GDK_");
448
+
449
+ #ifdef GDK_WINDOWING_X11
450
+ G_DEF_CLASS3("GdkGCX11", "GCX11", mGdk);
451
+ #elif defined(GDK_WINDOWING_WIN32)
452
+ G_DEF_CLASS3("GdkGCWin32", "GCWin32", mGdk);
453
+ #elif defined(GDK_WINDOWING_FB)
454
+ G_DEF_CLASS3("GdkGCFB", "GCFB", mGdk);
455
+ #endif
456
+ }