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,93 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtk.c -
5
+
6
+ $Author: sakai $
7
+ $Date: 2007/07/04 13:33:17 $
8
+
9
+ Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2001 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #include "global.h"
16
+ #ifdef HAVE_SYS_TIME_H
17
+ # include <sys/time.h>
18
+ #endif
19
+
20
+ VALUE mGtk;
21
+
22
+ ID id_relative_callbacks;
23
+ ID id_call;
24
+ static ID id__windows__;
25
+
26
+ static void
27
+ remove_from_windows(GtkWidget *window, VALUE obj)
28
+ {
29
+ VALUE klass;
30
+ klass = rb_obj_class(obj);
31
+ rb_hash_delete(rb_ivar_get(klass, id__windows__), obj);
32
+ }
33
+
34
+ void
35
+ rbgtk_initialize_gtkobject(obj, gtkobj)
36
+ VALUE obj;
37
+ GtkObject *gtkobj;
38
+ {
39
+ gtkobj = g_object_ref(gtkobj);
40
+ gtk_object_sink(gtkobj);
41
+ G_INITIALIZE(obj, gtkobj);
42
+
43
+ if (GTK_IS_WINDOW(gtkobj) || GTK_IS_MENU_SHELL(gtkobj)) {
44
+ VALUE klass;
45
+ klass = rb_obj_class(obj);
46
+ if (rb_ivar_defined(klass, id__windows__) == Qfalse) {
47
+ rb_ivar_set(klass, id__windows__, rb_hash_new());
48
+ }
49
+ rb_hash_aset(rb_ivar_get(klass, id__windows__), obj, Qnil);
50
+ g_signal_connect_after(gtkobj, "destroy",
51
+ G_CALLBACK(remove_from_windows),
52
+ (gpointer)obj);
53
+ }
54
+ }
55
+
56
+ void
57
+ exec_callback(widget, proc)
58
+ GtkWidget *widget;
59
+ gpointer proc;
60
+ {
61
+ rb_funcall((VALUE)proc, id_call, 1, GOBJ2RVAL(widget));
62
+ }
63
+
64
+ /*
65
+ * Gtk module
66
+ */
67
+
68
+ /* We can't use rbgtk_poll() on native Win32.
69
+ Because GPollFD doesn't have file descriptor but HANDLE. */
70
+ #define USE_POLL_FUNC
71
+
72
+ static VALUE
73
+ gtk_m_events_pending(self)
74
+ VALUE self;
75
+ {
76
+ return CBOOL2RVAL(gtk_events_pending());
77
+ }
78
+
79
+ /*
80
+ * Init
81
+ */
82
+ void
83
+ Init_gtk_gtk()
84
+ {
85
+ id_call = rb_intern("call");
86
+ id__windows__ = rb_intern("__windows__");
87
+
88
+ mGtk = rb_define_module("Gtk");
89
+ rb_ivar_set(mGtk, id_relative_callbacks, Qnil);
90
+
91
+ rb_define_module_function(mGtk, "events_pending?", gtk_m_events_pending, 0);
92
+
93
+ }
@@ -0,0 +1,121 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtk.h -
5
+
6
+ $Author: sakai $
7
+ $Date: 2007/07/06 10:13:27 $
8
+
9
+ Copyright (C) 2003-2006 Ruby-GNOME2 Project Team
10
+ Copyright (C) 1998-2000 Yukihiro Matsumoto,
11
+ Daisuke Kanda,
12
+ Hiroshi Igarashi
13
+ ************************************************/
14
+
15
+ #ifndef _RBGTK_H
16
+ #define _RBGTK_H
17
+
18
+ #include <rbgobject.h>
19
+ #include <rbgtkmacros.h>
20
+ #include <gtk/gtk.h>
21
+ #include <rbgdk.h>
22
+ #include <rbgtkconversions.h>
23
+
24
+ #include <signal.h>
25
+
26
+ #define RubyGtkContainerHookModule "RubyGtkContainerHook__"
27
+
28
+ #define RBGTK_MAJOR_VERSION RBGLIB_MAJOR_VERSION
29
+ #define RBGTK_MINOR_VERSION RBGLIB_MINOR_VERSION
30
+ #define RBGTK_MICRO_VERSION RBGLIB_MICRO_VERSION
31
+
32
+ #define RBGTK_INITIALIZE(obj,gtkobj)\
33
+ (rbgtk_initialize_gtkobject(obj, GTK_OBJECT(gtkobj)))
34
+
35
+ #define GTK_TYPE_ALLOCATION (gtk_allocation_get_type())
36
+ #define GTK_TYPE_ACCEL_KEY (gtk_accel_key_get_type())
37
+ #define GTK_TYPE_ACCEL_GROUP_ENTRY (gtk_accel_group_entry_get_type())
38
+ #define GTK_TYPE_BINDING_SET (gtk_bindingset_get_type())
39
+ #define GTK_TYPE_TEXT_APPEARANCE (gtk_text_appearance_get_type())
40
+ #define GTK_TYPE_RECENT_FILTER_INFO (gtk_recent_filter_info_get_type())
41
+ #define GTK_TYPE_RECENT_DATA (gtk_recent_data_get_type())
42
+ #ifndef GTK_TYPE_TARGET_LIST
43
+ extern GType gtk_target_list_get_type();
44
+ #define GTK_TYPE_TARGET_LIST (gtk_target_list_get_type())
45
+ #endif
46
+
47
+ RUBY_GTK2_VAR VALUE mGtk;
48
+
49
+ /*
50
+ * for gtk2.0/gtk2.2
51
+ */
52
+ #ifndef GTK_TYPE_CLIPBOARD
53
+ #define GTK_TYPE_CLIPBOARD (rbgtk_clipboard_get_type())
54
+ #define RVAL2CLIPBOARD(obj) (rbgtk_get_clipboard(obj))
55
+ #define CLIPBOARD2RVAL(val) (rbgtk_make_clipboard(val))
56
+ extern GType rbgtk_clipboard_get_type();
57
+ extern GtkClipboard* rbgtk_get_clipboard(VALUE obj);
58
+ extern VALUE rbgtk_make_clipboard(GtkClipboard* gobj);
59
+ #else
60
+ #define RVAL2CLIPBOARD(obj) (GTK_CLIPBOARD(RVAL2GOBJ(obj)))
61
+ #define CLIPBOARD2RVAL(val) (GOBJ2RVAL(val))
62
+ #endif
63
+
64
+ #ifndef GTK_TYPE_TREE_ROW_REFERENCE
65
+ #define GTK_TYPE_TREE_ROW_REFERENCE (rbgtk_tree_row_reference_get_type())
66
+ #define RVAL2TREEROWREFERENCE(obj) (rbgtk_get_tree_row_reference(obj))
67
+ extern GType rbgtk_tree_row_reference_get_type();
68
+ extern GtkTreeRowReference* rbgtk_get_tree_row_reference(VALUE obj);
69
+ #else
70
+ #define RVAL2TREEROWREFERENCE(obj) ((GtkTreeRowReference*)(RVAL2BOXED(obj, GTK_TYPE_TREE_ROW_REFERENCE)))
71
+ #endif
72
+
73
+
74
+ /*
75
+ * for gtk
76
+ */
77
+ extern void rbgtk_initialize_gtkobject(VALUE obj, GtkObject *gtkobj);
78
+ extern void exec_callback(GtkWidget *widget, gpointer proc);
79
+ extern GType gtk_allocation_get_type();
80
+ extern GType gtk_accel_key_get_type();
81
+ extern GType gtk_accel_group_entry_get_type();
82
+ extern GType gtk_bindingset_get_type();
83
+ extern GType gtk_text_appearance_get_type();
84
+ extern GType gtk_recent_filter_info_get_type();
85
+ extern GType gtk_recent_data_get_type();
86
+
87
+ /*
88
+ * Gtk::TreeIter callback
89
+ */
90
+ typedef void (*rbgtkiter_set_value_func)(void *model, GtkTreeIter *iter,
91
+ gint column, GValue *value);
92
+ extern void rbgtk_register_treeiter_set_value_func(GType, rbgtkiter_set_value_func);
93
+
94
+ /*
95
+ * Gtk::SelectionData
96
+ */
97
+ extern void rbgtk_atom2selectiondata(VALUE type, VALUE size, VALUE src, GdkAtom* gtype,
98
+ void** data, gint* format, gint* length);
99
+ extern void rbgtk_atom2selectiondata_free(GdkAtom gtype, void* data);
100
+
101
+ /*
102
+ * Gtk::Drag
103
+ */
104
+ extern GtkTargetEntry* rbgtk_get_target_entry(VALUE targets);
105
+
106
+ /*
107
+ * Gtk::Container
108
+ */
109
+ extern void rbgtkcontainer_register_child_property_setter(GType gtype,
110
+ const char* prop_name,
111
+ RValueToGValueFunc func);
112
+ extern void rbgtkcontainer_register_child_property_getter(GType gtype,
113
+ const char* prop_name,
114
+ GValueToRValueFunc func);
115
+
116
+ /*
117
+ * Dialog
118
+ */
119
+ extern VALUE rbgtk_dialog_add_buttons_internal(VALUE self, VALUE button_ary);
120
+
121
+ #endif /* _RBGTK_H */
@@ -0,0 +1,195 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkaboutdialog.c -
5
+
6
+ $Author: ktou $
7
+ $Date: 2007/08/17 11:52:05 $
8
+
9
+ Copyright (C) 2005 Masao Mutoh
10
+ ************************************************/
11
+
12
+ #include "global.h"
13
+
14
+ #if GTK_CHECK_VERSION(2,6,0)
15
+
16
+ #define _SELF(self) (GTK_ABOUT_DIALOG(RVAL2GOBJ(self)))
17
+
18
+ static VALUE
19
+ aboutdialog_initialize(self)
20
+ VALUE self;
21
+ {
22
+ RBGTK_INITIALIZE(self, gtk_about_dialog_new());
23
+ return Qnil;
24
+ }
25
+
26
+ /* Defined as Properties
27
+ const gchar* gtk_about_dialog_get_name (GtkAboutDialog *about);
28
+ void gtk_about_dialog_set_name (GtkAboutDialog *about,
29
+ const gchar *name);
30
+ const gchar* gtk_about_dialog_get_version (GtkAboutDialog *about);
31
+ void gtk_about_dialog_set_version (GtkAboutDialog *about,
32
+ const gchar *version);
33
+ const gchar* gtk_about_dialog_get_copyright (GtkAboutDialog *about);
34
+ void gtk_about_dialog_set_copyright (GtkAboutDialog *about,
35
+ const gchar *copyright);
36
+ const gchar* gtk_about_dialog_get_comments (GtkAboutDialog *about);
37
+ void gtk_about_dialog_set_comments (GtkAboutDialog *about,
38
+ const gchar *comments);
39
+ const gchar* gtk_about_dialog_get_license (GtkAboutDialog *about);
40
+ void gtk_about_dialog_set_license (GtkAboutDialog *about,
41
+ const gchar *license);
42
+ const gchar* gtk_about_dialog_get_website (GtkAboutDialog *about);
43
+ void gtk_about_dialog_set_website (GtkAboutDialog *about,
44
+ const gchar *website);
45
+ const gchar* gtk_about_dialog_get_website_label
46
+ (GtkAboutDialog *about);
47
+ void gtk_about_dialog_set_website_label
48
+ (GtkAboutDialog *about,
49
+ const gchar *website_label);
50
+ const gchar* const * gtk_about_dialog_get_authors
51
+ (GtkAboutDialog *about);
52
+ void gtk_about_dialog_set_authors (GtkAboutDialog *about,
53
+ const gchar **authors);
54
+ const gchar* const * gtk_about_dialog_get_artists
55
+ (GtkAboutDialog *about);
56
+ void gtk_about_dialog_set_artists (GtkAboutDialog *about,
57
+ const gchar **artists);
58
+ const gchar* const * gtk_about_dialog_get_documenters
59
+ (GtkAboutDialog *about);
60
+ void gtk_about_dialog_set_documenters
61
+ (GtkAboutDialog *about,
62
+ const gchar **documenters);
63
+ const gchar* gtk_about_dialog_get_translator_credits
64
+ (GtkAboutDialog *about);
65
+ void gtk_about_dialog_set_translator_credits
66
+ (GtkAboutDialog *about,
67
+ const gchar *translator_credits);
68
+ GdkPixbuf* gtk_about_dialog_get_logo (GtkAboutDialog *about);
69
+ void gtk_about_dialog_set_logo (GtkAboutDialog *about,
70
+ GdkPixbuf *logo);
71
+ const gchar* gtk_about_dialog_get_logo_icon_name
72
+ (GtkAboutDialog *about);
73
+ void gtk_about_dialog_set_logo_icon_name
74
+ (GtkAboutDialog *about,
75
+ const gchar *icon_name);
76
+ gboolean gtk_about_dialog_get_wrap_license
77
+ (GtkAboutDialog *about);
78
+ void gtk_about_dialog_set_wrap_license
79
+ (GtkAboutDialog *about,
80
+ gboolean wrap_license);
81
+ */
82
+
83
+ static void
84
+ activate_link_func(about, link, func)
85
+ GtkAboutDialog* about;
86
+ const gchar* link;
87
+ gpointer func;
88
+ {
89
+ rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(about), CSTR2RVAL(link));
90
+ }
91
+
92
+ static VALUE
93
+ aboutdialog_s_set_email_hook(self)
94
+ VALUE self;
95
+ {
96
+ VALUE func = rb_block_proc();
97
+ G_RELATIVE(self, func);
98
+ gtk_about_dialog_set_email_hook((GtkAboutDialogActivateLinkFunc)activate_link_func, (gpointer)func, (GDestroyNotify)NULL);
99
+ return self;
100
+ }
101
+
102
+ static VALUE
103
+ aboutdialog_s_set_url_hook(self)
104
+ VALUE self;
105
+ {
106
+ VALUE func = rb_block_proc();
107
+ G_RELATIVE(self, func);
108
+ gtk_about_dialog_set_url_hook((GtkAboutDialogActivateLinkFunc)activate_link_func, (gpointer)func, (GDestroyNotify)NULL);
109
+ return self;
110
+ }
111
+
112
+
113
+ typedef struct {
114
+ const char *name;
115
+ gpointer value;
116
+ } prop_data;
117
+
118
+ #define ABOUT_PROP_NUM (15)
119
+
120
+ static VALUE
121
+ aboutdialog_s_show_about_dialog(self, parent, props)
122
+ VALUE self, parent, props;
123
+ {
124
+ int i;
125
+ VALUE ary;
126
+ prop_data pd[ABOUT_PROP_NUM];
127
+
128
+ Check_Type(props, T_HASH);
129
+
130
+ ary = rb_funcall(props, rb_intern("to_a"), 0);
131
+
132
+ if (RARRAY_LEN(ary) > ABOUT_PROP_NUM)
133
+ rb_raise(rb_eArgError, "Too many args.");
134
+
135
+ for (i = 0; i < ABOUT_PROP_NUM; i++){
136
+ pd[i].name = (const char*)NULL;
137
+ pd[i].value = (gpointer)NULL;
138
+ }
139
+ for (i = 0; i < RARRAY_LEN(ary); i++){
140
+ if (TYPE(RARRAY_PTR(RARRAY_PTR(ary)[i])[0]) == T_SYMBOL){
141
+ pd[i].name = rb_id2name(SYM2ID(RARRAY_PTR(RARRAY_PTR(ary)[i])[0]));
142
+ } else {
143
+ pd[i].name = RVAL2CSTR(RARRAY_PTR(RARRAY_PTR(ary)[i])[0]);
144
+ }
145
+ if (strncmp(pd[i].name, "artists", strlen("artists")) == 0||
146
+ strncmp(pd[i].name, "authors", strlen("authors")) == 0||
147
+ strncmp(pd[i].name, "documenters", strlen("documenters")) == 0){
148
+ GValue gval = {0,};
149
+ g_value_init(&gval, G_TYPE_STRV);
150
+ rbgobj_rvalue_to_gvalue(RARRAY_PTR(RARRAY_PTR(ary)[i])[1], &gval);
151
+
152
+ pd[i].value = g_boxed_copy(G_TYPE_STRV, g_value_get_boxed(&gval));
153
+ } else if (strncmp(pd[i].name, "logo", strlen("logo")) == 0 &&
154
+ strlen(pd[i].name) == strlen("logo")){
155
+ pd[i].value = g_object_ref(RVAL2GOBJ(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]));
156
+ } else if (strncmp(pd[i].name, "wrap_license", strlen("wrap_license")) == 0){
157
+ pd[i].value = GINT_TO_POINTER(RVAL2CBOOL(RARRAY_PTR(ary)[i]));
158
+ } else {
159
+ pd[i].value = g_strdup(RVAL2CSTR(RARRAY_PTR(RARRAY_PTR(ary)[i])[1]));
160
+ }
161
+ }
162
+
163
+ gtk_show_about_dialog(GTK_WINDOW(RVAL2GOBJ(parent)),
164
+ pd[0].name, pd[0].value,
165
+ pd[1].name, pd[1].value,
166
+ pd[2].name, pd[2].value,
167
+ pd[3].name, pd[3].value,
168
+ pd[4].name, pd[4].value,
169
+ pd[5].name, pd[5].value,
170
+ pd[6].name, pd[6].value,
171
+ pd[7].name, pd[7].value,
172
+ pd[8].name, pd[8].value,
173
+ pd[9].name, pd[9].value,
174
+ pd[10].name, pd[10].value,
175
+ pd[11].name, pd[11].value,
176
+ pd[12].name, pd[12].value,
177
+ pd[13].name, pd[13].value,
178
+ pd[14].name, pd[14].value,
179
+ NULL);
180
+ return self;
181
+ }
182
+ #endif
183
+
184
+ void
185
+ Init_gtk_aboutdialog()
186
+ {
187
+ #if GTK_CHECK_VERSION(2,6,0)
188
+ VALUE gAboutDialog = G_DEF_CLASS(GTK_TYPE_ABOUT_DIALOG, "AboutDialog", mGtk);
189
+ rb_define_method(gAboutDialog, "initialize", aboutdialog_initialize, 0);
190
+
191
+ rb_define_singleton_method(gAboutDialog, "set_email_hook", aboutdialog_s_set_email_hook, 0);
192
+ rb_define_singleton_method(gAboutDialog, "set_url_hook", aboutdialog_s_set_url_hook, 0);
193
+ rb_define_singleton_method(gAboutDialog, "show", aboutdialog_s_show_about_dialog, 2);
194
+ #endif
195
+ }
@@ -0,0 +1,78 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtkaccelerator.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 14:27:09 $
8
+
9
+ Copyright (C) 2002,2003 Masao Mutoh
10
+ ************************************************/
11
+ #include "global.h"
12
+
13
+ #define RVAL2MOD(mods) RVAL2GFLAGS(mods, GDK_TYPE_MODIFIER_TYPE)
14
+
15
+ static VALUE
16
+ accel_valid(self, keyval, modifiers)
17
+ VALUE self, keyval, modifiers;
18
+ {
19
+ return CBOOL2RVAL(gtk_accelerator_valid(NUM2UINT(keyval), RVAL2MOD(modifiers)));
20
+ }
21
+
22
+ static VALUE
23
+ accel_parse(self, accelerator)
24
+ VALUE self, accelerator;
25
+ {
26
+ guint key;
27
+ GdkModifierType mods;
28
+ gtk_accelerator_parse(RVAL2CSTR(accelerator), &key, &mods);
29
+ return rb_ary_new3(2, UINT2NUM(key), GFLAGS2RVAL(mods, GDK_TYPE_MODIFIER_TYPE));
30
+ }
31
+
32
+ static VALUE
33
+ accel_name(self, key, mods)
34
+ VALUE self, key, mods;
35
+ {
36
+ return CSTR2RVAL(gtk_accelerator_name(NUM2UINT(key), RVAL2MOD(mods)));
37
+ }
38
+
39
+ #if GTK_CHECK_VERSION(2,6,0)
40
+ static VALUE
41
+ accel_get_label(self, key, mods)
42
+ VALUE self, key, mods;
43
+ {
44
+ return CSTR2RVAL(gtk_accelerator_get_label(NUM2UINT(key), RVAL2MOD(mods)));
45
+ }
46
+ #endif
47
+
48
+ static VALUE
49
+ accel_set_default_mod_mask(self, default_mod_mask)
50
+ VALUE self, default_mod_mask;
51
+ {
52
+ gtk_accelerator_set_default_mod_mask(RVAL2MOD(default_mod_mask));
53
+ return self;
54
+ }
55
+
56
+ static VALUE
57
+ accel_get_default_mod_mask(self)
58
+ VALUE self;
59
+ {
60
+ return GFLAGS2RVAL(gtk_accelerator_get_default_mod_mask(), GDK_TYPE_MODIFIER_TYPE);
61
+ }
62
+
63
+ void
64
+ Init_gtk_accelerator()
65
+ {
66
+ VALUE mGtkAccel = rb_define_module_under(mGtk, "Accelerator");
67
+
68
+ rb_define_singleton_method(mGtkAccel, "valid", accel_valid, 2);
69
+ rb_define_singleton_method(mGtkAccel, "parse", accel_parse, 1);
70
+ /* name is reserved by Ruby */
71
+ rb_define_singleton_method(mGtkAccel, "to_name", accel_name, 2);
72
+ #if GTK_CHECK_VERSION(2,6,0)
73
+ rb_define_singleton_method(mGtkAccel, "get_label", accel_get_label, 2);
74
+ #endif
75
+ rb_define_singleton_method(mGtkAccel, "set_default_mod_mask", accel_set_default_mod_mask, 1);
76
+ rb_define_singleton_method(mGtkAccel, "default_mod_mask", accel_get_default_mod_mask, 0);
77
+ G_DEF_SETTERS(mGtkAccel);
78
+ }