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,50 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgdkdisplaymanager.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2006/06/17 06:59:32 $
|
8
|
+
|
9
|
+
Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
15
|
+
#define _SELF(obj) GDK_DISPLAY_MANAGER(RVAL2GOBJ(obj))
|
16
|
+
|
17
|
+
static VALUE
|
18
|
+
gdkdisplaymanager_get(self)
|
19
|
+
VALUE self;
|
20
|
+
{
|
21
|
+
return GOBJ2RVAL(gdk_display_manager_get());
|
22
|
+
}
|
23
|
+
|
24
|
+
static VALUE
|
25
|
+
gdkdisplaymanager_list_displays(self)
|
26
|
+
VALUE self;
|
27
|
+
{
|
28
|
+
return GSLIST2ARYF(gdk_display_manager_list_displays(_SELF(self)));
|
29
|
+
}
|
30
|
+
|
31
|
+
/* Move to Gdk::Display.
|
32
|
+
static VALUE
|
33
|
+
gdkdisplaymanager_get_core_pointer(self)
|
34
|
+
VALUE self;
|
35
|
+
{
|
36
|
+
return GOBJ2RVAL(gdk_display_get_core_pointer(_SELF(self)));
|
37
|
+
}
|
38
|
+
*/
|
39
|
+
#endif
|
40
|
+
|
41
|
+
void
|
42
|
+
Init_gtk_gdk_display_manager()
|
43
|
+
{
|
44
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
45
|
+
VALUE gdkDisplayManager = G_DEF_CLASS(GDK_TYPE_DISPLAY_MANAGER, "DisplayManager", mGdk);
|
46
|
+
|
47
|
+
rb_define_singleton_method(gdkDisplayManager, "get", gdkdisplaymanager_get, 0);
|
48
|
+
rb_define_method(gdkDisplayManager, "displays", gdkdisplaymanager_list_displays, 0);
|
49
|
+
#endif
|
50
|
+
}
|
@@ -0,0 +1,280 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgdkdnd.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:31 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 Masao Mutoh
|
10
|
+
************************************************/
|
11
|
+
#include "global.h"
|
12
|
+
|
13
|
+
#define _SELF(self) (GDK_DRAG_CONTEXT(RVAL2GOBJ(self)))
|
14
|
+
|
15
|
+
static VALUE
|
16
|
+
gdkdragcontext_protocol(self)
|
17
|
+
VALUE self;
|
18
|
+
{
|
19
|
+
return GENUM2RVAL(_SELF(self)->protocol, GDK_TYPE_DRAG_PROTOCOL);
|
20
|
+
}
|
21
|
+
|
22
|
+
static VALUE
|
23
|
+
gdkdragcontext_is_source(self)
|
24
|
+
VALUE self;
|
25
|
+
{
|
26
|
+
return CBOOL2RVAL(_SELF(self)->is_source);
|
27
|
+
}
|
28
|
+
|
29
|
+
static VALUE
|
30
|
+
gdkdragcontext_source_window(self)
|
31
|
+
VALUE self;
|
32
|
+
{
|
33
|
+
return GOBJ2RVAL(_SELF(self)->source_window);
|
34
|
+
}
|
35
|
+
|
36
|
+
static VALUE
|
37
|
+
gdkdragcontext_dest_window(self)
|
38
|
+
VALUE self;
|
39
|
+
{
|
40
|
+
return GOBJ2RVAL(_SELF(self)->dest_window);
|
41
|
+
}
|
42
|
+
|
43
|
+
static VALUE
|
44
|
+
gdkdragcontext_targets(self)
|
45
|
+
VALUE self;
|
46
|
+
{
|
47
|
+
GList *list = _SELF(self)->targets, *cur;
|
48
|
+
VALUE ary = rb_ary_new();
|
49
|
+
|
50
|
+
for (cur = list; cur != NULL; cur = cur->next) {
|
51
|
+
rb_ary_push(ary, BOXED2RVAL((GdkAtom)cur->data, GDK_TYPE_ATOM));
|
52
|
+
}
|
53
|
+
return ary;
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
gdkdragcontext_actions(self)
|
58
|
+
VALUE self;
|
59
|
+
{
|
60
|
+
return GFLAGS2RVAL(_SELF(self)->actions, GDK_TYPE_DRAG_ACTION);
|
61
|
+
}
|
62
|
+
|
63
|
+
static VALUE
|
64
|
+
gdkdragcontext_suggested_action(self)
|
65
|
+
VALUE self;
|
66
|
+
{
|
67
|
+
return GFLAGS2RVAL(_SELF(self)->suggested_action, GDK_TYPE_DRAG_ACTION);
|
68
|
+
}
|
69
|
+
|
70
|
+
static VALUE
|
71
|
+
gdkdragcontext_action(self)
|
72
|
+
VALUE self;
|
73
|
+
{
|
74
|
+
return GFLAGS2RVAL(_SELF(self)->action, GDK_TYPE_DRAG_ACTION);
|
75
|
+
}
|
76
|
+
|
77
|
+
static VALUE
|
78
|
+
gdkdragcontext_start_time(self)
|
79
|
+
VALUE self;
|
80
|
+
{
|
81
|
+
return UINT2NUM(_SELF(self)->start_time);
|
82
|
+
}
|
83
|
+
|
84
|
+
static VALUE
|
85
|
+
gdkdragcontext_initialize(self)
|
86
|
+
VALUE self;
|
87
|
+
{
|
88
|
+
G_INITIALIZE(self, gdk_drag_context_new());
|
89
|
+
return Qnil;
|
90
|
+
}
|
91
|
+
|
92
|
+
static VALUE
|
93
|
+
gdkdragcontext_s_get_protocol(argc, argv, self)
|
94
|
+
int argc;
|
95
|
+
VALUE *argv;
|
96
|
+
VALUE self;
|
97
|
+
{
|
98
|
+
VALUE xid;
|
99
|
+
GdkDragProtocol prot;
|
100
|
+
guint32 ret;
|
101
|
+
|
102
|
+
if (argc == 1) {
|
103
|
+
rb_scan_args(argc, argv, "10", &xid);
|
104
|
+
ret = gdk_drag_get_protocol(NUM2UINT(xid), &prot);
|
105
|
+
} else {
|
106
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
107
|
+
VALUE display;
|
108
|
+
rb_scan_args(argc, argv, "20", &display, &xid);
|
109
|
+
ret = gdk_drag_get_protocol_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
|
110
|
+
NUM2UINT(xid), &prot);
|
111
|
+
#else
|
112
|
+
rb_warn("Not supported arguments for Gdk::Display in GTK+-2.0.x.");
|
113
|
+
ret = gdk_drag_get_protocol(NUM2UINT(xid), &prot);
|
114
|
+
#endif
|
115
|
+
}
|
116
|
+
|
117
|
+
return rb_ary_new3(2, GENUM2RVAL(prot, GDK_TYPE_DRAG_PROTOCOL), UINT2NUM(ret));
|
118
|
+
}
|
119
|
+
|
120
|
+
/* Instance Methods */
|
121
|
+
static VALUE
|
122
|
+
gdkdragcontext_get_selection(self)
|
123
|
+
VALUE self;
|
124
|
+
{
|
125
|
+
return BOXED2RVAL(gdk_drag_get_selection(_SELF(self)), GDK_TYPE_ATOM);
|
126
|
+
}
|
127
|
+
|
128
|
+
static VALUE
|
129
|
+
gdkdragcontext_drag_abort(self, time)
|
130
|
+
VALUE self, time;
|
131
|
+
{
|
132
|
+
gdk_drag_abort(_SELF(self), NUM2UINT(time));
|
133
|
+
return self;
|
134
|
+
}
|
135
|
+
|
136
|
+
static VALUE
|
137
|
+
gdkdragcontext_drop_reply(self, ok, time)
|
138
|
+
VALUE self, ok, time;
|
139
|
+
{
|
140
|
+
gdk_drop_reply(_SELF(self), RVAL2CBOOL(ok), NUM2UINT(time));
|
141
|
+
return self;
|
142
|
+
}
|
143
|
+
|
144
|
+
static VALUE
|
145
|
+
gdkdragcontext_drag_drop(self, time)
|
146
|
+
VALUE self, time;
|
147
|
+
{
|
148
|
+
gdk_drag_drop(_SELF(self), NUM2UINT(time));
|
149
|
+
return self;
|
150
|
+
}
|
151
|
+
|
152
|
+
static VALUE
|
153
|
+
gdkdragcontext_find_window(argc, argv, self)
|
154
|
+
int argc;
|
155
|
+
VALUE *argv;
|
156
|
+
VALUE self;
|
157
|
+
{
|
158
|
+
VALUE drag_window, x_root, y_root;
|
159
|
+
GdkWindow *dest_window;
|
160
|
+
GdkDragProtocol prot;
|
161
|
+
|
162
|
+
if (argc == 3) {
|
163
|
+
rb_scan_args(argc, argv, "30", &drag_window, &x_root, &y_root);
|
164
|
+
gdk_drag_find_window(_SELF(self),
|
165
|
+
GDK_WINDOW(RVAL2GOBJ(drag_window)),
|
166
|
+
NUM2INT(x_root), NUM2INT(y_root),
|
167
|
+
&dest_window, &prot);
|
168
|
+
} else {
|
169
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
170
|
+
VALUE screen;
|
171
|
+
rb_scan_args(argc, argv, "40", &drag_window, &screen, &x_root, &y_root);
|
172
|
+
gdk_drag_find_window_for_screen(_SELF(self),
|
173
|
+
GDK_WINDOW(RVAL2GOBJ(drag_window)),
|
174
|
+
GDK_SCREEN(RVAL2GOBJ(screen)),
|
175
|
+
NUM2INT(x_root), NUM2INT(y_root),
|
176
|
+
&dest_window, &prot);
|
177
|
+
#else
|
178
|
+
rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
|
179
|
+
#endif
|
180
|
+
}
|
181
|
+
|
182
|
+
return rb_ary_new3(2, GOBJ2RVAL(dest_window),
|
183
|
+
GENUM2RVAL(prot, GDK_TYPE_DRAG_PROTOCOL));
|
184
|
+
}
|
185
|
+
|
186
|
+
static VALUE
|
187
|
+
gdkdragcontext_s_drag_begin(self, window, targets)
|
188
|
+
VALUE self, window, targets;
|
189
|
+
{
|
190
|
+
GList* list = NULL;
|
191
|
+
VALUE ret;
|
192
|
+
int i;
|
193
|
+
for (i = 0; i < RARRAY_LEN(targets); i++){
|
194
|
+
list = g_list_append(list, GINT_TO_POINTER(RVAL2ATOM(RARRAY_PTR(targets)[0])));
|
195
|
+
}
|
196
|
+
|
197
|
+
ret = GOBJ2RVAL(gdk_drag_begin(GDK_WINDOW(RVAL2GOBJ(window)), list));
|
198
|
+
g_list_free(list);
|
199
|
+
|
200
|
+
return ret;
|
201
|
+
}
|
202
|
+
|
203
|
+
static VALUE
|
204
|
+
gdkdragcontext_drag_motion(self, dest_window, protocol, x_root, y_root,
|
205
|
+
suggested_action, possible_actions, time)
|
206
|
+
VALUE self, dest_window, protocol, x_root, y_root,
|
207
|
+
suggested_action, possible_actions, time;
|
208
|
+
{
|
209
|
+
gboolean ret = gdk_drag_motion(_SELF(self),
|
210
|
+
GDK_WINDOW(RVAL2GOBJ(dest_window)),
|
211
|
+
RVAL2GENUM(protocol, GDK_TYPE_DRAG_PROTOCOL),
|
212
|
+
NUM2INT(x_root), NUM2INT(y_root),
|
213
|
+
RVAL2GFLAGS(suggested_action, GDK_TYPE_DRAG_ACTION),
|
214
|
+
RVAL2GFLAGS(possible_actions, GDK_TYPE_DRAG_ACTION),
|
215
|
+
NUM2UINT(time));
|
216
|
+
return CBOOL2RVAL(ret);
|
217
|
+
}
|
218
|
+
|
219
|
+
static VALUE
|
220
|
+
gdkdragcontext_drop_finish(self, success, time)
|
221
|
+
VALUE self, success, time;
|
222
|
+
{
|
223
|
+
gdk_drop_finish(_SELF(self), RVAL2CBOOL(success), NUM2UINT(time));
|
224
|
+
return self;
|
225
|
+
}
|
226
|
+
|
227
|
+
static VALUE
|
228
|
+
gdkdragcontext_drag_status(self, action, time)
|
229
|
+
VALUE self, action, time;
|
230
|
+
{
|
231
|
+
gdk_drag_status(_SELF(self),
|
232
|
+
RVAL2GFLAGS(action, GDK_TYPE_DRAG_ACTION), NUM2UINT(time));
|
233
|
+
return self;
|
234
|
+
}
|
235
|
+
|
236
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
237
|
+
static VALUE
|
238
|
+
gdkdragcontext_drag_drop_succeeded(self)
|
239
|
+
VALUE self;
|
240
|
+
{
|
241
|
+
return CBOOL2RVAL(gdk_drag_drop_succeeded(_SELF(self)));
|
242
|
+
}
|
243
|
+
#endif
|
244
|
+
|
245
|
+
void
|
246
|
+
Init_gtk_gdk_dragcontext()
|
247
|
+
{
|
248
|
+
VALUE gdkDragContext = G_DEF_CLASS(GDK_TYPE_DRAG_CONTEXT, "DragContext", mGdk);
|
249
|
+
|
250
|
+
rb_define_singleton_method(gdkDragContext, "get_protocol", gdkdragcontext_s_get_protocol, -1);
|
251
|
+
rb_define_singleton_method(gdkDragContext, "drag_begin", gdkdragcontext_s_drag_begin, 1);
|
252
|
+
|
253
|
+
rb_define_method(gdkDragContext, "initialize", gdkdragcontext_initialize, 0);
|
254
|
+
rb_define_method(gdkDragContext, "protocol", gdkdragcontext_protocol, 0);
|
255
|
+
rb_define_method(gdkDragContext, "source?", gdkdragcontext_is_source, 0);
|
256
|
+
rb_define_method(gdkDragContext, "source_window", gdkdragcontext_source_window, 0);
|
257
|
+
rb_define_method(gdkDragContext, "dest_window", gdkdragcontext_dest_window, 0);
|
258
|
+
rb_define_method(gdkDragContext, "targets", gdkdragcontext_targets, 0);
|
259
|
+
rb_define_method(gdkDragContext, "actions", gdkdragcontext_actions, 0);
|
260
|
+
rb_define_method(gdkDragContext, "suggested_action", gdkdragcontext_suggested_action, 0);
|
261
|
+
rb_define_method(gdkDragContext, "action", gdkdragcontext_action, 0);
|
262
|
+
rb_define_method(gdkDragContext, "start_time", gdkdragcontext_start_time, 0);
|
263
|
+
|
264
|
+
rb_define_method(gdkDragContext, "selection", gdkdragcontext_get_selection, 0);
|
265
|
+
rb_define_method(gdkDragContext, "drag_abort", gdkdragcontext_drag_abort, 1);
|
266
|
+
rb_define_method(gdkDragContext, "drop_reply", gdkdragcontext_drop_reply, 2);
|
267
|
+
rb_define_method(gdkDragContext, "drag_drop", gdkdragcontext_drag_drop, 1);
|
268
|
+
rb_define_method(gdkDragContext, "find_window", gdkdragcontext_find_window, 4);
|
269
|
+
rb_define_method(gdkDragContext, "drag_motion", gdkdragcontext_drag_motion, 7);
|
270
|
+
rb_define_method(gdkDragContext, "drop_finish", gdkdragcontext_drop_finish, 2);
|
271
|
+
rb_define_method(gdkDragContext, "drag_status", gdkdragcontext_drag_status, 2);
|
272
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
273
|
+
rb_define_method(gdkDragContext, "drag_drop_succeeded?", gdkdragcontext_drag_drop_succeeded, 0);
|
274
|
+
#endif
|
275
|
+
/* Constants */
|
276
|
+
G_DEF_CLASS(GDK_TYPE_DRAG_PROTOCOL, "Protocol", gdkDragContext);
|
277
|
+
G_DEF_CLASS(GDK_TYPE_DRAG_ACTION, "Action", gdkDragContext);
|
278
|
+
G_DEF_CONSTANTS(gdkDragContext, GDK_TYPE_DRAG_PROTOCOL, "GDK_DRAG_");
|
279
|
+
G_DEF_CONSTANTS(gdkDragContext, GDK_TYPE_DRAG_ACTION, "GDK_");
|
280
|
+
}
|
data/src/rbgdkdraw.c
ADDED
@@ -0,0 +1,487 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgdkdraw.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:31 $
|
8
|
+
|
9
|
+
Copyright (C) 2002-2005 Masao Mutoh
|
10
|
+
Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
11
|
+
Daisuke Kanda,
|
12
|
+
Hiroshi Igarashi
|
13
|
+
************************************************/
|
14
|
+
|
15
|
+
#include "global.h"
|
16
|
+
#include "rbpango.h"
|
17
|
+
#ifdef GDK_WINDOWING_X11
|
18
|
+
#include <gdk/gdkx.h>
|
19
|
+
#endif
|
20
|
+
#ifdef HAVE_RB_CAIRO_H
|
21
|
+
#include <rb_cairo.h>
|
22
|
+
#endif
|
23
|
+
|
24
|
+
#define _SELF(s) GDK_DRAWABLE(RVAL2GOBJ(s))
|
25
|
+
|
26
|
+
static VALUE
|
27
|
+
gdkdraw_get_visual(self)
|
28
|
+
VALUE self;
|
29
|
+
{
|
30
|
+
return GOBJ2RVAL(_SELF(self));
|
31
|
+
}
|
32
|
+
|
33
|
+
static VALUE
|
34
|
+
gdkdraw_set_colormap(VALUE self, VALUE colormap)
|
35
|
+
{
|
36
|
+
VALUE old_colormap;
|
37
|
+
|
38
|
+
old_colormap = GOBJ2RVAL(gdk_drawable_get_colormap(_SELF(self)));
|
39
|
+
G_CHILD_REMOVE(self, old_colormap);
|
40
|
+
|
41
|
+
G_CHILD_ADD(self, colormap);
|
42
|
+
gdk_drawable_set_colormap(_SELF(self), GDK_COLORMAP(RVAL2GOBJ(colormap)));
|
43
|
+
return self;
|
44
|
+
}
|
45
|
+
|
46
|
+
static VALUE
|
47
|
+
gdkdraw_get_colormap(VALUE self)
|
48
|
+
{
|
49
|
+
VALUE rb_colormap;
|
50
|
+
|
51
|
+
rb_colormap = GOBJ2RVAL(gdk_drawable_get_colormap(_SELF(self)));
|
52
|
+
G_CHILD_ADD(self, rb_colormap);
|
53
|
+
return rb_colormap;
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
gdkdraw_get_depth(self)
|
58
|
+
VALUE self;
|
59
|
+
{
|
60
|
+
return INT2NUM(gdk_drawable_get_depth(_SELF(self)));
|
61
|
+
}
|
62
|
+
|
63
|
+
static VALUE
|
64
|
+
gdkdraw_get_size(self)
|
65
|
+
VALUE self;
|
66
|
+
{
|
67
|
+
gint width, height;
|
68
|
+
gdk_drawable_get_size(_SELF(self), &width, &height);
|
69
|
+
return rb_ary_new3(2, INT2NUM(width), INT2NUM(height));
|
70
|
+
}
|
71
|
+
|
72
|
+
static VALUE
|
73
|
+
gdkdraw_get_clip_region(self)
|
74
|
+
VALUE self;
|
75
|
+
{
|
76
|
+
return BOXED2RVAL(gdk_drawable_get_clip_region(_SELF(self)), GDK_TYPE_REGION);
|
77
|
+
}
|
78
|
+
|
79
|
+
static VALUE
|
80
|
+
gdkdraw_get_visible_region(self)
|
81
|
+
VALUE self;
|
82
|
+
{
|
83
|
+
return BOXED2RVAL(gdk_drawable_get_visible_region(_SELF(self)), GDK_TYPE_REGION);
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
static VALUE
|
88
|
+
gdkdraw_draw_point(self, gc, x, y)
|
89
|
+
VALUE self, gc, x, y;
|
90
|
+
{
|
91
|
+
gdk_draw_point(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
92
|
+
NUM2INT(x), NUM2INT(y));
|
93
|
+
return self;
|
94
|
+
}
|
95
|
+
|
96
|
+
static VALUE
|
97
|
+
gdkdraw_draw_points(self, gc, pnts)
|
98
|
+
VALUE self, gc, pnts;
|
99
|
+
{
|
100
|
+
GdkPoint *points;
|
101
|
+
int i;
|
102
|
+
|
103
|
+
Check_Type(pnts, T_ARRAY);
|
104
|
+
points = ALLOCA_N(GdkPoint,RARRAY_LEN(pnts));
|
105
|
+
for (i = 0; i < RARRAY_LEN(pnts); i++) {
|
106
|
+
Check_Type(RARRAY_PTR(pnts)[i], T_ARRAY);
|
107
|
+
if (RARRAY_LEN(RARRAY_PTR(pnts)[i]) < 2) {
|
108
|
+
rb_raise(rb_eArgError, "point %d should be array of size 2", i);
|
109
|
+
}
|
110
|
+
points[i].x = NUM2INT(RARRAY_PTR(RARRAY_PTR(pnts)[i])[0]);
|
111
|
+
points[i].y = NUM2INT(RARRAY_PTR(RARRAY_PTR(pnts)[i])[1]);
|
112
|
+
}
|
113
|
+
gdk_draw_points(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
114
|
+
points,
|
115
|
+
RARRAY_LEN(pnts));
|
116
|
+
return self;
|
117
|
+
}
|
118
|
+
|
119
|
+
static VALUE
|
120
|
+
gdkdraw_draw_line(self, gc, x1, y1, x2, y2)
|
121
|
+
VALUE self, gc, x1, y1, x2, y2;
|
122
|
+
{
|
123
|
+
gdk_draw_line(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
124
|
+
NUM2INT(x1), NUM2INT(y1),
|
125
|
+
NUM2INT(x2), NUM2INT(y2));
|
126
|
+
return self;
|
127
|
+
}
|
128
|
+
|
129
|
+
static VALUE
|
130
|
+
gdkdraw_draw_lines(self, gc, pnts)
|
131
|
+
VALUE self, gc, pnts;
|
132
|
+
{
|
133
|
+
GdkPoint *points;
|
134
|
+
int i;
|
135
|
+
|
136
|
+
Check_Type(pnts, T_ARRAY);
|
137
|
+
points = ALLOCA_N(GdkPoint,RARRAY_LEN(pnts));
|
138
|
+
for (i = 0; i < RARRAY_LEN(pnts); i++) {
|
139
|
+
Check_Type(RARRAY_PTR(pnts)[i], T_ARRAY);
|
140
|
+
if (RARRAY_LEN(RARRAY_PTR(pnts)[i]) < 2) {
|
141
|
+
rb_raise(rb_eArgError, "point %d should be array of size 2", i);
|
142
|
+
}
|
143
|
+
points[i].x = NUM2INT(RARRAY_PTR(RARRAY_PTR(pnts)[i])[0]);
|
144
|
+
points[i].y = NUM2INT(RARRAY_PTR(RARRAY_PTR(pnts)[i])[1]);
|
145
|
+
}
|
146
|
+
gdk_draw_lines(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
147
|
+
points,
|
148
|
+
RARRAY_LEN(pnts));
|
149
|
+
return self;
|
150
|
+
}
|
151
|
+
|
152
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
153
|
+
static VALUE
|
154
|
+
gdkdraw_draw_pixbuf(self, gc, pixbuf, src_x, src_y, dest_x, dest_y,
|
155
|
+
width, height, dither, x_dither, y_dither)
|
156
|
+
VALUE self, gc, pixbuf, src_x, src_y, dest_x, dest_y;
|
157
|
+
VALUE width, height, dither, x_dither, y_dither;
|
158
|
+
{
|
159
|
+
gdk_draw_pixbuf(_SELF(self),
|
160
|
+
GDK_GC(RVAL2GOBJ(gc)),
|
161
|
+
GDK_PIXBUF(RVAL2GOBJ(pixbuf)),
|
162
|
+
NUM2INT(src_x), NUM2INT(src_y),
|
163
|
+
NUM2INT(dest_x), NUM2INT(dest_y),
|
164
|
+
NUM2INT(width), NUM2INT(height),
|
165
|
+
RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
|
166
|
+
NUM2INT(x_dither), NUM2INT(y_dither));
|
167
|
+
return self;
|
168
|
+
}
|
169
|
+
#endif
|
170
|
+
|
171
|
+
static VALUE
|
172
|
+
gdkdraw_draw_segs(self, gc, segs)
|
173
|
+
VALUE self, gc, segs;
|
174
|
+
{
|
175
|
+
GdkSegment *segments;
|
176
|
+
int i;
|
177
|
+
|
178
|
+
Check_Type(segs, T_ARRAY);
|
179
|
+
segments = ALLOCA_N(GdkSegment,RARRAY_LEN(segs));
|
180
|
+
for (i = 0; i < RARRAY_LEN(segs); i++) {
|
181
|
+
Check_Type(RARRAY_PTR(segs)[i], T_ARRAY);
|
182
|
+
if (RARRAY_LEN(RARRAY_PTR(segs)[i]) < 4) {
|
183
|
+
rb_raise(rb_eArgError, "segment %d should be array of size 4", i);
|
184
|
+
}
|
185
|
+
segments[i].x1 = NUM2INT(RARRAY_PTR(RARRAY_PTR(segs)[i])[0]);
|
186
|
+
segments[i].y1 = NUM2INT(RARRAY_PTR(RARRAY_PTR(segs)[i])[1]);
|
187
|
+
segments[i].x2 = NUM2INT(RARRAY_PTR(RARRAY_PTR(segs)[i])[2]);
|
188
|
+
segments[i].y2 = NUM2INT(RARRAY_PTR(RARRAY_PTR(segs)[i])[3]);
|
189
|
+
}
|
190
|
+
gdk_draw_segments(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
191
|
+
segments, RARRAY_LEN(segs));
|
192
|
+
return self;
|
193
|
+
}
|
194
|
+
|
195
|
+
static VALUE
|
196
|
+
gdkdraw_draw_rect(self, gc, filled, x, y, w, h)
|
197
|
+
VALUE self, gc, filled, x, y, w, h;
|
198
|
+
{
|
199
|
+
gdk_draw_rectangle(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
200
|
+
RVAL2CBOOL(filled),
|
201
|
+
NUM2INT(x), NUM2INT(y),
|
202
|
+
NUM2INT(w), NUM2INT(h));
|
203
|
+
return self;
|
204
|
+
}
|
205
|
+
|
206
|
+
static VALUE
|
207
|
+
gdkdraw_draw_arc(self, gc, filled, x, y, w, h, a1, a2)
|
208
|
+
VALUE self, gc, filled, x, y, w, h, a1, a2;
|
209
|
+
{
|
210
|
+
gdk_draw_arc(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
211
|
+
RVAL2CBOOL(filled),
|
212
|
+
NUM2INT(x), NUM2INT(y),
|
213
|
+
NUM2INT(w), NUM2INT(h),
|
214
|
+
NUM2INT(a1), NUM2INT(a2));
|
215
|
+
return self;
|
216
|
+
}
|
217
|
+
|
218
|
+
static VALUE
|
219
|
+
gdkdraw_draw_poly(self, gc, filled, pnts)
|
220
|
+
VALUE self, gc, filled, pnts;
|
221
|
+
{
|
222
|
+
GdkPoint *points;
|
223
|
+
int i;
|
224
|
+
|
225
|
+
Check_Type(pnts, T_ARRAY);
|
226
|
+
points = ALLOCA_N(GdkPoint,RARRAY_LEN(pnts));
|
227
|
+
for (i = 0; i < RARRAY_LEN(pnts); i++) {
|
228
|
+
Check_Type(RARRAY_PTR(pnts)[i], T_ARRAY);
|
229
|
+
if (RARRAY_LEN(RARRAY_PTR(pnts)[i]) < 2) {
|
230
|
+
rb_raise(rb_eArgError, "point %d should be array of size 2", i);
|
231
|
+
}
|
232
|
+
points[i].x = NUM2INT(RARRAY_PTR(RARRAY_PTR(pnts)[i])[0]);
|
233
|
+
points[i].y = NUM2INT(RARRAY_PTR(RARRAY_PTR(pnts)[i])[1]);
|
234
|
+
}
|
235
|
+
gdk_draw_polygon(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
236
|
+
RVAL2CBOOL(filled),
|
237
|
+
points,
|
238
|
+
RARRAY_LEN(pnts));
|
239
|
+
return self;
|
240
|
+
}
|
241
|
+
|
242
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
243
|
+
/*
|
244
|
+
trapezoids = [[y1, x11, x21, y2, x12, x22], ...]
|
245
|
+
*/
|
246
|
+
static VALUE
|
247
|
+
gdkdraw_draw_trapezoids(self, gc, trapezoids)
|
248
|
+
VALUE self, gc, trapezoids;
|
249
|
+
{
|
250
|
+
GdkTrapezoid *gtrapezoids;
|
251
|
+
gint i, len;
|
252
|
+
|
253
|
+
Check_Type(trapezoids, T_ARRAY);
|
254
|
+
|
255
|
+
len = RARRAY_LEN(trapezoids);
|
256
|
+
|
257
|
+
gtrapezoids = ALLOCA_N(GdkTrapezoid, len);
|
258
|
+
for (i = 0; i < len; i++) {
|
259
|
+
Check_Type(RARRAY_PTR(trapezoids)[i], T_ARRAY);
|
260
|
+
if (RARRAY_LEN(RARRAY_PTR(trapezoids)[i]) < 6) {
|
261
|
+
rb_raise(rb_eArgError, "trapezoids %d should be array of size 6", i);
|
262
|
+
}
|
263
|
+
gtrapezoids[i].y1 = NUM2DBL(RARRAY_PTR(RARRAY_PTR(trapezoids)[i])[0]);
|
264
|
+
gtrapezoids[i].x11 = NUM2DBL(RARRAY_PTR(RARRAY_PTR(trapezoids)[i])[1]);
|
265
|
+
gtrapezoids[i].x21 = NUM2DBL(RARRAY_PTR(RARRAY_PTR(trapezoids)[i])[2]);
|
266
|
+
gtrapezoids[i].y2 = NUM2DBL(RARRAY_PTR(RARRAY_PTR(trapezoids)[i])[3]);
|
267
|
+
gtrapezoids[i].x12 = NUM2DBL(RARRAY_PTR(RARRAY_PTR(trapezoids)[i])[4]);
|
268
|
+
gtrapezoids[i].x22 = NUM2DBL(RARRAY_PTR(RARRAY_PTR(trapezoids)[i])[5]);
|
269
|
+
}
|
270
|
+
gdk_draw_trapezoids(_SELF(self), GDK_GC(RVAL2GOBJ(gc)), gtrapezoids, len);
|
271
|
+
return self;
|
272
|
+
}
|
273
|
+
#endif
|
274
|
+
|
275
|
+
static VALUE
|
276
|
+
gdkdraw_glyphs(self, gc, font, x, y, glyphs)
|
277
|
+
VALUE self, gc, font, x, y, glyphs;
|
278
|
+
{
|
279
|
+
gdk_draw_glyphs(_SELF(self), GDK_GC(RVAL2GOBJ(gc)), PANGO_FONT(RVAL2GOBJ(font)),
|
280
|
+
NUM2INT(x), NUM2INT(y),
|
281
|
+
(PangoGlyphString*)(RVAL2BOXED(glyphs, PANGO_TYPE_GLYPH_STRING)));
|
282
|
+
return self;
|
283
|
+
}
|
284
|
+
|
285
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
286
|
+
static VALUE
|
287
|
+
gdkdraw_glyphs_transformed(self, gc, matrix, font, x, y, glyphs)
|
288
|
+
VALUE self, gc, matrix, font, x, y, glyphs;
|
289
|
+
{
|
290
|
+
gdk_draw_glyphs_transformed(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
291
|
+
NIL_P(matrix) ? (PangoMatrix*)NULL : (PangoMatrix*)(RVAL2BOXED(matrix, PANGO_TYPE_MATRIX)),
|
292
|
+
PANGO_FONT(RVAL2GOBJ(font)),
|
293
|
+
NUM2INT(x), NUM2INT(y),
|
294
|
+
(PangoGlyphString*)(RVAL2BOXED(glyphs, PANGO_TYPE_GLYPH_STRING)));
|
295
|
+
return self;
|
296
|
+
}
|
297
|
+
#endif
|
298
|
+
|
299
|
+
static VALUE
|
300
|
+
gdkdraw_layout_line(argc, argv, self)
|
301
|
+
int argc;
|
302
|
+
VALUE *argv;
|
303
|
+
VALUE self;
|
304
|
+
{
|
305
|
+
VALUE gc, x, y, line, fg, bg;
|
306
|
+
|
307
|
+
rb_scan_args(argc, argv, "42", &gc, &x, &y, &line, &fg, &bg);
|
308
|
+
|
309
|
+
gdk_draw_layout_line_with_colors(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
310
|
+
NUM2INT(x), NUM2INT(y),
|
311
|
+
(PangoLayoutLine*)RVAL2BOXED(line, PANGO_TYPE_LAYOUT_LINE),
|
312
|
+
RVAL2GDKCOLOR(fg),
|
313
|
+
RVAL2GDKCOLOR(bg));
|
314
|
+
|
315
|
+
return self;
|
316
|
+
}
|
317
|
+
|
318
|
+
static VALUE
|
319
|
+
gdkdraw_layout(argc, argv, self)
|
320
|
+
int argc;
|
321
|
+
VALUE *argv;
|
322
|
+
VALUE self;
|
323
|
+
{
|
324
|
+
VALUE gc, x, y, layout, fg, bg;
|
325
|
+
|
326
|
+
rb_scan_args(argc, argv, "42", &gc, &x, &y, &layout, &fg, &bg);
|
327
|
+
|
328
|
+
gdk_draw_layout_with_colors(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
329
|
+
NUM2INT(x), NUM2INT(y), PANGO_LAYOUT(RVAL2GOBJ(layout)),
|
330
|
+
RVAL2GDKCOLOR(fg),
|
331
|
+
RVAL2GDKCOLOR(bg));
|
332
|
+
|
333
|
+
return self;
|
334
|
+
}
|
335
|
+
|
336
|
+
static VALUE
|
337
|
+
gdkdraw_draw_drawable(self, gc, src, xsrc, ysrc, xdst, ydst, w, h)
|
338
|
+
VALUE self, gc, src, xsrc, ysrc, xdst, ydst, w, h;
|
339
|
+
{
|
340
|
+
gdk_draw_drawable(_SELF(self), GDK_GC(RVAL2GOBJ(gc)), _SELF(src),
|
341
|
+
NUM2INT(xsrc), NUM2INT(ysrc),
|
342
|
+
NUM2INT(xdst), NUM2INT(ydst),
|
343
|
+
NUM2INT(w), NUM2INT(h));
|
344
|
+
return self;
|
345
|
+
}
|
346
|
+
|
347
|
+
static VALUE
|
348
|
+
gdkdraw_draw_image(self, gc, image, xsrc, ysrc, xdst, ydst, w, h)
|
349
|
+
VALUE self, gc, image, xsrc, ysrc, xdst, ydst, w, h;
|
350
|
+
{
|
351
|
+
gdk_draw_image(_SELF(self), GDK_GC(RVAL2GOBJ(gc)),
|
352
|
+
GDK_IMAGE(RVAL2GOBJ(image)),
|
353
|
+
NUM2INT(xsrc), NUM2INT(ysrc),
|
354
|
+
NUM2INT(xdst), NUM2INT(ydst),
|
355
|
+
NUM2INT(w), NUM2INT(h));
|
356
|
+
return self;
|
357
|
+
}
|
358
|
+
|
359
|
+
static VALUE
|
360
|
+
gdkdraw_get_image(self, x, y, w, h)
|
361
|
+
VALUE self, x, y, w, h;
|
362
|
+
{
|
363
|
+
return GOBJ2RVAL(gdk_drawable_get_image(_SELF(self),
|
364
|
+
NUM2INT(x), NUM2INT(y),
|
365
|
+
NUM2INT(w), NUM2INT(h)));
|
366
|
+
}
|
367
|
+
|
368
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
369
|
+
static VALUE
|
370
|
+
gdkdraw_copy_to_image(self, image, xsrc, ysrc, xdst, ydst, w, h)
|
371
|
+
VALUE self, image, xsrc, ysrc, xdst, ydst, w, h;
|
372
|
+
{
|
373
|
+
return GOBJ2RVAL(gdk_drawable_copy_to_image(_SELF(self),
|
374
|
+
GDK_IMAGE(RVAL2GOBJ(image)),
|
375
|
+
NUM2INT(xsrc), NUM2INT(ysrc),
|
376
|
+
NUM2INT(xdst), NUM2INT(ydst),
|
377
|
+
NUM2INT(w), NUM2INT(h)));
|
378
|
+
}
|
379
|
+
#endif
|
380
|
+
|
381
|
+
#ifdef GDK_WINDOWING_X11
|
382
|
+
static VALUE
|
383
|
+
gdkdraw_get_xid(self)
|
384
|
+
VALUE self;
|
385
|
+
{
|
386
|
+
return ULONG2NUM(GDK_DRAWABLE_XID(_SELF(self)));
|
387
|
+
}
|
388
|
+
#endif
|
389
|
+
|
390
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
391
|
+
static VALUE
|
392
|
+
gdkdraw_get_display(self)
|
393
|
+
VALUE self;
|
394
|
+
{
|
395
|
+
return GOBJ2RVAL(gdk_drawable_get_display(_SELF(self)));
|
396
|
+
}
|
397
|
+
|
398
|
+
static VALUE
|
399
|
+
gdkdraw_get_screen(self)
|
400
|
+
VALUE self;
|
401
|
+
{
|
402
|
+
return GOBJ2RVAL(gdk_drawable_get_screen(_SELF(self)));
|
403
|
+
}
|
404
|
+
#endif
|
405
|
+
|
406
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
407
|
+
# ifdef HAVE_RB_CAIRO_H
|
408
|
+
static VALUE
|
409
|
+
gdkdraw_cairo_create(self)
|
410
|
+
VALUE self;
|
411
|
+
{
|
412
|
+
VALUE rb_cr;
|
413
|
+
cairo_t *cr;
|
414
|
+
cr = gdk_cairo_create(_SELF(self));
|
415
|
+
rb_cairo_check_status(cairo_status(cr));
|
416
|
+
rb_cr = CRCONTEXT2RVAL(cr);
|
417
|
+
cairo_destroy (cr);
|
418
|
+
return rb_cr;
|
419
|
+
}
|
420
|
+
# endif
|
421
|
+
#endif
|
422
|
+
|
423
|
+
void
|
424
|
+
Init_gtk_gdk_draw()
|
425
|
+
{
|
426
|
+
VALUE gdkDrawable = G_DEF_CLASS(GDK_TYPE_DRAWABLE, "Drawable", mGdk);
|
427
|
+
|
428
|
+
rb_define_method(gdkDrawable, "visual", gdkdraw_get_visual, 0);
|
429
|
+
rb_define_method(gdkDrawable, "set_colormap", gdkdraw_set_colormap, 1);
|
430
|
+
rb_define_method(gdkDrawable, "colormap", gdkdraw_get_colormap, 0);
|
431
|
+
rb_define_method(gdkDrawable, "depth", gdkdraw_get_depth, 0);
|
432
|
+
rb_define_method(gdkDrawable, "size", gdkdraw_get_size, 0);
|
433
|
+
rb_define_method(gdkDrawable, "clip_region", gdkdraw_get_clip_region, 0);
|
434
|
+
rb_define_method(gdkDrawable, "visible_region", gdkdraw_get_visible_region, 0);
|
435
|
+
rb_define_method(gdkDrawable, "draw_point", gdkdraw_draw_point, 3);
|
436
|
+
rb_define_method(gdkDrawable, "draw_points", gdkdraw_draw_points, 2);
|
437
|
+
rb_define_method(gdkDrawable, "draw_line", gdkdraw_draw_line, 5);
|
438
|
+
rb_define_method(gdkDrawable, "draw_lines", gdkdraw_draw_lines, 2);
|
439
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
440
|
+
rb_define_method(gdkDrawable, "draw_pixbuf", gdkdraw_draw_pixbuf, 11);
|
441
|
+
#endif
|
442
|
+
rb_define_method(gdkDrawable, "draw_segments", gdkdraw_draw_segs, 2);
|
443
|
+
rb_define_method(gdkDrawable, "draw_rectangle", gdkdraw_draw_rect, 6);
|
444
|
+
rb_define_method(gdkDrawable, "draw_arc", gdkdraw_draw_arc, 8);
|
445
|
+
rb_define_method(gdkDrawable, "draw_polygon", gdkdraw_draw_poly, 3);
|
446
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
447
|
+
rb_define_method(gdkDrawable, "draw_trapezoids", gdkdraw_draw_trapezoids, 2);
|
448
|
+
#endif
|
449
|
+
rb_define_method(gdkDrawable, "draw_glyphs", gdkdraw_glyphs, 5);
|
450
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
451
|
+
rb_define_method(gdkDrawable, "draw_glyphs_transformed", gdkdraw_glyphs_transformed, 6);
|
452
|
+
#endif
|
453
|
+
rb_define_method(gdkDrawable, "draw_layout_line", gdkdraw_layout_line, -1);
|
454
|
+
rb_define_method(gdkDrawable, "draw_layout", gdkdraw_layout, -1);
|
455
|
+
rb_define_method(gdkDrawable, "draw_drawable", gdkdraw_draw_drawable, 8);
|
456
|
+
rb_define_method(gdkDrawable, "draw_image", gdkdraw_draw_image, 8);
|
457
|
+
rb_define_method(gdkDrawable, "get_image", gdkdraw_get_image, 4);
|
458
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
459
|
+
rb_define_method(gdkDrawable, "copy_to_image", gdkdraw_copy_to_image, 7);
|
460
|
+
#endif
|
461
|
+
|
462
|
+
#ifdef GDK_WINDOWING_X11
|
463
|
+
rb_define_method(gdkDrawable, "xid", gdkdraw_get_xid, 0);
|
464
|
+
#endif
|
465
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
466
|
+
rb_define_method(gdkDrawable, "display", gdkdraw_get_display, 0);
|
467
|
+
rb_define_method(gdkDrawable, "screen", gdkdraw_get_screen, 0);
|
468
|
+
#endif
|
469
|
+
|
470
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
471
|
+
# ifdef HAVE_RB_CAIRO_H
|
472
|
+
rb_define_method(gdkDrawable, "create_cairo_context",
|
473
|
+
gdkdraw_cairo_create, 0);
|
474
|
+
# endif
|
475
|
+
#endif
|
476
|
+
|
477
|
+
#ifdef GDK_WINDOWING_X11
|
478
|
+
G_DEF_CLASS3("GdkDrawableImplX11", "DrawableImplX11", mGdk);
|
479
|
+
#elif defined(GDK_WINDOWING_WIN32)
|
480
|
+
G_DEF_CLASS3("GdkDrawableImplWin32", "DrawableImplWin32", mGdk);
|
481
|
+
#elif defined(GDK_WINDOWING_FB)
|
482
|
+
G_DEF_CLASS3("GdkDrawableFB", "DrawableFB", mGdk);
|
483
|
+
#endif
|
484
|
+
|
485
|
+
G_DEF_SETTERS(gdkDrawable);
|
486
|
+
}
|
487
|
+
|