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/rbgtkobject.c
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkobject.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 14:27:10 $
|
8
|
+
|
9
|
+
Copyright (C) 2002-2004 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
|
+
/*
|
18
|
+
We shouldn't implement it.
|
19
|
+
void gtk_object_sink (GtkObject *object);
|
20
|
+
#define GTK_OBJECT_FLOATING (obj)
|
21
|
+
|
22
|
+
gtk_object_new is deprecated. Use g_object_new instead.
|
23
|
+
GtkObject* gtk_object_new (GtkType type,
|
24
|
+
const gchar *first_property_name,
|
25
|
+
...);
|
26
|
+
*/
|
27
|
+
|
28
|
+
static VALUE
|
29
|
+
gobj_get_type_name(self)
|
30
|
+
VALUE self;
|
31
|
+
{
|
32
|
+
return CSTR2RVAL(GTK_OBJECT_TYPE_NAME(RVAL2GOBJ(self)));
|
33
|
+
}
|
34
|
+
|
35
|
+
/*
|
36
|
+
They are all Deprecated.
|
37
|
+
void gtk_object_get (GtkObject *object,
|
38
|
+
const gchar *first_property_name,
|
39
|
+
...);
|
40
|
+
void gtk_object_set (GtkObject *object,
|
41
|
+
const gchar *first_property_name,
|
42
|
+
...);
|
43
|
+
void gtk_object_set_data (GtkObject *object,
|
44
|
+
const gchar *key,
|
45
|
+
gpointer data);
|
46
|
+
void gtk_object_set_data_full (GtkObject *object,
|
47
|
+
const gchar *key,
|
48
|
+
gpointer data,
|
49
|
+
GtkDestroyNotify destroy);
|
50
|
+
void gtk_object_remove_data (GtkObject *object,
|
51
|
+
const gchar *key);
|
52
|
+
gpointer gtk_object_get_data (GtkObject *object,
|
53
|
+
const gchar *key);
|
54
|
+
void gtk_object_remove_no_notify (GtkObject *object,
|
55
|
+
const gchar *key);
|
56
|
+
void gtk_object_set_user_data (GtkObject *object,
|
57
|
+
gpointer data);
|
58
|
+
gpointer gtk_object_get_user_data (GtkObject *object);
|
59
|
+
void gtk_object_add_arg_type (const gchar *arg_name,
|
60
|
+
GtkType arg_type,
|
61
|
+
guint arg_flags,
|
62
|
+
guint arg_id);
|
63
|
+
void gtk_object_set_data_by_id (GtkObject *object,
|
64
|
+
GQuark data_id,
|
65
|
+
gpointer data);
|
66
|
+
void gtk_object_set_data_by_id_full (GtkObject *object,
|
67
|
+
GQuark data_id,
|
68
|
+
gpointer data,
|
69
|
+
GtkDestroyNotify destroy);
|
70
|
+
gpointer gtk_object_get_data_by_id (GtkObject *object,
|
71
|
+
GQuark data_id);
|
72
|
+
void gtk_object_remove_data_by_id (GtkObject *object,
|
73
|
+
GQuark data_id);
|
74
|
+
void gtk_object_remove_no_notify_by_id
|
75
|
+
(GtkObject *object,
|
76
|
+
GQuark key_id);
|
77
|
+
#define gtk_object_data_try_key
|
78
|
+
#define gtk_object_data_force_id
|
79
|
+
*/
|
80
|
+
|
81
|
+
static VALUE
|
82
|
+
gobj_destroy(self)
|
83
|
+
VALUE self;
|
84
|
+
{
|
85
|
+
gtk_object_destroy(GTK_OBJECT(RVAL2GOBJ(self)));
|
86
|
+
return Qnil;
|
87
|
+
}
|
88
|
+
|
89
|
+
static VALUE
|
90
|
+
gobj_get_flags(self)
|
91
|
+
VALUE self;
|
92
|
+
{
|
93
|
+
/* _GtkObject.flags is int32 */
|
94
|
+
return(INT2FIX(GTK_OBJECT_FLAGS(RVAL2GOBJ(self))));
|
95
|
+
}
|
96
|
+
|
97
|
+
static VALUE
|
98
|
+
gobj_set_flags(self, flags)
|
99
|
+
VALUE self, flags;
|
100
|
+
{
|
101
|
+
GTK_OBJECT_SET_FLAGS(RVAL2GOBJ(self), NUM2INT(flags));
|
102
|
+
return self;
|
103
|
+
}
|
104
|
+
|
105
|
+
static VALUE
|
106
|
+
gobj_unset_flags(self, flags)
|
107
|
+
VALUE self, flags;
|
108
|
+
{
|
109
|
+
GTK_OBJECT_UNSET_FLAGS(RVAL2GOBJ(self), NUM2INT(flags));
|
110
|
+
return self;
|
111
|
+
}
|
112
|
+
|
113
|
+
/* Move from Bindings */
|
114
|
+
static VALUE
|
115
|
+
gobj_bindings_activate(self, keyval, modifiers)
|
116
|
+
VALUE self, keyval, modifiers;
|
117
|
+
{
|
118
|
+
return CBOOL2RVAL(gtk_bindings_activate(GTK_OBJECT(RVAL2GOBJ(self)),
|
119
|
+
NUM2UINT(keyval),
|
120
|
+
NUM2UINT(modifiers)));
|
121
|
+
}
|
122
|
+
|
123
|
+
/* Move from Bindings */
|
124
|
+
static VALUE
|
125
|
+
gobj_s_binding_set(self)
|
126
|
+
VALUE self;
|
127
|
+
{
|
128
|
+
GType gtype;
|
129
|
+
gpointer gclass;
|
130
|
+
GtkBindingSet* binding_set;
|
131
|
+
|
132
|
+
Check_Type(self, T_CLASS);
|
133
|
+
|
134
|
+
gtype = CLASS2GTYPE(self);
|
135
|
+
|
136
|
+
if (!G_TYPE_IS_CLASSED(gtype)) {
|
137
|
+
rb_raise(rb_eTypeError, "%s is not a classed GType",
|
138
|
+
rb_class2name(self));
|
139
|
+
}
|
140
|
+
gclass = g_type_class_ref(gtype);
|
141
|
+
if (!gclass) {
|
142
|
+
rb_raise(rb_eRuntimeError, "couldn't get class reference");
|
143
|
+
}
|
144
|
+
if (!GTK_IS_OBJECT_CLASS(gclass)) {
|
145
|
+
g_type_class_unref(gclass);
|
146
|
+
rb_raise(rb_eTypeError, "%s is not a Gtk Object class",
|
147
|
+
rb_class2name(self));
|
148
|
+
}
|
149
|
+
|
150
|
+
binding_set = gtk_binding_set_by_class(gclass);
|
151
|
+
if (!binding_set) {
|
152
|
+
g_type_class_unref(gclass);
|
153
|
+
rb_raise(rb_eRuntimeError, "couldn't get BindingSet from %s",
|
154
|
+
rb_class2name(self));
|
155
|
+
}
|
156
|
+
g_type_class_unref(gclass);
|
157
|
+
|
158
|
+
return BOXED2RVAL(binding_set, GTK_TYPE_BINDING_SET);
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
void
|
163
|
+
Init_gtk_object()
|
164
|
+
{
|
165
|
+
VALUE gObject = G_DEF_CLASS(GTK_TYPE_OBJECT, "Object", mGtk);
|
166
|
+
|
167
|
+
rb_define_singleton_method(gObject, "binding_set", gobj_s_binding_set, 0);
|
168
|
+
|
169
|
+
rb_define_method(gObject, "type_name", gobj_get_type_name, 0);
|
170
|
+
rb_define_method(gObject, "flags", gobj_get_flags, 0);
|
171
|
+
rb_define_method(gObject, "set_flags", gobj_set_flags, 1);
|
172
|
+
rb_define_method(gObject, "unset_flags", gobj_unset_flags, 1);
|
173
|
+
rb_define_method(gObject, "destroy", gobj_destroy, 0);
|
174
|
+
rb_define_method(gObject, "bindings_activate", gobj_bindings_activate, 2);
|
175
|
+
|
176
|
+
/* GtkObjectFlags */
|
177
|
+
G_DEF_CLASS(GTK_TYPE_OBJECT_FLAGS, "Flags", gObject);
|
178
|
+
G_DEF_CONSTANTS(gObject, GTK_TYPE_OBJECT_FLAGS, "GTK_");
|
179
|
+
|
180
|
+
/* undef deprecated properties */
|
181
|
+
rb_undef_method(gObject, "user_data");
|
182
|
+
rb_undef_method(gObject, "user_data=");
|
183
|
+
rb_undef_method(gObject, "set_user_data");
|
184
|
+
|
185
|
+
G_DEF_SETTERS(gObject);
|
186
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkoptionmenu.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2004/05/30 16:41:13 $
|
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
|
+
#ifndef GTK_DISABLE_DEPRECATED /* Since 2.4 */
|
18
|
+
|
19
|
+
static VALUE
|
20
|
+
omenu_initialize(self)
|
21
|
+
VALUE self;
|
22
|
+
{
|
23
|
+
RBGTK_INITIALIZE(self, gtk_option_menu_new());
|
24
|
+
return Qnil;
|
25
|
+
}
|
26
|
+
|
27
|
+
static VALUE
|
28
|
+
omenu_remove_menu(self)
|
29
|
+
VALUE self;
|
30
|
+
{
|
31
|
+
gtk_option_menu_remove_menu(GTK_OPTION_MENU(RVAL2GOBJ(self)));
|
32
|
+
return self;
|
33
|
+
}
|
34
|
+
|
35
|
+
static VALUE
|
36
|
+
omenu_set_history(self, index)
|
37
|
+
VALUE self, index;
|
38
|
+
{
|
39
|
+
gtk_option_menu_set_history(GTK_OPTION_MENU(RVAL2GOBJ(self)), NUM2INT(index));
|
40
|
+
return self;
|
41
|
+
}
|
42
|
+
|
43
|
+
static VALUE
|
44
|
+
omenu_get_history(self)
|
45
|
+
VALUE self;
|
46
|
+
{
|
47
|
+
return INT2NUM(gtk_option_menu_get_history(GTK_OPTION_MENU(RVAL2GOBJ(self))));
|
48
|
+
}
|
49
|
+
|
50
|
+
#endif
|
51
|
+
|
52
|
+
void
|
53
|
+
Init_gtk_option_menu()
|
54
|
+
{
|
55
|
+
#ifndef GTK_DISABLE_DEPRECATED /* Since 2.4 */
|
56
|
+
VALUE gOptionMenu = G_DEF_CLASS(GTK_TYPE_OPTION_MENU, "OptionMenu", mGtk);
|
57
|
+
|
58
|
+
rb_define_method(gOptionMenu, "initialize", omenu_initialize, 0);
|
59
|
+
rb_define_method(gOptionMenu, "remove_menu", omenu_remove_menu, 0);
|
60
|
+
rb_define_method(gOptionMenu, "set_history", omenu_set_history, 1);
|
61
|
+
rb_define_method(gOptionMenu, "history", omenu_get_history, 0);
|
62
|
+
|
63
|
+
G_DEF_SETTERS(gOptionMenu);
|
64
|
+
#endif
|
65
|
+
}
|
@@ -0,0 +1,196 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkpagesetup.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2006/11/15 23:46:13 $
|
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_PAGE_SETUP(RVAL2GOBJ(s)))
|
17
|
+
|
18
|
+
#define RVAL2SIZE(o) (RVAL2BOXED(o, GTK_TYPE_PAPER_SIZE))
|
19
|
+
#define RVAL2UNIT(o) (RVAL2GENUM(o, GTK_TYPE_UNIT))
|
20
|
+
|
21
|
+
static VALUE
|
22
|
+
ps_initialize(VALUE self)
|
23
|
+
{
|
24
|
+
G_INITIALIZE(self, gtk_page_setup_new());
|
25
|
+
return Qnil;
|
26
|
+
}
|
27
|
+
|
28
|
+
static VALUE
|
29
|
+
ps_copy(VALUE self)
|
30
|
+
{
|
31
|
+
return GOBJ2RVALU(gtk_page_setup_copy(_SELF(self)));
|
32
|
+
}
|
33
|
+
|
34
|
+
static VALUE
|
35
|
+
ps_get_orientation(VALUE self)
|
36
|
+
{
|
37
|
+
return GENUM2RVAL(gtk_page_setup_get_orientation(_SELF(self)),
|
38
|
+
GTK_TYPE_PAGE_ORIENTATION);
|
39
|
+
}
|
40
|
+
|
41
|
+
static VALUE
|
42
|
+
ps_set_orientation(VALUE self, VALUE orientation)
|
43
|
+
{
|
44
|
+
gtk_page_setup_set_orientation(_SELF(self),
|
45
|
+
RVAL2GENUM(orientation, GTK_TYPE_PAGE_ORIENTATION));
|
46
|
+
return self;
|
47
|
+
}
|
48
|
+
|
49
|
+
static VALUE
|
50
|
+
ps_get_paper_size(VALUE self)
|
51
|
+
{
|
52
|
+
return BOXED2RVAL(gtk_page_setup_get_paper_size(_SELF(self)), GTK_TYPE_PAPER_SIZE);
|
53
|
+
}
|
54
|
+
|
55
|
+
static VALUE
|
56
|
+
ps_set_paper_size(VALUE self, VALUE paper_size)
|
57
|
+
{
|
58
|
+
gtk_page_setup_set_paper_size(_SELF(self), RVAL2SIZE(paper_size));
|
59
|
+
return self;
|
60
|
+
}
|
61
|
+
|
62
|
+
static VALUE
|
63
|
+
ps_get_top_margin(VALUE self, VALUE unit)
|
64
|
+
{
|
65
|
+
return rb_float_new(gtk_page_setup_get_top_margin(_SELF(self),
|
66
|
+
RVAL2UNIT(unit)));
|
67
|
+
}
|
68
|
+
|
69
|
+
static VALUE
|
70
|
+
ps_set_top_margin(VALUE self, VALUE margin, VALUE unit)
|
71
|
+
{
|
72
|
+
gtk_page_setup_set_top_margin(_SELF(self), NUM2DBL(margin),
|
73
|
+
RVAL2UNIT(unit));
|
74
|
+
return self;
|
75
|
+
}
|
76
|
+
|
77
|
+
static VALUE
|
78
|
+
ps_get_bottom_margin(VALUE self, VALUE unit)
|
79
|
+
{
|
80
|
+
return rb_float_new(gtk_page_setup_get_bottom_margin(_SELF(self),
|
81
|
+
RVAL2UNIT(unit)));
|
82
|
+
}
|
83
|
+
|
84
|
+
static VALUE
|
85
|
+
ps_set_bottom_margin(VALUE self, VALUE margin, VALUE unit)
|
86
|
+
{
|
87
|
+
gtk_page_setup_set_bottom_margin(_SELF(self), NUM2DBL(margin),
|
88
|
+
RVAL2UNIT(unit));
|
89
|
+
return self;
|
90
|
+
}
|
91
|
+
|
92
|
+
static VALUE
|
93
|
+
ps_get_left_margin(VALUE self, VALUE unit)
|
94
|
+
{
|
95
|
+
return rb_float_new(gtk_page_setup_get_left_margin(_SELF(self),
|
96
|
+
RVAL2UNIT(unit)));
|
97
|
+
}
|
98
|
+
|
99
|
+
static VALUE
|
100
|
+
ps_set_left_margin(VALUE self, VALUE margin, VALUE unit)
|
101
|
+
{
|
102
|
+
gtk_page_setup_set_left_margin(_SELF(self), NUM2DBL(margin),
|
103
|
+
RVAL2UNIT(unit));
|
104
|
+
return self;
|
105
|
+
}
|
106
|
+
|
107
|
+
static VALUE
|
108
|
+
ps_get_right_margin(VALUE self, VALUE unit)
|
109
|
+
{
|
110
|
+
return rb_float_new(gtk_page_setup_get_right_margin(_SELF(self),
|
111
|
+
RVAL2UNIT(unit)));
|
112
|
+
}
|
113
|
+
|
114
|
+
static VALUE
|
115
|
+
ps_set_right_margin(VALUE self, VALUE margin, VALUE unit)
|
116
|
+
{
|
117
|
+
gtk_page_setup_set_right_margin(_SELF(self), NUM2DBL(margin),
|
118
|
+
RVAL2UNIT(unit));
|
119
|
+
return self;
|
120
|
+
}
|
121
|
+
|
122
|
+
static VALUE
|
123
|
+
ps_set_paper_size_and_default_margins(VALUE self, VALUE size)
|
124
|
+
{
|
125
|
+
gtk_page_setup_set_paper_size_and_default_margins(_SELF(self),
|
126
|
+
RVAL2SIZE(size));
|
127
|
+
return self;
|
128
|
+
}
|
129
|
+
|
130
|
+
/* These take orientation, but not margins into consideration */
|
131
|
+
static VALUE
|
132
|
+
ps_get_paper_width(VALUE self, VALUE unit)
|
133
|
+
{
|
134
|
+
return rb_float_new(gtk_page_setup_get_paper_width(_SELF(self),
|
135
|
+
RVAL2UNIT(unit)));
|
136
|
+
}
|
137
|
+
|
138
|
+
static VALUE
|
139
|
+
ps_get_paper_height(VALUE self, VALUE unit)
|
140
|
+
{
|
141
|
+
return rb_float_new(gtk_page_setup_get_paper_height(_SELF(self),
|
142
|
+
RVAL2UNIT(unit)));
|
143
|
+
}
|
144
|
+
|
145
|
+
/* These take orientation, and margins into consideration */
|
146
|
+
static VALUE
|
147
|
+
ps_get_page_width(VALUE self, VALUE unit)
|
148
|
+
{
|
149
|
+
return rb_float_new(gtk_page_setup_get_page_width(_SELF(self),
|
150
|
+
RVAL2UNIT(unit)));
|
151
|
+
}
|
152
|
+
|
153
|
+
static VALUE
|
154
|
+
ps_get_page_height(VALUE self, VALUE unit)
|
155
|
+
{
|
156
|
+
return rb_float_new(gtk_page_setup_get_page_height(_SELF(self),
|
157
|
+
RVAL2UNIT(unit)));
|
158
|
+
}
|
159
|
+
#endif
|
160
|
+
|
161
|
+
void
|
162
|
+
Init_gtk_page_setup()
|
163
|
+
{
|
164
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
165
|
+
VALUE gPageSetup = G_DEF_CLASS(GTK_TYPE_PAGE_SETUP, "PageSetup", mGtk);
|
166
|
+
|
167
|
+
rb_define_method(gPageSetup, "initialize", ps_initialize, 0);
|
168
|
+
rb_define_method(gPageSetup, "dup", ps_copy, 0);
|
169
|
+
|
170
|
+
rb_define_method(gPageSetup, "orientation", ps_get_orientation, 0);
|
171
|
+
rb_define_method(gPageSetup, "set_orientation", ps_set_orientation, 1);
|
172
|
+
rb_define_method(gPageSetup, "paper_size", ps_get_paper_size, 0);
|
173
|
+
rb_define_method(gPageSetup, "set_paper_size", ps_set_paper_size, 1);
|
174
|
+
rb_define_method(gPageSetup, "get_top_margin", ps_get_top_margin, 1);
|
175
|
+
rb_define_method(gPageSetup, "set_top_margin", ps_set_top_margin, 2);
|
176
|
+
rb_define_method(gPageSetup, "get_bottom_margin", ps_get_bottom_margin, 1);
|
177
|
+
rb_define_method(gPageSetup, "set_bottom_margin", ps_set_bottom_margin, 2);
|
178
|
+
rb_define_method(gPageSetup, "get_left_margin", ps_get_left_margin, 1);
|
179
|
+
rb_define_method(gPageSetup, "set_left_margin", ps_set_left_margin, 2);
|
180
|
+
rb_define_method(gPageSetup, "get_right_margin", ps_get_right_margin, 1);
|
181
|
+
rb_define_method(gPageSetup, "set_right_margin", ps_set_right_margin, 2);
|
182
|
+
|
183
|
+
rb_define_method(gPageSetup, "set_paper_size_and_default_margins",
|
184
|
+
ps_set_paper_size_and_default_margins, 1);
|
185
|
+
|
186
|
+
/* These take orientation, but not margins into consideration */
|
187
|
+
rb_define_method(gPageSetup, "get_paper_width", ps_get_paper_width, 1);
|
188
|
+
rb_define_method(gPageSetup, "get_paper_height", ps_get_paper_height, 1);
|
189
|
+
|
190
|
+
/* These take orientation, and margins into consideration */
|
191
|
+
rb_define_method(gPageSetup, "get_page_width", ps_get_page_width, 1);
|
192
|
+
rb_define_method(gPageSetup, "get_page_height", ps_get_page_height, 1);
|
193
|
+
|
194
|
+
G_DEF_SETTERS(gPageSetup);
|
195
|
+
#endif
|
196
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkpagesetupunixdialog.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2006/12/26 15:47:52 $
|
8
|
+
|
9
|
+
Copyright (C) 2006 Ruby-GNOME2 Project Team
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#ifdef HAVE_GTK_UNIX_PRINT
|
15
|
+
#include <gtk/gtkpagesetupunixdialog.h>
|
16
|
+
|
17
|
+
#define _SELF(s) (GTK_PAGE_SETUP_UNIX_DIALOG(RVAL2GOBJ(s)))
|
18
|
+
|
19
|
+
static VALUE
|
20
|
+
psud_initialize(int argc, VALUE *argv, VALUE self)
|
21
|
+
{
|
22
|
+
GtkWidget *dialog;
|
23
|
+
VALUE title, parent;
|
24
|
+
|
25
|
+
rb_scan_args(argc, argv, "02", &title, &parent);
|
26
|
+
dialog = gtk_page_setup_unix_dialog_new(RVAL2CSTR2(title), RVAL2GOBJ(parent));
|
27
|
+
|
28
|
+
RBGTK_INITIALIZE(self, dialog);
|
29
|
+
return Qnil;
|
30
|
+
}
|
31
|
+
|
32
|
+
static VALUE
|
33
|
+
psud_set_page_setup(VALUE self, VALUE page_setup)
|
34
|
+
{
|
35
|
+
gtk_page_setup_unix_dialog_set_page_setup(_SELF(self),
|
36
|
+
RVAL2GOBJ(page_setup));
|
37
|
+
return self;
|
38
|
+
}
|
39
|
+
|
40
|
+
static VALUE
|
41
|
+
psud_get_page_setup(VALUE self)
|
42
|
+
{
|
43
|
+
return GOBJ2RVAL(gtk_page_setup_unix_dialog_get_page_setup(_SELF(self)));
|
44
|
+
}
|
45
|
+
|
46
|
+
static VALUE
|
47
|
+
psud_set_print_settings(VALUE self, VALUE print_settings)
|
48
|
+
{
|
49
|
+
gtk_page_setup_unix_dialog_set_print_settings(_SELF(self),
|
50
|
+
RVAL2GOBJ(print_settings));
|
51
|
+
return Qnil;
|
52
|
+
}
|
53
|
+
|
54
|
+
static VALUE
|
55
|
+
psud_get_print_settings(VALUE self)
|
56
|
+
{
|
57
|
+
return GOBJ2RVAL(gtk_page_setup_unix_dialog_get_print_settings(_SELF(self)));
|
58
|
+
}
|
59
|
+
#endif
|
60
|
+
|
61
|
+
void
|
62
|
+
Init_gtk_page_setup_unix_dialog()
|
63
|
+
{
|
64
|
+
#if HAVE_GTK_UNIX_PRINT
|
65
|
+
VALUE gPageSetupUnixDialog = G_DEF_CLASS(GTK_TYPE_PAGE_SETUP_UNIX_DIALOG,
|
66
|
+
"PageSetupUnixDialog", mGtk);
|
67
|
+
|
68
|
+
rb_define_method(gPageSetupUnixDialog, "initialize", psud_initialize, -1);
|
69
|
+
rb_define_method(gPageSetupUnixDialog, "set_page_setup",
|
70
|
+
psud_set_page_setup, 1);
|
71
|
+
rb_define_method(gPageSetupUnixDialog, "page_setup",
|
72
|
+
psud_get_page_setup, 0);
|
73
|
+
rb_define_method(gPageSetupUnixDialog, "set_print_settings",
|
74
|
+
psud_set_print_settings, 1);
|
75
|
+
rb_define_method(gPageSetupUnixDialog, "print_settings",
|
76
|
+
psud_get_print_settings, 0);
|
77
|
+
|
78
|
+
G_DEF_SETTERS(gPageSetupUnixDialog);
|
79
|
+
#endif
|
80
|
+
}
|