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,49 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtktextchild.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 14:27:10 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 Masahiro Sakai
|
10
|
+
Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
|
11
|
+
************************************************/
|
12
|
+
|
13
|
+
#include "global.h"
|
14
|
+
|
15
|
+
#define _SELF(self) GTK_TEXT_CHILD_ANCHOR(RVAL2GOBJ(self))
|
16
|
+
|
17
|
+
static VALUE
|
18
|
+
textchild_initialize(argc, argv, self)
|
19
|
+
int argc;
|
20
|
+
VALUE* argv;
|
21
|
+
VALUE self;
|
22
|
+
{
|
23
|
+
RBGTK_INITIALIZE(self, gtk_text_child_anchor_new());
|
24
|
+
return Qnil;
|
25
|
+
}
|
26
|
+
|
27
|
+
static VALUE
|
28
|
+
textchild_get_widgets(self)
|
29
|
+
VALUE self;
|
30
|
+
{
|
31
|
+
return GLIST2ARYF(gtk_text_child_anchor_get_widgets(_SELF(self)));
|
32
|
+
}
|
33
|
+
|
34
|
+
static VALUE
|
35
|
+
textchild_get_deleted(self)
|
36
|
+
VALUE self;
|
37
|
+
{
|
38
|
+
return CBOOL2RVAL(gtk_text_child_anchor_get_deleted(_SELF(self)));
|
39
|
+
}
|
40
|
+
|
41
|
+
void
|
42
|
+
Init_gtk_textchild()
|
43
|
+
{
|
44
|
+
VALUE gTextChildAnchor = G_DEF_CLASS(GTK_TYPE_TEXT_CHILD_ANCHOR, "TextChildAnchor", mGtk);
|
45
|
+
|
46
|
+
rb_define_method(gTextChildAnchor, "initialize", textchild_initialize, 0);
|
47
|
+
rb_define_method(gTextChildAnchor, "widgets", textchild_get_widgets, 0);
|
48
|
+
rb_define_method(gTextChildAnchor, "deleted?", textchild_get_deleted, 0);
|
49
|
+
}
|
data/src/rbgtktextiter.c
ADDED
@@ -0,0 +1,553 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtktextiter.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:32 $
|
8
|
+
|
9
|
+
Copyright (C) 2002-2005 Ruby-GNOME2 Project Team
|
10
|
+
Copyright (C) 2002,2003 Masahiro Sakai
|
11
|
+
************************************************/
|
12
|
+
|
13
|
+
#include "global.h"
|
14
|
+
|
15
|
+
#define _SELF(s) ((GtkTextIter*)RVAL2BOXED(s, GTK_TYPE_TEXT_ITER))
|
16
|
+
#define RVAL2TAG(t) (GTK_TEXT_TAG(RVAL2GOBJ(t)))
|
17
|
+
#define ITR2RVAL(i) (BOXED2RVAL(i, GTK_TYPE_TEXT_ITER))
|
18
|
+
|
19
|
+
static gboolean is_compat_240;
|
20
|
+
static ID id_pixbuf;
|
21
|
+
|
22
|
+
static VALUE
|
23
|
+
get_buffer(self)
|
24
|
+
VALUE self;
|
25
|
+
{
|
26
|
+
return GOBJ2RVAL(gtk_text_iter_get_buffer(_SELF(self)));
|
27
|
+
}
|
28
|
+
|
29
|
+
#define def_gint_getter(__name__) \
|
30
|
+
static VALUE \
|
31
|
+
get_##__name__(self) \
|
32
|
+
VALUE self; \
|
33
|
+
{ \
|
34
|
+
return INT2NUM(gtk_text_iter_get_##__name__(_SELF(self))); \
|
35
|
+
}
|
36
|
+
|
37
|
+
def_gint_getter(offset)
|
38
|
+
def_gint_getter(line)
|
39
|
+
def_gint_getter(line_offset)
|
40
|
+
def_gint_getter(line_index)
|
41
|
+
def_gint_getter(visible_line_offset)
|
42
|
+
def_gint_getter(visible_line_index)
|
43
|
+
|
44
|
+
static VALUE
|
45
|
+
get_char(self)
|
46
|
+
VALUE self;
|
47
|
+
{
|
48
|
+
gchar buf[10];
|
49
|
+
gint len = g_unichar_to_utf8(gtk_text_iter_get_char(_SELF(self)), buf);
|
50
|
+
buf[len] = '\0';
|
51
|
+
return CSTR2RVAL(buf);
|
52
|
+
}
|
53
|
+
|
54
|
+
static VALUE
|
55
|
+
get_slice(self, rhs)
|
56
|
+
VALUE self, rhs;
|
57
|
+
{
|
58
|
+
return CSTR2RVAL(gtk_text_iter_get_slice(_SELF(self), _SELF(rhs)));
|
59
|
+
}
|
60
|
+
|
61
|
+
static VALUE
|
62
|
+
get_text(self, rhs)
|
63
|
+
VALUE self, rhs;
|
64
|
+
{
|
65
|
+
return CSTR2RVAL(gtk_text_iter_get_text(_SELF(self), _SELF(rhs)));
|
66
|
+
}
|
67
|
+
|
68
|
+
static VALUE
|
69
|
+
get_visible_slice(self, rhs)
|
70
|
+
VALUE self, rhs;
|
71
|
+
{
|
72
|
+
return CSTR2RVAL(gtk_text_iter_get_visible_slice(_SELF(self), _SELF(rhs)));
|
73
|
+
}
|
74
|
+
|
75
|
+
static VALUE
|
76
|
+
get_visible_text(self, rhs)
|
77
|
+
VALUE self, rhs;
|
78
|
+
{
|
79
|
+
return CSTR2RVAL(gtk_text_iter_get_visible_text(_SELF(self), _SELF(rhs)));
|
80
|
+
}
|
81
|
+
|
82
|
+
static VALUE
|
83
|
+
get_pixbuf(self)
|
84
|
+
VALUE self;
|
85
|
+
{
|
86
|
+
GdkPixbuf* pixbuf = gtk_text_iter_get_pixbuf(_SELF(self));
|
87
|
+
VALUE ret = Qnil;
|
88
|
+
if (pixbuf){
|
89
|
+
ret = GOBJ2RVAL(pixbuf);
|
90
|
+
G_CHILD_SET(self, id_pixbuf, ret);
|
91
|
+
}
|
92
|
+
return ret;
|
93
|
+
}
|
94
|
+
|
95
|
+
static VALUE
|
96
|
+
get_marks(self)
|
97
|
+
VALUE self;
|
98
|
+
{
|
99
|
+
return GSLIST2ARYF(gtk_text_iter_get_marks(_SELF(self)));
|
100
|
+
}
|
101
|
+
|
102
|
+
static VALUE
|
103
|
+
get_toggled_tags(self, toggled_on)
|
104
|
+
VALUE self, toggled_on;
|
105
|
+
{
|
106
|
+
return GSLIST2ARYF(gtk_text_iter_get_toggled_tags(_SELF(self), RVAL2CBOOL(toggled_on)));
|
107
|
+
}
|
108
|
+
|
109
|
+
static VALUE
|
110
|
+
get_child_anchor(self)
|
111
|
+
VALUE self;
|
112
|
+
{
|
113
|
+
GtkTextChildAnchor* anchor = gtk_text_iter_get_child_anchor(_SELF(self));
|
114
|
+
return anchor ? GOBJ2RVAL(anchor) : Qnil;
|
115
|
+
}
|
116
|
+
|
117
|
+
static VALUE
|
118
|
+
begins_tag(self, tag)
|
119
|
+
VALUE self, tag;
|
120
|
+
{
|
121
|
+
return CBOOL2RVAL(gtk_text_iter_begins_tag(_SELF(self), RVAL2TAG(tag)));
|
122
|
+
}
|
123
|
+
|
124
|
+
static VALUE
|
125
|
+
ends_tag(self, tag)
|
126
|
+
VALUE self, tag;
|
127
|
+
{
|
128
|
+
return CBOOL2RVAL(gtk_text_iter_ends_tag(_SELF(self), RVAL2TAG(tag)));
|
129
|
+
}
|
130
|
+
|
131
|
+
static VALUE
|
132
|
+
toggles_tag(self, tag)
|
133
|
+
VALUE self, tag;
|
134
|
+
{
|
135
|
+
return CBOOL2RVAL(gtk_text_iter_toggles_tag(_SELF(self), RVAL2TAG(tag)));
|
136
|
+
}
|
137
|
+
|
138
|
+
static VALUE
|
139
|
+
has_tag(self, tag)
|
140
|
+
VALUE self, tag;
|
141
|
+
{
|
142
|
+
return CBOOL2RVAL(gtk_text_iter_has_tag(_SELF(self), RVAL2TAG(tag)));
|
143
|
+
}
|
144
|
+
|
145
|
+
static VALUE
|
146
|
+
get_tags(self)
|
147
|
+
VALUE self;
|
148
|
+
{
|
149
|
+
return GSLIST2ARYF(gtk_text_iter_get_tags(_SELF(self)));
|
150
|
+
}
|
151
|
+
|
152
|
+
static VALUE
|
153
|
+
editable(self, default_setting)
|
154
|
+
VALUE self, default_setting;
|
155
|
+
{
|
156
|
+
return CBOOL2RVAL(gtk_text_iter_editable(_SELF(self), RVAL2CBOOL(default_setting)));
|
157
|
+
}
|
158
|
+
|
159
|
+
static VALUE
|
160
|
+
can_insert(self, default_setting)
|
161
|
+
VALUE self, default_setting;
|
162
|
+
{
|
163
|
+
return CBOOL2RVAL(gtk_text_iter_can_insert(_SELF(self), RVAL2CBOOL(default_setting)));
|
164
|
+
}
|
165
|
+
|
166
|
+
|
167
|
+
#define def_predicate(__name__) \
|
168
|
+
static VALUE \
|
169
|
+
__name__(self) \
|
170
|
+
VALUE self; \
|
171
|
+
{ \
|
172
|
+
return CBOOL2RVAL(gtk_text_iter_##__name__(_SELF(self))); \
|
173
|
+
}
|
174
|
+
|
175
|
+
def_predicate(starts_word)
|
176
|
+
def_predicate(ends_word)
|
177
|
+
def_predicate(inside_word)
|
178
|
+
def_predicate(starts_sentence)
|
179
|
+
def_predicate(ends_sentence)
|
180
|
+
def_predicate(starts_line)
|
181
|
+
def_predicate(ends_line)
|
182
|
+
def_predicate(is_cursor_position)
|
183
|
+
|
184
|
+
def_gint_getter(chars_in_line)
|
185
|
+
def_gint_getter(bytes_in_line)
|
186
|
+
|
187
|
+
static VALUE
|
188
|
+
get_attributes(self)
|
189
|
+
VALUE self;
|
190
|
+
{
|
191
|
+
GtkTextAttributes attr;
|
192
|
+
|
193
|
+
if(gtk_text_iter_get_attributes(_SELF(self), &attr) == TRUE){
|
194
|
+
return BOXED2RVAL(&attr, GTK_TYPE_TEXT_ATTRIBUTES);
|
195
|
+
} else {
|
196
|
+
return Qnil;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
static VALUE
|
201
|
+
get_language(self)
|
202
|
+
VALUE self;
|
203
|
+
{
|
204
|
+
return CSTR2RVAL(pango_language_to_string(gtk_text_iter_get_language(_SELF(self))));
|
205
|
+
}
|
206
|
+
|
207
|
+
def_predicate(is_end)
|
208
|
+
def_predicate(is_start)
|
209
|
+
|
210
|
+
|
211
|
+
#define def_move(__name__) \
|
212
|
+
static VALUE \
|
213
|
+
__name__(self) \
|
214
|
+
VALUE self; \
|
215
|
+
{ \
|
216
|
+
return CBOOL2RVAL(gtk_text_iter_##__name__(_SELF(self))); \
|
217
|
+
}
|
218
|
+
|
219
|
+
#define def_move_gint(__name__) \
|
220
|
+
static VALUE \
|
221
|
+
__name__(self, i) \
|
222
|
+
VALUE self, i; \
|
223
|
+
{ \
|
224
|
+
return CBOOL2RVAL(gtk_text_iter_##__name__(_SELF(self), NUM2INT(i))); \
|
225
|
+
}
|
226
|
+
|
227
|
+
def_move(forward_char)
|
228
|
+
def_move(backward_char)
|
229
|
+
def_move_gint(forward_chars)
|
230
|
+
def_move_gint(backward_chars)
|
231
|
+
def_move(forward_line)
|
232
|
+
def_move(backward_line)
|
233
|
+
def_move_gint(forward_lines)
|
234
|
+
def_move_gint(backward_lines)
|
235
|
+
def_move(forward_word_end)
|
236
|
+
def_move(backward_word_start)
|
237
|
+
def_move_gint(forward_word_ends)
|
238
|
+
def_move_gint(backward_word_starts)
|
239
|
+
def_move(forward_sentence_end)
|
240
|
+
def_move(backward_sentence_start)
|
241
|
+
def_move_gint(forward_sentence_ends)
|
242
|
+
def_move_gint(backward_sentence_starts)
|
243
|
+
|
244
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
245
|
+
def_move_gint(forward_visible_word_ends)
|
246
|
+
def_move_gint(backward_visible_word_starts)
|
247
|
+
def_move(forward_visible_word_end)
|
248
|
+
def_move(backward_visible_word_start)
|
249
|
+
def_move(forward_visible_cursor_position)
|
250
|
+
def_move(backward_visible_cursor_position)
|
251
|
+
def_move_gint(forward_visible_cursor_positions)
|
252
|
+
def_move_gint(backward_visible_cursor_positions)
|
253
|
+
#endif
|
254
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
255
|
+
def_move(forward_visible_line)
|
256
|
+
def_move(backward_visible_line)
|
257
|
+
def_move_gint(forward_visible_lines)
|
258
|
+
def_move_gint(backward_visible_lines)
|
259
|
+
#endif
|
260
|
+
def_move(forward_cursor_position)
|
261
|
+
def_move(backward_cursor_position)
|
262
|
+
def_move_gint(forward_cursor_positions)
|
263
|
+
def_move_gint(backward_cursor_positions)
|
264
|
+
def_move(forward_to_line_end)
|
265
|
+
|
266
|
+
static VALUE
|
267
|
+
forward_to_end(self)
|
268
|
+
VALUE self;
|
269
|
+
{
|
270
|
+
gtk_text_iter_forward_to_end(_SELF(self));
|
271
|
+
return self;
|
272
|
+
}
|
273
|
+
|
274
|
+
#define def_gint_setter(__name__) \
|
275
|
+
static VALUE \
|
276
|
+
set_##__name__(self, val) \
|
277
|
+
VALUE self, val; \
|
278
|
+
{ \
|
279
|
+
gtk_text_iter_set_##__name__(_SELF(self), NUM2INT(val)); \
|
280
|
+
return val; \
|
281
|
+
}
|
282
|
+
|
283
|
+
def_gint_setter(offset)
|
284
|
+
def_gint_setter(line)
|
285
|
+
def_gint_setter(line_offset)
|
286
|
+
def_gint_setter(line_index)
|
287
|
+
|
288
|
+
def_gint_setter(visible_line_offset)
|
289
|
+
def_gint_setter(visible_line_index)
|
290
|
+
|
291
|
+
static VALUE
|
292
|
+
forward_to_tag_toggle(argc, argv, self)
|
293
|
+
int argc;
|
294
|
+
VALUE *argv;
|
295
|
+
VALUE self;
|
296
|
+
{
|
297
|
+
VALUE tag;
|
298
|
+
|
299
|
+
rb_scan_args(argc, argv, "01", &tag);
|
300
|
+
return CBOOL2RVAL(gtk_text_iter_forward_to_tag_toggle(_SELF(self),
|
301
|
+
NIL_P(tag) ? NULL : RVAL2TAG(tag)));
|
302
|
+
}
|
303
|
+
|
304
|
+
static VALUE
|
305
|
+
backward_to_tag_toggle(argc, argv, self)
|
306
|
+
int argc;
|
307
|
+
VALUE *argv;
|
308
|
+
VALUE self;
|
309
|
+
{
|
310
|
+
VALUE tag;
|
311
|
+
|
312
|
+
rb_scan_args(argc, argv, "01", &tag);
|
313
|
+
return CBOOL2RVAL(gtk_text_iter_backward_to_tag_toggle(_SELF(self),
|
314
|
+
NIL_P(tag) ? NULL : RVAL2TAG(tag)));
|
315
|
+
}
|
316
|
+
|
317
|
+
static gboolean
|
318
|
+
char_predicate_func(ch, func)
|
319
|
+
guint32 ch;
|
320
|
+
gpointer func;
|
321
|
+
{
|
322
|
+
return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 1, UINT2NUM(ch)));
|
323
|
+
}
|
324
|
+
|
325
|
+
static VALUE
|
326
|
+
forward_find_char(argc, argv, self)
|
327
|
+
int argc;
|
328
|
+
VALUE *argv;
|
329
|
+
VALUE self;
|
330
|
+
{
|
331
|
+
VALUE limit;
|
332
|
+
volatile VALUE func = rb_block_proc();
|
333
|
+
|
334
|
+
rb_scan_args(argc, argv, "01", &limit);
|
335
|
+
return CBOOL2RVAL(gtk_text_iter_forward_find_char(_SELF(self),
|
336
|
+
(GtkTextCharPredicate)char_predicate_func,
|
337
|
+
(gpointer)func,
|
338
|
+
NIL_P(limit) ? NULL : _SELF(limit)));
|
339
|
+
}
|
340
|
+
|
341
|
+
static VALUE
|
342
|
+
backward_find_char(argc, argv, self)
|
343
|
+
int argc;
|
344
|
+
VALUE *argv;
|
345
|
+
VALUE self;
|
346
|
+
{
|
347
|
+
VALUE limit;
|
348
|
+
volatile VALUE func = rb_block_proc();
|
349
|
+
|
350
|
+
rb_scan_args(argc, argv, "01", &limit);
|
351
|
+
return CBOOL2RVAL(gtk_text_iter_backward_find_char(_SELF(self),
|
352
|
+
(GtkTextCharPredicate)char_predicate_func,
|
353
|
+
(gpointer)func,
|
354
|
+
NIL_P(limit) ? NULL : _SELF(limit)));
|
355
|
+
}
|
356
|
+
|
357
|
+
static VALUE
|
358
|
+
forward_search(argc, argv, self)
|
359
|
+
int argc;
|
360
|
+
VALUE *argv;
|
361
|
+
VALUE self;
|
362
|
+
{
|
363
|
+
GtkTextIter m_start, m_end;
|
364
|
+
VALUE str, flags, limit;
|
365
|
+
gboolean ret;
|
366
|
+
|
367
|
+
rb_scan_args(argc, argv, "21", &str, &flags, &limit);
|
368
|
+
|
369
|
+
if (is_compat_240){
|
370
|
+
ret = gtk_text_iter_forward_search(_SELF(self), RVAL2CSTR(str),
|
371
|
+
RVAL2GFLAGS(flags, GTK_TYPE_TEXT_SEARCH_FLAGS),
|
372
|
+
&m_start, &m_end,
|
373
|
+
NIL_P(limit) ? NULL : _SELF(limit));
|
374
|
+
} else {
|
375
|
+
ret = gtk_text_iter_forward_search(_SELF(self), RVAL2CSTR(str),
|
376
|
+
RVAL2GENUM(flags, GTK_TYPE_TEXT_SEARCH_FLAGS),
|
377
|
+
&m_start, &m_end,
|
378
|
+
NIL_P(limit) ? NULL : _SELF(limit));
|
379
|
+
}
|
380
|
+
return ret ? rb_ary_new3(2, ITR2RVAL(&m_start), ITR2RVAL(&m_end)) : Qnil;
|
381
|
+
}
|
382
|
+
|
383
|
+
static VALUE
|
384
|
+
backward_search(argc, argv, self)
|
385
|
+
int argc;
|
386
|
+
VALUE *argv;
|
387
|
+
VALUE self;
|
388
|
+
{
|
389
|
+
GtkTextIter m_start, m_end;
|
390
|
+
VALUE str, flags, limit;
|
391
|
+
gboolean ret;
|
392
|
+
|
393
|
+
rb_scan_args(argc, argv, "21", &str, &flags, &limit);
|
394
|
+
if (is_compat_240){
|
395
|
+
ret = gtk_text_iter_backward_search(_SELF(self), RVAL2CSTR(str),
|
396
|
+
RVAL2GFLAGS(flags, GTK_TYPE_TEXT_SEARCH_FLAGS),
|
397
|
+
&m_start, &m_end,
|
398
|
+
NIL_P(limit) ? NULL : _SELF(limit));
|
399
|
+
} else {
|
400
|
+
ret = gtk_text_iter_backward_search(_SELF(self), RVAL2CSTR(str),
|
401
|
+
RVAL2GENUM(flags, GTK_TYPE_TEXT_SEARCH_FLAGS),
|
402
|
+
&m_start, &m_end,
|
403
|
+
NIL_P(limit) ? NULL : _SELF(limit));
|
404
|
+
}
|
405
|
+
return ret ? rb_ary_new3(2, ITR2RVAL(&m_start), ITR2RVAL(&m_end)) : Qnil;
|
406
|
+
}
|
407
|
+
|
408
|
+
static VALUE
|
409
|
+
equal(self, other)
|
410
|
+
VALUE self, other;
|
411
|
+
{
|
412
|
+
return CBOOL2RVAL(gtk_text_iter_equal(_SELF(self), _SELF(other)));
|
413
|
+
}
|
414
|
+
|
415
|
+
static VALUE
|
416
|
+
compare(self, rhs)
|
417
|
+
VALUE self, rhs;
|
418
|
+
{
|
419
|
+
return INT2NUM(gtk_text_iter_compare(_SELF(self), _SELF(rhs)));
|
420
|
+
}
|
421
|
+
|
422
|
+
/*
|
423
|
+
The following methods don't have to be implimented.
|
424
|
+
Including Comparable module is enough.
|
425
|
+
|
426
|
+
gboolean gtk_text_iter_in_range (const GtkTextIter *iter,
|
427
|
+
const GtkTextIter *start,
|
428
|
+
const GtkTextIter *end);
|
429
|
+
void gtk_text_iter_order (GtkTextIter *first,
|
430
|
+
GtkTextIter *second);
|
431
|
+
*/
|
432
|
+
|
433
|
+
void
|
434
|
+
Init_gtk_textiter()
|
435
|
+
{
|
436
|
+
VALUE cTextIter = G_DEF_CLASS(GTK_TYPE_TEXT_ITER, "TextIter", mGtk);
|
437
|
+
rb_include_module(cTextIter, rb_mComparable);
|
438
|
+
|
439
|
+
is_compat_240 = gtk_check_version(2, 4, 0) ? FALSE : TRUE;
|
440
|
+
|
441
|
+
id_pixbuf = rb_intern("pixbuf");
|
442
|
+
|
443
|
+
rb_define_method(cTextIter, "buffer", get_buffer, 0);
|
444
|
+
rb_define_method(cTextIter, "offset", get_offset, 0);
|
445
|
+
rb_define_method(cTextIter, "line", get_line, 0);
|
446
|
+
rb_define_method(cTextIter, "line_offset", get_line_offset, 0);
|
447
|
+
rb_define_method(cTextIter, "line_index", get_line_index, 0);
|
448
|
+
rb_define_method(cTextIter, "visible_line_offset", get_visible_line_offset, 0);
|
449
|
+
rb_define_method(cTextIter, "visible_line_index", get_visible_line_index, 0);
|
450
|
+
rb_define_method(cTextIter, "char", get_char, 0);
|
451
|
+
|
452
|
+
rb_define_method(cTextIter, "get_slice", get_slice, 1);
|
453
|
+
rb_define_method(cTextIter, "get_text", get_text, 1);
|
454
|
+
rb_define_method(cTextIter, "get_visible_slice", get_visible_slice, 1);
|
455
|
+
rb_define_method(cTextIter, "get_visible_text", get_visible_text, 1);
|
456
|
+
|
457
|
+
rb_define_method(cTextIter, "pixbuf", get_pixbuf, 0);
|
458
|
+
rb_define_method(cTextIter, "marks", get_marks, 0);
|
459
|
+
rb_define_method(cTextIter, "child_anchor", get_child_anchor, 0);
|
460
|
+
|
461
|
+
rb_define_method(cTextIter, "toggled_tags", get_toggled_tags, 1);
|
462
|
+
rb_define_method(cTextIter, "begins_tag?", begins_tag, 1);
|
463
|
+
rb_define_method(cTextIter, "ends_tag?", ends_tag, 1);
|
464
|
+
rb_define_method(cTextIter, "toggles_tag?", toggles_tag, 1);
|
465
|
+
rb_define_method(cTextIter, "has_tag?", has_tag, 1);
|
466
|
+
rb_define_method(cTextIter, "tags", get_tags, 0);
|
467
|
+
|
468
|
+
rb_define_method(cTextIter, "editable?", editable, 1);
|
469
|
+
rb_define_method(cTextIter, "can_insert?", can_insert, 1);
|
470
|
+
|
471
|
+
rb_define_method(cTextIter, "starts_word?", starts_word, 0);
|
472
|
+
rb_define_method(cTextIter, "ends_word?", ends_word, 0);
|
473
|
+
rb_define_method(cTextIter, "inside_word?", inside_word, 0);
|
474
|
+
rb_define_method(cTextIter, "starts_sentence?", starts_sentence, 0);
|
475
|
+
rb_define_method(cTextIter, "ends_sentence?", ends_sentence, 0);
|
476
|
+
rb_define_method(cTextIter, "starts_line?", starts_line, 0);
|
477
|
+
rb_define_method(cTextIter, "ends_line?", ends_line, 0);
|
478
|
+
rb_define_method(cTextIter, "cursor_position?", is_cursor_position, 0);
|
479
|
+
|
480
|
+
rb_define_method(cTextIter, "chars_in_line", get_chars_in_line, 0);
|
481
|
+
rb_define_method(cTextIter, "bytes_in_line", get_bytes_in_line, 0);
|
482
|
+
|
483
|
+
rb_define_method(cTextIter, "attributes", get_attributes, 0);
|
484
|
+
|
485
|
+
rb_define_method(cTextIter, "language", get_language, 0);
|
486
|
+
rb_define_method(cTextIter, "end?", is_end, 0);
|
487
|
+
rb_define_method(cTextIter, "start?", is_start, 0);
|
488
|
+
|
489
|
+
rb_define_method(cTextIter, "forward_char", forward_char, 0);
|
490
|
+
rb_define_method(cTextIter, "backward_char", backward_char, 0);
|
491
|
+
rb_define_method(cTextIter, "forward_chars", forward_chars, 1);
|
492
|
+
rb_define_method(cTextIter, "backward_chars", backward_chars, 1);
|
493
|
+
rb_define_method(cTextIter, "forward_line", forward_line, 0);
|
494
|
+
rb_define_method(cTextIter, "backward_line", backward_line, 0);
|
495
|
+
rb_define_method(cTextIter, "forward_lines", forward_lines, 1);
|
496
|
+
rb_define_method(cTextIter, "backward_lines", backward_lines, 1);
|
497
|
+
rb_define_method(cTextIter, "forward_word_end", forward_word_end, 0);
|
498
|
+
rb_define_method(cTextIter, "backward_word_start", backward_word_start, 0);
|
499
|
+
rb_define_method(cTextIter, "forward_word_ends", forward_word_ends, 1);
|
500
|
+
rb_define_method(cTextIter, "backward_word_starts", backward_word_starts, 1);
|
501
|
+
rb_define_method(cTextIter, "forward_sentence_end", forward_sentence_end, 0);
|
502
|
+
rb_define_method(cTextIter, "backward_sentence_start", backward_sentence_start, 0);
|
503
|
+
rb_define_method(cTextIter, "forward_sentence_ends", forward_sentence_ends, 1);
|
504
|
+
rb_define_method(cTextIter, "backward_sentence_starts", backward_sentence_starts, 1);
|
505
|
+
|
506
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
507
|
+
rb_define_method(cTextIter, "forward_visible_word_ends", forward_visible_word_ends, 1);
|
508
|
+
rb_define_method(cTextIter, "backward_visible_word_starts", backward_visible_word_starts, 1);
|
509
|
+
rb_define_method(cTextIter, "forward_visible_word_end", forward_visible_word_end, 0);
|
510
|
+
rb_define_method(cTextIter, "backword_visible_word_start", backward_visible_word_start, 0);
|
511
|
+
rb_define_method(cTextIter, "forward_visible_cursor_position", forward_visible_cursor_position, 0);
|
512
|
+
rb_define_method(cTextIter, "backward_visible_cursor_position", backward_visible_cursor_position, 0);
|
513
|
+
rb_define_method(cTextIter, "forward_visible_cursor_positions", forward_visible_cursor_positions, 1);
|
514
|
+
rb_define_method(cTextIter, "backward_visible_cursor_positions", backward_visible_cursor_positions, 1);
|
515
|
+
#endif
|
516
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
517
|
+
rb_define_method(cTextIter, "forward_visible_line", forward_visible_line, 0);
|
518
|
+
rb_define_method(cTextIter, "backward_visible_line", backward_visible_line, 0);
|
519
|
+
rb_define_method(cTextIter, "forward_visible_lines", forward_visible_lines, 1);
|
520
|
+
rb_define_method(cTextIter, "backward_visible_lines", backward_visible_lines, 1);
|
521
|
+
#endif
|
522
|
+
rb_define_method(cTextIter, "forward_cursor_position", forward_cursor_position, 0);
|
523
|
+
rb_define_method(cTextIter, "backward_cursor_position", backward_cursor_position, 0);
|
524
|
+
rb_define_method(cTextIter, "forward_cursor_positions", forward_cursor_positions, 1);
|
525
|
+
rb_define_method(cTextIter, "backward_cursor_positions", backward_cursor_positions, 1);
|
526
|
+
rb_define_method(cTextIter, "forward_to_end", forward_to_end, 0);
|
527
|
+
rb_define_method(cTextIter, "forward_to_line_end", forward_to_line_end, 0);
|
528
|
+
|
529
|
+
|
530
|
+
rb_define_method(cTextIter, "set_offset", set_offset, 1);
|
531
|
+
rb_define_method(cTextIter, "set_line", set_line, 1);
|
532
|
+
rb_define_method(cTextIter, "set_line_offset", set_line_offset, 1);
|
533
|
+
rb_define_method(cTextIter, "set_line_index", set_line_index, 1);
|
534
|
+
|
535
|
+
rb_define_method(cTextIter, "set_visible_line_offset", set_visible_line_offset, 1);
|
536
|
+
rb_define_method(cTextIter, "set_visible_line_index", set_visible_line_index, 1);
|
537
|
+
|
538
|
+
rb_define_method(cTextIter, "forward_to_tag_toggle", forward_to_tag_toggle, -1);
|
539
|
+
rb_define_method(cTextIter, "backward_to_tag_toggle", backward_to_tag_toggle, -1);
|
540
|
+
rb_define_method(cTextIter, "forward_find_char", forward_find_char, -1);
|
541
|
+
rb_define_method(cTextIter, "backward_find_char", backward_find_char, -1);
|
542
|
+
rb_define_method(cTextIter, "forward_search", forward_search, -1);
|
543
|
+
rb_define_method(cTextIter, "backward_search", backward_search, -1);
|
544
|
+
|
545
|
+
rb_define_method(cTextIter, "==", equal, 1);
|
546
|
+
rb_define_method(cTextIter, "<=>", compare, 1);
|
547
|
+
|
548
|
+
G_DEF_SETTERS(cTextIter);
|
549
|
+
|
550
|
+
/* GtkTextSearchFlags */
|
551
|
+
G_DEF_CLASS(GTK_TYPE_TEXT_SEARCH_FLAGS, "SearchFlags", cTextIter);
|
552
|
+
G_DEF_CONSTANTS(cTextIter, GTK_TYPE_TEXT_SEARCH_FLAGS, "GTK_TEXT_");
|
553
|
+
}
|