gtk2 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +6664 -0
- data/README +33 -0
- data/Rakefile +71 -0
- data/extconf.rb +116 -0
- data/src/global.h +33 -0
- data/src/init.c +39 -0
- data/src/lib/gtk2.rb +13 -0
- data/src/lib/gtk2/base.rb +95 -0
- data/src/makeinits.rb +57 -0
- data/src/makekeysyms.rb +5 -0
- data/src/rbgdk.c +395 -0
- data/src/rbgdk.h +50 -0
- data/src/rbgdkatom.c +122 -0
- data/src/rbgdkcairo.c +100 -0
- data/src/rbgdkcolor.c +151 -0
- data/src/rbgdkcolormap.c +142 -0
- data/src/rbgdkconst.c +29 -0
- data/src/rbgdkconversions.h +18 -0
- data/src/rbgdkcursor.c +115 -0
- data/src/rbgdkdevice.c +235 -0
- data/src/rbgdkdisplay.c +634 -0
- data/src/rbgdkdisplaymanager.c +50 -0
- data/src/rbgdkdragcontext.c +280 -0
- data/src/rbgdkdraw.c +487 -0
- data/src/rbgdkevent.c +1020 -0
- data/src/rbgdkgc.c +456 -0
- data/src/rbgdkgeometry.c +272 -0
- data/src/rbgdkimage.c +155 -0
- data/src/rbgdkinput.c +70 -0
- data/src/rbgdkkeymap.c +153 -0
- data/src/rbgdkkeysyms.h +2174 -0
- data/src/rbgdkkeyval.c +105 -0
- data/src/rbgdkpango.c +171 -0
- data/src/rbgdkpangorenderer.c +132 -0
- data/src/rbgdkpixbuf.c +178 -0
- data/src/rbgdkpixmap.c +255 -0
- data/src/rbgdkproperty.c +342 -0
- data/src/rbgdkrectangle.c +146 -0
- data/src/rbgdkregion.c +242 -0
- data/src/rbgdkrgb.c +197 -0
- data/src/rbgdkscreen.c +535 -0
- data/src/rbgdkselection.c +161 -0
- data/src/rbgdkthreads.c +68 -0
- data/src/rbgdktimecoord.c +118 -0
- data/src/rbgdkvisual.c +273 -0
- data/src/rbgdkwindow.c +1302 -0
- data/src/rbgdkwindowattr.c +213 -0
- data/src/rbgdkx11.c +256 -0
- data/src/rbgtk.c +93 -0
- data/src/rbgtk.h +121 -0
- data/src/rbgtkaboutdialog.c +195 -0
- data/src/rbgtkaccelerator.c +78 -0
- data/src/rbgtkaccelgroup.c +216 -0
- data/src/rbgtkaccelgroupentry.c +85 -0
- data/src/rbgtkaccelkey.c +116 -0
- data/src/rbgtkaccellabel.c +46 -0
- data/src/rbgtkaccelmap.c +162 -0
- data/src/rbgtkaccessible.c +29 -0
- data/src/rbgtkaction.c +277 -0
- data/src/rbgtkactiongroup.c +377 -0
- data/src/rbgtkadjustment.c +153 -0
- data/src/rbgtkalignment.c +71 -0
- data/src/rbgtkallocation.c +171 -0
- data/src/rbgtkarrow.c +47 -0
- data/src/rbgtkaspectframe.c +46 -0
- data/src/rbgtkassistant.c +230 -0
- data/src/rbgtkbbox.c +47 -0
- data/src/rbgtkbin.c +31 -0
- data/src/rbgtkbindingset.c +192 -0
- data/src/rbgtkborder.c +80 -0
- data/src/rbgtkbox.c +142 -0
- data/src/rbgtkbuildable.c +115 -0
- data/src/rbgtkbuilder.c +154 -0
- data/src/rbgtkbutton.c +151 -0
- data/src/rbgtkcalendar.c +159 -0
- data/src/rbgtkcelleditable.c +49 -0
- data/src/rbgtkcelllayout.c +144 -0
- data/src/rbgtkcellrenderer.c +139 -0
- data/src/rbgtkcellrendereraccel.c +42 -0
- data/src/rbgtkcellrenderercombo.c +37 -0
- data/src/rbgtkcellrendererpixbuf.c +33 -0
- data/src/rbgtkcellrendererprogress.c +37 -0
- data/src/rbgtkcellrendererspin.c +38 -0
- data/src/rbgtkcellrenderertext.c +45 -0
- data/src/rbgtkcellrenderertoggle.c +32 -0
- data/src/rbgtkcellview.c +134 -0
- data/src/rbgtkcheckbutton.c +55 -0
- data/src/rbgtkcheckmenuitem.c +56 -0
- data/src/rbgtkclipboard.c +473 -0
- data/src/rbgtkcolorbutton.c +63 -0
- data/src/rbgtkcolorsel.c +175 -0
- data/src/rbgtkcolorselectiondialog.c +72 -0
- data/src/rbgtkcombo.c +117 -0
- data/src/rbgtkcombobox.c +240 -0
- data/src/rbgtkcomboboxentry.c +60 -0
- data/src/rbgtkconst.c +163 -0
- data/src/rbgtkcontainer.c +776 -0
- data/src/rbgtkconversions.h +26 -0
- data/src/rbgtkcurve.c +105 -0
- data/src/rbgtkdialog.c +244 -0
- data/src/rbgtkdrag.c +436 -0
- data/src/rbgtkdrawingarea.c +31 -0
- data/src/rbgtkeditable.c +152 -0
- data/src/rbgtkentry.c +161 -0
- data/src/rbgtkentrycompletion.c +167 -0
- data/src/rbgtkeventbox.c +31 -0
- data/src/rbgtkexpander.c +67 -0
- data/src/rbgtkfilechooser.c +403 -0
- data/src/rbgtkfilechooserbutton.c +72 -0
- data/src/rbgtkfilechooserdialog.c +58 -0
- data/src/rbgtkfilechooserwidget.c +50 -0
- data/src/rbgtkfilefilter.c +139 -0
- data/src/rbgtkfilesel.c +155 -0
- data/src/rbgtkfixed.c +72 -0
- data/src/rbgtkfontbutton.c +69 -0
- data/src/rbgtkfontselection.c +30 -0
- data/src/rbgtkfontselectiondialog.c +106 -0
- data/src/rbgtkframe.c +64 -0
- data/src/rbgtkgamma.c +47 -0
- data/src/rbgtkhandlebox.c +42 -0
- data/src/rbgtkhbbox.c +31 -0
- data/src/rbgtkhbox.c +38 -0
- data/src/rbgtkhpaned.c +31 -0
- data/src/rbgtkhruler.c +31 -0
- data/src/rbgtkhscale.c +45 -0
- data/src/rbgtkhscrollbar.c +38 -0
- data/src/rbgtkhseparator.c +30 -0
- data/src/rbgtkiconfactory.c +80 -0
- data/src/rbgtkiconinfo.c +118 -0
- data/src/rbgtkiconset.c +87 -0
- data/src/rbgtkiconsize.c +90 -0
- data/src/rbgtkiconsource.c +176 -0
- data/src/rbgtkicontheme.c +309 -0
- data/src/rbgtkiconview.c +351 -0
- data/src/rbgtkimage.c +152 -0
- data/src/rbgtkimagemenuitem.c +52 -0
- data/src/rbgtkimcontext.c +134 -0
- data/src/rbgtkimcontextsimple.c +48 -0
- data/src/rbgtkimmulticontext.c +38 -0
- data/src/rbgtkinits.c +473 -0
- data/src/rbgtkinputdialog.c +30 -0
- data/src/rbgtkinvisible.c +68 -0
- data/src/rbgtkitem.c +51 -0
- data/src/rbgtkitemfactory.c +312 -0
- data/src/rbgtklabel.c +168 -0
- data/src/rbgtklayout.c +91 -0
- data/src/rbgtklinkbutton.c +68 -0
- data/src/rbgtkliststore.c +412 -0
- data/src/rbgtkmacros.h +26 -0
- data/src/rbgtkmain.c +532 -0
- data/src/rbgtkmenu.c +272 -0
- data/src/rbgtkmenubar.c +48 -0
- data/src/rbgtkmenuitem.c +171 -0
- data/src/rbgtkmenushell.c +128 -0
- data/src/rbgtkmenutoolbutton.c +74 -0
- data/src/rbgtkmessagedialog.c +102 -0
- data/src/rbgtkmisc.c +63 -0
- data/src/rbgtknotebook.c +484 -0
- data/src/rbgtkobject.c +186 -0
- data/src/rbgtkoptionmenu.c +65 -0
- data/src/rbgtkpagesetup.c +196 -0
- data/src/rbgtkpagesetupunixdialog.c +80 -0
- data/src/rbgtkpaned.c +114 -0
- data/src/rbgtkpapersize.c +186 -0
- data/src/rbgtkplug.c +84 -0
- data/src/rbgtkprintcontext.c +124 -0
- data/src/rbgtkprinter.c +155 -0
- data/src/rbgtkprintjob.c +151 -0
- data/src/rbgtkprintoperation.c +152 -0
- data/src/rbgtkprintoperationpreview.c +54 -0
- data/src/rbgtkprintsettings.c +794 -0
- data/src/rbgtkprintunixdialog.c +98 -0
- data/src/rbgtkprogress.c +21 -0
- data/src/rbgtkprogressbar.c +72 -0
- data/src/rbgtkradioaction.c +102 -0
- data/src/rbgtkradiobutton.c +83 -0
- data/src/rbgtkradiomenuitem.c +115 -0
- data/src/rbgtkradiotoolbutton.c +99 -0
- data/src/rbgtkrange.c +98 -0
- data/src/rbgtkrc.c +228 -0
- data/src/rbgtkrcstyle.c +184 -0
- data/src/rbgtkrecentaction.c +52 -0
- data/src/rbgtkrecentchooser.c +276 -0
- data/src/rbgtkrecentchooserdialog.c +59 -0
- data/src/rbgtkrecentchoosermenu.c +55 -0
- data/src/rbgtkrecentchooserwidget.c +45 -0
- data/src/rbgtkrecentdata.c +152 -0
- data/src/rbgtkrecentfilter.c +180 -0
- data/src/rbgtkrecentfilterinfo.c +197 -0
- data/src/rbgtkrecentinfo.c +232 -0
- data/src/rbgtkrecentmanager.c +164 -0
- data/src/rbgtkruler.c +82 -0
- data/src/rbgtkscale.c +47 -0
- data/src/rbgtkscalebutton.c +115 -0
- data/src/rbgtkscrollbar.c +21 -0
- data/src/rbgtkscrolledwindow.c +160 -0
- data/src/rbgtkselection.c +171 -0
- data/src/rbgtkselectiondata.c +333 -0
- data/src/rbgtkseparator.c +21 -0
- data/src/rbgtkseparatormenuitem.c +28 -0
- data/src/rbgtkseparatortoolitem.c +40 -0
- data/src/rbgtksettings.c +225 -0
- data/src/rbgtksizegroup.c +74 -0
- data/src/rbgtksocket.c +72 -0
- data/src/rbgtkspinbutton.c +138 -0
- data/src/rbgtkstatusbar.c +90 -0
- data/src/rbgtkstatusicon.c +120 -0
- data/src/rbgtkstock.c +264 -0
- data/src/rbgtkstyle.c +722 -0
- data/src/rbgtktable.c +190 -0
- data/src/rbgtktargetlist.c +148 -0
- data/src/rbgtktearoffmenuitem.c +30 -0
- data/src/rbgtktextappearance.c +173 -0
- data/src/rbgtktextattributes.c +209 -0
- data/src/rbgtktextbuffer.c +993 -0
- data/src/rbgtktextchild.c +49 -0
- data/src/rbgtktextiter.c +553 -0
- data/src/rbgtktextmark.c +87 -0
- data/src/rbgtktexttag.c +66 -0
- data/src/rbgtktexttagtable.c +94 -0
- data/src/rbgtktextview.c +351 -0
- data/src/rbgtktoggleaction.c +76 -0
- data/src/rbgtktogglebutton.c +84 -0
- data/src/rbgtktoggletoolbutton.c +70 -0
- data/src/rbgtktoolbar.c +373 -0
- data/src/rbgtktoolbutton.c +75 -0
- data/src/rbgtktoolitem.c +184 -0
- data/src/rbgtktooltip.c +76 -0
- data/src/rbgtktooltips.c +107 -0
- data/src/rbgtktreedragdest.c +19 -0
- data/src/rbgtktreedragsource.c +19 -0
- data/src/rbgtktreeiter.c +259 -0
- data/src/rbgtktreemodel.c +256 -0
- data/src/rbgtktreemodelfilter.c +214 -0
- data/src/rbgtktreemodelsort.c +113 -0
- data/src/rbgtktreepath.c +195 -0
- data/src/rbgtktreerowreference.c +168 -0
- data/src/rbgtktreeselection.c +235 -0
- data/src/rbgtktreesortable.c +127 -0
- data/src/rbgtktreestore.c +379 -0
- data/src/rbgtktreeview.c +881 -0
- data/src/rbgtktreeviewcolumn.c +331 -0
- data/src/rbgtkuimanager.c +210 -0
- data/src/rbgtkvbbox.c +31 -0
- data/src/rbgtkvbox.c +38 -0
- data/src/rbgtkviewport.c +33 -0
- data/src/rbgtkvolumebutton.c +36 -0
- data/src/rbgtkvpaned.c +31 -0
- data/src/rbgtkvruler.c +30 -0
- data/src/rbgtkvscale.c +45 -0
- data/src/rbgtkvscrollbar.c +38 -0
- data/src/rbgtkvseparator.c +30 -0
- data/src/rbgtkwidget.c +1414 -0
- data/src/rbgtkwindow.c +822 -0
- data/src/rbgtkwindowgroup.c +48 -0
- data/test/gtk-test-utils.rb +15 -0
- data/test/run-test.rb +30 -0
- data/test/test_gc.rb +25 -0
- data/test/test_gdk.rb +18 -0
- data/test/test_gdk_color.rb +10 -0
- data/test/test_gdk_display.rb +37 -0
- data/test/test_gdk_event.rb +11 -0
- data/test/test_gdk_gc.rb +7 -0
- data/test/test_gdk_keymap.rb +8 -0
- data/test/test_gdk_pango.rb +9 -0
- data/test/test_gdk_selection_data.rb +17 -0
- data/test/test_gdk_window.rb +29 -0
- data/test/test_gdk_window_attribute.rb +9 -0
- data/test/test_gtk_about_dialog.rb +14 -0
- data/test/test_gtk_buildable.rb +66 -0
- data/test/test_gtk_builder.rb +188 -0
- data/test/test_gtk_entry.rb +18 -0
- data/test/test_gtk_icon_theme.rb +30 -0
- data/test/test_gtk_image.rb +8 -0
- data/test/test_gtk_list_store.rb +65 -0
- data/test/test_gtk_menu_item.rb +13 -0
- data/test/test_gtk_rc_style.rb +14 -0
- data/test/test_gtk_tree_path.rb +20 -0
- data/test/test_gtk_unix_print.rb +14 -0
- data/test/test_gtk_widget.rb +32 -0
- metadata +393 -0
data/src/rbgtkpaned.c
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkpaned.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:31 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
10
|
+
Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
11
|
+
Daisuke Kanda,
|
12
|
+
Hiroshi Igarashi
|
13
|
+
************************************************/
|
14
|
+
|
15
|
+
#include "global.h"
|
16
|
+
|
17
|
+
#define _SELF(self) (GTK_PANED(RVAL2GOBJ(self)))
|
18
|
+
#define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w)))
|
19
|
+
|
20
|
+
|
21
|
+
static VALUE
|
22
|
+
paned_add1(self, child)
|
23
|
+
VALUE self, child;
|
24
|
+
{
|
25
|
+
gtk_paned_add1(_SELF(self), RVAL2WIDGET(child));
|
26
|
+
return self;
|
27
|
+
}
|
28
|
+
|
29
|
+
static VALUE
|
30
|
+
paned_add2(self, child)
|
31
|
+
VALUE self, child;
|
32
|
+
{
|
33
|
+
gtk_paned_add2(_SELF(self), RVAL2WIDGET(child));
|
34
|
+
return self;
|
35
|
+
}
|
36
|
+
|
37
|
+
static VALUE
|
38
|
+
paned_pack1(self, child, resize, shrink)
|
39
|
+
VALUE self, child, resize, shrink;
|
40
|
+
{
|
41
|
+
gtk_paned_pack1(_SELF(self), RVAL2WIDGET(child),
|
42
|
+
RVAL2CBOOL(resize), RVAL2CBOOL(shrink));
|
43
|
+
return self;
|
44
|
+
}
|
45
|
+
|
46
|
+
static VALUE
|
47
|
+
paned_pack2(self, child, resize, shrink)
|
48
|
+
VALUE self, child, resize, shrink;
|
49
|
+
{
|
50
|
+
gtk_paned_pack2(_SELF(self), RVAL2WIDGET(child),
|
51
|
+
RVAL2CBOOL(resize), RVAL2CBOOL(shrink));
|
52
|
+
return self;
|
53
|
+
}
|
54
|
+
|
55
|
+
static VALUE
|
56
|
+
paned_child1(self)
|
57
|
+
VALUE self;
|
58
|
+
{
|
59
|
+
GtkWidget *child = _SELF(self)->child1;
|
60
|
+
return (child == NULL) ? Qnil : GOBJ2RVAL(child);
|
61
|
+
}
|
62
|
+
|
63
|
+
static VALUE
|
64
|
+
paned_child2(self)
|
65
|
+
VALUE self;
|
66
|
+
{
|
67
|
+
GtkWidget *child = _SELF(self)->child2;
|
68
|
+
return (child == NULL) ? Qnil : GOBJ2RVAL(child);
|
69
|
+
}
|
70
|
+
|
71
|
+
static VALUE
|
72
|
+
paned_child1_resize(self)
|
73
|
+
VALUE self;
|
74
|
+
{
|
75
|
+
return CBOOL2RVAL(_SELF(self)->child1_resize);
|
76
|
+
}
|
77
|
+
|
78
|
+
static VALUE
|
79
|
+
paned_child1_shrink(self)
|
80
|
+
VALUE self;
|
81
|
+
{
|
82
|
+
return CBOOL2RVAL(_SELF(self)->child1_shrink);
|
83
|
+
}
|
84
|
+
|
85
|
+
static VALUE
|
86
|
+
paned_child2_resize(self)
|
87
|
+
VALUE self;
|
88
|
+
{
|
89
|
+
return CBOOL2RVAL(_SELF(self)->child2_resize);
|
90
|
+
}
|
91
|
+
|
92
|
+
static VALUE
|
93
|
+
paned_child2_shrink(self)
|
94
|
+
VALUE self;
|
95
|
+
{
|
96
|
+
return CBOOL2RVAL(_SELF(self)->child2_shrink);
|
97
|
+
}
|
98
|
+
|
99
|
+
void
|
100
|
+
Init_gtk_paned()
|
101
|
+
{
|
102
|
+
VALUE gPaned = G_DEF_CLASS(GTK_TYPE_PANED, "Paned", mGtk);
|
103
|
+
|
104
|
+
rb_define_method(gPaned, "add1", paned_add1, 1);
|
105
|
+
rb_define_method(gPaned, "add2", paned_add2, 1);
|
106
|
+
rb_define_method(gPaned, "pack1", paned_pack1, 3);
|
107
|
+
rb_define_method(gPaned, "pack2", paned_pack2, 3);
|
108
|
+
rb_define_method(gPaned, "child1", paned_child1, 0);
|
109
|
+
rb_define_method(gPaned, "child2", paned_child2, 0);
|
110
|
+
rb_define_method(gPaned, "child1_resize?", paned_child1_resize, 0);
|
111
|
+
rb_define_method(gPaned, "child1_shrink?", paned_child1_shrink, 0);
|
112
|
+
rb_define_method(gPaned, "child2_resize?", paned_child2_resize, 0);
|
113
|
+
rb_define_method(gPaned, "child2_shrink?", paned_child2_shrink, 0);
|
114
|
+
}
|
@@ -0,0 +1,186 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkpapersize.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:31 $
|
8
|
+
|
9
|
+
Copyright (C) 2006 Ruby-GNOME2 Project Team
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
15
|
+
|
16
|
+
#define _SELF(s) (RVAL2BOXED(s, GTK_TYPE_PAPER_SIZE))
|
17
|
+
#define SIZE2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_PAPER_SIZE))
|
18
|
+
|
19
|
+
#define RVAL2UNIT(o) (RVAL2GENUM(o, GTK_TYPE_UNIT))
|
20
|
+
|
21
|
+
static VALUE
|
22
|
+
ps_initialize(int argc, VALUE *argv, VALUE self)
|
23
|
+
{
|
24
|
+
GtkPaperSize *size;
|
25
|
+
|
26
|
+
if (argc <= 1) {
|
27
|
+
VALUE name;
|
28
|
+
rb_scan_args(argc, argv, "01", &name);
|
29
|
+
size = gtk_paper_size_new(RVAL2CSTR2(name));
|
30
|
+
} else if (argc == 4) {
|
31
|
+
size = gtk_paper_size_new_from_ppd(RVAL2CSTR(argv[0]),
|
32
|
+
RVAL2CSTR(argv[1]),
|
33
|
+
NUM2DBL(argv[2]),
|
34
|
+
NUM2DBL(argv[3]));
|
35
|
+
} else if (argc == 5) {
|
36
|
+
size = gtk_paper_size_new_custom(RVAL2CSTR(argv[0]),
|
37
|
+
RVAL2CSTR(argv[1]),
|
38
|
+
NUM2DBL(argv[2]),
|
39
|
+
NUM2DBL(argv[3]),
|
40
|
+
RVAL2UNIT(argv[4]));
|
41
|
+
} else {
|
42
|
+
rb_raise(rb_eArgError,
|
43
|
+
"wrong number of arguments (%d for 0, 1, 4 or 5)", argc);
|
44
|
+
}
|
45
|
+
|
46
|
+
G_INITIALIZE(self, size);
|
47
|
+
return Qnil;
|
48
|
+
}
|
49
|
+
|
50
|
+
static VALUE
|
51
|
+
ps_is_equal(VALUE self, VALUE other)
|
52
|
+
{
|
53
|
+
return CBOOL2RVAL(RVAL2CBOOL(rb_equal(rb_obj_class(self), rb_obj_class(other))) &&
|
54
|
+
gtk_paper_size_is_equal(_SELF(self), _SELF(other)));
|
55
|
+
}
|
56
|
+
|
57
|
+
/* The width is always the shortest side, measure in mm */
|
58
|
+
static VALUE
|
59
|
+
ps_get_name(VALUE self)
|
60
|
+
{
|
61
|
+
return CSTR2RVAL(gtk_paper_size_get_name(_SELF(self)));
|
62
|
+
}
|
63
|
+
|
64
|
+
static VALUE
|
65
|
+
ps_get_display_name(VALUE self)
|
66
|
+
{
|
67
|
+
return CSTR2RVAL(gtk_paper_size_get_display_name(_SELF(self)));
|
68
|
+
}
|
69
|
+
|
70
|
+
static VALUE
|
71
|
+
ps_get_ppd_name(VALUE self)
|
72
|
+
{
|
73
|
+
return CSTR2RVAL(gtk_paper_size_get_ppd_name(_SELF(self)));
|
74
|
+
}
|
75
|
+
|
76
|
+
static VALUE
|
77
|
+
ps_get_width(VALUE self, VALUE unit)
|
78
|
+
{
|
79
|
+
return rb_float_new(gtk_paper_size_get_width(_SELF(self), RVAL2UNIT(unit)));
|
80
|
+
}
|
81
|
+
|
82
|
+
static VALUE
|
83
|
+
ps_get_height(VALUE self, VALUE unit)
|
84
|
+
{
|
85
|
+
return rb_float_new(gtk_paper_size_get_height(_SELF(self), RVAL2UNIT(unit)));
|
86
|
+
}
|
87
|
+
|
88
|
+
static VALUE
|
89
|
+
ps_is_custom(VALUE self)
|
90
|
+
{
|
91
|
+
return CBOOL2RVAL(gtk_paper_size_is_custom(_SELF(self)));
|
92
|
+
}
|
93
|
+
|
94
|
+
/* Only for custom sizes: */
|
95
|
+
static VALUE
|
96
|
+
ps_set_size(VALUE self, VALUE width, VALUE height, VALUE unit)
|
97
|
+
{
|
98
|
+
gtk_paper_size_set_size(_SELF(self), NUM2DBL(width), NUM2DBL(height),
|
99
|
+
RVAL2UNIT(unit));
|
100
|
+
return self;
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
static VALUE
|
105
|
+
ps_get_default_top_margin(VALUE self, VALUE unit)
|
106
|
+
{
|
107
|
+
return rb_float_new(gtk_paper_size_get_default_top_margin(_SELF(self),
|
108
|
+
RVAL2UNIT(unit)));
|
109
|
+
}
|
110
|
+
|
111
|
+
static VALUE
|
112
|
+
ps_get_default_bottom_margin(VALUE self, VALUE unit)
|
113
|
+
{
|
114
|
+
return rb_float_new(gtk_paper_size_get_default_bottom_margin(_SELF(self),
|
115
|
+
RVAL2UNIT(unit)));
|
116
|
+
}
|
117
|
+
|
118
|
+
static VALUE
|
119
|
+
ps_get_default_left_margin(VALUE self, VALUE unit)
|
120
|
+
{
|
121
|
+
return rb_float_new(gtk_paper_size_get_default_left_margin(_SELF(self),
|
122
|
+
RVAL2UNIT(unit)));
|
123
|
+
}
|
124
|
+
|
125
|
+
static VALUE
|
126
|
+
ps_get_default_right_margin(VALUE self, VALUE unit)
|
127
|
+
{
|
128
|
+
return rb_float_new(gtk_paper_size_get_default_right_margin(_SELF(self),
|
129
|
+
RVAL2UNIT(unit)));
|
130
|
+
}
|
131
|
+
|
132
|
+
static VALUE
|
133
|
+
ps_s_get_default(VALUE self)
|
134
|
+
{
|
135
|
+
return CSTR2RVAL(gtk_paper_size_get_default());
|
136
|
+
}
|
137
|
+
#endif
|
138
|
+
|
139
|
+
void
|
140
|
+
Init_gtk_paper_size()
|
141
|
+
{
|
142
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
143
|
+
VALUE gPaperSize = G_DEF_CLASS(GTK_TYPE_PAPER_SIZE, "PaperSize", mGtk);
|
144
|
+
|
145
|
+
rb_define_singleton_method(gPaperSize, "default", ps_s_get_default, 0);
|
146
|
+
|
147
|
+
rb_define_const(gPaperSize, "A3", rb_str_new2(GTK_PAPER_NAME_A3));
|
148
|
+
rb_define_const(gPaperSize, "A4", rb_str_new2(GTK_PAPER_NAME_A4));
|
149
|
+
rb_define_const(gPaperSize, "A5", rb_str_new2(GTK_PAPER_NAME_A5));
|
150
|
+
rb_define_const(gPaperSize, "B5", rb_str_new2(GTK_PAPER_NAME_B5));
|
151
|
+
rb_define_const(gPaperSize, "LETTER", rb_str_new2(GTK_PAPER_NAME_LETTER));
|
152
|
+
rb_define_const(gPaperSize, "EXECUTIVE",
|
153
|
+
rb_str_new2(GTK_PAPER_NAME_EXECUTIVE));
|
154
|
+
rb_define_const(gPaperSize, "LEGAL", rb_str_new2(GTK_PAPER_NAME_LEGAL));
|
155
|
+
|
156
|
+
rb_define_method(gPaperSize, "initialize", ps_initialize, -1);
|
157
|
+
rb_define_method(gPaperSize, "==", ps_is_equal, 1);
|
158
|
+
|
159
|
+
rb_define_method(gPaperSize, "name", ps_get_name, 0);
|
160
|
+
rb_define_method(gPaperSize, "display_name", ps_get_display_name, 0);
|
161
|
+
rb_define_method(gPaperSize, "ppd_name", ps_get_ppd_name, 0);
|
162
|
+
|
163
|
+
rb_define_method(gPaperSize, "get_width", ps_get_width, 1);
|
164
|
+
rb_define_method(gPaperSize, "get_height", ps_get_height, 1);
|
165
|
+
|
166
|
+
rb_define_method(gPaperSize, "custom?", ps_is_custom, 0);
|
167
|
+
|
168
|
+
rb_define_method(gPaperSize, "set_size", ps_set_size, 3);
|
169
|
+
|
170
|
+
rb_define_method(gPaperSize, "get_default_top_margin",
|
171
|
+
ps_get_default_top_margin, 1);
|
172
|
+
rb_define_method(gPaperSize, "get_default_bottom_margin",
|
173
|
+
ps_get_default_bottom_margin, 1);
|
174
|
+
rb_define_method(gPaperSize, "get_default_left_margin",
|
175
|
+
ps_get_default_left_margin, 1);
|
176
|
+
rb_define_method(gPaperSize, "get_default_right_margin",
|
177
|
+
ps_get_default_right_margin, 1);
|
178
|
+
|
179
|
+
G_DEF_SETTERS(gPaperSize);
|
180
|
+
|
181
|
+
/* GtkUnit */
|
182
|
+
G_DEF_CLASS(GTK_TYPE_UNIT, "Unit", gPaperSize);
|
183
|
+
G_DEF_CONSTANTS(gPaperSize, GTK_TYPE_UNIT, "GTK_");
|
184
|
+
|
185
|
+
#endif
|
186
|
+
}
|
data/src/rbgtkplug.c
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgdkplug.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2003/05/27 10:59:22 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
10
|
+
Copyright (C) 2002 Neil Conway
|
11
|
+
************************************************/
|
12
|
+
|
13
|
+
#include "global.h"
|
14
|
+
|
15
|
+
#ifdef HAVE_GTK_PLUG_GET_TYPE
|
16
|
+
|
17
|
+
static VALUE
|
18
|
+
plug_initialize(argc, argv, self)
|
19
|
+
int argc;
|
20
|
+
VALUE *argv;
|
21
|
+
VALUE self;
|
22
|
+
{
|
23
|
+
VALUE socket_id;
|
24
|
+
GdkNativeWindow id;
|
25
|
+
|
26
|
+
if (rb_scan_args(argc, argv, "01", &socket_id) == 0)
|
27
|
+
id = 0;
|
28
|
+
else {
|
29
|
+
#ifdef GDK_NATIVE_WINDOW_POINTER
|
30
|
+
id = GUINT_TO_POINTER(NUM2ULONG(socket_id));
|
31
|
+
#else
|
32
|
+
id = NUM2UINT(socket_id);
|
33
|
+
#endif
|
34
|
+
}
|
35
|
+
|
36
|
+
RBGTK_INITIALIZE(self, gtk_plug_new(id));
|
37
|
+
return Qnil;
|
38
|
+
}
|
39
|
+
|
40
|
+
/*
|
41
|
+
GtkWidget* gtk_plug_new_for_display (GdkDisplay *display,
|
42
|
+
GdkNativeWindow socket_id);
|
43
|
+
void gtk_plug_construct_for_display (GtkPlug *plug,
|
44
|
+
GdkDisplay *display,
|
45
|
+
GdkNativeWindow socket_id);
|
46
|
+
*/
|
47
|
+
|
48
|
+
static VALUE
|
49
|
+
plug_construct(self, socket_id)
|
50
|
+
VALUE self, socket_id;
|
51
|
+
{
|
52
|
+
#ifdef GDK_NATIVE_WINDOW_POINTER
|
53
|
+
gtk_plug_construct(GTK_PLUG(RVAL2GOBJ(self)), GUINT_TO_POINTER(NUM2ULONG(socket_id)));
|
54
|
+
#else
|
55
|
+
gtk_plug_construct(GTK_PLUG(RVAL2GOBJ(self)), (guint32)NUM2UINT(socket_id));
|
56
|
+
#endif
|
57
|
+
return self;
|
58
|
+
}
|
59
|
+
|
60
|
+
static VALUE
|
61
|
+
plug_get_id(self)
|
62
|
+
VALUE self;
|
63
|
+
{
|
64
|
+
GdkNativeWindow id = gtk_plug_get_id(GTK_PLUG(RVAL2GOBJ(self)));
|
65
|
+
#ifdef GDK_NATIVE_WINDOW_POINTER
|
66
|
+
return UINT2NUM(GPOINTER_TO_UINT(id));
|
67
|
+
#else
|
68
|
+
return UINT2NUM(id);
|
69
|
+
#endif
|
70
|
+
}
|
71
|
+
|
72
|
+
#endif /* HAVE_GTK_PLUG_GET_TYPE */
|
73
|
+
|
74
|
+
void
|
75
|
+
Init_gtk_plug()
|
76
|
+
{
|
77
|
+
#ifdef HAVE_GTK_PLUG_GET_TYPE
|
78
|
+
VALUE gPlug = G_DEF_CLASS(GTK_TYPE_PLUG, "Plug", mGtk);
|
79
|
+
|
80
|
+
rb_define_method(gPlug, "initialize", plug_initialize, -1);
|
81
|
+
rb_define_method(gPlug, "construct", plug_construct, 1);
|
82
|
+
rb_define_method(gPlug, "id", plug_get_id, 0);
|
83
|
+
#endif
|
84
|
+
}
|
@@ -0,0 +1,124 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkprintcontext.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2006/11/03 19:40:44 $
|
8
|
+
|
9
|
+
Copyright (C) 2006 Ruby-GNOME2 Project Team
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
15
|
+
|
16
|
+
#define _SELF(s) (GTK_PRINT_CONTEXT(RVAL2GOBJ(s)))
|
17
|
+
|
18
|
+
# ifdef HAVE_RB_CAIRO_H
|
19
|
+
#include <rb_cairo.h>
|
20
|
+
|
21
|
+
/* Rendering */
|
22
|
+
static VALUE
|
23
|
+
pc_get_cairo_context(VALUE self)
|
24
|
+
{
|
25
|
+
return CRCONTEXT2RVAL(gtk_print_context_get_cairo_context(_SELF(self)));
|
26
|
+
}
|
27
|
+
# endif
|
28
|
+
|
29
|
+
static VALUE
|
30
|
+
pc_get_page_setup(VALUE self)
|
31
|
+
{
|
32
|
+
return GOBJ2RVAL(gtk_print_context_get_page_setup(_SELF(self)));
|
33
|
+
}
|
34
|
+
|
35
|
+
static VALUE
|
36
|
+
pc_get_width(VALUE self)
|
37
|
+
{
|
38
|
+
return rb_float_new(gtk_print_context_get_width(_SELF(self)));
|
39
|
+
}
|
40
|
+
|
41
|
+
static VALUE
|
42
|
+
pc_get_height(VALUE self)
|
43
|
+
{
|
44
|
+
return rb_float_new(gtk_print_context_get_height(_SELF(self)));
|
45
|
+
}
|
46
|
+
|
47
|
+
static VALUE
|
48
|
+
pc_get_dpi_x(VALUE self)
|
49
|
+
{
|
50
|
+
return rb_float_new(gtk_print_context_get_dpi_x(_SELF(self)));
|
51
|
+
}
|
52
|
+
|
53
|
+
static VALUE
|
54
|
+
pc_get_dpi_y(VALUE self)
|
55
|
+
{
|
56
|
+
return rb_float_new(gtk_print_context_get_dpi_y(_SELF(self)));
|
57
|
+
}
|
58
|
+
|
59
|
+
/* Fonts */
|
60
|
+
static VALUE
|
61
|
+
pc_get_pango_fontmap(VALUE self)
|
62
|
+
{
|
63
|
+
return GOBJ2RVAL(gtk_print_context_get_pango_fontmap(_SELF(self)));
|
64
|
+
}
|
65
|
+
|
66
|
+
static VALUE
|
67
|
+
pc_create_pango_context(VALUE self)
|
68
|
+
{
|
69
|
+
return GOBJ2RVALU(gtk_print_context_create_pango_context(_SELF(self)));
|
70
|
+
}
|
71
|
+
|
72
|
+
static VALUE
|
73
|
+
pc_create_pango_layout(VALUE self)
|
74
|
+
{
|
75
|
+
return GOBJ2RVALU(gtk_print_context_create_pango_layout(_SELF(self)));
|
76
|
+
}
|
77
|
+
|
78
|
+
/* Needed for preview implementations */
|
79
|
+
# ifdef HAVE_RB_CAIRO_H
|
80
|
+
static VALUE
|
81
|
+
pc_set_cairo_context(VALUE self, VALUE cr, VALUE dpi_x, VALUE dpi_y)
|
82
|
+
{
|
83
|
+
gtk_print_context_set_cairo_context(_SELF(self),
|
84
|
+
RVAL2CRCONTEXT(cr),
|
85
|
+
NUM2DBL(dpi_x),
|
86
|
+
NUM2DBL(dpi_y));
|
87
|
+
return self;
|
88
|
+
}
|
89
|
+
# endif
|
90
|
+
#endif
|
91
|
+
|
92
|
+
void
|
93
|
+
Init_gtk_print_context()
|
94
|
+
{
|
95
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
96
|
+
VALUE gPrintContext = G_DEF_CLASS(GTK_TYPE_PRINT_CONTEXT,
|
97
|
+
"PrintContext", mGtk);
|
98
|
+
|
99
|
+
/* Rendering */
|
100
|
+
# ifdef HAVE_RB_CAIRO_H
|
101
|
+
rb_define_method(gPrintContext, "cairo_context", pc_get_cairo_context, 0);
|
102
|
+
# endif
|
103
|
+
rb_define_method(gPrintContext, "page_setup", pc_get_page_setup, 0);
|
104
|
+
rb_define_method(gPrintContext, "width", pc_get_width, 0);
|
105
|
+
rb_define_method(gPrintContext, "height", pc_get_height, 0);
|
106
|
+
rb_define_method(gPrintContext, "dpi_x", pc_get_dpi_x, 0);
|
107
|
+
rb_define_method(gPrintContext, "dpi_y", pc_get_dpi_y, 0);
|
108
|
+
|
109
|
+
/* Fonts */
|
110
|
+
rb_define_method(gPrintContext, "pango_fontmap", pc_get_pango_fontmap, 0);
|
111
|
+
rb_define_method(gPrintContext, "create_pango_context",
|
112
|
+
pc_create_pango_context, 0);
|
113
|
+
rb_define_method(gPrintContext, "create_pango_layout",
|
114
|
+
pc_create_pango_layout, 0);
|
115
|
+
|
116
|
+
/* Needed for preview implementations */
|
117
|
+
# ifdef HAVE_RB_CAIRO_H
|
118
|
+
rb_define_method(gPrintContext, "set_cairo_context",
|
119
|
+
pc_set_cairo_context, 3);
|
120
|
+
# endif
|
121
|
+
|
122
|
+
G_DEF_SETTERS(gPrintContext);
|
123
|
+
#endif
|
124
|
+
}
|