gtk2 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +66 -1
- data/ext/gtk2/extconf.rb +0 -96
- data/ext/gtk2/global.h +274 -13
- data/ext/gtk2/gtk2.def +5 -3
- data/ext/gtk2/init.c +263 -19
- data/ext/gtk2/rbgdk.c +245 -89
- data/ext/gtk2/rbgdk.h +32 -6
- data/ext/gtk2/rbgdkatom.c +38 -28
- data/ext/gtk2/rbgdkcairo.c +32 -42
- data/ext/gtk2/rbgdkcolor.c +52 -42
- data/ext/gtk2/rbgdkcolormap.c +42 -37
- data/ext/gtk2/rbgdkconst.c +23 -13
- data/ext/gtk2/rbgdkconversions.h +19 -6
- data/ext/gtk2/rbgdkcursor.c +37 -25
- data/ext/gtk2/rbgdkdevice.c +77 -67
- data/ext/gtk2/rbgdkdisplay.c +158 -150
- data/ext/gtk2/rbgdkdisplaymanager.c +27 -15
- data/ext/gtk2/rbgdkdragcontext.c +121 -70
- data/ext/gtk2/rbgdkdraw.c +252 -160
- data/ext/gtk2/rbgdkevent.c +30 -20
- data/ext/gtk2/rbgdkgc.c +123 -116
- data/ext/gtk2/rbgdkgeometry.c +77 -68
- data/ext/gtk2/rbgdkimage.c +58 -47
- data/ext/gtk2/rbgdkinput.c +33 -26
- data/ext/gtk2/rbgdkkeymap.c +38 -27
- data/ext/gtk2/rbgdkkeyval.c +44 -32
- data/ext/gtk2/rbgdkpango.c +66 -39
- data/ext/gtk2/rbgdkpangorenderer.c +63 -35
- data/ext/gtk2/rbgdkpixbuf.c +36 -25
- data/ext/gtk2/rbgdkpixmap.c +65 -49
- data/ext/gtk2/rbgdkproperty.c +66 -60
- data/ext/gtk2/rbgdkrectangle.c +54 -46
- data/ext/gtk2/rbgdkregion.c +144 -79
- data/ext/gtk2/rbgdkrgb.c +74 -58
- data/ext/gtk2/rbgdkscreen.c +103 -97
- data/ext/gtk2/rbgdkselection.c +49 -39
- data/ext/gtk2/rbgdkthreads.c +32 -19
- data/ext/gtk2/rbgdktimecoord.c +60 -38
- data/ext/gtk2/rbgdkvisual.c +79 -71
- data/ext/gtk2/rbgdkwindow.c +284 -305
- data/ext/gtk2/rbgdkwindowattr.c +69 -58
- data/ext/gtk2/rbgdkx11.c +41 -28
- data/ext/gtk2/rbgtk.c +498 -19
- data/ext/gtk2/rbgtk.h +35 -20
- data/ext/gtk2/rbgtkaboutdialog.c +33 -80
- data/ext/gtk2/rbgtkaccelerator.c +36 -23
- data/ext/gtk2/rbgtkaccelgroup.c +50 -40
- data/ext/gtk2/rbgtkaccelgroupentry.c +32 -20
- data/ext/gtk2/rbgtkaccelkey.c +40 -28
- data/ext/gtk2/rbgtkaccellabel.c +30 -18
- data/ext/gtk2/rbgtkaccelmap.c +55 -42
- data/ext/gtk2/rbgtkaccessible.c +25 -14
- data/ext/gtk2/rbgtkaction.c +68 -68
- data/ext/gtk2/rbgtkactiongroup.c +317 -195
- data/ext/gtk2/rbgtkadjustment.c +33 -46
- data/ext/gtk2/rbgtkalignment.c +36 -24
- data/ext/gtk2/rbgtkallocation.c +53 -42
- data/ext/gtk2/rbgtkarrow.c +34 -22
- data/ext/gtk2/rbgtkaspectframe.c +32 -20
- data/ext/gtk2/rbgtkassistant.c +81 -61
- data/ext/gtk2/rbgtkbbox.c +32 -20
- data/ext/gtk2/rbgtkbin.c +28 -16
- data/ext/gtk2/rbgtkbindingset.c +42 -35
- data/ext/gtk2/rbgtkborder.c +34 -23
- data/ext/gtk2/rbgtkbox.c +40 -29
- data/ext/gtk2/rbgtkbuildable.c +57 -45
- data/ext/gtk2/rbgtkbuilder.c +53 -38
- data/ext/gtk2/rbgtkbutton.c +41 -55
- data/ext/gtk2/rbgtkcalendar.c +51 -40
- data/ext/gtk2/rbgtkcelleditable.c +28 -17
- data/ext/gtk2/rbgtkcelllayout.c +41 -30
- data/ext/gtk2/rbgtkcellrenderer.c +43 -32
- data/ext/gtk2/rbgtkcellrendereraccel.c +26 -18
- data/ext/gtk2/rbgtkcellrenderercombo.c +25 -17
- data/ext/gtk2/rbgtkcellrendererpixbuf.c +24 -17
- data/ext/gtk2/rbgtkcellrendererprogress.c +25 -17
- data/ext/gtk2/rbgtkcellrendererspin.c +24 -16
- data/ext/gtk2/rbgtkcellrendererspinner.c +23 -11
- data/ext/gtk2/rbgtkcellrenderertext.c +28 -21
- data/ext/gtk2/rbgtkcellrenderertoggle.c +24 -16
- data/ext/gtk2/rbgtkcellview.c +34 -33
- data/ext/gtk2/rbgtkcheckbutton.c +28 -16
- data/ext/gtk2/rbgtkcheckmenuitem.c +31 -19
- data/ext/gtk2/rbgtkclipboard.c +123 -77
- data/ext/gtk2/rbgtkcolorbutton.c +26 -31
- data/ext/gtk2/rbgtkcolorsel.c +109 -55
- data/ext/gtk2/rbgtkcolorselectiondialog.c +28 -19
- data/ext/gtk2/rbgtkcombo.c +43 -32
- data/ext/gtk2/rbgtkcombobox.c +44 -83
- data/ext/gtk2/rbgtkcomboboxentry.c +26 -21
- data/ext/gtk2/rbgtkconst.c +23 -13
- data/ext/gtk2/rbgtkcontainer.c +153 -100
- data/ext/gtk2/rbgtkconversions.h +19 -6
- data/ext/gtk2/rbgtkcurve.c +46 -36
- data/ext/gtk2/rbgtkdialog.c +104 -70
- data/ext/gtk2/rbgtkdrag.c +173 -121
- data/ext/gtk2/rbgtkdrawingarea.c +28 -16
- data/ext/gtk2/rbgtkeditable.c +63 -51
- data/ext/gtk2/rbgtkentry.c +48 -85
- data/ext/gtk2/rbgtkentrycompletion.c +42 -55
- data/ext/gtk2/rbgtkeventbox.c +28 -16
- data/ext/gtk2/rbgtkexpander.c +26 -35
- data/ext/gtk2/rbgtkfilechooser.c +87 -143
- data/ext/gtk2/rbgtkfilechooserbutton.c +26 -32
- data/ext/gtk2/rbgtkfilechooserdialog.c +25 -15
- data/ext/gtk2/rbgtkfilechooserwidget.c +26 -15
- data/ext/gtk2/rbgtkfilefilter.c +45 -35
- data/ext/gtk2/rbgtkfilesel.c +54 -43
- data/ext/gtk2/rbgtkfilesystemerror.c +51 -0
- data/ext/gtk2/rbgtkfixed.c +36 -25
- data/ext/gtk2/rbgtkfontbutton.c +26 -37
- data/ext/gtk2/rbgtkfontselection.c +27 -15
- data/ext/gtk2/rbgtkfontselectiondialog.c +43 -32
- data/ext/gtk2/rbgtkframe.c +39 -28
- data/ext/gtk2/rbgtkgamma.c +32 -20
- data/ext/gtk2/rbgtkhandlebox.c +31 -19
- data/ext/gtk2/rbgtkhbbox.c +28 -16
- data/ext/gtk2/rbgtkhbox.c +29 -17
- data/ext/gtk2/rbgtkhpaned.c +28 -16
- data/ext/gtk2/rbgtkhruler.c +28 -16
- data/ext/gtk2/rbgtkhscale.c +28 -16
- data/ext/gtk2/rbgtkhscrollbar.c +28 -16
- data/ext/gtk2/rbgtkhseparator.c +28 -16
- data/ext/gtk2/rbgtkiconfactory.c +35 -23
- data/ext/gtk2/rbgtkiconinfo.c +42 -30
- data/ext/gtk2/rbgtkiconset.c +31 -19
- data/ext/gtk2/rbgtkiconsize.c +38 -25
- data/ext/gtk2/rbgtkiconsource.c +62 -50
- data/ext/gtk2/rbgtkicontheme.c +95 -95
- data/ext/gtk2/rbgtkiconview.c +87 -121
- data/ext/gtk2/rbgtkimage.c +31 -40
- data/ext/gtk2/rbgtkimagemenuitem.c +26 -14
- data/ext/gtk2/rbgtkimcontext.c +46 -34
- data/ext/gtk2/rbgtkimcontextsimple.c +47 -24
- data/ext/gtk2/rbgtkimmulticontext.c +26 -14
- data/ext/gtk2/rbgtkinputdialog.c +28 -16
- data/ext/gtk2/rbgtkinvisible.c +24 -18
- data/ext/gtk2/rbgtkitem.c +32 -20
- data/ext/gtk2/rbgtkitemfactory.c +65 -57
- data/ext/gtk2/rbgtklabel.c +46 -57
- data/ext/gtk2/rbgtklayout.c +40 -29
- data/ext/gtk2/rbgtklinkbutton.c +26 -15
- data/ext/gtk2/rbgtkliststore.c +145 -102
- data/ext/gtk2/rbgtkmacros.h +19 -6
- data/ext/gtk2/rbgtkmenu.c +47 -59
- data/ext/gtk2/rbgtkmenubar.c +30 -30
- data/ext/gtk2/rbgtkmenuitem.c +34 -41
- data/ext/gtk2/rbgtkmenushell.c +43 -42
- data/ext/gtk2/rbgtkmenutoolbutton.c +27 -16
- data/ext/gtk2/rbgtkmessagedialog.c +31 -25
- data/ext/gtk2/rbgtkmisc.c +33 -22
- data/ext/gtk2/rbgtknotebook.c +98 -134
- data/ext/gtk2/rbgtkobject.c +46 -81
- data/ext/gtk2/rbgtkoptionmenu.c +35 -23
- data/ext/gtk2/rbgtkpagesetup.c +64 -54
- data/ext/gtk2/rbgtkpagesetupunixdialog.c +34 -27
- data/ext/gtk2/rbgtkpaned.c +46 -36
- data/ext/gtk2/rbgtkpapersize.c +60 -54
- data/ext/gtk2/rbgtkplug.c +32 -20
- data/ext/gtk2/rbgtkprintcontext.c +43 -35
- data/ext/gtk2/rbgtkprinter.c +36 -37
- data/ext/gtk2/rbgtkprintjob.c +36 -37
- data/ext/gtk2/rbgtkprintoperation.c +44 -33
- data/ext/gtk2/rbgtkprintoperationpreview.c +30 -18
- data/ext/gtk2/rbgtkprintsettings.c +248 -192
- data/ext/gtk2/rbgtkprintunixdialog.c +33 -45
- data/ext/gtk2/rbgtkprogress.c +23 -13
- data/ext/gtk2/rbgtkprogressbar.c +47 -46
- data/ext/gtk2/rbgtkradioaction.c +84 -39
- data/ext/gtk2/rbgtkradiobutton.c +33 -21
- data/ext/gtk2/rbgtkradiomenuitem.c +86 -45
- data/ext/gtk2/rbgtkradiotoolbutton.c +99 -53
- data/ext/gtk2/rbgtkrange.c +36 -56
- data/ext/gtk2/rbgtkrc.c +61 -49
- data/ext/gtk2/rbgtkrcstyle.c +59 -48
- data/ext/gtk2/rbgtkrecentaction.c +28 -16
- data/ext/gtk2/rbgtkrecentchooser.c +58 -92
- data/ext/gtk2/rbgtkrecentchooserdialog.c +29 -18
- data/ext/gtk2/rbgtkrecentchoosermenu.c +25 -21
- data/ext/gtk2/rbgtkrecentchooserwidget.c +24 -13
- data/ext/gtk2/rbgtkrecentdata.c +47 -36
- data/ext/gtk2/rbgtkrecentfilter.c +55 -46
- data/ext/gtk2/rbgtkrecentfilterinfo.c +51 -40
- data/ext/gtk2/rbgtkrecentinfo.c +66 -56
- data/ext/gtk2/rbgtkrecentmanager.c +47 -43
- data/ext/gtk2/rbgtkruler.c +35 -30
- data/ext/gtk2/rbgtkscale.c +29 -18
- data/ext/gtk2/rbgtkscalebutton.c +27 -27
- data/ext/gtk2/rbgtkscrollbar.c +23 -13
- data/ext/gtk2/rbgtkscrolledwindow.c +44 -60
- data/ext/gtk2/rbgtkselection.c +87 -67
- data/ext/gtk2/rbgtkselectiondata.c +74 -65
- data/ext/gtk2/rbgtkseparator.c +23 -13
- data/ext/gtk2/rbgtkseparatormenuitem.c +25 -13
- data/ext/gtk2/rbgtkseparatortoolitem.c +26 -21
- data/ext/gtk2/rbgtksettings.c +123 -103
- data/ext/gtk2/rbgtksizegroup.c +33 -30
- data/ext/gtk2/rbgtksocket.c +32 -20
- data/ext/gtk2/rbgtkspinbutton.c +48 -38
- data/ext/gtk2/rbgtkspinner.c +27 -14
- data/ext/gtk2/rbgtkstatusbar.c +36 -31
- data/ext/gtk2/rbgtkstatusicon.c +31 -44
- data/ext/gtk2/rbgtkstock.c +137 -125
- data/ext/gtk2/rbgtkstyle.c +177 -161
- data/ext/gtk2/rbgtktable.c +58 -47
- data/ext/gtk2/rbgtktargetlist.c +56 -36
- data/ext/gtk2/rbgtktearoffmenuitem.c +28 -16
- data/ext/gtk2/rbgtktextappearance.c +44 -34
- data/ext/gtk2/rbgtktextattributes.c +54 -42
- data/ext/gtk2/rbgtktextbuffer.c +188 -191
- data/ext/gtk2/rbgtktextchild.c +29 -18
- data/ext/gtk2/rbgtktextiter.c +153 -145
- data/ext/gtk2/rbgtktextmark.c +33 -30
- data/ext/gtk2/rbgtktexttag.c +34 -22
- data/ext/gtk2/rbgtktexttagtable.c +36 -25
- data/ext/gtk2/rbgtktextview.c +85 -73
- data/ext/gtk2/rbgtktoggleaction.c +27 -22
- data/ext/gtk2/rbgtktogglebutton.c +37 -26
- data/ext/gtk2/rbgtktoggletoolbutton.c +26 -20
- data/ext/gtk2/rbgtktoolbar.c +66 -69
- data/ext/gtk2/rbgtktoolbutton.c +27 -40
- data/ext/gtk2/rbgtktoolitem.c +60 -62
- data/ext/gtk2/rbgtktooltip.c +36 -25
- data/ext/gtk2/rbgtktooltips.c +42 -34
- data/ext/gtk2/rbgtktreedragdest.c +20 -11
- data/ext/gtk2/rbgtktreedragsource.c +20 -11
- data/ext/gtk2/rbgtktreeiter.c +58 -47
- data/ext/gtk2/rbgtktreemodel.c +83 -65
- data/ext/gtk2/rbgtktreemodelfilter.c +47 -35
- data/ext/gtk2/rbgtktreemodelsort.c +38 -27
- data/ext/gtk2/rbgtktreepath.c +55 -44
- data/ext/gtk2/rbgtktreerowreference.c +60 -42
- data/ext/gtk2/rbgtktreeselection.c +61 -52
- data/ext/gtk2/rbgtktreesortable.c +52 -42
- data/ext/gtk2/rbgtktreestore.c +88 -67
- data/ext/gtk2/rbgtktreeview.c +157 -185
- data/ext/gtk2/rbgtktreeviewcolumn.c +57 -62
- data/ext/gtk2/rbgtkuimanager.c +61 -61
- data/ext/gtk2/rbgtkvbbox.c +28 -16
- data/ext/gtk2/rbgtkvbox.c +29 -17
- data/ext/gtk2/rbgtkviewport.c +28 -16
- data/ext/gtk2/rbgtkvolumebutton.c +28 -16
- data/ext/gtk2/rbgtkvpaned.c +28 -16
- data/ext/gtk2/rbgtkvruler.c +28 -16
- data/ext/gtk2/rbgtkvscale.c +28 -16
- data/ext/gtk2/rbgtkvscrollbar.c +28 -16
- data/ext/gtk2/rbgtkvseparator.c +28 -16
- data/ext/gtk2/rbgtkwidget.c +284 -296
- data/ext/gtk2/rbgtkwindow.c +156 -214
- data/ext/gtk2/rbgtkwindowgroup.c +35 -24
- data/sample/testgtk/labels.rb +1 -0
- data/sample/testgtk/testgtk.rb +2 -0
- metadata +16 -17
- data/ChangeLog +0 -6902
- data/ext/gtk2/rbgtkmain.c +0 -493
@@ -1,13 +1,23 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2002-2006 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
11
21
|
|
12
22
|
#include "global.h"
|
13
23
|
|
@@ -40,6 +50,7 @@ rbgtk_get_tree_row_reference(VALUE obj)
|
|
40
50
|
|
41
51
|
/*****************************************/
|
42
52
|
|
53
|
+
#define RG_TARGET_NAMESPACE cTreeRowReference
|
43
54
|
#define _SELF(s) RVAL2TREEROWREFERENCE(s)
|
44
55
|
|
45
56
|
/*****************************************/
|
@@ -49,11 +60,11 @@ static ID id_model;
|
|
49
60
|
static ID id_path;
|
50
61
|
|
51
62
|
static VALUE
|
52
|
-
|
63
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
53
64
|
{
|
54
65
|
VALUE proxy, model, path;
|
55
66
|
GtkTreeRowReference* ref;
|
56
|
-
|
67
|
+
|
57
68
|
if (argc == 3){
|
58
69
|
rb_scan_args(argc, argv, "3", &proxy, &model, &path);
|
59
70
|
G_CHILD_SET(self, id_proxy, proxy);
|
@@ -70,14 +81,13 @@ treerowref_initialize(int argc, VALUE *argv, VALUE self)
|
|
70
81
|
|
71
82
|
G_CHILD_SET(self, id_model, model);
|
72
83
|
G_CHILD_SET(self, id_path, path);
|
73
|
-
|
84
|
+
|
74
85
|
G_INITIALIZE(self, ref);
|
75
86
|
return Qnil;
|
76
87
|
}
|
77
88
|
|
78
|
-
|
79
89
|
static VALUE
|
80
|
-
|
90
|
+
rg_path(VALUE self)
|
81
91
|
{
|
82
92
|
VALUE ret = GTKTREEPATH2RVAL(gtk_tree_row_reference_get_path(_SELF(self)));
|
83
93
|
G_CHILD_SET(self, id_path, ret);
|
@@ -86,7 +96,7 @@ treerowref_get_path(VALUE self)
|
|
86
96
|
|
87
97
|
#if GTK_CHECK_VERSION(2,8,0)
|
88
98
|
static VALUE
|
89
|
-
|
99
|
+
rg_model(VALUE self)
|
90
100
|
{
|
91
101
|
VALUE ret = GOBJ2RVAL(gtk_tree_row_reference_get_model(_SELF(self)));
|
92
102
|
G_CHILD_SET(self, id_model, ret);
|
@@ -95,63 +105,71 @@ treerowref_get_model(VALUE self)
|
|
95
105
|
#endif
|
96
106
|
|
97
107
|
static VALUE
|
98
|
-
|
108
|
+
rg_valid_p(VALUE self)
|
99
109
|
{
|
100
110
|
return CBOOL2RVAL(gtk_tree_row_reference_valid(_SELF(self)));
|
101
111
|
}
|
102
112
|
|
103
113
|
static VALUE
|
104
|
-
|
114
|
+
rg_s_inserted(VALUE self, VALUE proxy, VALUE path)
|
105
115
|
{
|
106
116
|
gtk_tree_row_reference_inserted(RVAL2GOBJ(proxy), RVAL2GTKTREEPATH(path));
|
107
117
|
return self;
|
108
118
|
}
|
109
119
|
|
110
120
|
static VALUE
|
111
|
-
|
121
|
+
rg_s_deleted(VALUE self, VALUE proxy, VALUE path)
|
112
122
|
{
|
113
123
|
gtk_tree_row_reference_deleted(RVAL2GOBJ(proxy), RVAL2GTKTREEPATH(path));
|
114
124
|
return self;
|
115
125
|
}
|
116
126
|
|
117
127
|
static VALUE
|
118
|
-
|
128
|
+
rg_s_reordered(VALUE self, VALUE rbproxy, VALUE rbpath, VALUE rbiter, VALUE rbnew_order)
|
119
129
|
{
|
120
|
-
|
121
|
-
|
130
|
+
GObject *proxy = RVAL2GOBJ(rbproxy);
|
131
|
+
GtkTreePath *path = RVAL2GTKTREEPATH(rbpath);
|
132
|
+
GtkTreeIter *iter = RVAL2GTKTREEITER(rbiter);
|
133
|
+
/* TODO: How do we implement this check?
|
134
|
+
gint columns = gtk_tree_model_get_n_columns(proxy);
|
135
|
+
*/
|
136
|
+
long n;
|
137
|
+
gint *new_order = RVAL2GINTS(rbnew_order, n);
|
138
|
+
|
139
|
+
/*
|
140
|
+
if (n != columns) {
|
141
|
+
g_free(new_order);
|
142
|
+
|
143
|
+
rb_raise(rb_eArgError,
|
144
|
+
"new order array must contain same number of elements as the number of columns in the store: %ld != %d",
|
145
|
+
n, columns);
|
146
|
+
}
|
147
|
+
*/
|
122
148
|
|
123
|
-
|
149
|
+
gtk_tree_row_reference_reordered(proxy, path, iter, new_order);
|
124
150
|
|
125
|
-
|
126
|
-
orders = ALLOCA_N(gint, len);
|
151
|
+
g_free(new_order);
|
127
152
|
|
128
|
-
for (i = 0; i < len; i++) {
|
129
|
-
orders[i] = RARRAY_PTR(new_orders)[i];
|
130
|
-
}
|
131
|
-
|
132
|
-
gtk_tree_row_reference_reordered(RVAL2GOBJ(proxy), RVAL2GTKTREEPATH(path),
|
133
|
-
RVAL2GTKTREEITER(iter), orders);
|
134
153
|
return self;
|
135
154
|
}
|
136
155
|
|
137
156
|
void
|
138
|
-
Init_gtk_treerowreference()
|
157
|
+
Init_gtk_treerowreference(VALUE mGtk)
|
139
158
|
{
|
140
|
-
VALUE
|
141
|
-
|
142
|
-
|
143
|
-
|
159
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_ROW_REFERENCE, "TreeRowReference", mGtk);
|
160
|
+
|
161
|
+
RG_DEF_METHOD(initialize, -1);
|
162
|
+
RG_DEF_METHOD(path, 0);
|
144
163
|
#if GTK_CHECK_VERSION(2,8,0)
|
145
|
-
|
164
|
+
RG_DEF_METHOD(model, 0);
|
146
165
|
#endif
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
166
|
+
RG_DEF_METHOD_P(valid, 0);
|
167
|
+
|
168
|
+
RG_DEF_SMETHOD(inserted, 2);
|
169
|
+
RG_DEF_SMETHOD(deleted, 2);
|
170
|
+
RG_DEF_SMETHOD(reordered, 4);
|
152
171
|
|
153
172
|
id_proxy = rb_intern("proxy");
|
154
173
|
id_model = rb_intern("model");
|
155
174
|
id_path = rb_intern("path");
|
156
175
|
}
|
157
|
-
|
@@ -1,28 +1,39 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2002-2006 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
11
21
|
|
12
22
|
#include "global.h"
|
13
23
|
|
24
|
+
#define RG_TARGET_NAMESPACE cTreeSelection
|
14
25
|
#define _SELF(s) (GTK_TREE_SELECTION(RVAL2GOBJ(s)))
|
15
26
|
#define RVAL2TREEMODEL(s) (GTK_TREE_MODEL(RVAL2GOBJ(s)))
|
16
27
|
|
17
28
|
static VALUE
|
18
|
-
|
29
|
+
rg_set_mode(VALUE self, VALUE type)
|
19
30
|
{
|
20
31
|
gtk_tree_selection_set_mode(_SELF(self), RVAL2GENUM(type, GTK_TYPE_SELECTION_MODE));
|
21
32
|
return self;
|
22
33
|
}
|
23
34
|
|
24
35
|
static VALUE
|
25
|
-
|
36
|
+
rg_mode(VALUE self)
|
26
37
|
{
|
27
38
|
return GENUM2RVAL(gtk_tree_selection_get_mode(_SELF(self)), GTK_TYPE_SELECTION_MODE);
|
28
39
|
}
|
@@ -38,7 +49,7 @@ selection_func(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *pa
|
|
38
49
|
}
|
39
50
|
|
40
51
|
static VALUE
|
41
|
-
|
52
|
+
rg_set_select_function(VALUE self)
|
42
53
|
{
|
43
54
|
volatile VALUE func = rb_block_proc();
|
44
55
|
G_RELATIVE(self, func);
|
@@ -54,13 +65,13 @@ gpointer gtk_tree_selection_get_user_data
|
|
54
65
|
*/
|
55
66
|
|
56
67
|
static VALUE
|
57
|
-
|
68
|
+
rg_tree_view(VALUE self)
|
58
69
|
{
|
59
70
|
return GOBJ2RVAL(gtk_tree_selection_get_tree_view(_SELF(self)));
|
60
71
|
}
|
61
72
|
|
62
73
|
static VALUE
|
63
|
-
|
74
|
+
rg_selected(VALUE self)
|
64
75
|
{
|
65
76
|
GtkTreeIter iter;
|
66
77
|
GtkTreeModel* model;
|
@@ -78,7 +89,7 @@ foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer
|
|
78
89
|
}
|
79
90
|
|
80
91
|
static VALUE
|
81
|
-
|
92
|
+
rg_selected_each(VALUE self)
|
82
93
|
{
|
83
94
|
volatile VALUE func = rb_block_proc();
|
84
95
|
gtk_tree_selection_selected_foreach(_SELF(self),
|
@@ -88,61 +99,61 @@ treeselection_selected_foreach(VALUE self)
|
|
88
99
|
}
|
89
100
|
|
90
101
|
static VALUE
|
91
|
-
|
102
|
+
rg_select_path(VALUE self, VALUE path)
|
92
103
|
{
|
93
104
|
gtk_tree_selection_select_path(_SELF(self), RVAL2GTKTREEPATH(path));
|
94
105
|
return self;
|
95
106
|
}
|
96
107
|
|
97
108
|
static VALUE
|
98
|
-
|
109
|
+
rg_unselect_path(VALUE self, VALUE path)
|
99
110
|
{
|
100
111
|
gtk_tree_selection_unselect_path(_SELF(self), RVAL2GTKTREEPATH(path));
|
101
112
|
return self;
|
102
113
|
}
|
103
114
|
|
104
115
|
static VALUE
|
105
|
-
|
116
|
+
rg_path_is_selected_p(VALUE self, VALUE path)
|
106
117
|
{
|
107
118
|
return CBOOL2RVAL(gtk_tree_selection_path_is_selected(_SELF(self), RVAL2GTKTREEPATH(path)));
|
108
119
|
}
|
109
120
|
|
110
121
|
static VALUE
|
111
|
-
|
122
|
+
rg_select_iter(VALUE self, VALUE iter)
|
112
123
|
{
|
113
124
|
gtk_tree_selection_select_iter(_SELF(self), RVAL2GTKTREEITER(iter));
|
114
125
|
return self;
|
115
126
|
}
|
116
127
|
|
117
128
|
static VALUE
|
118
|
-
|
129
|
+
rg_unselect_iter(VALUE self, VALUE iter)
|
119
130
|
{
|
120
131
|
gtk_tree_selection_unselect_iter(_SELF(self), RVAL2GTKTREEITER(iter));
|
121
132
|
return self;
|
122
133
|
}
|
123
134
|
|
124
135
|
static VALUE
|
125
|
-
|
136
|
+
rg_iter_is_selected_p(VALUE self, VALUE iter)
|
126
137
|
{
|
127
138
|
return CBOOL2RVAL(gtk_tree_selection_iter_is_selected(_SELF(self), RVAL2GTKTREEITER(iter)));
|
128
139
|
}
|
129
140
|
|
130
141
|
static VALUE
|
131
|
-
|
142
|
+
rg_select_all(VALUE self)
|
132
143
|
{
|
133
144
|
gtk_tree_selection_select_all(_SELF(self));
|
134
145
|
return self;
|
135
146
|
}
|
136
147
|
|
137
148
|
static VALUE
|
138
|
-
|
149
|
+
rg_unselect_all(VALUE self)
|
139
150
|
{
|
140
151
|
gtk_tree_selection_unselect_all(_SELF(self));
|
141
152
|
return self;
|
142
153
|
}
|
143
154
|
|
144
155
|
static VALUE
|
145
|
-
|
156
|
+
rg_select_range(VALUE self, VALUE start_path, VALUE end_path)
|
146
157
|
{
|
147
158
|
gtk_tree_selection_select_range(_SELF(self), RVAL2GTKTREEPATH(start_path),
|
148
159
|
RVAL2GTKTREEPATH(end_path));
|
@@ -151,7 +162,7 @@ treeselection_select_range(VALUE self, VALUE start_path, VALUE end_path)
|
|
151
162
|
|
152
163
|
#if GTK_CHECK_VERSION(2,2,0)
|
153
164
|
static VALUE
|
154
|
-
|
165
|
+
rg_selected_rows(VALUE self)
|
155
166
|
{
|
156
167
|
GtkTreeModel* model;
|
157
168
|
GList* list = gtk_tree_selection_get_selected_rows(_SELF(self), &model);
|
@@ -162,13 +173,13 @@ treeselection_get_selected_rows(VALUE self)
|
|
162
173
|
}
|
163
174
|
|
164
175
|
static VALUE
|
165
|
-
|
176
|
+
rg_count_selected_rows(VALUE self)
|
166
177
|
{
|
167
178
|
return INT2NUM(gtk_tree_selection_count_selected_rows(_SELF(self)));
|
168
179
|
}
|
169
180
|
|
170
181
|
static VALUE
|
171
|
-
|
182
|
+
rg_unselect_range(VALUE self, VALUE start_path, VALUE end_path)
|
172
183
|
{
|
173
184
|
gtk_tree_selection_unselect_range(_SELF(self), RVAL2GTKTREEPATH(start_path),
|
174
185
|
RVAL2GTKTREEPATH(end_path));
|
@@ -177,32 +188,30 @@ treeselection_unselect_range(VALUE self, VALUE start_path, VALUE end_path)
|
|
177
188
|
#endif
|
178
189
|
|
179
190
|
void
|
180
|
-
Init_gtk_treeselection()
|
181
|
-
{
|
182
|
-
VALUE
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
191
|
+
Init_gtk_treeselection(VALUE mGtk)
|
192
|
+
{
|
193
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_SELECTION, "TreeSelection", mGtk);
|
194
|
+
|
195
|
+
RG_DEF_METHOD(set_mode, 1);
|
196
|
+
RG_DEF_METHOD(mode, 0);
|
197
|
+
RG_DEF_METHOD(set_select_function, 0);
|
198
|
+
RG_DEF_METHOD(tree_view, 0);
|
199
|
+
RG_DEF_METHOD(selected, 0);
|
200
|
+
RG_DEF_METHOD(selected_each, 0);
|
201
|
+
RG_DEF_METHOD(select_path, 1);
|
202
|
+
RG_DEF_METHOD(unselect_path, 1);
|
203
|
+
RG_DEF_METHOD_P(path_is_selected, 1);
|
204
|
+
RG_DEF_METHOD(select_iter, 1);
|
205
|
+
RG_DEF_METHOD(unselect_iter, 1);
|
206
|
+
RG_DEF_METHOD_P(iter_is_selected, 1);
|
207
|
+
RG_DEF_METHOD(select_all, 0);
|
208
|
+
RG_DEF_METHOD(unselect_all, 0);
|
209
|
+
RG_DEF_METHOD(select_range, 2);
|
199
210
|
#if GTK_CHECK_VERSION(2,2,0)
|
200
|
-
|
201
|
-
|
202
|
-
|
211
|
+
RG_DEF_METHOD(selected_rows, 0);
|
212
|
+
RG_DEF_METHOD(count_selected_rows, 0);
|
213
|
+
RG_DEF_METHOD(unselect_range, 2);
|
203
214
|
#endif
|
204
215
|
|
205
|
-
G_DEF_SETTERS(
|
216
|
+
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
206
217
|
}
|
207
|
-
|
208
|
-
|
@@ -1,60 +1,70 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
12
21
|
|
13
22
|
#include "global.h"
|
14
23
|
|
15
|
-
#define
|
24
|
+
#define RG_TARGET_NAMESPACE mTreeSortable
|
25
|
+
#define _SELF(s) (GTK_TREE_SORTABLE(RVAL2GOBJ(s)))
|
16
26
|
|
17
27
|
static VALUE
|
18
|
-
|
28
|
+
rg_sort_column_changed(VALUE self)
|
19
29
|
{
|
20
30
|
gtk_tree_sortable_sort_column_changed(_SELF(self));
|
21
31
|
return self;
|
22
32
|
}
|
23
33
|
|
24
34
|
static VALUE
|
25
|
-
|
35
|
+
rg_sort_column_id(VALUE self)
|
26
36
|
{
|
27
37
|
gint sort_column_id;
|
28
38
|
GtkSortType order;
|
29
39
|
|
30
40
|
if (gtk_tree_sortable_get_sort_column_id(_SELF(self), &sort_column_id,
|
31
|
-
|
32
|
-
|
41
|
+
&order)) {
|
42
|
+
VALUE ary;
|
33
43
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
44
|
+
ary = rb_ary_new2(2);
|
45
|
+
rb_ary_push(ary, INT2NUM(sort_column_id));
|
46
|
+
rb_ary_push(ary, GENUM2RVAL(order, GTK_TYPE_SORT_TYPE));
|
47
|
+
return ary;
|
38
48
|
} else {
|
39
|
-
|
49
|
+
return Qnil; /* XXX: or something else? exception? */
|
40
50
|
}
|
41
51
|
}
|
42
52
|
|
43
53
|
static VALUE
|
44
|
-
|
54
|
+
rg_set_sort_column_id(int argc, VALUE *argv, VALUE self)
|
45
55
|
{
|
46
56
|
gint sort_column_id;
|
47
57
|
GtkSortType order;
|
48
58
|
|
49
59
|
if (argc == 1 || argc == 2) {
|
50
|
-
|
51
|
-
|
60
|
+
sort_column_id = NUM2INT(argv[0]);
|
61
|
+
order = (argc == 2) ? RVAL2GENUM(argv[1], GTK_TYPE_SORT_TYPE) : GTK_SORT_ASCENDING;
|
52
62
|
} else {
|
53
|
-
|
63
|
+
rb_raise(rb_eArgError, "need 1 or 2 arguments.");
|
54
64
|
}
|
55
65
|
|
56
66
|
gtk_tree_sortable_set_sort_column_id(_SELF(self), sort_column_id,
|
57
|
-
|
67
|
+
order);
|
58
68
|
return self;
|
59
69
|
}
|
60
70
|
|
@@ -64,50 +74,50 @@ sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer func)
|
|
64
74
|
a->user_data3 = model;
|
65
75
|
b->user_data3 = model;
|
66
76
|
return NUM2INT(rb_funcall((VALUE)func, id_call, 2, GTKTREEITER2RVAL(a),
|
67
|
-
|
77
|
+
GTKTREEITER2RVAL(b)));
|
68
78
|
}
|
69
79
|
|
70
80
|
static VALUE
|
71
|
-
|
81
|
+
rg_set_sort_func(VALUE self, VALUE sort_column_id)
|
72
82
|
{
|
73
83
|
volatile VALUE func = rb_block_proc();
|
74
84
|
G_RELATIVE(self, func);
|
75
85
|
gtk_tree_sortable_set_sort_func(_SELF(self), NUM2INT(sort_column_id),
|
76
|
-
|
77
|
-
|
86
|
+
(GtkTreeIterCompareFunc)sort_func,
|
87
|
+
(gpointer)func, NULL);
|
78
88
|
return self;
|
79
89
|
}
|
80
90
|
|
81
91
|
static VALUE
|
82
|
-
|
92
|
+
rg_set_default_sort_func(VALUE self)
|
83
93
|
{
|
84
94
|
volatile VALUE func = rb_block_proc();
|
85
95
|
G_RELATIVE(self, func);
|
86
96
|
gtk_tree_sortable_set_default_sort_func(_SELF(self),
|
87
|
-
|
88
|
-
|
97
|
+
(GtkTreeIterCompareFunc)sort_func,
|
98
|
+
(gpointer)func, NULL);
|
89
99
|
return self;
|
90
100
|
}
|
91
101
|
|
92
102
|
static VALUE
|
93
|
-
|
103
|
+
rg_has_default_sort_func_p(VALUE self)
|
94
104
|
{
|
95
105
|
return RVAL2CBOOL(gtk_tree_sortable_has_default_sort_func(_SELF(self)));
|
96
106
|
}
|
97
107
|
|
98
108
|
void
|
99
|
-
Init_gtk_treesortable()
|
109
|
+
Init_gtk_treesortable(VALUE mGtk)
|
100
110
|
{
|
101
|
-
VALUE
|
111
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_TYPE_TREE_SORTABLE, "TreeSortable", mGtk);
|
102
112
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
113
|
+
RG_DEF_METHOD(sort_column_changed, 0);
|
114
|
+
RG_DEF_METHOD(sort_column_id, 0);
|
115
|
+
RG_DEF_METHOD(set_sort_column_id, -1);
|
116
|
+
RG_DEF_METHOD(set_sort_func, 1);
|
117
|
+
RG_DEF_METHOD(set_default_sort_func, 0);
|
118
|
+
RG_DEF_METHOD_P(has_default_sort_func, 0);
|
109
119
|
|
110
|
-
rb_define_const(
|
120
|
+
rb_define_const(RG_TARGET_NAMESPACE, "DEFAULT_SORT_COLUMN_ID", GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID);
|
111
121
|
}
|
112
122
|
|
113
123
|
/* vim: set sts=4 sw=4 ts=8: */
|