gtk2 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. data/Rakefile +66 -1
  2. data/ext/gtk2/extconf.rb +0 -96
  3. data/ext/gtk2/global.h +274 -13
  4. data/ext/gtk2/gtk2.def +5 -3
  5. data/ext/gtk2/init.c +263 -19
  6. data/ext/gtk2/rbgdk.c +245 -89
  7. data/ext/gtk2/rbgdk.h +32 -6
  8. data/ext/gtk2/rbgdkatom.c +38 -28
  9. data/ext/gtk2/rbgdkcairo.c +32 -42
  10. data/ext/gtk2/rbgdkcolor.c +52 -42
  11. data/ext/gtk2/rbgdkcolormap.c +42 -37
  12. data/ext/gtk2/rbgdkconst.c +23 -13
  13. data/ext/gtk2/rbgdkconversions.h +19 -6
  14. data/ext/gtk2/rbgdkcursor.c +37 -25
  15. data/ext/gtk2/rbgdkdevice.c +77 -67
  16. data/ext/gtk2/rbgdkdisplay.c +158 -150
  17. data/ext/gtk2/rbgdkdisplaymanager.c +27 -15
  18. data/ext/gtk2/rbgdkdragcontext.c +121 -70
  19. data/ext/gtk2/rbgdkdraw.c +252 -160
  20. data/ext/gtk2/rbgdkevent.c +30 -20
  21. data/ext/gtk2/rbgdkgc.c +123 -116
  22. data/ext/gtk2/rbgdkgeometry.c +77 -68
  23. data/ext/gtk2/rbgdkimage.c +58 -47
  24. data/ext/gtk2/rbgdkinput.c +33 -26
  25. data/ext/gtk2/rbgdkkeymap.c +38 -27
  26. data/ext/gtk2/rbgdkkeyval.c +44 -32
  27. data/ext/gtk2/rbgdkpango.c +66 -39
  28. data/ext/gtk2/rbgdkpangorenderer.c +63 -35
  29. data/ext/gtk2/rbgdkpixbuf.c +36 -25
  30. data/ext/gtk2/rbgdkpixmap.c +65 -49
  31. data/ext/gtk2/rbgdkproperty.c +66 -60
  32. data/ext/gtk2/rbgdkrectangle.c +54 -46
  33. data/ext/gtk2/rbgdkregion.c +144 -79
  34. data/ext/gtk2/rbgdkrgb.c +74 -58
  35. data/ext/gtk2/rbgdkscreen.c +103 -97
  36. data/ext/gtk2/rbgdkselection.c +49 -39
  37. data/ext/gtk2/rbgdkthreads.c +32 -19
  38. data/ext/gtk2/rbgdktimecoord.c +60 -38
  39. data/ext/gtk2/rbgdkvisual.c +79 -71
  40. data/ext/gtk2/rbgdkwindow.c +284 -305
  41. data/ext/gtk2/rbgdkwindowattr.c +69 -58
  42. data/ext/gtk2/rbgdkx11.c +41 -28
  43. data/ext/gtk2/rbgtk.c +498 -19
  44. data/ext/gtk2/rbgtk.h +35 -20
  45. data/ext/gtk2/rbgtkaboutdialog.c +33 -80
  46. data/ext/gtk2/rbgtkaccelerator.c +36 -23
  47. data/ext/gtk2/rbgtkaccelgroup.c +50 -40
  48. data/ext/gtk2/rbgtkaccelgroupentry.c +32 -20
  49. data/ext/gtk2/rbgtkaccelkey.c +40 -28
  50. data/ext/gtk2/rbgtkaccellabel.c +30 -18
  51. data/ext/gtk2/rbgtkaccelmap.c +55 -42
  52. data/ext/gtk2/rbgtkaccessible.c +25 -14
  53. data/ext/gtk2/rbgtkaction.c +68 -68
  54. data/ext/gtk2/rbgtkactiongroup.c +317 -195
  55. data/ext/gtk2/rbgtkadjustment.c +33 -46
  56. data/ext/gtk2/rbgtkalignment.c +36 -24
  57. data/ext/gtk2/rbgtkallocation.c +53 -42
  58. data/ext/gtk2/rbgtkarrow.c +34 -22
  59. data/ext/gtk2/rbgtkaspectframe.c +32 -20
  60. data/ext/gtk2/rbgtkassistant.c +81 -61
  61. data/ext/gtk2/rbgtkbbox.c +32 -20
  62. data/ext/gtk2/rbgtkbin.c +28 -16
  63. data/ext/gtk2/rbgtkbindingset.c +42 -35
  64. data/ext/gtk2/rbgtkborder.c +34 -23
  65. data/ext/gtk2/rbgtkbox.c +40 -29
  66. data/ext/gtk2/rbgtkbuildable.c +57 -45
  67. data/ext/gtk2/rbgtkbuilder.c +53 -38
  68. data/ext/gtk2/rbgtkbutton.c +41 -55
  69. data/ext/gtk2/rbgtkcalendar.c +51 -40
  70. data/ext/gtk2/rbgtkcelleditable.c +28 -17
  71. data/ext/gtk2/rbgtkcelllayout.c +41 -30
  72. data/ext/gtk2/rbgtkcellrenderer.c +43 -32
  73. data/ext/gtk2/rbgtkcellrendereraccel.c +26 -18
  74. data/ext/gtk2/rbgtkcellrenderercombo.c +25 -17
  75. data/ext/gtk2/rbgtkcellrendererpixbuf.c +24 -17
  76. data/ext/gtk2/rbgtkcellrendererprogress.c +25 -17
  77. data/ext/gtk2/rbgtkcellrendererspin.c +24 -16
  78. data/ext/gtk2/rbgtkcellrendererspinner.c +23 -11
  79. data/ext/gtk2/rbgtkcellrenderertext.c +28 -21
  80. data/ext/gtk2/rbgtkcellrenderertoggle.c +24 -16
  81. data/ext/gtk2/rbgtkcellview.c +34 -33
  82. data/ext/gtk2/rbgtkcheckbutton.c +28 -16
  83. data/ext/gtk2/rbgtkcheckmenuitem.c +31 -19
  84. data/ext/gtk2/rbgtkclipboard.c +123 -77
  85. data/ext/gtk2/rbgtkcolorbutton.c +26 -31
  86. data/ext/gtk2/rbgtkcolorsel.c +109 -55
  87. data/ext/gtk2/rbgtkcolorselectiondialog.c +28 -19
  88. data/ext/gtk2/rbgtkcombo.c +43 -32
  89. data/ext/gtk2/rbgtkcombobox.c +44 -83
  90. data/ext/gtk2/rbgtkcomboboxentry.c +26 -21
  91. data/ext/gtk2/rbgtkconst.c +23 -13
  92. data/ext/gtk2/rbgtkcontainer.c +153 -100
  93. data/ext/gtk2/rbgtkconversions.h +19 -6
  94. data/ext/gtk2/rbgtkcurve.c +46 -36
  95. data/ext/gtk2/rbgtkdialog.c +104 -70
  96. data/ext/gtk2/rbgtkdrag.c +173 -121
  97. data/ext/gtk2/rbgtkdrawingarea.c +28 -16
  98. data/ext/gtk2/rbgtkeditable.c +63 -51
  99. data/ext/gtk2/rbgtkentry.c +48 -85
  100. data/ext/gtk2/rbgtkentrycompletion.c +42 -55
  101. data/ext/gtk2/rbgtkeventbox.c +28 -16
  102. data/ext/gtk2/rbgtkexpander.c +26 -35
  103. data/ext/gtk2/rbgtkfilechooser.c +87 -143
  104. data/ext/gtk2/rbgtkfilechooserbutton.c +26 -32
  105. data/ext/gtk2/rbgtkfilechooserdialog.c +25 -15
  106. data/ext/gtk2/rbgtkfilechooserwidget.c +26 -15
  107. data/ext/gtk2/rbgtkfilefilter.c +45 -35
  108. data/ext/gtk2/rbgtkfilesel.c +54 -43
  109. data/ext/gtk2/rbgtkfilesystemerror.c +51 -0
  110. data/ext/gtk2/rbgtkfixed.c +36 -25
  111. data/ext/gtk2/rbgtkfontbutton.c +26 -37
  112. data/ext/gtk2/rbgtkfontselection.c +27 -15
  113. data/ext/gtk2/rbgtkfontselectiondialog.c +43 -32
  114. data/ext/gtk2/rbgtkframe.c +39 -28
  115. data/ext/gtk2/rbgtkgamma.c +32 -20
  116. data/ext/gtk2/rbgtkhandlebox.c +31 -19
  117. data/ext/gtk2/rbgtkhbbox.c +28 -16
  118. data/ext/gtk2/rbgtkhbox.c +29 -17
  119. data/ext/gtk2/rbgtkhpaned.c +28 -16
  120. data/ext/gtk2/rbgtkhruler.c +28 -16
  121. data/ext/gtk2/rbgtkhscale.c +28 -16
  122. data/ext/gtk2/rbgtkhscrollbar.c +28 -16
  123. data/ext/gtk2/rbgtkhseparator.c +28 -16
  124. data/ext/gtk2/rbgtkiconfactory.c +35 -23
  125. data/ext/gtk2/rbgtkiconinfo.c +42 -30
  126. data/ext/gtk2/rbgtkiconset.c +31 -19
  127. data/ext/gtk2/rbgtkiconsize.c +38 -25
  128. data/ext/gtk2/rbgtkiconsource.c +62 -50
  129. data/ext/gtk2/rbgtkicontheme.c +95 -95
  130. data/ext/gtk2/rbgtkiconview.c +87 -121
  131. data/ext/gtk2/rbgtkimage.c +31 -40
  132. data/ext/gtk2/rbgtkimagemenuitem.c +26 -14
  133. data/ext/gtk2/rbgtkimcontext.c +46 -34
  134. data/ext/gtk2/rbgtkimcontextsimple.c +47 -24
  135. data/ext/gtk2/rbgtkimmulticontext.c +26 -14
  136. data/ext/gtk2/rbgtkinputdialog.c +28 -16
  137. data/ext/gtk2/rbgtkinvisible.c +24 -18
  138. data/ext/gtk2/rbgtkitem.c +32 -20
  139. data/ext/gtk2/rbgtkitemfactory.c +65 -57
  140. data/ext/gtk2/rbgtklabel.c +46 -57
  141. data/ext/gtk2/rbgtklayout.c +40 -29
  142. data/ext/gtk2/rbgtklinkbutton.c +26 -15
  143. data/ext/gtk2/rbgtkliststore.c +145 -102
  144. data/ext/gtk2/rbgtkmacros.h +19 -6
  145. data/ext/gtk2/rbgtkmenu.c +47 -59
  146. data/ext/gtk2/rbgtkmenubar.c +30 -30
  147. data/ext/gtk2/rbgtkmenuitem.c +34 -41
  148. data/ext/gtk2/rbgtkmenushell.c +43 -42
  149. data/ext/gtk2/rbgtkmenutoolbutton.c +27 -16
  150. data/ext/gtk2/rbgtkmessagedialog.c +31 -25
  151. data/ext/gtk2/rbgtkmisc.c +33 -22
  152. data/ext/gtk2/rbgtknotebook.c +98 -134
  153. data/ext/gtk2/rbgtkobject.c +46 -81
  154. data/ext/gtk2/rbgtkoptionmenu.c +35 -23
  155. data/ext/gtk2/rbgtkpagesetup.c +64 -54
  156. data/ext/gtk2/rbgtkpagesetupunixdialog.c +34 -27
  157. data/ext/gtk2/rbgtkpaned.c +46 -36
  158. data/ext/gtk2/rbgtkpapersize.c +60 -54
  159. data/ext/gtk2/rbgtkplug.c +32 -20
  160. data/ext/gtk2/rbgtkprintcontext.c +43 -35
  161. data/ext/gtk2/rbgtkprinter.c +36 -37
  162. data/ext/gtk2/rbgtkprintjob.c +36 -37
  163. data/ext/gtk2/rbgtkprintoperation.c +44 -33
  164. data/ext/gtk2/rbgtkprintoperationpreview.c +30 -18
  165. data/ext/gtk2/rbgtkprintsettings.c +248 -192
  166. data/ext/gtk2/rbgtkprintunixdialog.c +33 -45
  167. data/ext/gtk2/rbgtkprogress.c +23 -13
  168. data/ext/gtk2/rbgtkprogressbar.c +47 -46
  169. data/ext/gtk2/rbgtkradioaction.c +84 -39
  170. data/ext/gtk2/rbgtkradiobutton.c +33 -21
  171. data/ext/gtk2/rbgtkradiomenuitem.c +86 -45
  172. data/ext/gtk2/rbgtkradiotoolbutton.c +99 -53
  173. data/ext/gtk2/rbgtkrange.c +36 -56
  174. data/ext/gtk2/rbgtkrc.c +61 -49
  175. data/ext/gtk2/rbgtkrcstyle.c +59 -48
  176. data/ext/gtk2/rbgtkrecentaction.c +28 -16
  177. data/ext/gtk2/rbgtkrecentchooser.c +58 -92
  178. data/ext/gtk2/rbgtkrecentchooserdialog.c +29 -18
  179. data/ext/gtk2/rbgtkrecentchoosermenu.c +25 -21
  180. data/ext/gtk2/rbgtkrecentchooserwidget.c +24 -13
  181. data/ext/gtk2/rbgtkrecentdata.c +47 -36
  182. data/ext/gtk2/rbgtkrecentfilter.c +55 -46
  183. data/ext/gtk2/rbgtkrecentfilterinfo.c +51 -40
  184. data/ext/gtk2/rbgtkrecentinfo.c +66 -56
  185. data/ext/gtk2/rbgtkrecentmanager.c +47 -43
  186. data/ext/gtk2/rbgtkruler.c +35 -30
  187. data/ext/gtk2/rbgtkscale.c +29 -18
  188. data/ext/gtk2/rbgtkscalebutton.c +27 -27
  189. data/ext/gtk2/rbgtkscrollbar.c +23 -13
  190. data/ext/gtk2/rbgtkscrolledwindow.c +44 -60
  191. data/ext/gtk2/rbgtkselection.c +87 -67
  192. data/ext/gtk2/rbgtkselectiondata.c +74 -65
  193. data/ext/gtk2/rbgtkseparator.c +23 -13
  194. data/ext/gtk2/rbgtkseparatormenuitem.c +25 -13
  195. data/ext/gtk2/rbgtkseparatortoolitem.c +26 -21
  196. data/ext/gtk2/rbgtksettings.c +123 -103
  197. data/ext/gtk2/rbgtksizegroup.c +33 -30
  198. data/ext/gtk2/rbgtksocket.c +32 -20
  199. data/ext/gtk2/rbgtkspinbutton.c +48 -38
  200. data/ext/gtk2/rbgtkspinner.c +27 -14
  201. data/ext/gtk2/rbgtkstatusbar.c +36 -31
  202. data/ext/gtk2/rbgtkstatusicon.c +31 -44
  203. data/ext/gtk2/rbgtkstock.c +137 -125
  204. data/ext/gtk2/rbgtkstyle.c +177 -161
  205. data/ext/gtk2/rbgtktable.c +58 -47
  206. data/ext/gtk2/rbgtktargetlist.c +56 -36
  207. data/ext/gtk2/rbgtktearoffmenuitem.c +28 -16
  208. data/ext/gtk2/rbgtktextappearance.c +44 -34
  209. data/ext/gtk2/rbgtktextattributes.c +54 -42
  210. data/ext/gtk2/rbgtktextbuffer.c +188 -191
  211. data/ext/gtk2/rbgtktextchild.c +29 -18
  212. data/ext/gtk2/rbgtktextiter.c +153 -145
  213. data/ext/gtk2/rbgtktextmark.c +33 -30
  214. data/ext/gtk2/rbgtktexttag.c +34 -22
  215. data/ext/gtk2/rbgtktexttagtable.c +36 -25
  216. data/ext/gtk2/rbgtktextview.c +85 -73
  217. data/ext/gtk2/rbgtktoggleaction.c +27 -22
  218. data/ext/gtk2/rbgtktogglebutton.c +37 -26
  219. data/ext/gtk2/rbgtktoggletoolbutton.c +26 -20
  220. data/ext/gtk2/rbgtktoolbar.c +66 -69
  221. data/ext/gtk2/rbgtktoolbutton.c +27 -40
  222. data/ext/gtk2/rbgtktoolitem.c +60 -62
  223. data/ext/gtk2/rbgtktooltip.c +36 -25
  224. data/ext/gtk2/rbgtktooltips.c +42 -34
  225. data/ext/gtk2/rbgtktreedragdest.c +20 -11
  226. data/ext/gtk2/rbgtktreedragsource.c +20 -11
  227. data/ext/gtk2/rbgtktreeiter.c +58 -47
  228. data/ext/gtk2/rbgtktreemodel.c +83 -65
  229. data/ext/gtk2/rbgtktreemodelfilter.c +47 -35
  230. data/ext/gtk2/rbgtktreemodelsort.c +38 -27
  231. data/ext/gtk2/rbgtktreepath.c +55 -44
  232. data/ext/gtk2/rbgtktreerowreference.c +60 -42
  233. data/ext/gtk2/rbgtktreeselection.c +61 -52
  234. data/ext/gtk2/rbgtktreesortable.c +52 -42
  235. data/ext/gtk2/rbgtktreestore.c +88 -67
  236. data/ext/gtk2/rbgtktreeview.c +157 -185
  237. data/ext/gtk2/rbgtktreeviewcolumn.c +57 -62
  238. data/ext/gtk2/rbgtkuimanager.c +61 -61
  239. data/ext/gtk2/rbgtkvbbox.c +28 -16
  240. data/ext/gtk2/rbgtkvbox.c +29 -17
  241. data/ext/gtk2/rbgtkviewport.c +28 -16
  242. data/ext/gtk2/rbgtkvolumebutton.c +28 -16
  243. data/ext/gtk2/rbgtkvpaned.c +28 -16
  244. data/ext/gtk2/rbgtkvruler.c +28 -16
  245. data/ext/gtk2/rbgtkvscale.c +28 -16
  246. data/ext/gtk2/rbgtkvscrollbar.c +28 -16
  247. data/ext/gtk2/rbgtkvseparator.c +28 -16
  248. data/ext/gtk2/rbgtkwidget.c +284 -296
  249. data/ext/gtk2/rbgtkwindow.c +156 -214
  250. data/ext/gtk2/rbgtkwindowgroup.c +35 -24
  251. data/sample/testgtk/labels.rb +1 -0
  252. data/sample/testgtk/testgtk.rb +2 -0
  253. metadata +16 -17
  254. data/ChangeLog +0 -6902
  255. data/ext/gtk2/rbgtkmain.c +0 -493
@@ -1,22 +1,33 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgdkpangorenderer.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2005/02/12 16:03:46 $
8
-
9
- Copyright (C) 2005 Masao Mutoh
10
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2005 Masao Mutoh
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
11
21
 
12
22
  #include "global.h"
13
23
 
14
24
  #if GTK_CHECK_VERSION(2,6,0)
15
25
 
26
+ #define RG_TARGET_NAMESPACE cPangoRenderer
16
27
  #define _SELF(s) (GDK_PANGO_RENDERER(RVAL2GOBJ(s)))
17
28
 
18
29
  static VALUE
19
- prenderer_initialize(int argc, VALUE *argv, VALUE self)
30
+ rg_initialize(int argc, VALUE *argv, VALUE self)
20
31
  {
21
32
  VALUE screen;
22
33
  GdkScreen* gscreen;
@@ -35,7 +46,7 @@ prenderer_initialize(int argc, VALUE *argv, VALUE self)
35
46
  }
36
47
 
37
48
  static VALUE
38
- prenderer_s_get_default(int argc, VALUE *argv, VALUE self)
49
+ rg_s_get_default(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
39
50
  {
40
51
  VALUE screen;
41
52
  GdkScreen* gscreen;
@@ -51,14 +62,14 @@ prenderer_s_get_default(int argc, VALUE *argv, VALUE self)
51
62
  }
52
63
 
53
64
  static VALUE
54
- prenderer_s_default(VALUE self)
65
+ rg_s_default(G_GNUC_UNUSED VALUE self)
55
66
  {
56
67
  GdkScreen* gscreen = gdk_screen_get_default();
57
68
  return GOBJ2RVAL(gdk_pango_renderer_get_default(gscreen));
58
69
  }
59
70
 
60
71
  static VALUE
61
- prenderer_set_drawable(VALUE self, VALUE drawable)
72
+ rg_set_drawable(VALUE self, VALUE drawable)
62
73
  {
63
74
  gdk_pango_renderer_set_drawable(_SELF(self),
64
75
  GDK_DRAWABLE(RVAL2GOBJ(drawable)));
@@ -66,56 +77,73 @@ prenderer_set_drawable(VALUE self, VALUE drawable)
66
77
  }
67
78
 
68
79
  static VALUE
69
- prenderer_set_gc(VALUE self, VALUE gc)
80
+ rg_set_gc(VALUE self, VALUE gc)
70
81
  {
71
82
  gdk_pango_renderer_set_gc(_SELF(self),
72
83
  NIL_P(gc) ? NULL : GDK_GC(RVAL2GOBJ(gc)));
73
84
  return self;
74
85
  }
75
86
 
87
+ #ifdef HAVE_PANGO_RENDER_PART_GET_TYPE
76
88
  static VALUE
77
- prenderer_set_stipple(VALUE self, VALUE part, VALUE stipple)
89
+ rg_set_stipple(VALUE self, VALUE part, VALUE stipple)
78
90
  {
79
- #if HAVE_PANGO_RENDER_PART_GET_TYPE
80
91
  gdk_pango_renderer_set_stipple(_SELF(self), RVAL2GENUM(part, PANGO_TYPE_RENDER_PART),
81
92
  NIL_P(stipple) ? NULL : GDK_BITMAP(RVAL2GOBJ(stipple)));
93
+
94
+ return self;
95
+ }
82
96
  #else
83
- rb_warning("Gdk::PangoRender#set_tipple is not supported (Require pango-1.8.1 or later");
84
- #endif
97
+ static VALUE
98
+ prenderer_set_stipple(G_GNUC_UNUSED VALUE self,
99
+ G_GNUC_UNUSED VALUE part,
100
+ G_GNUC_UNUSED VALUE stipple)
101
+ {
102
+ rb_warning("Gdk::PangoRender#set_tipple is not supported (Require pango-1.8.1 or later");
103
+
85
104
  return self;
86
105
  }
106
+ #endif
87
107
 
108
+ #ifdef HAVE_PANGO_RENDER_PART_GET_TYPE
88
109
  static VALUE
89
- prenderer_set_override_color(VALUE self, VALUE part, VALUE color)
110
+ rg_set_override_color(VALUE self, VALUE part, VALUE color)
90
111
  {
91
- #if HAVE_PANGO_RENDER_PART_GET_TYPE
92
- gdk_pango_renderer_set_override_color(_SELF(self),
112
+ gdk_pango_renderer_set_override_color(_SELF(self),
93
113
  RVAL2GENUM(part, PANGO_TYPE_RENDER_PART),
94
114
  RVAL2GDKCOLOR(color));
115
+
116
+ return self;
117
+ }
95
118
  #else
96
- rb_warning("Gdk::PangoRender#set_override_color is not supported (Require pango-1.8.1 or later");
97
- #endif
119
+ static VALUE
120
+ prenderer_set_override_color(G_GNUC_UNUSED VALUE self,
121
+ G_GNUC_UNUSED VALUE part,
122
+ G_GNUC_UNUSED VALUE color)
123
+ {
124
+ rb_warning("Gdk::PangoRender#set_override_color is not supported (Require pango-1.8.1 or later");
125
+
98
126
  return self;
99
127
  }
100
128
  #endif
101
129
 
130
+ #endif
131
+
102
132
  void
103
- Init_gtk_gdk_pangorenderer()
133
+ Init_gtk_gdk_pangorenderer(VALUE mGdk)
104
134
  {
105
135
  #if GTK_CHECK_VERSION(2,6,0)
106
- VALUE renderer = G_DEF_CLASS(GDK_TYPE_PANGO_RENDERER, "PangoRenderer", mGdk);
136
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PANGO_RENDERER, "PangoRenderer", mGdk);
107
137
 
108
- rb_define_method(renderer, "initialize", prenderer_initialize, -1);
109
- rb_define_method(renderer, "set_drawable", prenderer_set_drawable, 1);
110
- rb_define_method(renderer, "set_gc", prenderer_set_gc, 1);
111
- rb_define_method(renderer, "set_stipple", prenderer_set_stipple, 2);
112
- rb_define_method(renderer, "set_override_color", prenderer_set_override_color, 2);
138
+ RG_DEF_METHOD(initialize, -1);
139
+ RG_DEF_METHOD(set_drawable, 1);
140
+ RG_DEF_METHOD(set_gc, 1);
141
+ RG_DEF_METHOD(set_stipple, 2);
142
+ RG_DEF_METHOD(set_override_color, 2);
113
143
 
114
- rb_define_singleton_method(renderer, "get_default", prenderer_s_get_default, -1);
115
- rb_define_singleton_method(renderer, "default", prenderer_s_default, 0);
144
+ RG_DEF_SMETHOD(get_default, -1);
145
+ RG_DEF_SMETHOD(default, 0);
116
146
 
117
- G_DEF_SETTERS(renderer);
147
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
118
148
  #endif
119
149
  }
120
-
121
-
@@ -1,20 +1,31 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgdkpixbuf.c -
5
-
6
- $Author: ktou $
7
- $Date: 2006/10/14 04:59:14 $
8
-
9
- Copyright (C) 2002,2003 Masao Mutoh
10
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002,2003 Masao Mutoh
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
11
21
 
12
22
  #include "global.h"
13
23
 
24
+ #define RG_TARGET_NAMESPACE cPixbuf
14
25
  #define _SELF(s) GDK_PIXBUF(RVAL2GOBJ(s))
15
26
 
16
27
  static VALUE
17
- pixbuf_render_threshold_alpha(VALUE self, VALUE bitmap, VALUE src_x, VALUE src_y, VALUE dest_x, VALUE dest_y, VALUE width, VALUE height, VALUE alpha_threshold)
28
+ rg_render_threshold_alpha(VALUE self, VALUE bitmap, VALUE src_x, VALUE src_y, VALUE dest_x, VALUE dest_y, VALUE width, VALUE height, VALUE alpha_threshold)
18
29
  {
19
30
  gdk_pixbuf_render_threshold_alpha(_SELF(self), GDK_BITMAP(RVAL2GOBJ(bitmap)),
20
31
  NUM2INT(src_x), NUM2INT(src_y),
@@ -25,7 +36,7 @@ pixbuf_render_threshold_alpha(VALUE self, VALUE bitmap, VALUE src_x, VALUE src_y
25
36
  }
26
37
 
27
38
  static VALUE
28
- pixbuf_render_to_drawable(int argc, VALUE *argv, VALUE self)
39
+ rg_render_to_drawable(int argc, VALUE *argv, VALUE self)
29
40
  {
30
41
  VALUE gc, src_x, src_y, dest_x, dest_y, width, height,
31
42
  dither, x_dither, y_dither;
@@ -53,9 +64,9 @@ pixbuf_render_to_drawable(int argc, VALUE *argv, VALUE self)
53
64
  rb_raise(rb_eArgError, "arguments 7 must be non nil");
54
65
 
55
66
  gdk_pixbuf_render_to_drawable(_SELF(self),
56
- GDK_DRAWABLE(RVAL2GOBJ(self)),
57
- GDK_GC(RVAL2GOBJ(gc)),
58
- NUM2INT(src_x), NUM2INT(src_y),
67
+ GDK_DRAWABLE(RVAL2GOBJ(self)),
68
+ GDK_GC(RVAL2GOBJ(gc)),
69
+ NUM2INT(src_x), NUM2INT(src_y),
59
70
  NUM2INT(dest_x), NUM2INT(dest_y),
60
71
  NUM2INT(width), NUM2INT(height),
61
72
  NIL_P(dither) ? GDK_RGB_DITHER_NONE : RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
@@ -65,7 +76,7 @@ pixbuf_render_to_drawable(int argc, VALUE *argv, VALUE self)
65
76
  }
66
77
 
67
78
  static VALUE
68
- pixbuf_render_pixmap_and_mask(int argc, VALUE *argv, VALUE self)
79
+ rg_render_pixmap_and_mask(int argc, VALUE *argv, VALUE self)
69
80
  {
70
81
  VALUE colormap_or_alpha, alpha;
71
82
  GdkPixmap *pixmap;
@@ -93,7 +104,7 @@ pixbuf_render_pixmap_and_mask(int argc, VALUE *argv, VALUE self)
93
104
  }
94
105
 
95
106
  static VALUE
96
- pixbuf_s_from_drawable(int argc, VALUE *argv, VALUE self)
107
+ rg_s_from_drawable(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
97
108
  {
98
109
  VALUE cmap, src, src_x, src_y, width, height, dest, dest_x, dest_y;
99
110
  GdkPixbuf* buf;
@@ -118,9 +129,9 @@ pixbuf_s_from_drawable(int argc, VALUE *argv, VALUE self)
118
129
  return dest;
119
130
  }
120
131
  }
121
-
132
+
122
133
  static VALUE
123
- pixbuf_s_from_image(int argc, VALUE *argv, VALUE self)
134
+ rg_s_from_image(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
124
135
  {
125
136
  VALUE cmap, src, src_x, src_y, width, height, dest, dest_x, dest_y;
126
137
  GdkPixbuf* buf;
@@ -147,17 +158,17 @@ pixbuf_s_from_image(int argc, VALUE *argv, VALUE self)
147
158
  }
148
159
 
149
160
  void
150
- Init_gtk_gdk_pixbuf()
161
+ Init_gtk_gdk_pixbuf(VALUE mGdk)
151
162
  {
152
163
  /*
153
164
  * This defines Gdk::Pixbuf methods of GDK side.
154
165
  */
155
- VALUE gdkPixbuf = GTYPE2CLASS(GDK_TYPE_PIXBUF);
166
+ VALUE RG_TARGET_NAMESPACE = GTYPE2CLASS(GDK_TYPE_PIXBUF);
156
167
 
157
- rb_define_method(gdkPixbuf, "render_threshold_alpha", pixbuf_render_threshold_alpha, 8);
158
- rb_define_method(gdkPixbuf, "render_to_drawable", pixbuf_render_to_drawable, -1);
159
- rb_define_method(gdkPixbuf, "render_pixmap_and_mask", pixbuf_render_pixmap_and_mask, -1);
168
+ RG_DEF_METHOD(render_threshold_alpha, 8);
169
+ RG_DEF_METHOD(render_to_drawable, -1);
170
+ RG_DEF_METHOD(render_pixmap_and_mask, -1);
160
171
 
161
- rb_define_singleton_method(gdkPixbuf, "from_drawable", pixbuf_s_from_drawable, -1);
162
- rb_define_singleton_method(gdkPixbuf, "from_image", pixbuf_s_from_image, -1);
172
+ RG_DEF_SMETHOD(from_drawable, -1);
173
+ RG_DEF_SMETHOD(from_image, -1);
163
174
  }
@@ -1,39 +1,51 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgdkpixmap.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2006/11/25 17:50:41 $
8
-
9
- Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
10
- Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
- Daisuke Kanda,
12
- Hiroshi Igarashi
13
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002-2004 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
+ */
14
24
 
15
25
  #include "global.h"
16
26
  #ifdef HAVE_XREADBITMAPFILEDATA
17
27
  #include <X11/Xlib.h>
18
28
  #endif /* HAVE_XREADBITMAPFILEDATA */
19
29
 
30
+ #define RG_TARGET_NAMESPACE cPixmap
31
+
20
32
  static VALUE
21
- gdkpmap_initialize(VALUE self, VALUE win, VALUE w, VALUE h, VALUE depth)
33
+ rg_initialize(VALUE self, VALUE win, VALUE w, VALUE h, VALUE depth)
22
34
  {
23
- G_INITIALIZE(self, gdk_pixmap_new(GDK_WINDOW(RVAL2GOBJ(win)),
24
- NUM2INT(w), NUM2INT(h),
25
- NUM2INT(depth)));
26
- return Qnil;
35
+ G_INITIALIZE(self, gdk_pixmap_new(GDK_WINDOW(RVAL2GOBJ(win)),
36
+ NUM2INT(w), NUM2INT(h),
37
+ NUM2INT(depth)));
38
+ return Qnil;
27
39
  }
28
40
 
29
41
  static VALUE
30
- gdkpmap_create_from_data(int argc, VALUE *argv, VALUE self)
42
+ rg_s_create_from_data(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
31
43
  {
32
44
  VALUE win, data, w, h, depth, fg, bg, ret;
33
45
 
34
46
  rb_scan_args(argc, argv, "43", &win, &data, &w, &h, &depth, &fg, &bg);
35
47
 
36
- Check_Type(data, T_STRING);
48
+ StringValue(data);
37
49
  if (NIL_P(depth)){
38
50
  ret = GOBJ2RVAL(gdk_bitmap_create_from_data(NIL_P(win) ? NULL : GDK_WINDOW(RVAL2GOBJ(win)),
39
51
  RVAL2CSTR(data), NUM2INT(w), NUM2INT(h)));
@@ -41,14 +53,14 @@ gdkpmap_create_from_data(int argc, VALUE *argv, VALUE self)
41
53
  ret = GOBJ2RVAL(gdk_pixmap_create_from_data(NIL_P(win) ? NULL : GDK_WINDOW(RVAL2GOBJ(win)),
42
54
  RVAL2CSTR(data), NUM2INT(w), NUM2INT(h),
43
55
  NUM2INT(depth),
44
- RVAL2GDKCOLOR(fg),
45
- RVAL2GDKCOLOR(bg)));
56
+ RVAL2GDKCOLOR(fg),
57
+ RVAL2GDKCOLOR(bg)));
46
58
  }
47
59
  return ret;
48
60
  }
49
61
 
50
62
  static VALUE
51
- gdkpmap_create_from_xpm(VALUE self, VALUE win, VALUE color, VALUE fname)
63
+ rg_s_create_from_xpm(G_GNUC_UNUSED VALUE self, VALUE win, VALUE color, VALUE fname)
52
64
  {
53
65
  GdkPixmap *result;
54
66
  GdkBitmap *mask;
@@ -64,7 +76,7 @@ gdkpmap_create_from_xpm(VALUE self, VALUE win, VALUE color, VALUE fname)
64
76
  }
65
77
 
66
78
  static VALUE
67
- gdkpmap_create_from_xpm_d(VALUE self, VALUE win, VALUE tcolor, VALUE data)
79
+ rg_s_create_from_xpm_d(G_GNUC_UNUSED VALUE self, VALUE win, VALUE tcolor, VALUE data)
68
80
  {
69
81
  GdkPixmap *result;
70
82
  GdkBitmap *mask;
@@ -81,7 +93,7 @@ gdkpmap_create_from_xpm_d(VALUE self, VALUE win, VALUE tcolor, VALUE data)
81
93
  }
82
94
 
83
95
  static VALUE
84
- gdkpmap_colormap_create_from_xpm(VALUE self, VALUE win, VALUE colormap, VALUE tcolor, VALUE fname)
96
+ rg_s_colormap_create_from_xpm(G_GNUC_UNUSED VALUE self, VALUE win, VALUE colormap, VALUE tcolor, VALUE fname)
85
97
  {
86
98
  GdkPixmap *result;
87
99
  GdkBitmap *mask;
@@ -98,7 +110,7 @@ gdkpmap_colormap_create_from_xpm(VALUE self, VALUE win, VALUE colormap, VALUE tc
98
110
  }
99
111
 
100
112
  static VALUE
101
- gdkpmap_colormap_create_from_xpm_d(VALUE self, VALUE win, VALUE colormap, VALUE tcolor, VALUE data)
113
+ rg_s_colormap_create_from_xpm_d(G_GNUC_UNUSED VALUE self, VALUE win, VALUE colormap, VALUE tcolor, VALUE data)
102
114
  {
103
115
  GdkPixmap *result;
104
116
  GdkBitmap *mask;
@@ -115,14 +127,14 @@ gdkpmap_colormap_create_from_xpm_d(VALUE self, VALUE win, VALUE colormap, VALUE
115
127
 
116
128
  #ifdef HAVE_XREADBITMAPFILEDATA
117
129
  static VALUE
118
- gdkpmap_create_from_xbm(VALUE self, VALUE win, VALUE fname)
130
+ rg_s_create_from_xbm(VALUE self, VALUE win, VALUE fname)
119
131
  {
120
132
  GdkBitmap *new;
121
133
  unsigned char *data;
122
134
  unsigned int width, height;
123
135
  int x, y;
124
136
 
125
- Check_Type(fname, T_STRING);
137
+ StringValue(fname);
126
138
  if (XReadBitmapFileData(RVAL2CSTR(fname), &width, &height, &data, &x, &y))
127
139
  rb_raise(rb_eArgError, "Bitmap not created from %s", RVAL2CSTR(fname));
128
140
 
@@ -141,13 +153,13 @@ gdkpmap_create_from_xbm(VALUE self, VALUE win, VALUE fname)
141
153
  */
142
154
 
143
155
  static VALUE
144
- gdkpmap_foreign_new(int argc, VALUE *argv, VALUE self)
156
+ rg_s_foreign_new(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
145
157
  {
146
158
  VALUE arg[5];
147
159
  GdkPixmap* win = NULL;
148
-
160
+
149
161
  rb_scan_args(argc, argv, "14", &arg[0], &arg[1], &arg[2], &arg[3], &arg[4]);
150
-
162
+
151
163
  switch(argc)
152
164
  {
153
165
  case 1:
@@ -174,31 +186,35 @@ gdkpmap_foreign_new(int argc, VALUE *argv, VALUE self)
174
186
  rb_warn("Not supported. GTK+-2.10.0 or later.");
175
187
  #endif
176
188
  break;
189
+ default:
190
+ break;
177
191
  }
178
192
  return win ? GOBJ2RVAL(win) : Qnil;
179
193
  }
180
194
 
181
195
  static VALUE
182
- gdkpmap_lookup(int argc, VALUE *argv, VALUE self)
196
+ rg_s_lookup(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
183
197
  {
184
198
  VALUE arg[2];
185
199
  GdkPixmap* win = NULL;
186
-
200
+
187
201
  rb_scan_args(argc, argv, "11", &arg[0], &arg[1]);
188
202
 
189
203
  switch(argc)
190
204
  {
191
205
  case 1:
192
- win = gdk_pixmap_lookup(RVAL2GDKNATIVEWINDOW(arg[0]));
193
- break;
206
+ win = gdk_pixmap_lookup(RVAL2GDKNATIVEWINDOW(arg[0]));
207
+ break;
194
208
  case 2:
195
209
  #if GTK_CHECK_VERSION(2,2,0)
196
- win = gdk_pixmap_lookup_for_display(RVAL2GOBJ(arg[0]), RVAL2GDKNATIVEWINDOW(arg[1]));
210
+ win = gdk_pixmap_lookup_for_display(RVAL2GOBJ(arg[0]), RVAL2GDKNATIVEWINDOW(arg[1]));
197
211
  #else
198
- win = gdk_pixmap_lookup(RVAL2GDKNATIVEWINDOW(arg[1]));
212
+ win = gdk_pixmap_lookup(RVAL2GDKNATIVEWINDOW(arg[1]));
199
213
  rb_warn("Not supported in GTK+-2.0.x.");
200
214
  #endif
201
- break;
215
+ break;
216
+ default:
217
+ break;
202
218
  }
203
219
  if (win == NULL)
204
220
  return Qnil;
@@ -208,18 +224,18 @@ gdkpmap_lookup(int argc, VALUE *argv, VALUE self)
208
224
  }
209
225
 
210
226
  void
211
- Init_gtk_gdk_pixmap()
227
+ Init_gtk_gdk_pixmap(VALUE mGdk)
212
228
  {
213
- VALUE gdkPixmap = G_DEF_CLASS(GDK_TYPE_PIXMAP, "Pixmap", mGdk);
214
-
215
- rb_define_method(gdkPixmap, "initialize", gdkpmap_initialize, 4);
216
- rb_define_singleton_method(gdkPixmap, "create_from_data", gdkpmap_create_from_data, -1);
217
- rb_define_singleton_method(gdkPixmap, "create_from_xpm", gdkpmap_create_from_xpm, 3);
218
- rb_define_singleton_method(gdkPixmap, "create_from_xpm_d", gdkpmap_create_from_xpm_d, 3);
219
- rb_define_singleton_method(gdkPixmap, "colormap_create_from_xpm", gdkpmap_colormap_create_from_xpm, 4);
220
- rb_define_singleton_method(gdkPixmap, "colormap_create_from_xpm_d", gdkpmap_colormap_create_from_xpm_d, 4);
229
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PIXMAP, "Pixmap", mGdk);
230
+
231
+ RG_DEF_METHOD(initialize, 4);
232
+ RG_DEF_SMETHOD(create_from_data, -1);
233
+ RG_DEF_SMETHOD(create_from_xpm, 3);
234
+ RG_DEF_SMETHOD(create_from_xpm_d, 3);
235
+ RG_DEF_SMETHOD(colormap_create_from_xpm, 4);
236
+ RG_DEF_SMETHOD(colormap_create_from_xpm_d, 4);
221
237
  #ifdef HAVE_XREADBITMAPFILEDATA
222
- rb_define_singleton_method(gdkPixmap, "create_from_xbm", gdkpmap_create_from_xbm, 2);
238
+ RG_DEF_SMETHOD(create_from_xbm, 2);
223
239
  #endif /* HAVE_XREADBITMAPFILEDATA */
224
240
  #ifdef GDK_WINDOWING_X11
225
241
  G_DEF_CLASS3("GdkPixmapImplX11", "PixmapImplX11", mGdk);
@@ -229,7 +245,7 @@ Init_gtk_gdk_pixmap()
229
245
  G_DEF_CLASS3("GdkPixmapFB", "PixmapFB", mGdk);
230
246
  #endif
231
247
 
232
- rb_define_singleton_method(gdkPixmap, "foreign_new", gdkpmap_foreign_new, -1);
233
- rb_define_singleton_method(gdkPixmap, "lookup", gdkpmap_lookup, -1);
248
+ RG_DEF_SMETHOD(foreign_new, -1);
249
+ RG_DEF_SMETHOD(lookup, -1);
234
250
 
235
251
  }