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
data/ext/gtk2/rbgdkcolormap.c
CHANGED
@@ -1,26 +1,34 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2002,2003 Masao Mutoh
|
5
|
+
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
6
|
+
* Daisuke Kanda,
|
7
|
+
* Hiroshi Igarashi
|
8
|
+
*
|
9
|
+
* This library is free software; you can redistribute it and/or
|
10
|
+
* modify it under the terms of the GNU Lesser General Public
|
11
|
+
* License as published by the Free Software Foundation; either
|
12
|
+
* version 2.1 of the License, or (at your option) any later version.
|
13
|
+
*
|
14
|
+
* This library is distributed in the hope that it will be useful,
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
+
* Lesser General Public License for more details.
|
18
|
+
*
|
19
|
+
* You should have received a copy of the GNU Lesser General Public
|
20
|
+
* License along with this library; if not, write to the Free Software
|
21
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
22
|
+
* MA 02110-1301 USA
|
23
|
+
*/
|
17
24
|
|
18
25
|
#include "global.h"
|
19
26
|
|
27
|
+
#define RG_TARGET_NAMESPACE cColormap
|
20
28
|
#define _SELF(self) (GDK_COLORMAP(RVAL2GOBJ(self)))
|
21
29
|
|
22
30
|
static VALUE
|
23
|
-
|
31
|
+
rg_initialize(VALUE self, VALUE visual, VALUE allocate)
|
24
32
|
{
|
25
33
|
GdkColormap *cmap = gdk_colormap_new(GDK_VISUAL(RVAL2GOBJ(visual)),
|
26
34
|
RVAL2CBOOL(allocate));
|
@@ -29,7 +37,7 @@ gdkcmap_initialize(VALUE self, VALUE visual, VALUE allocate)
|
|
29
37
|
}
|
30
38
|
|
31
39
|
static VALUE
|
32
|
-
|
40
|
+
rg_s_system(G_GNUC_UNUSED VALUE self)
|
33
41
|
{
|
34
42
|
return GOBJ2RVAL(gdk_colormap_get_system());
|
35
43
|
}
|
@@ -46,7 +54,7 @@ gint gdk_colormap_alloc_colors (GdkColormap *colormap,
|
|
46
54
|
*/
|
47
55
|
|
48
56
|
static VALUE
|
49
|
-
|
57
|
+
rg_alloc_color(VALUE self, VALUE color, VALUE writeable, VALUE best_match)
|
50
58
|
{
|
51
59
|
gboolean result;
|
52
60
|
GdkColor *c = RVAL2GDKCOLOR(color);
|
@@ -58,14 +66,14 @@ gdkcmap_alloc_color(VALUE self, VALUE color, VALUE writeable, VALUE best_match)
|
|
58
66
|
/* Don't implement Gdk::Colormap#free_colors.
|
59
67
|
Because it should be pair with Gdk::Colormap#alloc_colors */
|
60
68
|
static VALUE
|
61
|
-
|
69
|
+
rg_free_color(VALUE self, VALUE color)
|
62
70
|
{
|
63
71
|
gdk_colormap_free_colors(_SELF(self), RVAL2GDKCOLOR(color), 1);
|
64
72
|
return self;
|
65
73
|
}
|
66
74
|
|
67
75
|
static VALUE
|
68
|
-
|
76
|
+
rg_query_color(VALUE self, VALUE pixel)
|
69
77
|
{
|
70
78
|
GdkColor color;
|
71
79
|
gdk_colormap_query_color(_SELF(self), NUM2ULONG(pixel), &color);
|
@@ -73,21 +81,21 @@ gdkcmap_query_color(VALUE self, VALUE pixel)
|
|
73
81
|
}
|
74
82
|
|
75
83
|
static VALUE
|
76
|
-
|
84
|
+
rg_visual(VALUE self)
|
77
85
|
{
|
78
86
|
return GOBJ2RVAL(gdk_colormap_get_visual(_SELF(self)));
|
79
87
|
}
|
80
88
|
|
81
89
|
#if GTK_CHECK_VERSION(2,2,0)
|
82
90
|
static VALUE
|
83
|
-
|
91
|
+
rg_screen(VALUE self)
|
84
92
|
{
|
85
93
|
return GOBJ2RVAL(gdk_colormap_get_screen(_SELF(self)));
|
86
94
|
}
|
87
95
|
#endif
|
88
96
|
|
89
97
|
static VALUE
|
90
|
-
|
98
|
+
rg_colors(VALUE self)
|
91
99
|
{
|
92
100
|
GdkColormap *cmap;
|
93
101
|
GdkColor *colors;
|
@@ -114,21 +122,18 @@ gdkcmap_colors(VALUE self)
|
|
114
122
|
}
|
115
123
|
|
116
124
|
void
|
117
|
-
Init_gtk_gdk_colormap()
|
125
|
+
Init_gtk_gdk_colormap(VALUE mGdk)
|
118
126
|
{
|
119
|
-
VALUE
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
rb_define_method(gdkColormap, "visual", gdkcmap_get_visual, 0);
|
127
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_COLORMAP, "Colormap", mGdk);
|
128
|
+
|
129
|
+
RG_DEF_SMETHOD(system, 0);
|
130
|
+
RG_DEF_METHOD(initialize, 2);
|
131
|
+
RG_DEF_METHOD(alloc_color, 3);
|
132
|
+
RG_DEF_METHOD(free_color, 1);
|
133
|
+
RG_DEF_METHOD(query_color, 1);
|
134
|
+
RG_DEF_METHOD(visual, 0);
|
128
135
|
#if GTK_CHECK_VERSION(2,2,0)
|
129
|
-
|
136
|
+
RG_DEF_METHOD(screen, 0);
|
130
137
|
#endif
|
131
|
-
|
138
|
+
RG_DEF_METHOD(colors, 0);
|
132
139
|
}
|
133
|
-
|
134
|
-
|
data/ext/gtk2/rbgdkconst.c
CHANGED
@@ -1,16 +1,26 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
5
|
+
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
6
|
+
* Daisuke Kanda,
|
7
|
+
* Hiroshi Igarashi
|
8
|
+
*
|
9
|
+
* This library is free software; you can redistribute it and/or
|
10
|
+
* modify it under the terms of the GNU Lesser General Public
|
11
|
+
* License as published by the Free Software Foundation; either
|
12
|
+
* version 2.1 of the License, or (at your option) any later version.
|
13
|
+
*
|
14
|
+
* This library is distributed in the hope that it will be useful,
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
+
* Lesser General Public License for more details.
|
18
|
+
*
|
19
|
+
* You should have received a copy of the GNU Lesser General Public
|
20
|
+
* License along with this library; if not, write to the Free Software
|
21
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
22
|
+
* MA 02110-1301 USA
|
23
|
+
*/
|
14
24
|
|
15
25
|
#include "global.h"
|
16
26
|
|
@@ -18,7 +28,7 @@
|
|
18
28
|
* Gdk module constants
|
19
29
|
*/
|
20
30
|
void
|
21
|
-
Init_gtk_gdk_const()
|
31
|
+
Init_gtk_gdk_const(VALUE mGdk)
|
22
32
|
{
|
23
33
|
/* GdkStatus */
|
24
34
|
G_DEF_CLASS(GDK_TYPE_STATUS, "Status", mGdk);
|
data/ext/gtk2/rbgdkconversions.h
CHANGED
@@ -1,10 +1,23 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2008 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
|
+
*/
|
8
21
|
|
9
22
|
#ifndef __RB_GDK_CONVERSIONS_H__
|
10
23
|
#define __RB_GDK_CONVERSIONS_H__
|
data/ext/gtk2/rbgdkcursor.c
CHANGED
@@ -1,18 +1,30 @@
|
|
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) 2001-2004 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 cCursor
|
25
|
+
|
14
26
|
static VALUE
|
15
|
-
|
27
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
16
28
|
{
|
17
29
|
GdkCursor* cursor = NULL;
|
18
30
|
|
@@ -52,57 +64,57 @@ gdkcursor_initialize(int argc, VALUE *argv, VALUE self)
|
|
52
64
|
NIL_P(mask)?NULL:GDK_PIXMAP(RVAL2GOBJ(mask)),
|
53
65
|
RVAL2GDKCOLOR(fg),
|
54
66
|
RVAL2GDKCOLOR(bg),
|
55
|
-
|
67
|
+
NUM2INT(x), NUM2INT(y));
|
56
68
|
}
|
57
69
|
G_INITIALIZE(self, cursor);
|
58
|
-
|
70
|
+
|
59
71
|
return Qnil;
|
60
72
|
}
|
61
73
|
|
62
74
|
#if GTK_CHECK_VERSION(2,2,0)
|
63
75
|
static VALUE
|
64
|
-
|
76
|
+
rg_display(VALUE self)
|
65
77
|
{
|
66
78
|
return GOBJ2RVAL(gdk_cursor_get_display((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_CURSOR)));
|
67
79
|
}
|
68
80
|
#endif
|
69
81
|
|
70
82
|
static VALUE
|
71
|
-
|
83
|
+
rg_pixmap_p(VALUE self)
|
72
84
|
{
|
73
85
|
return CBOOL2RVAL(((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_COLOR))->type ==
|
74
86
|
GDK_CURSOR_IS_PIXMAP);
|
75
87
|
}
|
76
88
|
|
77
89
|
static VALUE
|
78
|
-
|
90
|
+
rg_cursor_type(VALUE self)
|
79
91
|
{
|
80
92
|
return GENUM2RVAL(((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_CURSOR))->type, GDK_TYPE_CURSOR_TYPE);
|
81
93
|
}
|
82
94
|
|
83
95
|
#if GTK_CHECK_VERSION(2,8,0)
|
84
96
|
static VALUE
|
85
|
-
|
97
|
+
rg_image(VALUE self)
|
86
98
|
{
|
87
99
|
return GOBJ2RVAL(gdk_cursor_get_image((GdkCursor*)RVAL2BOXED(self, GDK_TYPE_CURSOR)));
|
88
100
|
}
|
89
101
|
#endif
|
90
102
|
|
91
103
|
void
|
92
|
-
Init_gtk_gdk_cursor()
|
104
|
+
Init_gtk_gdk_cursor(VALUE mGdk)
|
93
105
|
{
|
94
|
-
VALUE
|
106
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_CURSOR, "Cursor", mGdk);
|
95
107
|
|
96
|
-
|
108
|
+
RG_DEF_METHOD(initialize, -1);
|
97
109
|
#if GTK_CHECK_VERSION(2,2,0)
|
98
|
-
|
110
|
+
RG_DEF_METHOD(display, 0);
|
99
111
|
#endif
|
100
|
-
|
101
|
-
|
112
|
+
RG_DEF_METHOD_P(pixmap, 0);
|
113
|
+
RG_DEF_METHOD(cursor_type, 0);
|
102
114
|
#if GTK_CHECK_VERSION(2,8,0)
|
103
|
-
|
115
|
+
RG_DEF_METHOD(image, 0);
|
104
116
|
#endif
|
105
117
|
|
106
|
-
G_DEF_CLASS(GDK_TYPE_CURSOR_TYPE, "Type",
|
107
|
-
G_DEF_CONSTANTS(
|
118
|
+
G_DEF_CLASS(GDK_TYPE_CURSOR_TYPE, "Type", RG_TARGET_NAMESPACE);
|
119
|
+
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_CURSOR_TYPE, "GDK_");
|
108
120
|
}
|
data/ext/gtk2/rbgdkdevice.c
CHANGED
@@ -1,50 +1,60 @@
|
|
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) 2003-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 cDevice
|
14
25
|
#define _SELF(self) (GDK_DEVICE(RVAL2GOBJ(self)))
|
15
26
|
|
16
27
|
/* Methods */
|
17
28
|
static VALUE
|
18
|
-
|
29
|
+
rg_s_list(G_GNUC_UNUSED VALUE self)
|
19
30
|
{
|
20
31
|
/* Owned by GDK */
|
21
32
|
return GLIST2ARY(gdk_devices_list());
|
22
33
|
}
|
23
34
|
|
24
35
|
static VALUE
|
25
|
-
|
36
|
+
rg_s_set_extension_events(G_GNUC_UNUSED VALUE self, VALUE window, VALUE mask, VALUE mode)
|
26
37
|
{
|
27
38
|
gdk_input_set_extension_events(GDK_WINDOW(RVAL2GOBJ(window)),
|
28
39
|
NUM2INT(mask), FIX2INT(mode));
|
29
40
|
return Qnil;
|
30
41
|
}
|
31
42
|
|
32
|
-
|
33
43
|
static VALUE
|
34
|
-
|
44
|
+
rg_set_source(VALUE self, VALUE source)
|
35
45
|
{
|
36
46
|
gdk_device_set_source(_SELF(self), RVAL2GENUM(source, GDK_TYPE_INPUT_SOURCE));
|
37
47
|
return self;
|
38
48
|
}
|
39
49
|
|
40
50
|
static VALUE
|
41
|
-
|
51
|
+
rg_set_mode(VALUE self, VALUE mode)
|
42
52
|
{
|
43
53
|
return CBOOL2RVAL(gdk_device_set_mode(_SELF(self), RVAL2GENUM(mode, GDK_TYPE_INPUT_MODE)));
|
44
54
|
}
|
45
55
|
|
46
56
|
static VALUE
|
47
|
-
|
57
|
+
rg_set_key(VALUE self, VALUE index, VALUE keyval, VALUE modifiers)
|
48
58
|
{
|
49
59
|
gdk_device_set_key(_SELF(self), NUM2UINT(index), NUM2UINT(keyval),
|
50
60
|
RVAL2GFLAGS(modifiers, GDK_TYPE_MODIFIER_TYPE));
|
@@ -52,7 +62,7 @@ device_set_key(VALUE self, VALUE index, VALUE keyval, VALUE modifiers)
|
|
52
62
|
}
|
53
63
|
|
54
64
|
static VALUE
|
55
|
-
|
65
|
+
rg_set_axis_use(VALUE self, VALUE index, VALUE use)
|
56
66
|
{
|
57
67
|
gdk_device_set_axis_use(_SELF(self), NUM2UINT(index),
|
58
68
|
RVAL2GENUM(use, GDK_TYPE_AXIS_USE));
|
@@ -60,13 +70,13 @@ device_set_axis_use(VALUE self, VALUE index, VALUE use)
|
|
60
70
|
}
|
61
71
|
|
62
72
|
static VALUE
|
63
|
-
|
73
|
+
rg_s_core_pointer(G_GNUC_UNUSED VALUE self)
|
64
74
|
{
|
65
75
|
return GOBJ2RVAL(gdk_device_get_core_pointer());
|
66
76
|
}
|
67
77
|
|
68
78
|
static VALUE
|
69
|
-
|
79
|
+
rg_get_state(VALUE self, VALUE window)
|
70
80
|
{
|
71
81
|
gdouble axes[2];
|
72
82
|
GdkModifierType mask;
|
@@ -78,7 +88,7 @@ device_get_state(VALUE self, VALUE window)
|
|
78
88
|
}
|
79
89
|
|
80
90
|
static VALUE
|
81
|
-
|
91
|
+
rg_get_history(VALUE self, VALUE window, VALUE start, VALUE stop)
|
82
92
|
{
|
83
93
|
gboolean ret;
|
84
94
|
GdkTimeCoord** events;
|
@@ -99,55 +109,55 @@ device_get_history(VALUE self, VALUE window, VALUE start, VALUE stop)
|
|
99
109
|
}
|
100
110
|
|
101
111
|
static VALUE
|
102
|
-
|
112
|
+
rg_get_axis(VALUE self, VALUE rbaxes, VALUE rbuse)
|
103
113
|
{
|
114
|
+
GdkDevice *device = _SELF(self);
|
115
|
+
GdkAxisUse use = RVAL2GENUM(rbuse, GDK_TYPE_AXIS_USE);
|
116
|
+
long n;
|
117
|
+
gdouble *axes = RVAL2GDOUBLES(rbaxes, n);
|
118
|
+
gint device_n_axes = gdk_device_get_n_axes(device);
|
104
119
|
gdouble value;
|
105
|
-
gboolean
|
106
|
-
gdouble* gaxes;
|
107
|
-
gint i;
|
108
|
-
gint len = RARRAY_LEN(axes);
|
109
|
-
|
110
|
-
gaxes = g_new(gdouble, len);
|
120
|
+
gboolean found;
|
111
121
|
|
112
|
-
|
113
|
-
|
114
|
-
|
122
|
+
if (n != device_n_axes)
|
123
|
+
rb_raise(rb_eArgError,
|
124
|
+
"unexpected number of axes: %ld != %d",
|
125
|
+
n, device_n_axes);
|
115
126
|
|
116
|
-
|
117
|
-
&value);
|
127
|
+
found = gdk_device_get_axis(device, axes, use, &value);
|
118
128
|
|
119
|
-
g_free(
|
129
|
+
g_free(axes);
|
120
130
|
|
121
|
-
return
|
131
|
+
return found ? DBL2NUM(value) : Qnil;
|
122
132
|
}
|
123
133
|
|
124
134
|
/* Accessor */
|
125
135
|
static VALUE
|
126
|
-
|
136
|
+
rg_name(VALUE self)
|
127
137
|
{
|
128
138
|
return CSTR2RVAL(_SELF(self)->name);
|
129
139
|
}
|
130
140
|
|
131
141
|
static VALUE
|
132
|
-
|
142
|
+
rg_source(VALUE self)
|
133
143
|
{
|
134
144
|
return GENUM2RVAL(_SELF(self)->source, GDK_TYPE_INPUT_SOURCE);
|
135
145
|
}
|
136
146
|
|
137
147
|
static VALUE
|
138
|
-
|
148
|
+
rg_mode(VALUE self)
|
139
149
|
{
|
140
150
|
return GENUM2RVAL(_SELF(self)->mode, GDK_TYPE_INPUT_MODE);
|
141
151
|
}
|
142
152
|
|
143
153
|
static VALUE
|
144
|
-
|
154
|
+
rg_has_cursor_p(VALUE self)
|
145
155
|
{
|
146
156
|
return CBOOL2RVAL(_SELF(self)->has_cursor);
|
147
157
|
}
|
148
158
|
|
149
159
|
static VALUE
|
150
|
-
|
160
|
+
rg_axes(VALUE self)
|
151
161
|
{
|
152
162
|
gint i;
|
153
163
|
VALUE ary = rb_ary_new();
|
@@ -161,7 +171,7 @@ device_axes(VALUE self)
|
|
161
171
|
}
|
162
172
|
|
163
173
|
static VALUE
|
164
|
-
|
174
|
+
rg_keys(VALUE self)
|
165
175
|
{
|
166
176
|
gint i;
|
167
177
|
VALUE ary = rb_ary_new();
|
@@ -175,45 +185,45 @@ device_keys(VALUE self)
|
|
175
185
|
}
|
176
186
|
|
177
187
|
void
|
178
|
-
Init_gtk_gdk_device()
|
188
|
+
Init_gtk_gdk_device(VALUE mGdk)
|
179
189
|
{
|
180
|
-
VALUE
|
190
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DEVICE, "Device", mGdk);
|
181
191
|
|
182
|
-
|
183
|
-
|
184
|
-
|
192
|
+
RG_DEF_SMETHOD(list, 0);
|
193
|
+
RG_DEF_SMETHOD(core_pointer, 0);
|
194
|
+
RG_DEF_SMETHOD(set_extension_events, 3);
|
185
195
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
196
|
+
RG_DEF_METHOD(set_source, 1);
|
197
|
+
RG_DEF_METHOD(set_mode, 1);
|
198
|
+
RG_DEF_METHOD(set_key, 3);
|
199
|
+
RG_DEF_METHOD(set_axis_use, 2);
|
200
|
+
RG_DEF_METHOD(get_state, 1);
|
201
|
+
RG_DEF_METHOD(get_history, 3);
|
202
|
+
RG_DEF_METHOD(get_axis, 2);
|
193
203
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
204
|
+
RG_DEF_METHOD(name, 0);
|
205
|
+
RG_DEF_METHOD(source, 0);
|
206
|
+
RG_DEF_METHOD(mode, 0);
|
207
|
+
RG_DEF_METHOD_P(has_cursor, 0);
|
208
|
+
RG_DEF_METHOD(axes, 0);
|
209
|
+
RG_DEF_METHOD(keys, 0);
|
200
210
|
|
201
|
-
G_DEF_SETTERS(
|
211
|
+
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
202
212
|
|
203
213
|
/* GdkInputSource */
|
204
|
-
G_DEF_CLASS(GDK_TYPE_INPUT_SOURCE, "InputSource",
|
205
|
-
G_DEF_CONSTANTS(
|
214
|
+
G_DEF_CLASS(GDK_TYPE_INPUT_SOURCE, "InputSource", RG_TARGET_NAMESPACE);
|
215
|
+
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_INPUT_SOURCE, "GDK_");
|
206
216
|
|
207
217
|
/* GdkInputMode */
|
208
|
-
G_DEF_CLASS(GDK_TYPE_INPUT_MODE, "InputMode",
|
209
|
-
G_DEF_CONSTANTS(
|
210
|
-
|
218
|
+
G_DEF_CLASS(GDK_TYPE_INPUT_MODE, "InputMode", RG_TARGET_NAMESPACE);
|
219
|
+
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_INPUT_MODE, "GDK_");
|
220
|
+
|
211
221
|
/* GdkAxisUse */
|
212
|
-
G_DEF_CLASS(GDK_TYPE_AXIS_USE, "AxisUse",
|
213
|
-
G_DEF_CONSTANTS(
|
222
|
+
G_DEF_CLASS(GDK_TYPE_AXIS_USE, "AxisUse", RG_TARGET_NAMESPACE);
|
223
|
+
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_AXIS_USE, "GDK_");
|
214
224
|
|
215
225
|
/* GdkExtensionMode */
|
216
|
-
G_DEF_CLASS(GDK_TYPE_EXTENSION_MODE, "ExtensionMode",
|
217
|
-
G_DEF_CONSTANTS(
|
226
|
+
G_DEF_CLASS(GDK_TYPE_EXTENSION_MODE, "ExtensionMode", RG_TARGET_NAMESPACE);
|
227
|
+
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GDK_TYPE_EXTENSION_MODE, "GDK_");
|
218
228
|
|
219
229
|
}
|