gtk2 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +6664 -0
- data/README +33 -0
- data/Rakefile +71 -0
- data/extconf.rb +116 -0
- data/src/global.h +33 -0
- data/src/init.c +39 -0
- data/src/lib/gtk2.rb +13 -0
- data/src/lib/gtk2/base.rb +95 -0
- data/src/makeinits.rb +57 -0
- data/src/makekeysyms.rb +5 -0
- data/src/rbgdk.c +395 -0
- data/src/rbgdk.h +50 -0
- data/src/rbgdkatom.c +122 -0
- data/src/rbgdkcairo.c +100 -0
- data/src/rbgdkcolor.c +151 -0
- data/src/rbgdkcolormap.c +142 -0
- data/src/rbgdkconst.c +29 -0
- data/src/rbgdkconversions.h +18 -0
- data/src/rbgdkcursor.c +115 -0
- data/src/rbgdkdevice.c +235 -0
- data/src/rbgdkdisplay.c +634 -0
- data/src/rbgdkdisplaymanager.c +50 -0
- data/src/rbgdkdragcontext.c +280 -0
- data/src/rbgdkdraw.c +487 -0
- data/src/rbgdkevent.c +1020 -0
- data/src/rbgdkgc.c +456 -0
- data/src/rbgdkgeometry.c +272 -0
- data/src/rbgdkimage.c +155 -0
- data/src/rbgdkinput.c +70 -0
- data/src/rbgdkkeymap.c +153 -0
- data/src/rbgdkkeysyms.h +2174 -0
- data/src/rbgdkkeyval.c +105 -0
- data/src/rbgdkpango.c +171 -0
- data/src/rbgdkpangorenderer.c +132 -0
- data/src/rbgdkpixbuf.c +178 -0
- data/src/rbgdkpixmap.c +255 -0
- data/src/rbgdkproperty.c +342 -0
- data/src/rbgdkrectangle.c +146 -0
- data/src/rbgdkregion.c +242 -0
- data/src/rbgdkrgb.c +197 -0
- data/src/rbgdkscreen.c +535 -0
- data/src/rbgdkselection.c +161 -0
- data/src/rbgdkthreads.c +68 -0
- data/src/rbgdktimecoord.c +118 -0
- data/src/rbgdkvisual.c +273 -0
- data/src/rbgdkwindow.c +1302 -0
- data/src/rbgdkwindowattr.c +213 -0
- data/src/rbgdkx11.c +256 -0
- data/src/rbgtk.c +93 -0
- data/src/rbgtk.h +121 -0
- data/src/rbgtkaboutdialog.c +195 -0
- data/src/rbgtkaccelerator.c +78 -0
- data/src/rbgtkaccelgroup.c +216 -0
- data/src/rbgtkaccelgroupentry.c +85 -0
- data/src/rbgtkaccelkey.c +116 -0
- data/src/rbgtkaccellabel.c +46 -0
- data/src/rbgtkaccelmap.c +162 -0
- data/src/rbgtkaccessible.c +29 -0
- data/src/rbgtkaction.c +277 -0
- data/src/rbgtkactiongroup.c +377 -0
- data/src/rbgtkadjustment.c +153 -0
- data/src/rbgtkalignment.c +71 -0
- data/src/rbgtkallocation.c +171 -0
- data/src/rbgtkarrow.c +47 -0
- data/src/rbgtkaspectframe.c +46 -0
- data/src/rbgtkassistant.c +230 -0
- data/src/rbgtkbbox.c +47 -0
- data/src/rbgtkbin.c +31 -0
- data/src/rbgtkbindingset.c +192 -0
- data/src/rbgtkborder.c +80 -0
- data/src/rbgtkbox.c +142 -0
- data/src/rbgtkbuildable.c +115 -0
- data/src/rbgtkbuilder.c +154 -0
- data/src/rbgtkbutton.c +151 -0
- data/src/rbgtkcalendar.c +159 -0
- data/src/rbgtkcelleditable.c +49 -0
- data/src/rbgtkcelllayout.c +144 -0
- data/src/rbgtkcellrenderer.c +139 -0
- data/src/rbgtkcellrendereraccel.c +42 -0
- data/src/rbgtkcellrenderercombo.c +37 -0
- data/src/rbgtkcellrendererpixbuf.c +33 -0
- data/src/rbgtkcellrendererprogress.c +37 -0
- data/src/rbgtkcellrendererspin.c +38 -0
- data/src/rbgtkcellrenderertext.c +45 -0
- data/src/rbgtkcellrenderertoggle.c +32 -0
- data/src/rbgtkcellview.c +134 -0
- data/src/rbgtkcheckbutton.c +55 -0
- data/src/rbgtkcheckmenuitem.c +56 -0
- data/src/rbgtkclipboard.c +473 -0
- data/src/rbgtkcolorbutton.c +63 -0
- data/src/rbgtkcolorsel.c +175 -0
- data/src/rbgtkcolorselectiondialog.c +72 -0
- data/src/rbgtkcombo.c +117 -0
- data/src/rbgtkcombobox.c +240 -0
- data/src/rbgtkcomboboxentry.c +60 -0
- data/src/rbgtkconst.c +163 -0
- data/src/rbgtkcontainer.c +776 -0
- data/src/rbgtkconversions.h +26 -0
- data/src/rbgtkcurve.c +105 -0
- data/src/rbgtkdialog.c +244 -0
- data/src/rbgtkdrag.c +436 -0
- data/src/rbgtkdrawingarea.c +31 -0
- data/src/rbgtkeditable.c +152 -0
- data/src/rbgtkentry.c +161 -0
- data/src/rbgtkentrycompletion.c +167 -0
- data/src/rbgtkeventbox.c +31 -0
- data/src/rbgtkexpander.c +67 -0
- data/src/rbgtkfilechooser.c +403 -0
- data/src/rbgtkfilechooserbutton.c +72 -0
- data/src/rbgtkfilechooserdialog.c +58 -0
- data/src/rbgtkfilechooserwidget.c +50 -0
- data/src/rbgtkfilefilter.c +139 -0
- data/src/rbgtkfilesel.c +155 -0
- data/src/rbgtkfixed.c +72 -0
- data/src/rbgtkfontbutton.c +69 -0
- data/src/rbgtkfontselection.c +30 -0
- data/src/rbgtkfontselectiondialog.c +106 -0
- data/src/rbgtkframe.c +64 -0
- data/src/rbgtkgamma.c +47 -0
- data/src/rbgtkhandlebox.c +42 -0
- data/src/rbgtkhbbox.c +31 -0
- data/src/rbgtkhbox.c +38 -0
- data/src/rbgtkhpaned.c +31 -0
- data/src/rbgtkhruler.c +31 -0
- data/src/rbgtkhscale.c +45 -0
- data/src/rbgtkhscrollbar.c +38 -0
- data/src/rbgtkhseparator.c +30 -0
- data/src/rbgtkiconfactory.c +80 -0
- data/src/rbgtkiconinfo.c +118 -0
- data/src/rbgtkiconset.c +87 -0
- data/src/rbgtkiconsize.c +90 -0
- data/src/rbgtkiconsource.c +176 -0
- data/src/rbgtkicontheme.c +309 -0
- data/src/rbgtkiconview.c +351 -0
- data/src/rbgtkimage.c +152 -0
- data/src/rbgtkimagemenuitem.c +52 -0
- data/src/rbgtkimcontext.c +134 -0
- data/src/rbgtkimcontextsimple.c +48 -0
- data/src/rbgtkimmulticontext.c +38 -0
- data/src/rbgtkinits.c +473 -0
- data/src/rbgtkinputdialog.c +30 -0
- data/src/rbgtkinvisible.c +68 -0
- data/src/rbgtkitem.c +51 -0
- data/src/rbgtkitemfactory.c +312 -0
- data/src/rbgtklabel.c +168 -0
- data/src/rbgtklayout.c +91 -0
- data/src/rbgtklinkbutton.c +68 -0
- data/src/rbgtkliststore.c +412 -0
- data/src/rbgtkmacros.h +26 -0
- data/src/rbgtkmain.c +532 -0
- data/src/rbgtkmenu.c +272 -0
- data/src/rbgtkmenubar.c +48 -0
- data/src/rbgtkmenuitem.c +171 -0
- data/src/rbgtkmenushell.c +128 -0
- data/src/rbgtkmenutoolbutton.c +74 -0
- data/src/rbgtkmessagedialog.c +102 -0
- data/src/rbgtkmisc.c +63 -0
- data/src/rbgtknotebook.c +484 -0
- data/src/rbgtkobject.c +186 -0
- data/src/rbgtkoptionmenu.c +65 -0
- data/src/rbgtkpagesetup.c +196 -0
- data/src/rbgtkpagesetupunixdialog.c +80 -0
- data/src/rbgtkpaned.c +114 -0
- data/src/rbgtkpapersize.c +186 -0
- data/src/rbgtkplug.c +84 -0
- data/src/rbgtkprintcontext.c +124 -0
- data/src/rbgtkprinter.c +155 -0
- data/src/rbgtkprintjob.c +151 -0
- data/src/rbgtkprintoperation.c +152 -0
- data/src/rbgtkprintoperationpreview.c +54 -0
- data/src/rbgtkprintsettings.c +794 -0
- data/src/rbgtkprintunixdialog.c +98 -0
- data/src/rbgtkprogress.c +21 -0
- data/src/rbgtkprogressbar.c +72 -0
- data/src/rbgtkradioaction.c +102 -0
- data/src/rbgtkradiobutton.c +83 -0
- data/src/rbgtkradiomenuitem.c +115 -0
- data/src/rbgtkradiotoolbutton.c +99 -0
- data/src/rbgtkrange.c +98 -0
- data/src/rbgtkrc.c +228 -0
- data/src/rbgtkrcstyle.c +184 -0
- data/src/rbgtkrecentaction.c +52 -0
- data/src/rbgtkrecentchooser.c +276 -0
- data/src/rbgtkrecentchooserdialog.c +59 -0
- data/src/rbgtkrecentchoosermenu.c +55 -0
- data/src/rbgtkrecentchooserwidget.c +45 -0
- data/src/rbgtkrecentdata.c +152 -0
- data/src/rbgtkrecentfilter.c +180 -0
- data/src/rbgtkrecentfilterinfo.c +197 -0
- data/src/rbgtkrecentinfo.c +232 -0
- data/src/rbgtkrecentmanager.c +164 -0
- data/src/rbgtkruler.c +82 -0
- data/src/rbgtkscale.c +47 -0
- data/src/rbgtkscalebutton.c +115 -0
- data/src/rbgtkscrollbar.c +21 -0
- data/src/rbgtkscrolledwindow.c +160 -0
- data/src/rbgtkselection.c +171 -0
- data/src/rbgtkselectiondata.c +333 -0
- data/src/rbgtkseparator.c +21 -0
- data/src/rbgtkseparatormenuitem.c +28 -0
- data/src/rbgtkseparatortoolitem.c +40 -0
- data/src/rbgtksettings.c +225 -0
- data/src/rbgtksizegroup.c +74 -0
- data/src/rbgtksocket.c +72 -0
- data/src/rbgtkspinbutton.c +138 -0
- data/src/rbgtkstatusbar.c +90 -0
- data/src/rbgtkstatusicon.c +120 -0
- data/src/rbgtkstock.c +264 -0
- data/src/rbgtkstyle.c +722 -0
- data/src/rbgtktable.c +190 -0
- data/src/rbgtktargetlist.c +148 -0
- data/src/rbgtktearoffmenuitem.c +30 -0
- data/src/rbgtktextappearance.c +173 -0
- data/src/rbgtktextattributes.c +209 -0
- data/src/rbgtktextbuffer.c +993 -0
- data/src/rbgtktextchild.c +49 -0
- data/src/rbgtktextiter.c +553 -0
- data/src/rbgtktextmark.c +87 -0
- data/src/rbgtktexttag.c +66 -0
- data/src/rbgtktexttagtable.c +94 -0
- data/src/rbgtktextview.c +351 -0
- data/src/rbgtktoggleaction.c +76 -0
- data/src/rbgtktogglebutton.c +84 -0
- data/src/rbgtktoggletoolbutton.c +70 -0
- data/src/rbgtktoolbar.c +373 -0
- data/src/rbgtktoolbutton.c +75 -0
- data/src/rbgtktoolitem.c +184 -0
- data/src/rbgtktooltip.c +76 -0
- data/src/rbgtktooltips.c +107 -0
- data/src/rbgtktreedragdest.c +19 -0
- data/src/rbgtktreedragsource.c +19 -0
- data/src/rbgtktreeiter.c +259 -0
- data/src/rbgtktreemodel.c +256 -0
- data/src/rbgtktreemodelfilter.c +214 -0
- data/src/rbgtktreemodelsort.c +113 -0
- data/src/rbgtktreepath.c +195 -0
- data/src/rbgtktreerowreference.c +168 -0
- data/src/rbgtktreeselection.c +235 -0
- data/src/rbgtktreesortable.c +127 -0
- data/src/rbgtktreestore.c +379 -0
- data/src/rbgtktreeview.c +881 -0
- data/src/rbgtktreeviewcolumn.c +331 -0
- data/src/rbgtkuimanager.c +210 -0
- data/src/rbgtkvbbox.c +31 -0
- data/src/rbgtkvbox.c +38 -0
- data/src/rbgtkviewport.c +33 -0
- data/src/rbgtkvolumebutton.c +36 -0
- data/src/rbgtkvpaned.c +31 -0
- data/src/rbgtkvruler.c +30 -0
- data/src/rbgtkvscale.c +45 -0
- data/src/rbgtkvscrollbar.c +38 -0
- data/src/rbgtkvseparator.c +30 -0
- data/src/rbgtkwidget.c +1414 -0
- data/src/rbgtkwindow.c +822 -0
- data/src/rbgtkwindowgroup.c +48 -0
- data/test/gtk-test-utils.rb +15 -0
- data/test/run-test.rb +30 -0
- data/test/test_gc.rb +25 -0
- data/test/test_gdk.rb +18 -0
- data/test/test_gdk_color.rb +10 -0
- data/test/test_gdk_display.rb +37 -0
- data/test/test_gdk_event.rb +11 -0
- data/test/test_gdk_gc.rb +7 -0
- data/test/test_gdk_keymap.rb +8 -0
- data/test/test_gdk_pango.rb +9 -0
- data/test/test_gdk_selection_data.rb +17 -0
- data/test/test_gdk_window.rb +29 -0
- data/test/test_gdk_window_attribute.rb +9 -0
- data/test/test_gtk_about_dialog.rb +14 -0
- data/test/test_gtk_buildable.rb +66 -0
- data/test/test_gtk_builder.rb +188 -0
- data/test/test_gtk_entry.rb +18 -0
- data/test/test_gtk_icon_theme.rb +30 -0
- data/test/test_gtk_image.rb +8 -0
- data/test/test_gtk_list_store.rb +65 -0
- data/test/test_gtk_menu_item.rb +13 -0
- data/test/test_gtk_rc_style.rb +14 -0
- data/test/test_gtk_tree_path.rb +20 -0
- data/test/test_gtk_unix_print.rb +14 -0
- data/test/test_gtk_widget.rb +32 -0
- metadata +393 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcellrendererprogress.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2004/12/27 16:32:56 $
|
8
|
+
|
9
|
+
Copyright (C) 2004 Darren Willis
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
15
|
+
|
16
|
+
static VALUE
|
17
|
+
crprogress_initialize(self)
|
18
|
+
VALUE self;
|
19
|
+
{
|
20
|
+
RBGTK_INITIALIZE(self, gtk_cell_renderer_progress_new());
|
21
|
+
return Qnil;
|
22
|
+
}
|
23
|
+
|
24
|
+
#endif
|
25
|
+
|
26
|
+
void
|
27
|
+
Init_gtk_cellrendererprogress()
|
28
|
+
{
|
29
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
30
|
+
VALUE renderer = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_PROGRESS, "CellRendererProgress", mGtk);
|
31
|
+
rb_define_method(renderer, "initialize", crprogress_initialize, 0);
|
32
|
+
#endif
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcellrendererspin.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2006/10/21 16:58:00 $
|
8
|
+
|
9
|
+
Copyright (C) 2006 Ruby-GNOME2 Team
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
15
|
+
|
16
|
+
#define _SELF(s) (GTK_CELL_RENDERER_SPIN(RVAL2GOBJ(s)))
|
17
|
+
|
18
|
+
static VALUE
|
19
|
+
crspin_initialize(self)
|
20
|
+
VALUE self;
|
21
|
+
{
|
22
|
+
RBGTK_INITIALIZE(self, gtk_cell_renderer_spin_new());
|
23
|
+
return Qnil;
|
24
|
+
}
|
25
|
+
|
26
|
+
#endif
|
27
|
+
|
28
|
+
void
|
29
|
+
Init_gtk_cellrendererspin()
|
30
|
+
{
|
31
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
32
|
+
VALUE renderer = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_SPIN, "CellRendererSpin", mGtk);
|
33
|
+
rb_define_method(renderer, "initialize", crspin_initialize, 0);
|
34
|
+
#endif
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcellrenderertext.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2003/01/19 14:28:24 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 Masao Mutoh
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
|
15
|
+
#define _SELF(s) (GTK_CELL_RENDERER_TEXT(RVAL2GOBJ(s)))
|
16
|
+
|
17
|
+
static VALUE
|
18
|
+
crtext_initialize(self)
|
19
|
+
VALUE self;
|
20
|
+
{
|
21
|
+
RBGTK_INITIALIZE(self, gtk_cell_renderer_text_new());
|
22
|
+
return Qnil;
|
23
|
+
}
|
24
|
+
|
25
|
+
static VALUE
|
26
|
+
crtext_set_fixed_height_from_font(self, number_of_rows)
|
27
|
+
VALUE self, number_of_rows;
|
28
|
+
{
|
29
|
+
gtk_cell_renderer_text_set_fixed_height_from_font(_SELF(self), NUM2INT(number_of_rows));
|
30
|
+
return self;
|
31
|
+
}
|
32
|
+
|
33
|
+
void
|
34
|
+
Init_gtk_cellrenderertext()
|
35
|
+
{
|
36
|
+
VALUE renderer = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_TEXT, "CellRendererText", mGtk);
|
37
|
+
|
38
|
+
rb_define_method(renderer, "initialize", crtext_initialize, 0);
|
39
|
+
rb_define_method(renderer, "set_fixed_height_from_font", crtext_set_fixed_height_from_font, 1);
|
40
|
+
|
41
|
+
G_DEF_SETTERS(renderer);
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcellrenderertoggle.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2003/01/19 14:28:24 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 Masao Mutoh
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#define _SELF(s) (GTK_CELL_RENDERER_TOGGLE(RVAL2GOBJ(s)))
|
15
|
+
|
16
|
+
static VALUE
|
17
|
+
crtoggle_initialize(self)
|
18
|
+
VALUE self;
|
19
|
+
{
|
20
|
+
RBGTK_INITIALIZE(self, gtk_cell_renderer_toggle_new());
|
21
|
+
return Qnil;
|
22
|
+
}
|
23
|
+
|
24
|
+
void
|
25
|
+
Init_gtk_cellrenderertoggle()
|
26
|
+
{
|
27
|
+
VALUE renderer = G_DEF_CLASS(GTK_TYPE_CELL_RENDERER_TOGGLE, "CellRendererToggle", mGtk);
|
28
|
+
rb_define_method(renderer, "initialize", crtoggle_initialize, 0);
|
29
|
+
}
|
30
|
+
|
31
|
+
|
32
|
+
|
data/src/rbgtkcellview.c
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcellview.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:31 $
|
8
|
+
|
9
|
+
Copyright (C) 2005,2006 Masao Mutoh
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
15
|
+
|
16
|
+
#define _SELF(self) (GTK_CELL_VIEW(RVAL2GOBJ(self)))
|
17
|
+
|
18
|
+
static ID id_model;
|
19
|
+
static ID id_text;
|
20
|
+
|
21
|
+
static VALUE
|
22
|
+
cview_initialize(argc, argv, self)
|
23
|
+
int argc;
|
24
|
+
VALUE *argv;
|
25
|
+
VALUE self;
|
26
|
+
{
|
27
|
+
VALUE text;
|
28
|
+
VALUE with_markup = Qnil;
|
29
|
+
GtkWidget *widget = NULL;
|
30
|
+
|
31
|
+
rb_scan_args(argc, argv, "02", &text, &with_markup);
|
32
|
+
|
33
|
+
if (NIL_P(text)) {
|
34
|
+
widget = gtk_cell_view_new();
|
35
|
+
} else {
|
36
|
+
G_CHILD_SET(self, id_text, text);
|
37
|
+
if (TYPE(text) == T_STRING){
|
38
|
+
if (NIL_P(with_markup) || RVAL2CBOOL(with_markup)){
|
39
|
+
widget = gtk_cell_view_new_with_markup(RVAL2CSTR(text));
|
40
|
+
} else {
|
41
|
+
widget = gtk_cell_view_new_with_text(RVAL2CSTR(text));
|
42
|
+
}
|
43
|
+
} else if (rb_obj_is_kind_of(text, GTYPE2CLASS(GDK_TYPE_PIXBUF))){
|
44
|
+
widget = gtk_cell_view_new_with_pixbuf(GDK_PIXBUF(RVAL2GOBJ(text)));
|
45
|
+
} else {
|
46
|
+
rb_raise(rb_eArgError,
|
47
|
+
"invalid argument %s (expect String or Gdk::Pixbuf)",
|
48
|
+
rb_class2name(CLASS_OF(text)));
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
RBGTK_INITIALIZE(self, widget);
|
53
|
+
|
54
|
+
return Qnil;
|
55
|
+
}
|
56
|
+
|
57
|
+
static VALUE
|
58
|
+
cview_set_model(self, model)
|
59
|
+
VALUE self, model;
|
60
|
+
{
|
61
|
+
G_CHILD_SET(self, id_model, model);
|
62
|
+
gtk_cell_view_set_model(_SELF(self),
|
63
|
+
NIL_P(model) ? (GtkTreeModel*)NULL : GTK_TREE_MODEL(RVAL2GOBJ(model)));
|
64
|
+
return self;
|
65
|
+
}
|
66
|
+
|
67
|
+
static VALUE
|
68
|
+
cview_set_displayed_row(self, path)
|
69
|
+
VALUE self, path;
|
70
|
+
{
|
71
|
+
gtk_cell_view_set_displayed_row(_SELF(self),
|
72
|
+
NIL_P(path) ? (GtkTreePath*)NULL :
|
73
|
+
RVAL2GTKTREEPATH(path));
|
74
|
+
return self;
|
75
|
+
}
|
76
|
+
|
77
|
+
static VALUE
|
78
|
+
cview_get_displayed_row(self)
|
79
|
+
VALUE self;
|
80
|
+
{
|
81
|
+
return GTKTREEPATH2RVAL(gtk_cell_view_get_displayed_row(_SELF(self)));
|
82
|
+
}
|
83
|
+
|
84
|
+
static VALUE
|
85
|
+
cview_get_size_of_row(self, path)
|
86
|
+
VALUE self, path;
|
87
|
+
{
|
88
|
+
GtkRequisition req;
|
89
|
+
gboolean ret = gtk_cell_view_get_size_of_row(_SELF(self),
|
90
|
+
RVAL2GTKTREEPATH(path),
|
91
|
+
&req);
|
92
|
+
if (! ret)
|
93
|
+
rb_raise(rb_eRuntimeError, "Can't get the value");
|
94
|
+
|
95
|
+
return rb_ary_assoc(INT2NUM(req.width), INT2NUM(req.height));
|
96
|
+
}
|
97
|
+
|
98
|
+
/* Use Gtk::CellView#background_gdk(Gdk::Color) instead.
|
99
|
+
void gtk_cell_view_set_background_color
|
100
|
+
(GtkCellView *cell_view,
|
101
|
+
const GdkColor *color);
|
102
|
+
*/
|
103
|
+
|
104
|
+
static VALUE
|
105
|
+
cview_get_cell_renderers(self)
|
106
|
+
VALUE self;
|
107
|
+
{
|
108
|
+
return GLIST2ARYF(gtk_cell_view_get_cell_renderers(_SELF(self)));
|
109
|
+
}
|
110
|
+
#endif
|
111
|
+
|
112
|
+
void
|
113
|
+
Init_gtk_cellview()
|
114
|
+
{
|
115
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
116
|
+
VALUE cview = G_DEF_CLASS(GTK_TYPE_CELL_VIEW, "CellView", mGtk);
|
117
|
+
|
118
|
+
id_model = rb_intern("model");
|
119
|
+
id_text = rb_intern("text");
|
120
|
+
|
121
|
+
rb_define_method(cview, "initialize", cview_initialize, -1);
|
122
|
+
rb_define_method(cview, "set_model", cview_set_model, 1);
|
123
|
+
rb_define_method(cview, "set_displayed_row", cview_set_displayed_row, 1);
|
124
|
+
rb_define_method(cview, "displayed_row", cview_get_displayed_row, 0);
|
125
|
+
rb_define_method(cview, "get_size_of_row", cview_get_size_of_row, 1);
|
126
|
+
rb_define_method(cview, "cell_renderers", cview_get_cell_renderers, 0);
|
127
|
+
|
128
|
+
G_DEF_SETTERS(cview);
|
129
|
+
#endif
|
130
|
+
}
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcheckbutton.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:31 $
|
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
|
+
static VALUE
|
18
|
+
cbtn_initialize(argc, argv, self)
|
19
|
+
int argc;
|
20
|
+
VALUE *argv;
|
21
|
+
VALUE self;
|
22
|
+
{
|
23
|
+
VALUE label, use_underline;
|
24
|
+
GtkWidget *widget;
|
25
|
+
|
26
|
+
if (rb_scan_args(argc, argv, "02", &label, &use_underline) > 0) {
|
27
|
+
if (TYPE(label) == T_STRING){
|
28
|
+
if (NIL_P(use_underline) || RVAL2CBOOL(use_underline)){
|
29
|
+
widget = gtk_check_button_new_with_mnemonic(RVAL2CSTR(label));
|
30
|
+
} else {
|
31
|
+
widget = gtk_check_button_new_with_label(RVAL2CSTR(label));
|
32
|
+
}
|
33
|
+
} else if (TYPE(label) == T_SYMBOL){
|
34
|
+
widget = gtk_check_button_new_with_label(rb_id2name(SYM2ID(label)));
|
35
|
+
gtk_button_set_use_stock(GTK_BUTTON(widget), TRUE);
|
36
|
+
} else {
|
37
|
+
rb_raise(rb_eArgError, "invalid argument %s (expect Symbol(Gtk::Stock constants) or String)",
|
38
|
+
rb_class2name(CLASS_OF(label)));
|
39
|
+
}
|
40
|
+
}
|
41
|
+
else {
|
42
|
+
widget = gtk_check_button_new();
|
43
|
+
}
|
44
|
+
|
45
|
+
RBGTK_INITIALIZE(self, widget);
|
46
|
+
return Qnil;
|
47
|
+
}
|
48
|
+
|
49
|
+
void
|
50
|
+
Init_gtk_check_button()
|
51
|
+
{
|
52
|
+
VALUE gCButton = G_DEF_CLASS(GTK_TYPE_CHECK_BUTTON, "CheckButton", mGtk);
|
53
|
+
|
54
|
+
rb_define_method(gCButton, "initialize", cbtn_initialize, -1);
|
55
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcheckmenuitem.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:31 $
|
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
|
+
static VALUE
|
18
|
+
cmitem_initialize(argc, argv, self)
|
19
|
+
int argc;
|
20
|
+
VALUE *argv;
|
21
|
+
VALUE self;
|
22
|
+
{
|
23
|
+
VALUE label, use_underline;
|
24
|
+
GtkWidget *widget = NULL;
|
25
|
+
|
26
|
+
if (rb_scan_args(argc, argv, "02", &label, &use_underline) > 0) {
|
27
|
+
if (NIL_P(use_underline) || RVAL2CBOOL(use_underline)){
|
28
|
+
widget = gtk_check_menu_item_new_with_mnemonic(RVAL2CSTR(label));
|
29
|
+
} else {
|
30
|
+
widget = gtk_check_menu_item_new_with_label(RVAL2CSTR(label));
|
31
|
+
}
|
32
|
+
}
|
33
|
+
else {
|
34
|
+
widget = gtk_check_menu_item_new();
|
35
|
+
}
|
36
|
+
|
37
|
+
RBGTK_INITIALIZE(self, widget);
|
38
|
+
return Qnil;
|
39
|
+
}
|
40
|
+
|
41
|
+
static VALUE
|
42
|
+
cmitem_toggled(self)
|
43
|
+
VALUE self;
|
44
|
+
{
|
45
|
+
gtk_check_menu_item_toggled(GTK_CHECK_MENU_ITEM(RVAL2GOBJ(self)));
|
46
|
+
return self;
|
47
|
+
}
|
48
|
+
|
49
|
+
void
|
50
|
+
Init_gtk_check_menu_item()
|
51
|
+
{
|
52
|
+
VALUE gCMenuItem = G_DEF_CLASS(GTK_TYPE_CHECK_MENU_ITEM, "CheckMenuItem", mGtk);
|
53
|
+
|
54
|
+
rb_define_method(gCMenuItem, "initialize", cmitem_initialize, -1);
|
55
|
+
rb_define_method(gCMenuItem, "toggled", cmitem_toggled, 0);
|
56
|
+
}
|
@@ -0,0 +1,473 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkclipboard.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 14:27:09 $
|
8
|
+
|
9
|
+
Copyright (C) 2004,2006 Ruby-GNOME2 Project
|
10
|
+
Copyright (C) 2002,2003 OGASAWARA, Takeshi
|
11
|
+
************************************************/
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#define _SELF(s) RVAL2CLIPBOARD(s)
|
15
|
+
|
16
|
+
#ifndef GTK_TYPE_CLIPBOARD
|
17
|
+
static GtkClipboard*
|
18
|
+
clipboard_copy(const GtkClipboard *clipboard)
|
19
|
+
{
|
20
|
+
/* I don't know how to copy this object ... */
|
21
|
+
return (GtkClipboard*)clipboard;
|
22
|
+
}
|
23
|
+
|
24
|
+
GType
|
25
|
+
rbgtk_clipboard_get_type()
|
26
|
+
{
|
27
|
+
static GType our_type = 0;
|
28
|
+
if(our_type == 0)
|
29
|
+
our_type = g_boxed_type_register_static("GtkClipboard",
|
30
|
+
(GBoxedCopyFunc)clipboard_copy,
|
31
|
+
(GBoxedFreeFunc)g_free);
|
32
|
+
return our_type;
|
33
|
+
}
|
34
|
+
|
35
|
+
GtkClipboard*
|
36
|
+
rbgtk_get_clipboard(obj)
|
37
|
+
VALUE obj;
|
38
|
+
{
|
39
|
+
return GTK_CLIPBOARD(RVAL2GOBJ(obj));
|
40
|
+
}
|
41
|
+
|
42
|
+
VALUE
|
43
|
+
rbgtk_make_clipboard(gobj)
|
44
|
+
GtkClipboard* gobj;
|
45
|
+
{
|
46
|
+
return GOBJ2RVAL(gobj);
|
47
|
+
}
|
48
|
+
#endif
|
49
|
+
|
50
|
+
static VALUE
|
51
|
+
clipboard_get(argc, argv, self)
|
52
|
+
int argc;
|
53
|
+
VALUE* argv;
|
54
|
+
VALUE self;
|
55
|
+
{
|
56
|
+
GtkClipboard *clipboard;
|
57
|
+
|
58
|
+
if (argc == 1){
|
59
|
+
VALUE selection;
|
60
|
+
rb_scan_args(argc, argv, "10", &selection);
|
61
|
+
clipboard = gtk_clipboard_get(RVAL2ATOM(selection));
|
62
|
+
} else {
|
63
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
64
|
+
VALUE display, selection;
|
65
|
+
rb_scan_args(argc, argv, "20", &display, &selection);
|
66
|
+
clipboard = gtk_clipboard_get_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
67
|
+
RVAL2ATOM(selection));
|
68
|
+
#else
|
69
|
+
rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
|
70
|
+
#endif
|
71
|
+
}
|
72
|
+
return CLIPBOARD2RVAL(clipboard);
|
73
|
+
}
|
74
|
+
|
75
|
+
static VALUE
|
76
|
+
clipboard_get_display(self)
|
77
|
+
VALUE self;
|
78
|
+
{
|
79
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
80
|
+
return GOBJ2RVAL(gtk_clipboard_get_display(_SELF(self)));
|
81
|
+
#else
|
82
|
+
return Qnil;
|
83
|
+
#endif
|
84
|
+
}
|
85
|
+
|
86
|
+
static void
|
87
|
+
clipboard_get_func(clipboard, selection_data, info, func)
|
88
|
+
GtkClipboard *clipboard;
|
89
|
+
GtkSelectionData* selection_data;
|
90
|
+
gpointer func;
|
91
|
+
{
|
92
|
+
rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard),
|
93
|
+
BOXED2RVAL(selection_data, GTK_TYPE_SELECTION_DATA));
|
94
|
+
}
|
95
|
+
|
96
|
+
static VALUE
|
97
|
+
clipboard_set(self, targets)
|
98
|
+
VALUE self, targets;
|
99
|
+
{
|
100
|
+
const GtkTargetEntry* gtargets = (const GtkTargetEntry*)rbgtk_get_target_entry(targets);
|
101
|
+
VALUE func = rb_block_proc();
|
102
|
+
G_RELATIVE(self, func);
|
103
|
+
return CBOOL2RVAL(gtk_clipboard_set_with_data(_SELF(self),
|
104
|
+
gtargets,
|
105
|
+
RARRAY_LEN(targets),
|
106
|
+
(GtkClipboardGetFunc)clipboard_get_func,
|
107
|
+
(GtkClipboardClearFunc)NULL,
|
108
|
+
(gpointer)func));
|
109
|
+
}
|
110
|
+
/*
|
111
|
+
Do not implement this. Use Gtk::Clipboard#set_with_data instead.
|
112
|
+
gboolean gtk_clipboard_set_with_owner (GtkClipboard *clipboard,
|
113
|
+
const GtkTargetEntry *targets,
|
114
|
+
guint n_targets,
|
115
|
+
GtkClipboardGetFunc get_func,
|
116
|
+
GtkClipboardClearFunc clear_func,
|
117
|
+
GObject *owner);
|
118
|
+
|
119
|
+
static VALUE
|
120
|
+
clipboard_get_owner(self)
|
121
|
+
VALUE self;
|
122
|
+
{
|
123
|
+
GObject *gobj;
|
124
|
+
gobj = gtk_clipboard_get_owner(_SELF(self));
|
125
|
+
return gobj ? GOBJ2RVAL(gobj) : Qnil;
|
126
|
+
}
|
127
|
+
*/
|
128
|
+
|
129
|
+
static VALUE
|
130
|
+
clipboard_clear(self)
|
131
|
+
VALUE self;
|
132
|
+
{
|
133
|
+
gtk_clipboard_clear(_SELF(self));
|
134
|
+
return self;
|
135
|
+
}
|
136
|
+
|
137
|
+
static VALUE
|
138
|
+
clipboard_set_text(self, text)
|
139
|
+
VALUE self, text;
|
140
|
+
{
|
141
|
+
StringValue(text);
|
142
|
+
gtk_clipboard_set_text(_SELF(self), RVAL2CSTR(text), RSTRING_LEN(text));
|
143
|
+
return self;
|
144
|
+
}
|
145
|
+
|
146
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
147
|
+
static VALUE
|
148
|
+
clipboard_set_image(self, pixbuf)
|
149
|
+
VALUE self, pixbuf;
|
150
|
+
{
|
151
|
+
gtk_clipboard_set_image(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(pixbuf)));
|
152
|
+
return self;
|
153
|
+
}
|
154
|
+
#endif
|
155
|
+
|
156
|
+
static void
|
157
|
+
clipboard_received_func(clipboard, selection_data, func)
|
158
|
+
GtkClipboard *clipboard;
|
159
|
+
GtkSelectionData* selection_data;
|
160
|
+
gpointer func;
|
161
|
+
{
|
162
|
+
rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard),
|
163
|
+
BOXED2RVAL(selection_data, GTK_TYPE_SELECTION_DATA));
|
164
|
+
}
|
165
|
+
|
166
|
+
static VALUE
|
167
|
+
clipboard_request_contents(self, target)
|
168
|
+
VALUE self, target;
|
169
|
+
{
|
170
|
+
VALUE func = rb_block_proc();
|
171
|
+
G_RELATIVE(self, func);
|
172
|
+
gtk_clipboard_request_contents(_SELF(self), RVAL2ATOM(target),
|
173
|
+
(GtkClipboardReceivedFunc)clipboard_received_func,
|
174
|
+
(gpointer)func);
|
175
|
+
return self;
|
176
|
+
}
|
177
|
+
|
178
|
+
static void
|
179
|
+
clipboard_text_received_func(GtkClipboard *clipboard, const gchar *text,
|
180
|
+
gpointer func)
|
181
|
+
{
|
182
|
+
VALUE vtext = Qnil;
|
183
|
+
if (text) {
|
184
|
+
vtext = CSTR2RVAL(text);
|
185
|
+
RBG_STRING_SET_UTF8_ENCODING(vtext);
|
186
|
+
}
|
187
|
+
|
188
|
+
rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard), vtext);
|
189
|
+
}
|
190
|
+
|
191
|
+
static VALUE
|
192
|
+
clipboard_request_text(self)
|
193
|
+
VALUE self;
|
194
|
+
{
|
195
|
+
VALUE func = rb_block_proc();
|
196
|
+
G_RELATIVE(self, func);
|
197
|
+
gtk_clipboard_request_text(_SELF(self),
|
198
|
+
(GtkClipboardTextReceivedFunc)clipboard_text_received_func,
|
199
|
+
(gpointer)func);
|
200
|
+
return self;
|
201
|
+
}
|
202
|
+
|
203
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
204
|
+
static void
|
205
|
+
clipboard_image_received_func(clipboard, pixbuf, func)
|
206
|
+
GtkClipboard* clipboard;
|
207
|
+
GdkPixbuf* pixbuf;
|
208
|
+
gpointer func;
|
209
|
+
{
|
210
|
+
rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard),
|
211
|
+
GOBJ2RVAL(pixbuf));
|
212
|
+
}
|
213
|
+
|
214
|
+
static VALUE
|
215
|
+
clipboard_request_image(self)
|
216
|
+
VALUE self;
|
217
|
+
{
|
218
|
+
VALUE func = rb_block_proc();
|
219
|
+
G_RELATIVE(self, func);
|
220
|
+
gtk_clipboard_request_image(_SELF(self),
|
221
|
+
(GtkClipboardImageReceivedFunc)clipboard_image_received_func,
|
222
|
+
(gpointer)func);
|
223
|
+
return self;
|
224
|
+
}
|
225
|
+
#endif
|
226
|
+
|
227
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
228
|
+
static void
|
229
|
+
clipboard_target_received_func(clipboard, atoms, n_atoms, func)
|
230
|
+
GtkClipboard* clipboard;
|
231
|
+
GdkAtom* atoms;
|
232
|
+
gint n_atoms;
|
233
|
+
gpointer func;
|
234
|
+
{
|
235
|
+
gint i;
|
236
|
+
VALUE ary = rb_ary_new();
|
237
|
+
for (i = 0; i < n_atoms; i++){
|
238
|
+
rb_ary_push(ary, BOXED2RVAL(atoms[i], GDK_TYPE_ATOM));
|
239
|
+
}
|
240
|
+
|
241
|
+
rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard), ary);
|
242
|
+
}
|
243
|
+
|
244
|
+
static VALUE
|
245
|
+
clipboard_request_targets(self)
|
246
|
+
VALUE self;
|
247
|
+
{
|
248
|
+
VALUE func = rb_block_proc();
|
249
|
+
G_RELATIVE(self, func);
|
250
|
+
|
251
|
+
gtk_clipboard_request_targets(_SELF(self),
|
252
|
+
(GtkClipboardTargetsReceivedFunc)clipboard_target_received_func,
|
253
|
+
(gpointer)func);
|
254
|
+
return self;
|
255
|
+
}
|
256
|
+
#endif
|
257
|
+
|
258
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
259
|
+
static void
|
260
|
+
clipboard_rich_text_received_func(clipboard, format, text, length, func)
|
261
|
+
GtkClipboard* clipboard;
|
262
|
+
GdkAtom format;
|
263
|
+
const guint8 *text;
|
264
|
+
gsize length;
|
265
|
+
gpointer func;
|
266
|
+
{
|
267
|
+
rb_funcall((VALUE)func, id_call, 3, CLIPBOARD2RVAL(clipboard),
|
268
|
+
BOXED2RVAL(format, GDK_TYPE_ATOM), rb_str_new((char*)text, length));
|
269
|
+
}
|
270
|
+
|
271
|
+
static VALUE
|
272
|
+
clipboard_request_rich_text(self, buffer)
|
273
|
+
VALUE self, buffer;
|
274
|
+
{
|
275
|
+
VALUE func = rb_block_proc();
|
276
|
+
G_RELATIVE(self, func);
|
277
|
+
|
278
|
+
gtk_clipboard_request_rich_text(_SELF(self), GTK_TEXT_BUFFER(RVAL2GOBJ(buffer)),
|
279
|
+
(GtkClipboardRichTextReceivedFunc)clipboard_rich_text_received_func,
|
280
|
+
(gpointer)func);
|
281
|
+
return self;
|
282
|
+
}
|
283
|
+
#endif
|
284
|
+
|
285
|
+
static VALUE
|
286
|
+
clipboard_wait_for_contents(self, target)
|
287
|
+
VALUE self, target;
|
288
|
+
{
|
289
|
+
return BOXED2RVAL(gtk_clipboard_wait_for_contents(
|
290
|
+
_SELF(self),
|
291
|
+
RVAL2ATOM(target)),
|
292
|
+
GTK_TYPE_SELECTION_DATA);
|
293
|
+
}
|
294
|
+
|
295
|
+
static VALUE
|
296
|
+
clipboard_wait_for_text(self)
|
297
|
+
VALUE self;
|
298
|
+
{
|
299
|
+
gchar *str;
|
300
|
+
str = gtk_clipboard_wait_for_text(_SELF(self));
|
301
|
+
return str ? CSTR2RVAL(str) : Qnil;
|
302
|
+
}
|
303
|
+
|
304
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
305
|
+
static VALUE
|
306
|
+
clipboard_wait_for_image(self)
|
307
|
+
VALUE self;
|
308
|
+
{
|
309
|
+
GdkPixbuf* pixbuf = gtk_clipboard_wait_for_image(_SELF(self));
|
310
|
+
return GOBJ2RVAL(pixbuf);
|
311
|
+
}
|
312
|
+
#endif
|
313
|
+
|
314
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
315
|
+
static VALUE
|
316
|
+
clipboard_wait_for_rich_text(self, buffer)
|
317
|
+
VALUE self, buffer;
|
318
|
+
{
|
319
|
+
GdkAtom format;
|
320
|
+
gsize length;
|
321
|
+
guint8* data = gtk_clipboard_wait_for_rich_text(_SELF(self),
|
322
|
+
GTK_TEXT_BUFFER(RVAL2GOBJ(buffer)),
|
323
|
+
&format, &length);
|
324
|
+
if (data){
|
325
|
+
VALUE str = rb_str_new((char*)data, length);
|
326
|
+
g_free(data);
|
327
|
+
return rb_assoc_new(str, BOXED2RVAL(format, GDK_TYPE_ATOM));
|
328
|
+
} else {
|
329
|
+
return rb_assoc_new(Qnil, BOXED2RVAL(format, GDK_TYPE_ATOM));
|
330
|
+
}
|
331
|
+
|
332
|
+
}
|
333
|
+
#endif
|
334
|
+
|
335
|
+
static VALUE
|
336
|
+
clipboard_wait_is_text_available(self)
|
337
|
+
VALUE self;
|
338
|
+
{
|
339
|
+
return CBOOL2RVAL(gtk_clipboard_wait_is_text_available(_SELF(self)));
|
340
|
+
}
|
341
|
+
|
342
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
343
|
+
static VALUE
|
344
|
+
clipboard_wait_is_image_available(self)
|
345
|
+
VALUE self;
|
346
|
+
{
|
347
|
+
return CBOOL2RVAL(gtk_clipboard_wait_is_image_available(_SELF(self)));
|
348
|
+
}
|
349
|
+
#endif
|
350
|
+
|
351
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
352
|
+
static VALUE
|
353
|
+
clipboard_wait_is_rich_text_available(self, buffer)
|
354
|
+
VALUE self, buffer;
|
355
|
+
{
|
356
|
+
return CBOOL2RVAL(gtk_clipboard_wait_is_rich_text_available(_SELF(self), GTK_TEXT_BUFFER(RVAL2GOBJ(buffer))));
|
357
|
+
}
|
358
|
+
#endif
|
359
|
+
|
360
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
361
|
+
static VALUE
|
362
|
+
clipboard_wait_for_targets(self)
|
363
|
+
VALUE self;
|
364
|
+
{
|
365
|
+
gint i;
|
366
|
+
VALUE ary = Qnil;
|
367
|
+
GdkAtom* targets;
|
368
|
+
gint n_targets = 0;
|
369
|
+
gboolean ret = gtk_clipboard_wait_for_targets(_SELF(self), &targets, &n_targets);
|
370
|
+
|
371
|
+
if (ret){
|
372
|
+
ary = rb_ary_new();
|
373
|
+
for (i = 0; i < n_targets; i++){
|
374
|
+
if ((GdkAtom)targets == (GdkAtom)GDK_NONE){
|
375
|
+
rb_ary_push(ary, rb_eval_string("Gdk::Atom::NONE"));
|
376
|
+
}
|
377
|
+
else
|
378
|
+
rb_ary_push(ary, BOXED2RVAL(targets, GDK_TYPE_ATOM));
|
379
|
+
targets++;
|
380
|
+
}
|
381
|
+
/* How can I this ?
|
382
|
+
g_free(&o_targets);
|
383
|
+
*/
|
384
|
+
}
|
385
|
+
return ary;
|
386
|
+
}
|
387
|
+
#endif
|
388
|
+
|
389
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
390
|
+
static VALUE
|
391
|
+
clipboard_wait_is_target_available(self, target)
|
392
|
+
VALUE self, target;
|
393
|
+
{
|
394
|
+
return CBOOL2RVAL(gtk_clipboard_wait_is_target_available(_SELF(self), RVAL2ATOM(target)));
|
395
|
+
}
|
396
|
+
|
397
|
+
static VALUE
|
398
|
+
clipboard_set_can_store(self, targets)
|
399
|
+
VALUE self, targets;
|
400
|
+
{
|
401
|
+
gint n_targets = 0;
|
402
|
+
GtkTargetEntry* entries = (GtkTargetEntry*)NULL;
|
403
|
+
|
404
|
+
if (!NIL_P(targets)){
|
405
|
+
n_targets = RARRAY_LEN(targets);
|
406
|
+
entries = rbgtk_get_target_entry(targets);
|
407
|
+
}
|
408
|
+
gtk_clipboard_set_can_store(_SELF(self), entries, n_targets);
|
409
|
+
return self;
|
410
|
+
}
|
411
|
+
|
412
|
+
static VALUE
|
413
|
+
clipboard_store(self)
|
414
|
+
VALUE self;
|
415
|
+
{
|
416
|
+
gtk_clipboard_store(_SELF(self));
|
417
|
+
return self;
|
418
|
+
}
|
419
|
+
#endif
|
420
|
+
|
421
|
+
void
|
422
|
+
Init_gtk_clipboard()
|
423
|
+
{
|
424
|
+
VALUE gClipboard = G_DEF_CLASS(GTK_TYPE_CLIPBOARD, "Clipboard", mGtk);
|
425
|
+
|
426
|
+
rb_define_singleton_method(gClipboard, "get", clipboard_get, -1);
|
427
|
+
rb_define_method(gClipboard, "display", clipboard_get_display, 0);
|
428
|
+
rb_define_method(gClipboard, "set", clipboard_set, 1);
|
429
|
+
/*
|
430
|
+
rb_define_method(gClipboard, "owner", clipboard_get_owner, 0);
|
431
|
+
*/
|
432
|
+
rb_define_method(gClipboard, "clear", clipboard_clear, 0);
|
433
|
+
rb_define_method(gClipboard, "set_text", clipboard_set_text, 1);
|
434
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
435
|
+
rb_define_method(gClipboard, "set_image", clipboard_set_image, 1);
|
436
|
+
#endif
|
437
|
+
rb_define_method(gClipboard, "request_contents", clipboard_request_contents, 1);
|
438
|
+
rb_define_method(gClipboard, "request_text", clipboard_request_text, 0);
|
439
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
440
|
+
rb_define_method(gClipboard, "request_image", clipboard_request_image, 0);
|
441
|
+
#endif
|
442
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
443
|
+
rb_define_method(gClipboard, "request_targets", clipboard_request_targets, 0);
|
444
|
+
#endif
|
445
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
446
|
+
rb_define_method(gClipboard, "request_rich_text", clipboard_request_rich_text, 1);
|
447
|
+
#endif
|
448
|
+
rb_define_method(gClipboard, "wait_for_contents", clipboard_wait_for_contents, 1);
|
449
|
+
rb_define_method(gClipboard, "wait_for_text", clipboard_wait_for_text, 0);
|
450
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
451
|
+
rb_define_method(gClipboard, "wait_for_image", clipboard_wait_for_image, 0);
|
452
|
+
#endif
|
453
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
454
|
+
rb_define_method(gClipboard, "wait_for_rich_text", clipboard_wait_for_rich_text, 1);
|
455
|
+
#endif
|
456
|
+
rb_define_method(gClipboard, "wait_is_text_available?", clipboard_wait_is_text_available, 0);
|
457
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
458
|
+
rb_define_method(gClipboard, "wait_is_image_available?", clipboard_wait_is_image_available, 0);
|
459
|
+
#endif
|
460
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
461
|
+
rb_define_method(gClipboard, "wait_is_rich_text_available?", clipboard_wait_is_rich_text_available, 1);
|
462
|
+
#endif
|
463
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
464
|
+
rb_define_method(gClipboard, "wait_for_targets", clipboard_wait_for_targets, 0);
|
465
|
+
#endif
|
466
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
467
|
+
rb_define_method(gClipboard, "wait_is_target_available?", clipboard_wait_is_target_available, 1);
|
468
|
+
rb_define_method(gClipboard, "set_can_store", clipboard_set_can_store, 1);
|
469
|
+
rb_define_method(gClipboard, "store", clipboard_store, 0);
|
470
|
+
#endif
|
471
|
+
|
472
|
+
G_DEF_SETTERS(gClipboard);
|
473
|
+
}
|