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
data/src/rbgtkscale.c
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkscale.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2004/11/14 11:01:43 $
|
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
|
+
#define _SELF(self) (GTK_SCALE(RVAL2GOBJ(self)))
|
18
|
+
|
19
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
20
|
+
static VALUE
|
21
|
+
rbscale_get_layout(self)
|
22
|
+
VALUE self;
|
23
|
+
{
|
24
|
+
return GOBJ2RVAL(gtk_scale_get_layout(_SELF(self)));
|
25
|
+
}
|
26
|
+
|
27
|
+
static VALUE
|
28
|
+
rbscale_get_layout_offsets(self)
|
29
|
+
VALUE self;
|
30
|
+
{
|
31
|
+
gint x, y;
|
32
|
+
gtk_scale_get_layout_offsets(_SELF(self), &x, &y);
|
33
|
+
return rb_assoc_new(INT2NUM(x), INT2NUM(y));
|
34
|
+
}
|
35
|
+
#endif
|
36
|
+
|
37
|
+
void
|
38
|
+
Init_gtk_scale()
|
39
|
+
{
|
40
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
41
|
+
VALUE gScale = G_DEF_CLASS(GTK_TYPE_SCALE, "Scale", mGtk);
|
42
|
+
rb_define_method(gScale, "layout", rbscale_get_layout, 0);
|
43
|
+
rb_define_method(gScale, "layout_offsets", rbscale_get_layout_offsets, 0);
|
44
|
+
#else
|
45
|
+
G_DEF_CLASS(GTK_TYPE_SCALE, "Scale", mGtk);
|
46
|
+
#endif
|
47
|
+
}
|
@@ -0,0 +1,115 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkscalebutton.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/12 14:43:11 $
|
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
|
+
#if GTK_CHECK_VERSION(2,12,0)
|
18
|
+
|
19
|
+
#define _SELF(s) (GTK_SCALE_BUTTON(RVAL2GOBJ(s)))
|
20
|
+
|
21
|
+
static VALUE
|
22
|
+
scalebutton_set_icons(VALUE self, VALUE icons);
|
23
|
+
|
24
|
+
static VALUE
|
25
|
+
scalebutton_initialize(argc, argv, self)
|
26
|
+
int argc;
|
27
|
+
VALUE *argv;
|
28
|
+
VALUE self;
|
29
|
+
{
|
30
|
+
VALUE arg1, arg2, arg3, arg4, arg5;
|
31
|
+
GtkWidget *widget;
|
32
|
+
gdouble min = 0;
|
33
|
+
gdouble max = 100;
|
34
|
+
gdouble step = 2;
|
35
|
+
|
36
|
+
rb_scan_args(argc, argv, "14", &arg1, &arg2, &arg3, &arg4, &arg5);
|
37
|
+
|
38
|
+
if (!NIL_P(arg2))
|
39
|
+
min = NUM2DBL(arg2);
|
40
|
+
|
41
|
+
if (!NIL_P(arg3))
|
42
|
+
max = NUM2DBL(arg3);
|
43
|
+
|
44
|
+
if (!NIL_P(arg4))
|
45
|
+
step = NUM2DBL(arg4);
|
46
|
+
|
47
|
+
widget = gtk_scale_button_new(RVAL2GENUM(arg1, GTK_TYPE_ICON_SIZE), min, max, step, NULL);
|
48
|
+
RBGTK_INITIALIZE(self, widget);
|
49
|
+
|
50
|
+
if (!NIL_P(arg5))
|
51
|
+
scalebutton_set_icons(self, arg5);
|
52
|
+
|
53
|
+
return Qnil;
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
scalebutton_set_adjustment(self, adjustment)
|
58
|
+
VALUE self, adjustment;
|
59
|
+
{
|
60
|
+
gtk_scale_button_set_adjustment(_SELF(self), RVAL2GOBJ(adjustment));
|
61
|
+
return self;
|
62
|
+
}
|
63
|
+
|
64
|
+
static VALUE
|
65
|
+
scalebutton_set_icons(self, icons)
|
66
|
+
VALUE self, icons;
|
67
|
+
{
|
68
|
+
int i;
|
69
|
+
gchar **icons_c = g_new0(gchar*, RARRAY_LEN(icons) + 1);
|
70
|
+
for (i = 0; i < RARRAY_LEN(icons); i++)
|
71
|
+
icons_c[i] = RVAL2CSTR(RARRAY_PTR(icons)[i]);
|
72
|
+
icons_c[i] = NULL;
|
73
|
+
gtk_scale_button_set_icons(_SELF(self), (const gchar **) icons_c);
|
74
|
+
g_free(icons_c);
|
75
|
+
return self;
|
76
|
+
}
|
77
|
+
|
78
|
+
static VALUE
|
79
|
+
scalebutton_set_value(self, value)
|
80
|
+
VALUE self, value;
|
81
|
+
{
|
82
|
+
gtk_scale_button_set_value(_SELF(self), NUM2DBL(value));
|
83
|
+
return self;
|
84
|
+
}
|
85
|
+
|
86
|
+
static VALUE
|
87
|
+
scalebutton_get_adjustment(self)
|
88
|
+
VALUE self;
|
89
|
+
{
|
90
|
+
return GOBJ2RVAL(gtk_scale_button_get_adjustment(_SELF(self)));
|
91
|
+
}
|
92
|
+
|
93
|
+
static VALUE
|
94
|
+
scalebutton_get_value(self)
|
95
|
+
VALUE self;
|
96
|
+
{
|
97
|
+
return rb_float_new(gtk_scale_button_get_value(_SELF(self)));
|
98
|
+
}
|
99
|
+
|
100
|
+
#endif
|
101
|
+
|
102
|
+
void
|
103
|
+
Init_gtk_scalebutton()
|
104
|
+
{
|
105
|
+
#if GTK_CHECK_VERSION(2,12,0)
|
106
|
+
VALUE gScaleButton = G_DEF_CLASS(GTK_TYPE_SCALE_BUTTON, "ScaleButton", mGtk);
|
107
|
+
rb_define_method(gScaleButton, "initialize", scalebutton_initialize, -1);
|
108
|
+
rb_define_method(gScaleButton, "set_adjustment", scalebutton_set_adjustment, 1);
|
109
|
+
rb_define_method(gScaleButton, "set_icons", scalebutton_set_icons, 1);
|
110
|
+
rb_define_method(gScaleButton, "set_value", scalebutton_set_value, 1);
|
111
|
+
rb_define_method(gScaleButton, "adjustment", scalebutton_get_adjustment, 0);
|
112
|
+
rb_define_method(gScaleButton, "value", scalebutton_get_value, 0);
|
113
|
+
G_DEF_SETTERS(gScaleButton);
|
114
|
+
#endif
|
115
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkscrollbar.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2003/02/01 16:46:24 $
|
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
|
+
void
|
18
|
+
Init_gtk_scrollbar()
|
19
|
+
{
|
20
|
+
G_DEF_CLASS(GTK_TYPE_SCROLLBAR, "Scrollbar", mGtk);
|
21
|
+
}
|
@@ -0,0 +1,160 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkscrolledwindow.c -
|
5
|
+
|
6
|
+
$Author: ktou $
|
7
|
+
$Date: 2006/11/13 12:53:21 $
|
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
|
+
#define _SELF(self) (GTK_SCROLLED_WINDOW(RVAL2GOBJ(self)))
|
18
|
+
|
19
|
+
static VALUE
|
20
|
+
scwin_initialize(argc, argv, self)
|
21
|
+
int argc;
|
22
|
+
VALUE *argv;
|
23
|
+
VALUE self;
|
24
|
+
{
|
25
|
+
VALUE arg1, arg2;
|
26
|
+
GtkAdjustment *h_adj = NULL;
|
27
|
+
GtkAdjustment *v_adj = NULL;
|
28
|
+
|
29
|
+
rb_scan_args(argc, argv, "02", &arg1, &arg2);
|
30
|
+
|
31
|
+
if (!NIL_P(arg1)) h_adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1));
|
32
|
+
if (!NIL_P(arg2)) v_adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg2));
|
33
|
+
|
34
|
+
RBGTK_INITIALIZE(self, gtk_scrolled_window_new(h_adj, v_adj));
|
35
|
+
return Qnil;
|
36
|
+
}
|
37
|
+
|
38
|
+
static VALUE
|
39
|
+
scwin_set_policy(self, hpolicy, vpolicy)
|
40
|
+
VALUE self, hpolicy, vpolicy;
|
41
|
+
{
|
42
|
+
gtk_scrolled_window_set_policy(_SELF(self),
|
43
|
+
RVAL2GENUM(hpolicy, GTK_TYPE_POLICY_TYPE),
|
44
|
+
RVAL2GENUM(vpolicy, GTK_TYPE_POLICY_TYPE));
|
45
|
+
return self;
|
46
|
+
}
|
47
|
+
|
48
|
+
static VALUE
|
49
|
+
scwin_get_policy(self)
|
50
|
+
VALUE self;
|
51
|
+
{
|
52
|
+
GtkPolicyType hpolicy, vpolicy;
|
53
|
+
|
54
|
+
gtk_scrolled_window_get_policy(_SELF(self), &hpolicy, &vpolicy);
|
55
|
+
return rb_ary_new3(2,
|
56
|
+
GENUM2RVAL(hpolicy, GTK_TYPE_POLICY_TYPE),
|
57
|
+
GENUM2RVAL(vpolicy, GTK_TYPE_POLICY_TYPE));
|
58
|
+
}
|
59
|
+
|
60
|
+
static VALUE
|
61
|
+
scwin_add_with_viewport(self, other)
|
62
|
+
VALUE self, other;
|
63
|
+
{
|
64
|
+
gtk_scrolled_window_add_with_viewport(_SELF(self),
|
65
|
+
GTK_WIDGET(RVAL2GOBJ(other)));
|
66
|
+
G_CHILD_ADD(self, other);
|
67
|
+
return self;
|
68
|
+
}
|
69
|
+
|
70
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
71
|
+
static VALUE
|
72
|
+
scwin_get_hscrollbar(self)
|
73
|
+
VALUE self;
|
74
|
+
{
|
75
|
+
return GOBJ2RVAL(gtk_scrolled_window_get_hscrollbar(_SELF(self)));
|
76
|
+
}
|
77
|
+
|
78
|
+
static VALUE
|
79
|
+
scwin_get_vscrollbar(self)
|
80
|
+
VALUE self;
|
81
|
+
{
|
82
|
+
return GOBJ2RVAL(gtk_scrolled_window_get_vscrollbar(_SELF(self)));
|
83
|
+
}
|
84
|
+
#endif
|
85
|
+
|
86
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
87
|
+
static VALUE
|
88
|
+
scwin_set_placement(self, corner_type)
|
89
|
+
VALUE self, corner_type;
|
90
|
+
{
|
91
|
+
gtk_scrolled_window_set_placement(_SELF(self),
|
92
|
+
RVAL2GENUM(corner_type, GTK_TYPE_CORNER_TYPE));
|
93
|
+
return self;
|
94
|
+
}
|
95
|
+
|
96
|
+
static VALUE
|
97
|
+
scwin_unset_placement(self)
|
98
|
+
VALUE self;
|
99
|
+
{
|
100
|
+
gtk_scrolled_window_unset_placement(_SELF(self));
|
101
|
+
return self;
|
102
|
+
}
|
103
|
+
|
104
|
+
static VALUE
|
105
|
+
scwin_get_placement(self)
|
106
|
+
VALUE self;
|
107
|
+
{
|
108
|
+
return GENUM2RVAL(gtk_scrolled_window_get_placement(_SELF(self)),
|
109
|
+
GTK_TYPE_CORNER_TYPE);
|
110
|
+
}
|
111
|
+
#endif
|
112
|
+
|
113
|
+
/* Defined as properties
|
114
|
+
GtkAdjustment* gtk_scrolled_window_get_hadjustment
|
115
|
+
(GtkScrolledWindow *scrolled_window);
|
116
|
+
GtkAdjustment* gtk_scrolled_window_get_vadjustment
|
117
|
+
(GtkScrolledWindow *scrolled_window);
|
118
|
+
GtkWidget* gtk_scrolled_window_get_hscrollbar
|
119
|
+
(GtkScrolledWindow *scrolled_window);
|
120
|
+
GtkWidget* gtk_scrolled_window_get_vscrollbar
|
121
|
+
(GtkScrolledWindow *scrolled_window);
|
122
|
+
void gtk_scrolled_window_add_with_viewport
|
123
|
+
(GtkScrolledWindow *scrolled_window,
|
124
|
+
GtkWidget *child);
|
125
|
+
void gtk_scrolled_window_set_shadow_type
|
126
|
+
(GtkScrolledWindow *scrolled_window,
|
127
|
+
GtkShadowType type);
|
128
|
+
void gtk_scrolled_window_set_hadjustment
|
129
|
+
(GtkScrolledWindow *scrolled_window,
|
130
|
+
GtkAdjustment *hadjustment);
|
131
|
+
void gtk_scrolled_window_set_vadjustment
|
132
|
+
(GtkScrolledWindow *scrolled_window,
|
133
|
+
GtkAdjustment *vadjustment);
|
134
|
+
GtkShadowType gtk_scrolled_window_get_shadow_type
|
135
|
+
(GtkScrolledWindow *scrolled_window);
|
136
|
+
|
137
|
+
*/
|
138
|
+
|
139
|
+
|
140
|
+
void
|
141
|
+
Init_gtk_scrolled_window()
|
142
|
+
{
|
143
|
+
VALUE gScrolledWin = G_DEF_CLASS(GTK_TYPE_SCROLLED_WINDOW, "ScrolledWindow", mGtk);
|
144
|
+
|
145
|
+
rb_define_method(gScrolledWin, "initialize", scwin_initialize, -1);
|
146
|
+
rb_define_method(gScrolledWin, "set_policy", scwin_set_policy, 2);
|
147
|
+
rb_define_method(gScrolledWin, "policy", scwin_get_policy, 0);
|
148
|
+
rb_define_method(gScrolledWin, "add_with_viewport", scwin_add_with_viewport, 1);
|
149
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
150
|
+
rb_define_method(gScrolledWin, "hscrollbar", scwin_get_hscrollbar, 0);
|
151
|
+
rb_define_method(gScrolledWin, "vscrollbar", scwin_get_vscrollbar, 0);
|
152
|
+
#endif
|
153
|
+
|
154
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
155
|
+
rb_define_method(gScrolledWin, "unset_placement", scwin_unset_placement, 0);
|
156
|
+
rb_define_method(gScrolledWin, "placement", scwin_get_placement, 0);
|
157
|
+
rb_define_method(gScrolledWin, "set_placement", scwin_set_placement, 1);
|
158
|
+
#endif
|
159
|
+
G_DEF_SETTERS(gScrolledWin);
|
160
|
+
}
|
@@ -0,0 +1,171 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkselection.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 14:27:10 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 Masao Mutoh
|
10
|
+
|
11
|
+
This file is devided from rbgtkwidget.c.
|
12
|
+
rbgtkwidget.c -
|
13
|
+
Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
14
|
+
Daisuke Kanda,
|
15
|
+
Hiroshi Igarashi
|
16
|
+
************************************************/
|
17
|
+
#include "global.h"
|
18
|
+
|
19
|
+
#define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w)))
|
20
|
+
|
21
|
+
static VALUE
|
22
|
+
gtkdrag_selection_owner_set(argc, argv, self)
|
23
|
+
int argc;
|
24
|
+
VALUE* argv;
|
25
|
+
VALUE self;
|
26
|
+
{
|
27
|
+
gboolean ret;
|
28
|
+
|
29
|
+
if (argc == 3){
|
30
|
+
VALUE widget, selection, time;
|
31
|
+
rb_scan_args(argc, argv, "30", &widget, &selection, &time);
|
32
|
+
ret = gtk_selection_owner_set(RVAL2WIDGET(widget),
|
33
|
+
RVAL2ATOM(selection), NUM2INT(time));
|
34
|
+
} else {
|
35
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
36
|
+
VALUE display, widget, selection, time;
|
37
|
+
rb_scan_args(argc, argv, "40", &display, &widget, &selection, &time);
|
38
|
+
ret = gtk_selection_owner_set_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
39
|
+
RVAL2WIDGET(widget),
|
40
|
+
RVAL2ATOM(selection), NUM2INT(time));
|
41
|
+
#else
|
42
|
+
rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
|
43
|
+
#endif
|
44
|
+
}
|
45
|
+
return CBOOL2RVAL(ret);
|
46
|
+
}
|
47
|
+
|
48
|
+
static VALUE
|
49
|
+
gtkdrag_selection_add_target(self, widget, selection, target, info)
|
50
|
+
VALUE self, widget, selection, target, info;
|
51
|
+
{
|
52
|
+
gtk_selection_add_target(RVAL2WIDGET(widget), RVAL2ATOM(selection),
|
53
|
+
RVAL2ATOM(target), NUM2INT(info));
|
54
|
+
return self;
|
55
|
+
}
|
56
|
+
|
57
|
+
static VALUE
|
58
|
+
gtkdrag_selection_add_targets(self, widget, selection, targets)
|
59
|
+
VALUE self, widget, selection, targets;
|
60
|
+
{
|
61
|
+
gtk_selection_add_targets(RVAL2WIDGET(widget),
|
62
|
+
RVAL2ATOM(selection),
|
63
|
+
rbgtk_get_target_entry(targets), RARRAY_LEN(targets));
|
64
|
+
return self;
|
65
|
+
}
|
66
|
+
|
67
|
+
static VALUE
|
68
|
+
gtkdrag_selection_clear_targets(self, widget, selection)
|
69
|
+
VALUE self, widget, selection;
|
70
|
+
{
|
71
|
+
gtk_selection_clear_targets(RVAL2WIDGET(widget), RVAL2ATOM(selection));
|
72
|
+
return self;
|
73
|
+
}
|
74
|
+
|
75
|
+
static VALUE
|
76
|
+
gtkdrag_selection_convert(self, widget, selection, target, time)
|
77
|
+
VALUE self, widget, selection, target, time;
|
78
|
+
{
|
79
|
+
gboolean ret = gtk_selection_convert(RVAL2WIDGET(widget),
|
80
|
+
RVAL2ATOM(selection), RVAL2ATOM(target),
|
81
|
+
NUM2INT(time));
|
82
|
+
return CBOOL2RVAL(ret);
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE
|
86
|
+
gtkdrag_selection_remove_all(self, widget)
|
87
|
+
VALUE self, widget;
|
88
|
+
{
|
89
|
+
gtk_selection_remove_all(RVAL2WIDGET(widget));
|
90
|
+
return self;
|
91
|
+
}
|
92
|
+
|
93
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
94
|
+
static VALUE
|
95
|
+
targets_include_image(self, targets, writable)
|
96
|
+
VALUE self, targets, writable;
|
97
|
+
{
|
98
|
+
gint i;
|
99
|
+
gint len = RARRAY_LEN(targets);
|
100
|
+
GdkAtom* gtargets = ALLOCA_N(GdkAtom, len);
|
101
|
+
|
102
|
+
for (i = 0; i < len; i++){
|
103
|
+
gtargets[i] = RVAL2ATOM(RARRAY_PTR(targets)[i]);
|
104
|
+
}
|
105
|
+
|
106
|
+
return CBOOL2RVAL(gtk_targets_include_image(gtargets, len, RVAL2CBOOL(writable)));
|
107
|
+
}
|
108
|
+
|
109
|
+
static VALUE
|
110
|
+
targets_include_text(self, targets)
|
111
|
+
VALUE self, targets;
|
112
|
+
{
|
113
|
+
gint i;
|
114
|
+
gint len = RARRAY_LEN(targets);
|
115
|
+
GdkAtom* gtargets = ALLOCA_N(GdkAtom, len);
|
116
|
+
for (i = 0; i < len; i++){
|
117
|
+
gtargets[i] = RVAL2ATOM(RARRAY_PTR(targets)[i]);
|
118
|
+
}
|
119
|
+
return CBOOL2RVAL(gtk_targets_include_text(gtargets, len));
|
120
|
+
}
|
121
|
+
|
122
|
+
static VALUE
|
123
|
+
targets_include_uri(self, targets)
|
124
|
+
VALUE self, targets;
|
125
|
+
{
|
126
|
+
gint i;
|
127
|
+
gint len = RARRAY_LEN(targets);
|
128
|
+
GdkAtom* gtargets = ALLOCA_N(GdkAtom, len);
|
129
|
+
|
130
|
+
for (i = 0; i < len; i++){
|
131
|
+
gtargets[i] = RVAL2ATOM(RARRAY_PTR(targets)[i]);
|
132
|
+
}
|
133
|
+
|
134
|
+
return CBOOL2RVAL(gtk_targets_include_uri(gtargets, len));
|
135
|
+
}
|
136
|
+
|
137
|
+
static VALUE
|
138
|
+
targets_include_rich_text(self, targets, buffer)
|
139
|
+
VALUE self, targets, buffer;
|
140
|
+
{
|
141
|
+
gint i;
|
142
|
+
gint len = RARRAY_LEN(targets);
|
143
|
+
GdkAtom* gtargets = ALLOCA_N(GdkAtom, len);
|
144
|
+
|
145
|
+
for (i = 0; i < len; i++){
|
146
|
+
gtargets[i] = RVAL2ATOM(RARRAY_PTR(targets)[i]);
|
147
|
+
}
|
148
|
+
|
149
|
+
return CBOOL2RVAL(gtk_targets_include_rich_text(gtargets, len, RVAL2GOBJ(buffer)));
|
150
|
+
}
|
151
|
+
#endif
|
152
|
+
|
153
|
+
void
|
154
|
+
Init_gtk_selection()
|
155
|
+
{
|
156
|
+
VALUE mSelection = rb_define_module_under(mGtk, "Selection");
|
157
|
+
|
158
|
+
rb_define_module_function(mSelection, "owner_set", gtkdrag_selection_owner_set, 3);
|
159
|
+
rb_define_module_function(mSelection, "add_target", gtkdrag_selection_add_target, 4);
|
160
|
+
rb_define_module_function(mSelection, "add_targets", gtkdrag_selection_add_targets, 3);
|
161
|
+
rb_define_module_function(mSelection, "clear_targets", gtkdrag_selection_clear_targets, 2);
|
162
|
+
rb_define_module_function(mSelection, "convert", gtkdrag_selection_convert, 4);
|
163
|
+
rb_define_module_function(mSelection, "remove_all", gtkdrag_selection_remove_all, 1);
|
164
|
+
|
165
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
166
|
+
rb_define_module_function(mSelection, "include_image?", targets_include_image, 2);
|
167
|
+
rb_define_module_function(mSelection, "include_text?", targets_include_text, 1);
|
168
|
+
rb_define_module_function(mSelection, "include_uri?", targets_include_uri, 1);
|
169
|
+
rb_define_module_function(mSelection, "include_rich_text?", targets_include_rich_text, 2);
|
170
|
+
#endif
|
171
|
+
}
|