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,186 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkobject.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 14:27:10 $
8
+
9
+ Copyright (C) 2002-2004 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
+ /*
18
+ We shouldn't implement it.
19
+ void gtk_object_sink (GtkObject *object);
20
+ #define GTK_OBJECT_FLOATING (obj)
21
+
22
+ gtk_object_new is deprecated. Use g_object_new instead.
23
+ GtkObject* gtk_object_new (GtkType type,
24
+ const gchar *first_property_name,
25
+ ...);
26
+ */
27
+
28
+ static VALUE
29
+ gobj_get_type_name(self)
30
+ VALUE self;
31
+ {
32
+ return CSTR2RVAL(GTK_OBJECT_TYPE_NAME(RVAL2GOBJ(self)));
33
+ }
34
+
35
+ /*
36
+ They are all Deprecated.
37
+ void gtk_object_get (GtkObject *object,
38
+ const gchar *first_property_name,
39
+ ...);
40
+ void gtk_object_set (GtkObject *object,
41
+ const gchar *first_property_name,
42
+ ...);
43
+ void gtk_object_set_data (GtkObject *object,
44
+ const gchar *key,
45
+ gpointer data);
46
+ void gtk_object_set_data_full (GtkObject *object,
47
+ const gchar *key,
48
+ gpointer data,
49
+ GtkDestroyNotify destroy);
50
+ void gtk_object_remove_data (GtkObject *object,
51
+ const gchar *key);
52
+ gpointer gtk_object_get_data (GtkObject *object,
53
+ const gchar *key);
54
+ void gtk_object_remove_no_notify (GtkObject *object,
55
+ const gchar *key);
56
+ void gtk_object_set_user_data (GtkObject *object,
57
+ gpointer data);
58
+ gpointer gtk_object_get_user_data (GtkObject *object);
59
+ void gtk_object_add_arg_type (const gchar *arg_name,
60
+ GtkType arg_type,
61
+ guint arg_flags,
62
+ guint arg_id);
63
+ void gtk_object_set_data_by_id (GtkObject *object,
64
+ GQuark data_id,
65
+ gpointer data);
66
+ void gtk_object_set_data_by_id_full (GtkObject *object,
67
+ GQuark data_id,
68
+ gpointer data,
69
+ GtkDestroyNotify destroy);
70
+ gpointer gtk_object_get_data_by_id (GtkObject *object,
71
+ GQuark data_id);
72
+ void gtk_object_remove_data_by_id (GtkObject *object,
73
+ GQuark data_id);
74
+ void gtk_object_remove_no_notify_by_id
75
+ (GtkObject *object,
76
+ GQuark key_id);
77
+ #define gtk_object_data_try_key
78
+ #define gtk_object_data_force_id
79
+ */
80
+
81
+ static VALUE
82
+ gobj_destroy(self)
83
+ VALUE self;
84
+ {
85
+ gtk_object_destroy(GTK_OBJECT(RVAL2GOBJ(self)));
86
+ return Qnil;
87
+ }
88
+
89
+ static VALUE
90
+ gobj_get_flags(self)
91
+ VALUE self;
92
+ {
93
+ /* _GtkObject.flags is int32 */
94
+ return(INT2FIX(GTK_OBJECT_FLAGS(RVAL2GOBJ(self))));
95
+ }
96
+
97
+ static VALUE
98
+ gobj_set_flags(self, flags)
99
+ VALUE self, flags;
100
+ {
101
+ GTK_OBJECT_SET_FLAGS(RVAL2GOBJ(self), NUM2INT(flags));
102
+ return self;
103
+ }
104
+
105
+ static VALUE
106
+ gobj_unset_flags(self, flags)
107
+ VALUE self, flags;
108
+ {
109
+ GTK_OBJECT_UNSET_FLAGS(RVAL2GOBJ(self), NUM2INT(flags));
110
+ return self;
111
+ }
112
+
113
+ /* Move from Bindings */
114
+ static VALUE
115
+ gobj_bindings_activate(self, keyval, modifiers)
116
+ VALUE self, keyval, modifiers;
117
+ {
118
+ return CBOOL2RVAL(gtk_bindings_activate(GTK_OBJECT(RVAL2GOBJ(self)),
119
+ NUM2UINT(keyval),
120
+ NUM2UINT(modifiers)));
121
+ }
122
+
123
+ /* Move from Bindings */
124
+ static VALUE
125
+ gobj_s_binding_set(self)
126
+ VALUE self;
127
+ {
128
+ GType gtype;
129
+ gpointer gclass;
130
+ GtkBindingSet* binding_set;
131
+
132
+ Check_Type(self, T_CLASS);
133
+
134
+ gtype = CLASS2GTYPE(self);
135
+
136
+ if (!G_TYPE_IS_CLASSED(gtype)) {
137
+ rb_raise(rb_eTypeError, "%s is not a classed GType",
138
+ rb_class2name(self));
139
+ }
140
+ gclass = g_type_class_ref(gtype);
141
+ if (!gclass) {
142
+ rb_raise(rb_eRuntimeError, "couldn't get class reference");
143
+ }
144
+ if (!GTK_IS_OBJECT_CLASS(gclass)) {
145
+ g_type_class_unref(gclass);
146
+ rb_raise(rb_eTypeError, "%s is not a Gtk Object class",
147
+ rb_class2name(self));
148
+ }
149
+
150
+ binding_set = gtk_binding_set_by_class(gclass);
151
+ if (!binding_set) {
152
+ g_type_class_unref(gclass);
153
+ rb_raise(rb_eRuntimeError, "couldn't get BindingSet from %s",
154
+ rb_class2name(self));
155
+ }
156
+ g_type_class_unref(gclass);
157
+
158
+ return BOXED2RVAL(binding_set, GTK_TYPE_BINDING_SET);
159
+ }
160
+
161
+
162
+ void
163
+ Init_gtk_object()
164
+ {
165
+ VALUE gObject = G_DEF_CLASS(GTK_TYPE_OBJECT, "Object", mGtk);
166
+
167
+ rb_define_singleton_method(gObject, "binding_set", gobj_s_binding_set, 0);
168
+
169
+ rb_define_method(gObject, "type_name", gobj_get_type_name, 0);
170
+ rb_define_method(gObject, "flags", gobj_get_flags, 0);
171
+ rb_define_method(gObject, "set_flags", gobj_set_flags, 1);
172
+ rb_define_method(gObject, "unset_flags", gobj_unset_flags, 1);
173
+ rb_define_method(gObject, "destroy", gobj_destroy, 0);
174
+ rb_define_method(gObject, "bindings_activate", gobj_bindings_activate, 2);
175
+
176
+ /* GtkObjectFlags */
177
+ G_DEF_CLASS(GTK_TYPE_OBJECT_FLAGS, "Flags", gObject);
178
+ G_DEF_CONSTANTS(gObject, GTK_TYPE_OBJECT_FLAGS, "GTK_");
179
+
180
+ /* undef deprecated properties */
181
+ rb_undef_method(gObject, "user_data");
182
+ rb_undef_method(gObject, "user_data=");
183
+ rb_undef_method(gObject, "set_user_data");
184
+
185
+ G_DEF_SETTERS(gObject);
186
+ }
@@ -0,0 +1,65 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkoptionmenu.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2004/05/30 16:41:13 $
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
+ #ifndef GTK_DISABLE_DEPRECATED /* Since 2.4 */
18
+
19
+ static VALUE
20
+ omenu_initialize(self)
21
+ VALUE self;
22
+ {
23
+ RBGTK_INITIALIZE(self, gtk_option_menu_new());
24
+ return Qnil;
25
+ }
26
+
27
+ static VALUE
28
+ omenu_remove_menu(self)
29
+ VALUE self;
30
+ {
31
+ gtk_option_menu_remove_menu(GTK_OPTION_MENU(RVAL2GOBJ(self)));
32
+ return self;
33
+ }
34
+
35
+ static VALUE
36
+ omenu_set_history(self, index)
37
+ VALUE self, index;
38
+ {
39
+ gtk_option_menu_set_history(GTK_OPTION_MENU(RVAL2GOBJ(self)), NUM2INT(index));
40
+ return self;
41
+ }
42
+
43
+ static VALUE
44
+ omenu_get_history(self)
45
+ VALUE self;
46
+ {
47
+ return INT2NUM(gtk_option_menu_get_history(GTK_OPTION_MENU(RVAL2GOBJ(self))));
48
+ }
49
+
50
+ #endif
51
+
52
+ void
53
+ Init_gtk_option_menu()
54
+ {
55
+ #ifndef GTK_DISABLE_DEPRECATED /* Since 2.4 */
56
+ VALUE gOptionMenu = G_DEF_CLASS(GTK_TYPE_OPTION_MENU, "OptionMenu", mGtk);
57
+
58
+ rb_define_method(gOptionMenu, "initialize", omenu_initialize, 0);
59
+ rb_define_method(gOptionMenu, "remove_menu", omenu_remove_menu, 0);
60
+ rb_define_method(gOptionMenu, "set_history", omenu_set_history, 1);
61
+ rb_define_method(gOptionMenu, "history", omenu_get_history, 0);
62
+
63
+ G_DEF_SETTERS(gOptionMenu);
64
+ #endif
65
+ }
@@ -0,0 +1,196 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkpagesetup.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2006/11/15 23:46:13 $
8
+
9
+ Copyright (C) 2006 Ruby-GNOME2 Project Team
10
+ ************************************************/
11
+
12
+ #include "global.h"
13
+
14
+ #if GTK_CHECK_VERSION(2,10,0)
15
+
16
+ #define _SELF(s) (GTK_PAGE_SETUP(RVAL2GOBJ(s)))
17
+
18
+ #define RVAL2SIZE(o) (RVAL2BOXED(o, GTK_TYPE_PAPER_SIZE))
19
+ #define RVAL2UNIT(o) (RVAL2GENUM(o, GTK_TYPE_UNIT))
20
+
21
+ static VALUE
22
+ ps_initialize(VALUE self)
23
+ {
24
+ G_INITIALIZE(self, gtk_page_setup_new());
25
+ return Qnil;
26
+ }
27
+
28
+ static VALUE
29
+ ps_copy(VALUE self)
30
+ {
31
+ return GOBJ2RVALU(gtk_page_setup_copy(_SELF(self)));
32
+ }
33
+
34
+ static VALUE
35
+ ps_get_orientation(VALUE self)
36
+ {
37
+ return GENUM2RVAL(gtk_page_setup_get_orientation(_SELF(self)),
38
+ GTK_TYPE_PAGE_ORIENTATION);
39
+ }
40
+
41
+ static VALUE
42
+ ps_set_orientation(VALUE self, VALUE orientation)
43
+ {
44
+ gtk_page_setup_set_orientation(_SELF(self),
45
+ RVAL2GENUM(orientation, GTK_TYPE_PAGE_ORIENTATION));
46
+ return self;
47
+ }
48
+
49
+ static VALUE
50
+ ps_get_paper_size(VALUE self)
51
+ {
52
+ return BOXED2RVAL(gtk_page_setup_get_paper_size(_SELF(self)), GTK_TYPE_PAPER_SIZE);
53
+ }
54
+
55
+ static VALUE
56
+ ps_set_paper_size(VALUE self, VALUE paper_size)
57
+ {
58
+ gtk_page_setup_set_paper_size(_SELF(self), RVAL2SIZE(paper_size));
59
+ return self;
60
+ }
61
+
62
+ static VALUE
63
+ ps_get_top_margin(VALUE self, VALUE unit)
64
+ {
65
+ return rb_float_new(gtk_page_setup_get_top_margin(_SELF(self),
66
+ RVAL2UNIT(unit)));
67
+ }
68
+
69
+ static VALUE
70
+ ps_set_top_margin(VALUE self, VALUE margin, VALUE unit)
71
+ {
72
+ gtk_page_setup_set_top_margin(_SELF(self), NUM2DBL(margin),
73
+ RVAL2UNIT(unit));
74
+ return self;
75
+ }
76
+
77
+ static VALUE
78
+ ps_get_bottom_margin(VALUE self, VALUE unit)
79
+ {
80
+ return rb_float_new(gtk_page_setup_get_bottom_margin(_SELF(self),
81
+ RVAL2UNIT(unit)));
82
+ }
83
+
84
+ static VALUE
85
+ ps_set_bottom_margin(VALUE self, VALUE margin, VALUE unit)
86
+ {
87
+ gtk_page_setup_set_bottom_margin(_SELF(self), NUM2DBL(margin),
88
+ RVAL2UNIT(unit));
89
+ return self;
90
+ }
91
+
92
+ static VALUE
93
+ ps_get_left_margin(VALUE self, VALUE unit)
94
+ {
95
+ return rb_float_new(gtk_page_setup_get_left_margin(_SELF(self),
96
+ RVAL2UNIT(unit)));
97
+ }
98
+
99
+ static VALUE
100
+ ps_set_left_margin(VALUE self, VALUE margin, VALUE unit)
101
+ {
102
+ gtk_page_setup_set_left_margin(_SELF(self), NUM2DBL(margin),
103
+ RVAL2UNIT(unit));
104
+ return self;
105
+ }
106
+
107
+ static VALUE
108
+ ps_get_right_margin(VALUE self, VALUE unit)
109
+ {
110
+ return rb_float_new(gtk_page_setup_get_right_margin(_SELF(self),
111
+ RVAL2UNIT(unit)));
112
+ }
113
+
114
+ static VALUE
115
+ ps_set_right_margin(VALUE self, VALUE margin, VALUE unit)
116
+ {
117
+ gtk_page_setup_set_right_margin(_SELF(self), NUM2DBL(margin),
118
+ RVAL2UNIT(unit));
119
+ return self;
120
+ }
121
+
122
+ static VALUE
123
+ ps_set_paper_size_and_default_margins(VALUE self, VALUE size)
124
+ {
125
+ gtk_page_setup_set_paper_size_and_default_margins(_SELF(self),
126
+ RVAL2SIZE(size));
127
+ return self;
128
+ }
129
+
130
+ /* These take orientation, but not margins into consideration */
131
+ static VALUE
132
+ ps_get_paper_width(VALUE self, VALUE unit)
133
+ {
134
+ return rb_float_new(gtk_page_setup_get_paper_width(_SELF(self),
135
+ RVAL2UNIT(unit)));
136
+ }
137
+
138
+ static VALUE
139
+ ps_get_paper_height(VALUE self, VALUE unit)
140
+ {
141
+ return rb_float_new(gtk_page_setup_get_paper_height(_SELF(self),
142
+ RVAL2UNIT(unit)));
143
+ }
144
+
145
+ /* These take orientation, and margins into consideration */
146
+ static VALUE
147
+ ps_get_page_width(VALUE self, VALUE unit)
148
+ {
149
+ return rb_float_new(gtk_page_setup_get_page_width(_SELF(self),
150
+ RVAL2UNIT(unit)));
151
+ }
152
+
153
+ static VALUE
154
+ ps_get_page_height(VALUE self, VALUE unit)
155
+ {
156
+ return rb_float_new(gtk_page_setup_get_page_height(_SELF(self),
157
+ RVAL2UNIT(unit)));
158
+ }
159
+ #endif
160
+
161
+ void
162
+ Init_gtk_page_setup()
163
+ {
164
+ #if GTK_CHECK_VERSION(2,10,0)
165
+ VALUE gPageSetup = G_DEF_CLASS(GTK_TYPE_PAGE_SETUP, "PageSetup", mGtk);
166
+
167
+ rb_define_method(gPageSetup, "initialize", ps_initialize, 0);
168
+ rb_define_method(gPageSetup, "dup", ps_copy, 0);
169
+
170
+ rb_define_method(gPageSetup, "orientation", ps_get_orientation, 0);
171
+ rb_define_method(gPageSetup, "set_orientation", ps_set_orientation, 1);
172
+ rb_define_method(gPageSetup, "paper_size", ps_get_paper_size, 0);
173
+ rb_define_method(gPageSetup, "set_paper_size", ps_set_paper_size, 1);
174
+ rb_define_method(gPageSetup, "get_top_margin", ps_get_top_margin, 1);
175
+ rb_define_method(gPageSetup, "set_top_margin", ps_set_top_margin, 2);
176
+ rb_define_method(gPageSetup, "get_bottom_margin", ps_get_bottom_margin, 1);
177
+ rb_define_method(gPageSetup, "set_bottom_margin", ps_set_bottom_margin, 2);
178
+ rb_define_method(gPageSetup, "get_left_margin", ps_get_left_margin, 1);
179
+ rb_define_method(gPageSetup, "set_left_margin", ps_set_left_margin, 2);
180
+ rb_define_method(gPageSetup, "get_right_margin", ps_get_right_margin, 1);
181
+ rb_define_method(gPageSetup, "set_right_margin", ps_set_right_margin, 2);
182
+
183
+ rb_define_method(gPageSetup, "set_paper_size_and_default_margins",
184
+ ps_set_paper_size_and_default_margins, 1);
185
+
186
+ /* These take orientation, but not margins into consideration */
187
+ rb_define_method(gPageSetup, "get_paper_width", ps_get_paper_width, 1);
188
+ rb_define_method(gPageSetup, "get_paper_height", ps_get_paper_height, 1);
189
+
190
+ /* These take orientation, and margins into consideration */
191
+ rb_define_method(gPageSetup, "get_page_width", ps_get_page_width, 1);
192
+ rb_define_method(gPageSetup, "get_page_height", ps_get_page_height, 1);
193
+
194
+ G_DEF_SETTERS(gPageSetup);
195
+ #endif
196
+ }
@@ -0,0 +1,80 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkpagesetupunixdialog.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2006/12/26 15:47:52 $
8
+
9
+ Copyright (C) 2006 Ruby-GNOME2 Project Team
10
+ ************************************************/
11
+
12
+ #include "global.h"
13
+
14
+ #ifdef HAVE_GTK_UNIX_PRINT
15
+ #include <gtk/gtkpagesetupunixdialog.h>
16
+
17
+ #define _SELF(s) (GTK_PAGE_SETUP_UNIX_DIALOG(RVAL2GOBJ(s)))
18
+
19
+ static VALUE
20
+ psud_initialize(int argc, VALUE *argv, VALUE self)
21
+ {
22
+ GtkWidget *dialog;
23
+ VALUE title, parent;
24
+
25
+ rb_scan_args(argc, argv, "02", &title, &parent);
26
+ dialog = gtk_page_setup_unix_dialog_new(RVAL2CSTR2(title), RVAL2GOBJ(parent));
27
+
28
+ RBGTK_INITIALIZE(self, dialog);
29
+ return Qnil;
30
+ }
31
+
32
+ static VALUE
33
+ psud_set_page_setup(VALUE self, VALUE page_setup)
34
+ {
35
+ gtk_page_setup_unix_dialog_set_page_setup(_SELF(self),
36
+ RVAL2GOBJ(page_setup));
37
+ return self;
38
+ }
39
+
40
+ static VALUE
41
+ psud_get_page_setup(VALUE self)
42
+ {
43
+ return GOBJ2RVAL(gtk_page_setup_unix_dialog_get_page_setup(_SELF(self)));
44
+ }
45
+
46
+ static VALUE
47
+ psud_set_print_settings(VALUE self, VALUE print_settings)
48
+ {
49
+ gtk_page_setup_unix_dialog_set_print_settings(_SELF(self),
50
+ RVAL2GOBJ(print_settings));
51
+ return Qnil;
52
+ }
53
+
54
+ static VALUE
55
+ psud_get_print_settings(VALUE self)
56
+ {
57
+ return GOBJ2RVAL(gtk_page_setup_unix_dialog_get_print_settings(_SELF(self)));
58
+ }
59
+ #endif
60
+
61
+ void
62
+ Init_gtk_page_setup_unix_dialog()
63
+ {
64
+ #if HAVE_GTK_UNIX_PRINT
65
+ VALUE gPageSetupUnixDialog = G_DEF_CLASS(GTK_TYPE_PAGE_SETUP_UNIX_DIALOG,
66
+ "PageSetupUnixDialog", mGtk);
67
+
68
+ rb_define_method(gPageSetupUnixDialog, "initialize", psud_initialize, -1);
69
+ rb_define_method(gPageSetupUnixDialog, "set_page_setup",
70
+ psud_set_page_setup, 1);
71
+ rb_define_method(gPageSetupUnixDialog, "page_setup",
72
+ psud_get_page_setup, 0);
73
+ rb_define_method(gPageSetupUnixDialog, "set_print_settings",
74
+ psud_set_print_settings, 1);
75
+ rb_define_method(gPageSetupUnixDialog, "print_settings",
76
+ psud_get_print_settings, 0);
77
+
78
+ G_DEF_SETTERS(gPageSetupUnixDialog);
79
+ #endif
80
+ }