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,26 +1,34 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgdkcolormap.c -
5
-
6
- $Author: ggc $
7
- $Date: 2007/07/13 16:07:31 $
8
-
9
- Copyright (C) 2002,2003 Masao Mutoh
10
-
11
- This file is devided from rbgdkcolor.c.
12
- rbgdkcolor.c -
13
- Copyright (C) 1998-2000 Yukihiro Matsumoto,
14
- Daisuke Kanda,
15
- Hiroshi Igarashi
16
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002,2003 Masao Mutoh
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
+ */
17
24
 
18
25
  #include "global.h"
19
26
 
27
+ #define RG_TARGET_NAMESPACE cColormap
20
28
  #define _SELF(self) (GDK_COLORMAP(RVAL2GOBJ(self)))
21
29
 
22
30
  static VALUE
23
- gdkcmap_initialize(VALUE self, VALUE visual, VALUE allocate)
31
+ rg_initialize(VALUE self, VALUE visual, VALUE allocate)
24
32
  {
25
33
  GdkColormap *cmap = gdk_colormap_new(GDK_VISUAL(RVAL2GOBJ(visual)),
26
34
  RVAL2CBOOL(allocate));
@@ -29,7 +37,7 @@ gdkcmap_initialize(VALUE self, VALUE visual, VALUE allocate)
29
37
  }
30
38
 
31
39
  static VALUE
32
- gdkcmap_s_get_system(VALUE self)
40
+ rg_s_system(G_GNUC_UNUSED VALUE self)
33
41
  {
34
42
  return GOBJ2RVAL(gdk_colormap_get_system());
35
43
  }
@@ -46,7 +54,7 @@ gint gdk_colormap_alloc_colors (GdkColormap *colormap,
46
54
  */
47
55
 
48
56
  static VALUE
49
- gdkcmap_alloc_color(VALUE self, VALUE color, VALUE writeable, VALUE best_match)
57
+ rg_alloc_color(VALUE self, VALUE color, VALUE writeable, VALUE best_match)
50
58
  {
51
59
  gboolean result;
52
60
  GdkColor *c = RVAL2GDKCOLOR(color);
@@ -58,14 +66,14 @@ gdkcmap_alloc_color(VALUE self, VALUE color, VALUE writeable, VALUE best_match)
58
66
  /* Don't implement Gdk::Colormap#free_colors.
59
67
  Because it should be pair with Gdk::Colormap#alloc_colors */
60
68
  static VALUE
61
- gdkcmap_free_color(VALUE self, VALUE color)
69
+ rg_free_color(VALUE self, VALUE color)
62
70
  {
63
71
  gdk_colormap_free_colors(_SELF(self), RVAL2GDKCOLOR(color), 1);
64
72
  return self;
65
73
  }
66
74
 
67
75
  static VALUE
68
- gdkcmap_query_color(VALUE self, VALUE pixel)
76
+ rg_query_color(VALUE self, VALUE pixel)
69
77
  {
70
78
  GdkColor color;
71
79
  gdk_colormap_query_color(_SELF(self), NUM2ULONG(pixel), &color);
@@ -73,21 +81,21 @@ gdkcmap_query_color(VALUE self, VALUE pixel)
73
81
  }
74
82
 
75
83
  static VALUE
76
- gdkcmap_get_visual(VALUE self)
84
+ rg_visual(VALUE self)
77
85
  {
78
86
  return GOBJ2RVAL(gdk_colormap_get_visual(_SELF(self)));
79
87
  }
80
88
 
81
89
  #if GTK_CHECK_VERSION(2,2,0)
82
90
  static VALUE
83
- gdkcmap_get_screen(VALUE self)
91
+ rg_screen(VALUE self)
84
92
  {
85
93
  return GOBJ2RVAL(gdk_colormap_get_screen(_SELF(self)));
86
94
  }
87
95
  #endif
88
96
 
89
97
  static VALUE
90
- gdkcmap_colors(VALUE self)
98
+ rg_colors(VALUE self)
91
99
  {
92
100
  GdkColormap *cmap;
93
101
  GdkColor *colors;
@@ -114,21 +122,18 @@ gdkcmap_colors(VALUE self)
114
122
  }
115
123
 
116
124
  void
117
- Init_gtk_gdk_colormap()
125
+ Init_gtk_gdk_colormap(VALUE mGdk)
118
126
  {
119
- VALUE gdkColormap = G_DEF_CLASS(GDK_TYPE_COLORMAP, "Colormap", mGdk);
120
-
121
- rb_define_singleton_method(gdkColormap, "system",
122
- gdkcmap_s_get_system, 0);
123
- rb_define_method(gdkColormap, "initialize", gdkcmap_initialize, 2);
124
- rb_define_method(gdkColormap, "alloc_color", gdkcmap_alloc_color, 3);
125
- rb_define_method(gdkColormap, "free_color", gdkcmap_free_color, 1);
126
- rb_define_method(gdkColormap, "query_color", gdkcmap_query_color, 1);
127
- rb_define_method(gdkColormap, "visual", gdkcmap_get_visual, 0);
127
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_COLORMAP, "Colormap", mGdk);
128
+
129
+ RG_DEF_SMETHOD(system, 0);
130
+ RG_DEF_METHOD(initialize, 2);
131
+ RG_DEF_METHOD(alloc_color, 3);
132
+ RG_DEF_METHOD(free_color, 1);
133
+ RG_DEF_METHOD(query_color, 1);
134
+ RG_DEF_METHOD(visual, 0);
128
135
  #if GTK_CHECK_VERSION(2,2,0)
129
- rb_define_method(gdkColormap, "screen", gdkcmap_get_screen, 0);
136
+ RG_DEF_METHOD(screen, 0);
130
137
  #endif
131
- rb_define_method(gdkColormap, "colors", gdkcmap_colors, 0);
138
+ RG_DEF_METHOD(colors, 0);
132
139
  }
133
-
134
-
@@ -1,16 +1,26 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgdkconst.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2003/11/02 18:29:28 $
8
-
9
- Copyright (C) 2002,2003 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,2003 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 1998-2000 Yukihiro Matsumoto,
6
+ * Daisuke Kanda,
7
+ * Hiroshi Igarashi
8
+ *
9
+ * This library is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU Lesser General Public
11
+ * License as published by the Free Software Foundation; either
12
+ * version 2.1 of the License, or (at your option) any later version.
13
+ *
14
+ * This library is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
+ * Lesser General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU Lesser General Public
20
+ * License along with this library; if not, write to the Free Software
21
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
+ * MA 02110-1301 USA
23
+ */
14
24
 
15
25
  #include "global.h"
16
26
 
@@ -18,7 +28,7 @@
18
28
  * Gdk module constants
19
29
  */
20
30
  void
21
- Init_gtk_gdk_const()
31
+ Init_gtk_gdk_const(VALUE mGdk)
22
32
  {
23
33
  /* GdkStatus */
24
34
  G_DEF_CLASS(GDK_TYPE_STATUS, "Status", mGdk);
@@ -1,10 +1,23 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgdkconversions.h -
5
-
6
- Copyright (C) 2008 Ruby-GNOME2 Project Team
7
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008 Ruby-GNOME2 Project Team
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
+ */
8
21
 
9
22
  #ifndef __RB_GDK_CONVERSIONS_H__
10
23
  #define __RB_GDK_CONVERSIONS_H__
@@ -1,18 +1,30 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgdkcursor.c -
5
-
6
- $Author: ggc $
7
- $Date: 2007/07/13 14:27:08 $
8
-
9
- Copyright (C) 2001-2004 Masao Mutoh
10
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2001-2004 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 cCursor
25
+
14
26
  static VALUE
15
- gdkcursor_initialize(int argc, VALUE *argv, VALUE self)
27
+ rg_initialize(int argc, VALUE *argv, VALUE self)
16
28
  {
17
29
  GdkCursor* cursor = NULL;
18
30
 
@@ -52,57 +64,57 @@ gdkcursor_initialize(int argc, VALUE *argv, VALUE self)
52
64
  NIL_P(mask)?NULL:GDK_PIXMAP(RVAL2GOBJ(mask)),
53
65
  RVAL2GDKCOLOR(fg),
54
66
  RVAL2GDKCOLOR(bg),
55
- NUM2INT(x), NUM2INT(y));
67
+ NUM2INT(x), NUM2INT(y));
56
68
  }
57
69
  G_INITIALIZE(self, cursor);
58
-
70
+
59
71
  return Qnil;
60
72
  }
61
73
 
62
74
  #if GTK_CHECK_VERSION(2,2,0)
63
75
  static VALUE
64
- gdkcursor_get_display(VALUE self)
76
+ rg_display(VALUE self)
65
77
  {
66
78
  return GOBJ2RVAL(gdk_cursor_get_display((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_CURSOR)));
67
79
  }
68
80
  #endif
69
81
 
70
82
  static VALUE
71
- gdkcursor_is_pixmap(VALUE self)
83
+ rg_pixmap_p(VALUE self)
72
84
  {
73
85
  return CBOOL2RVAL(((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_COLOR))->type ==
74
86
  GDK_CURSOR_IS_PIXMAP);
75
87
  }
76
88
 
77
89
  static VALUE
78
- gdkcursor_cursor_type(VALUE self)
90
+ rg_cursor_type(VALUE self)
79
91
  {
80
92
  return GENUM2RVAL(((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_CURSOR))->type, GDK_TYPE_CURSOR_TYPE);
81
93
  }
82
94
 
83
95
  #if GTK_CHECK_VERSION(2,8,0)
84
96
  static VALUE
85
- gdkcursor_get_image(VALUE self)
97
+ rg_image(VALUE self)
86
98
  {
87
99
  return GOBJ2RVAL(gdk_cursor_get_image((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_CURSOR)));
88
100
  }
89
101
  #endif
90
102
 
91
103
  void
92
- Init_gtk_gdk_cursor()
104
+ Init_gtk_gdk_cursor(VALUE mGdk)
93
105
  {
94
- VALUE gdkCursor = G_DEF_CLASS(GDK_TYPE_CURSOR, "Cursor", mGdk);
106
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_CURSOR, "Cursor", mGdk);
95
107
 
96
- rb_define_method(gdkCursor, "initialize", gdkcursor_initialize, -1);
108
+ RG_DEF_METHOD(initialize, -1);
97
109
  #if GTK_CHECK_VERSION(2,2,0)
98
- rb_define_method(gdkCursor, "display", gdkcursor_get_display, 0);
110
+ RG_DEF_METHOD(display, 0);
99
111
  #endif
100
- rb_define_method(gdkCursor, "pixmap?", gdkcursor_is_pixmap, 0);
101
- rb_define_method(gdkCursor, "cursor_type", gdkcursor_cursor_type, 0);
112
+ RG_DEF_METHOD_P(pixmap, 0);
113
+ RG_DEF_METHOD(cursor_type, 0);
102
114
  #if GTK_CHECK_VERSION(2,8,0)
103
- rb_define_method(gdkCursor, "image", gdkcursor_get_image, 0);
115
+ RG_DEF_METHOD(image, 0);
104
116
  #endif
105
117
 
106
- G_DEF_CLASS(GDK_TYPE_CURSOR_TYPE, "Type", gdkCursor);
107
- G_DEF_CONSTANTS(gdkCursor, GDK_TYPE_CURSOR_TYPE, "GDK_");
118
+ G_DEF_CLASS(GDK_TYPE_CURSOR_TYPE, "Type", RG_TARGET_NAMESPACE);
119
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_CURSOR_TYPE, "GDK_");
108
120
  }
@@ -1,50 +1,60 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /************************************************
3
-
4
- rbgdkdevice.c -
5
-
6
- $Author: mutoh $
7
- $Date: 2006/06/17 06:59:32 $
8
-
9
- Copyright (C) 2003-2006 Masao Mutoh
10
- ************************************************/
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003-2006 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 cDevice
14
25
  #define _SELF(self) (GDK_DEVICE(RVAL2GOBJ(self)))
15
26
 
16
27
  /* Methods */
17
28
  static VALUE
18
- device_s_list(VALUE self)
29
+ rg_s_list(G_GNUC_UNUSED VALUE self)
19
30
  {
20
31
  /* Owned by GDK */
21
32
  return GLIST2ARY(gdk_devices_list());
22
33
  }
23
34
 
24
35
  static VALUE
25
- device_s_set_extension_events(VALUE self, VALUE window, VALUE mask, VALUE mode)
36
+ rg_s_set_extension_events(G_GNUC_UNUSED VALUE self, VALUE window, VALUE mask, VALUE mode)
26
37
  {
27
38
  gdk_input_set_extension_events(GDK_WINDOW(RVAL2GOBJ(window)),
28
39
  NUM2INT(mask), FIX2INT(mode));
29
40
  return Qnil;
30
41
  }
31
42
 
32
-
33
43
  static VALUE
34
- device_set_source(VALUE self, VALUE source)
44
+ rg_set_source(VALUE self, VALUE source)
35
45
  {
36
46
  gdk_device_set_source(_SELF(self), RVAL2GENUM(source, GDK_TYPE_INPUT_SOURCE));
37
47
  return self;
38
48
  }
39
49
 
40
50
  static VALUE
41
- device_set_mode(VALUE self, VALUE mode)
51
+ rg_set_mode(VALUE self, VALUE mode)
42
52
  {
43
53
  return CBOOL2RVAL(gdk_device_set_mode(_SELF(self), RVAL2GENUM(mode, GDK_TYPE_INPUT_MODE)));
44
54
  }
45
55
 
46
56
  static VALUE
47
- device_set_key(VALUE self, VALUE index, VALUE keyval, VALUE modifiers)
57
+ rg_set_key(VALUE self, VALUE index, VALUE keyval, VALUE modifiers)
48
58
  {
49
59
  gdk_device_set_key(_SELF(self), NUM2UINT(index), NUM2UINT(keyval),
50
60
  RVAL2GFLAGS(modifiers, GDK_TYPE_MODIFIER_TYPE));
@@ -52,7 +62,7 @@ device_set_key(VALUE self, VALUE index, VALUE keyval, VALUE modifiers)
52
62
  }
53
63
 
54
64
  static VALUE
55
- device_set_axis_use(VALUE self, VALUE index, VALUE use)
65
+ rg_set_axis_use(VALUE self, VALUE index, VALUE use)
56
66
  {
57
67
  gdk_device_set_axis_use(_SELF(self), NUM2UINT(index),
58
68
  RVAL2GENUM(use, GDK_TYPE_AXIS_USE));
@@ -60,13 +70,13 @@ device_set_axis_use(VALUE self, VALUE index, VALUE use)
60
70
  }
61
71
 
62
72
  static VALUE
63
- device_s_get_core_pointer(VALUE self)
73
+ rg_s_core_pointer(G_GNUC_UNUSED VALUE self)
64
74
  {
65
75
  return GOBJ2RVAL(gdk_device_get_core_pointer());
66
76
  }
67
77
 
68
78
  static VALUE
69
- device_get_state(VALUE self, VALUE window)
79
+ rg_get_state(VALUE self, VALUE window)
70
80
  {
71
81
  gdouble axes[2];
72
82
  GdkModifierType mask;
@@ -78,7 +88,7 @@ device_get_state(VALUE self, VALUE window)
78
88
  }
79
89
 
80
90
  static VALUE
81
- device_get_history(VALUE self, VALUE window, VALUE start, VALUE stop)
91
+ rg_get_history(VALUE self, VALUE window, VALUE start, VALUE stop)
82
92
  {
83
93
  gboolean ret;
84
94
  GdkTimeCoord** events;
@@ -99,55 +109,55 @@ device_get_history(VALUE self, VALUE window, VALUE start, VALUE stop)
99
109
  }
100
110
 
101
111
  static VALUE
102
- device_get_axis(VALUE self, VALUE axes, VALUE use)
112
+ rg_get_axis(VALUE self, VALUE rbaxes, VALUE rbuse)
103
113
  {
114
+ GdkDevice *device = _SELF(self);
115
+ GdkAxisUse use = RVAL2GENUM(rbuse, GDK_TYPE_AXIS_USE);
116
+ long n;
117
+ gdouble *axes = RVAL2GDOUBLES(rbaxes, n);
118
+ gint device_n_axes = gdk_device_get_n_axes(device);
104
119
  gdouble value;
105
- gboolean ret;
106
- gdouble* gaxes;
107
- gint i;
108
- gint len = RARRAY_LEN(axes);
109
-
110
- gaxes = g_new(gdouble, len);
120
+ gboolean found;
111
121
 
112
- for (i = 0; i < len; i++){
113
- gaxes[i] = RARRAY_PTR(axes)[i];
114
- }
122
+ if (n != device_n_axes)
123
+ rb_raise(rb_eArgError,
124
+ "unexpected number of axes: %ld != %d",
125
+ n, device_n_axes);
115
126
 
116
- ret = gdk_device_get_axis(_SELF(self), gaxes, RVAL2GENUM(use, GDK_TYPE_AXIS_USE),
117
- &value);
127
+ found = gdk_device_get_axis(device, axes, use, &value);
118
128
 
119
- g_free(gaxes);
129
+ g_free(axes);
120
130
 
121
- return ret ? rb_float_new(value) : Qnil;
131
+ return found ? DBL2NUM(value) : Qnil;
122
132
  }
123
133
 
124
134
  /* Accessor */
125
135
  static VALUE
126
- device_name(VALUE self)
136
+ rg_name(VALUE self)
127
137
  {
128
138
  return CSTR2RVAL(_SELF(self)->name);
129
139
  }
130
140
 
131
141
  static VALUE
132
- device_source(VALUE self)
142
+ rg_source(VALUE self)
133
143
  {
134
144
  return GENUM2RVAL(_SELF(self)->source, GDK_TYPE_INPUT_SOURCE);
135
145
  }
136
146
 
137
147
  static VALUE
138
- device_mode(VALUE self)
148
+ rg_mode(VALUE self)
139
149
  {
140
150
  return GENUM2RVAL(_SELF(self)->mode, GDK_TYPE_INPUT_MODE);
141
151
  }
142
152
 
143
153
  static VALUE
144
- device_has_cursor(VALUE self)
154
+ rg_has_cursor_p(VALUE self)
145
155
  {
146
156
  return CBOOL2RVAL(_SELF(self)->has_cursor);
147
157
  }
148
158
 
149
159
  static VALUE
150
- device_axes(VALUE self)
160
+ rg_axes(VALUE self)
151
161
  {
152
162
  gint i;
153
163
  VALUE ary = rb_ary_new();
@@ -161,7 +171,7 @@ device_axes(VALUE self)
161
171
  }
162
172
 
163
173
  static VALUE
164
- device_keys(VALUE self)
174
+ rg_keys(VALUE self)
165
175
  {
166
176
  gint i;
167
177
  VALUE ary = rb_ary_new();
@@ -175,45 +185,45 @@ device_keys(VALUE self)
175
185
  }
176
186
 
177
187
  void
178
- Init_gtk_gdk_device()
188
+ Init_gtk_gdk_device(VALUE mGdk)
179
189
  {
180
- VALUE dev = G_DEF_CLASS(GDK_TYPE_DEVICE, "Device", mGdk);
190
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DEVICE, "Device", mGdk);
181
191
 
182
- rb_define_singleton_method(dev, "list", device_s_list, 0);
183
- rb_define_singleton_method(dev, "core_pointer", device_s_get_core_pointer, 0);
184
- rb_define_singleton_method(dev, "set_extension_events", device_s_set_extension_events, 3);
192
+ RG_DEF_SMETHOD(list, 0);
193
+ RG_DEF_SMETHOD(core_pointer, 0);
194
+ RG_DEF_SMETHOD(set_extension_events, 3);
185
195
 
186
- rb_define_method(dev, "set_source", device_set_source, 1);
187
- rb_define_method(dev, "set_mode", device_set_mode, 1);
188
- rb_define_method(dev, "set_key", device_set_key, 3);
189
- rb_define_method(dev, "set_axis_use", device_set_axis_use, 2);
190
- rb_define_method(dev, "get_state", device_get_state, 1);
191
- rb_define_method(dev, "get_history", device_get_history, 3);
192
- rb_define_method(dev, "get_axis", device_get_axis, 2);
196
+ RG_DEF_METHOD(set_source, 1);
197
+ RG_DEF_METHOD(set_mode, 1);
198
+ RG_DEF_METHOD(set_key, 3);
199
+ RG_DEF_METHOD(set_axis_use, 2);
200
+ RG_DEF_METHOD(get_state, 1);
201
+ RG_DEF_METHOD(get_history, 3);
202
+ RG_DEF_METHOD(get_axis, 2);
193
203
 
194
- rb_define_method(dev, "name", device_name, 0);
195
- rb_define_method(dev, "source", device_source, 0);
196
- rb_define_method(dev, "mode", device_mode, 0);
197
- rb_define_method(dev, "has_cursor?", device_has_cursor, 0);
198
- rb_define_method(dev, "axes", device_axes, 0);
199
- rb_define_method(dev, "keys", device_keys, 0);
204
+ RG_DEF_METHOD(name, 0);
205
+ RG_DEF_METHOD(source, 0);
206
+ RG_DEF_METHOD(mode, 0);
207
+ RG_DEF_METHOD_P(has_cursor, 0);
208
+ RG_DEF_METHOD(axes, 0);
209
+ RG_DEF_METHOD(keys, 0);
200
210
 
201
- G_DEF_SETTERS(dev);
211
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
202
212
 
203
213
  /* GdkInputSource */
204
- G_DEF_CLASS(GDK_TYPE_INPUT_SOURCE, "InputSource", dev);
205
- G_DEF_CONSTANTS(dev, GDK_TYPE_INPUT_SOURCE, "GDK_");
214
+ G_DEF_CLASS(GDK_TYPE_INPUT_SOURCE, "InputSource", RG_TARGET_NAMESPACE);
215
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_INPUT_SOURCE, "GDK_");
206
216
 
207
217
  /* GdkInputMode */
208
- G_DEF_CLASS(GDK_TYPE_INPUT_MODE, "InputMode", dev);
209
- G_DEF_CONSTANTS(dev, GDK_TYPE_INPUT_MODE, "GDK_");
210
-
218
+ G_DEF_CLASS(GDK_TYPE_INPUT_MODE, "InputMode", RG_TARGET_NAMESPACE);
219
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_INPUT_MODE, "GDK_");
220
+
211
221
  /* GdkAxisUse */
212
- G_DEF_CLASS(GDK_TYPE_AXIS_USE, "AxisUse", dev);
213
- G_DEF_CONSTANTS(dev, GDK_TYPE_AXIS_USE, "GDK_");
222
+ G_DEF_CLASS(GDK_TYPE_AXIS_USE, "AxisUse", RG_TARGET_NAMESPACE);
223
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_AXIS_USE, "GDK_");
214
224
 
215
225
  /* GdkExtensionMode */
216
- G_DEF_CLASS(GDK_TYPE_EXTENSION_MODE, "ExtensionMode", dev);
217
- G_DEF_CONSTANTS(dev, GDK_TYPE_EXTENSION_MODE, "GDK_");
226
+ G_DEF_CLASS(GDK_TYPE_EXTENSION_MODE, "ExtensionMode", RG_TARGET_NAMESPACE);
227
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_EXTENSION_MODE, "GDK_");
218
228
 
219
229
  }