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/rbgtkstock.c
ADDED
@@ -0,0 +1,264 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkstock.c -
|
5
|
+
|
6
|
+
$Author: sakai $
|
7
|
+
$Date: 2007/07/08 03:00:49 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 KUBO Takehiro
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#define Check_Symbol(sym) do { \
|
15
|
+
if (!SYMBOL_P(sym)) \
|
16
|
+
rb_raise(rb_eArgError, "invalid argument %s (expect Symbol)", \
|
17
|
+
rb_class2name(CLASS_OF(sym))); \
|
18
|
+
} while (0)
|
19
|
+
|
20
|
+
/* check whether sym is a Symbol or not in advance. */
|
21
|
+
#define SYM2CSTR(sym) rb_id2name(SYM2ID(sym))
|
22
|
+
#define CSTR2SYM(str) ID2SYM(rb_intern(str))
|
23
|
+
|
24
|
+
static VALUE
|
25
|
+
stock_m_add(argc, argv, klass)
|
26
|
+
int argc;
|
27
|
+
VALUE *argv, klass;
|
28
|
+
{
|
29
|
+
VALUE stock_id, label, modifier, keyval, translation_domain;
|
30
|
+
GtkStockItem item;
|
31
|
+
|
32
|
+
rb_scan_args(argc, argv, "23", &stock_id, &label, &modifier, &keyval, &translation_domain);
|
33
|
+
Check_Symbol(stock_id);
|
34
|
+
item.stock_id = (gchar *)SYM2CSTR(stock_id);
|
35
|
+
item.label = RVAL2CSTR(label);
|
36
|
+
item.modifier = NIL_P(modifier) ? 0 : NUM2UINT(modifier);
|
37
|
+
item.keyval = NIL_P(keyval) ? 0 : NUM2UINT(keyval);
|
38
|
+
item.translation_domain = NIL_P(translation_domain) ? NULL : RVAL2CSTR(translation_domain);
|
39
|
+
gtk_stock_add(&item, 1);
|
40
|
+
return Qnil;
|
41
|
+
}
|
42
|
+
|
43
|
+
static VALUE
|
44
|
+
stock_m_lookup(klass, stock_id)
|
45
|
+
VALUE klass, stock_id;
|
46
|
+
{
|
47
|
+
GtkStockItem item;
|
48
|
+
|
49
|
+
Check_Symbol(stock_id);
|
50
|
+
if (gtk_stock_lookup(SYM2CSTR(stock_id), &item)) {
|
51
|
+
return rb_ary_new3(5,
|
52
|
+
CSTR2SYM(item.stock_id),
|
53
|
+
CSTR2RVAL(item.label),
|
54
|
+
UINT2NUM(item.modifier),
|
55
|
+
UINT2NUM(item.keyval),
|
56
|
+
CSTR2RVAL(item.translation_domain));
|
57
|
+
}
|
58
|
+
rb_raise(rb_eArgError, "no such stock-id: %s", SYM2CSTR(stock_id));
|
59
|
+
}
|
60
|
+
|
61
|
+
static VALUE
|
62
|
+
stock_m_list_ids(klass)
|
63
|
+
VALUE klass;
|
64
|
+
{
|
65
|
+
GSList *ids = gtk_stock_list_ids();
|
66
|
+
GSList *l;
|
67
|
+
VALUE ary = rb_ary_new();
|
68
|
+
for (l = ids; l != NULL; l = g_slist_next(l)) {
|
69
|
+
rb_ary_push(ary, CSTR2SYM(l->data));
|
70
|
+
g_free(l->data);
|
71
|
+
}
|
72
|
+
g_slist_free(ids);
|
73
|
+
return ary;
|
74
|
+
}
|
75
|
+
|
76
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
77
|
+
static gchar*
|
78
|
+
translate_func(path, func)
|
79
|
+
const gchar* path;
|
80
|
+
gpointer func;
|
81
|
+
{
|
82
|
+
VALUE ret = rb_funcall((VALUE)func, id_call, 1, CSTR2RVAL(path));
|
83
|
+
return RVAL2CSTR(ret);
|
84
|
+
}
|
85
|
+
|
86
|
+
static VALUE
|
87
|
+
stock_m_set_translate_func(klass, domain)
|
88
|
+
VALUE klass;
|
89
|
+
VALUE domain;
|
90
|
+
{
|
91
|
+
VALUE func = rb_block_proc();
|
92
|
+
G_RELATIVE(klass, func);
|
93
|
+
gtk_stock_set_translate_func(RVAL2CSTR(domain),
|
94
|
+
(GtkTranslateFunc)translate_func,
|
95
|
+
(gpointer)func,
|
96
|
+
NULL);
|
97
|
+
return Qnil;
|
98
|
+
}
|
99
|
+
#endif
|
100
|
+
|
101
|
+
void
|
102
|
+
Init_gtk_stock()
|
103
|
+
{
|
104
|
+
VALUE mGtkStock = rb_define_module_under(mGtk, "Stock");
|
105
|
+
|
106
|
+
rb_undef_method(mGtkStock, "new");
|
107
|
+
rb_define_singleton_method(mGtkStock, "add", stock_m_add, -1);
|
108
|
+
rb_define_singleton_method(mGtkStock, "lookup", stock_m_lookup, 1);
|
109
|
+
rb_define_singleton_method(mGtkStock, "ids", stock_m_list_ids, 0);
|
110
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
111
|
+
rb_define_singleton_method(mGtkStock, "set_translate_func", stock_m_set_translate_func, 1);
|
112
|
+
#endif
|
113
|
+
|
114
|
+
/* Stock IDs (not all are stock items; some are images only) */
|
115
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
116
|
+
rb_define_const(mGtkStock, "ABOUT", CSTR2SYM(GTK_STOCK_ABOUT));
|
117
|
+
#endif
|
118
|
+
rb_define_const(mGtkStock, "ADD", CSTR2SYM(GTK_STOCK_ADD));
|
119
|
+
rb_define_const(mGtkStock, "APPLY", CSTR2SYM(GTK_STOCK_APPLY));
|
120
|
+
rb_define_const(mGtkStock, "BOLD", CSTR2SYM(GTK_STOCK_BOLD));
|
121
|
+
rb_define_const(mGtkStock, "CANCEL", CSTR2SYM(GTK_STOCK_CANCEL));
|
122
|
+
#if GTK_CHECK_VERSION(2,16,0)
|
123
|
+
rb_define_const(mGtkStock, "CAPS_LOCK_WARNING", CSTR2SYM(GTK_STOCK_CAPS_LOCK_WARNING));
|
124
|
+
#endif
|
125
|
+
rb_define_const(mGtkStock, "CDROM", CSTR2SYM(GTK_STOCK_CDROM));
|
126
|
+
rb_define_const(mGtkStock, "CLEAR", CSTR2SYM(GTK_STOCK_CLEAR));
|
127
|
+
rb_define_const(mGtkStock, "CLOSE", CSTR2SYM(GTK_STOCK_CLOSE));
|
128
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
129
|
+
rb_define_const(mGtkStock, "COLOR_PICKER", CSTR2SYM(GTK_STOCK_COLOR_PICKER));
|
130
|
+
#endif
|
131
|
+
rb_define_const(mGtkStock, "CONVERT", CSTR2SYM(GTK_STOCK_CONVERT));
|
132
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
133
|
+
rb_define_const(mGtkStock, "CONNECT", CSTR2SYM(GTK_STOCK_CONNECT));
|
134
|
+
#endif
|
135
|
+
rb_define_const(mGtkStock, "COPY", CSTR2SYM(GTK_STOCK_COPY));
|
136
|
+
rb_define_const(mGtkStock, "CUT", CSTR2SYM(GTK_STOCK_CUT));
|
137
|
+
rb_define_const(mGtkStock, "DELETE", CSTR2SYM(GTK_STOCK_DELETE));
|
138
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
139
|
+
rb_define_const(mGtkStock, "DIALOG_AUTHENTICATION", CSTR2SYM(GTK_STOCK_DIALOG_AUTHENTICATION));
|
140
|
+
#endif
|
141
|
+
rb_define_const(mGtkStock, "DIALOG_ERROR", CSTR2SYM(GTK_STOCK_DIALOG_ERROR));
|
142
|
+
rb_define_const(mGtkStock, "DIALOG_INFO", CSTR2SYM(GTK_STOCK_DIALOG_INFO));
|
143
|
+
rb_define_const(mGtkStock, "DIALOG_QUESTION", CSTR2SYM(GTK_STOCK_DIALOG_QUESTION));
|
144
|
+
rb_define_const(mGtkStock, "DIALOG_WARNING", CSTR2SYM(GTK_STOCK_DIALOG_WARNING));
|
145
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
146
|
+
rb_define_const(mGtkStock, "DIRECTORY", CSTR2SYM(GTK_STOCK_DIRECTORY));
|
147
|
+
#endif
|
148
|
+
#if GTK_CHECK_VERSION(2,12,0)
|
149
|
+
rb_define_const(mGtkStock, "DISCARD", CSTR2SYM(GTK_STOCK_DISCARD));
|
150
|
+
#endif
|
151
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
152
|
+
rb_define_const(mGtkStock, "DISCONNECT", CSTR2SYM(GTK_STOCK_DISCONNECT));
|
153
|
+
#endif
|
154
|
+
rb_define_const(mGtkStock, "DND", CSTR2SYM(GTK_STOCK_DND));
|
155
|
+
rb_define_const(mGtkStock, "DND_MULTIPLE", CSTR2SYM(GTK_STOCK_DND_MULTIPLE));
|
156
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
157
|
+
rb_define_const(mGtkStock, "EDIT", CSTR2SYM(GTK_STOCK_EDIT));
|
158
|
+
rb_define_const(mGtkStock, "FILE", CSTR2SYM(GTK_STOCK_FILE));
|
159
|
+
#endif
|
160
|
+
rb_define_const(mGtkStock, "EXECUTE", CSTR2SYM(GTK_STOCK_EXECUTE));
|
161
|
+
rb_define_const(mGtkStock, "FIND", CSTR2SYM(GTK_STOCK_FIND));
|
162
|
+
rb_define_const(mGtkStock, "FIND_AND_REPLACE", CSTR2SYM(GTK_STOCK_FIND_AND_REPLACE));
|
163
|
+
rb_define_const(mGtkStock, "FLOPPY", CSTR2SYM(GTK_STOCK_FLOPPY));
|
164
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
165
|
+
rb_define_const(mGtkStock, "FULLSCREEN", CSTR2SYM(GTK_STOCK_FULLSCREEN));
|
166
|
+
#endif
|
167
|
+
rb_define_const(mGtkStock, "GOTO_BOTTOM", CSTR2SYM(GTK_STOCK_GOTO_BOTTOM));
|
168
|
+
rb_define_const(mGtkStock, "GOTO_FIRST", CSTR2SYM(GTK_STOCK_GOTO_FIRST));
|
169
|
+
rb_define_const(mGtkStock, "GOTO_LAST", CSTR2SYM(GTK_STOCK_GOTO_LAST));
|
170
|
+
rb_define_const(mGtkStock, "GOTO_TOP", CSTR2SYM(GTK_STOCK_GOTO_TOP));
|
171
|
+
rb_define_const(mGtkStock, "GO_BACK", CSTR2SYM(GTK_STOCK_GO_BACK));
|
172
|
+
rb_define_const(mGtkStock, "GO_DOWN", CSTR2SYM(GTK_STOCK_GO_DOWN));
|
173
|
+
rb_define_const(mGtkStock, "GO_FORWARD", CSTR2SYM(GTK_STOCK_GO_FORWARD));
|
174
|
+
rb_define_const(mGtkStock, "GO_UP", CSTR2SYM(GTK_STOCK_GO_UP));
|
175
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
176
|
+
rb_define_const(mGtkStock, "HARDDISK", CSTR2SYM(GTK_STOCK_HARDDISK));
|
177
|
+
#endif
|
178
|
+
rb_define_const(mGtkStock, "HELP", CSTR2SYM(GTK_STOCK_HELP));
|
179
|
+
rb_define_const(mGtkStock, "HOME", CSTR2SYM(GTK_STOCK_HOME));
|
180
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
181
|
+
rb_define_const(mGtkStock, "INDENT", CSTR2SYM(GTK_STOCK_INDENT));
|
182
|
+
#endif
|
183
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
184
|
+
rb_define_const(mGtkStock, "INFO", CSTR2SYM(GTK_STOCK_INFO));
|
185
|
+
#endif
|
186
|
+
rb_define_const(mGtkStock, "INDEX", CSTR2SYM(GTK_STOCK_INDEX));
|
187
|
+
rb_define_const(mGtkStock, "ITALIC", CSTR2SYM(GTK_STOCK_ITALIC));
|
188
|
+
rb_define_const(mGtkStock, "JUMP_TO", CSTR2SYM(GTK_STOCK_JUMP_TO));
|
189
|
+
rb_define_const(mGtkStock, "JUSTIFY_CENTER", CSTR2SYM(GTK_STOCK_JUSTIFY_CENTER));
|
190
|
+
rb_define_const(mGtkStock, "JUSTIFY_FILL", CSTR2SYM(GTK_STOCK_JUSTIFY_FILL));
|
191
|
+
rb_define_const(mGtkStock, "JUSTIFY_LEFT", CSTR2SYM(GTK_STOCK_JUSTIFY_LEFT));
|
192
|
+
rb_define_const(mGtkStock, "JUSTIFY_RIGHT", CSTR2SYM(GTK_STOCK_JUSTIFY_RIGHT));
|
193
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
194
|
+
rb_define_const(mGtkStock, "LEAVE_FULLSCREEN", CSTR2SYM(GTK_STOCK_LEAVE_FULLSCREEN));
|
195
|
+
#endif
|
196
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
197
|
+
rb_define_const(mGtkStock, "MEDIA_FORWARD", CSTR2SYM(GTK_STOCK_MEDIA_FORWARD));
|
198
|
+
rb_define_const(mGtkStock, "MEDIA_NEXT", CSTR2SYM(GTK_STOCK_MEDIA_NEXT));
|
199
|
+
rb_define_const(mGtkStock, "MEDIA_PAUSE", CSTR2SYM(GTK_STOCK_MEDIA_PAUSE));
|
200
|
+
rb_define_const(mGtkStock, "MEDIA_PLAY", CSTR2SYM(GTK_STOCK_MEDIA_PLAY));
|
201
|
+
rb_define_const(mGtkStock, "MEDIA_PREVIOUS", CSTR2SYM(GTK_STOCK_MEDIA_PREVIOUS));
|
202
|
+
rb_define_const(mGtkStock, "MEDIA_RECORD", CSTR2SYM(GTK_STOCK_MEDIA_RECORD));
|
203
|
+
rb_define_const(mGtkStock, "MEDIA_REWIND", CSTR2SYM(GTK_STOCK_MEDIA_REWIND));
|
204
|
+
rb_define_const(mGtkStock, "MEDIA_STOP", CSTR2SYM(GTK_STOCK_MEDIA_STOP));
|
205
|
+
#endif
|
206
|
+
rb_define_const(mGtkStock, "MISSING_IMAGE", CSTR2SYM(GTK_STOCK_MISSING_IMAGE));
|
207
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
208
|
+
rb_define_const(mGtkStock, "NETWORK", CSTR2SYM(GTK_STOCK_NETWORK));
|
209
|
+
#endif
|
210
|
+
rb_define_const(mGtkStock, "NEW", CSTR2SYM(GTK_STOCK_NEW));
|
211
|
+
rb_define_const(mGtkStock, "NO", CSTR2SYM(GTK_STOCK_NO));
|
212
|
+
rb_define_const(mGtkStock, "OK", CSTR2SYM(GTK_STOCK_OK));
|
213
|
+
rb_define_const(mGtkStock, "OPEN", CSTR2SYM(GTK_STOCK_OPEN));
|
214
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
215
|
+
rb_define_const(mGtkStock, "ORIENTATION_LANDSCAPE", CSTR2SYM(GTK_STOCK_ORIENTATION_LANDSCAPE));
|
216
|
+
rb_define_const(mGtkStock, "ORIENTATION_PORTRAIT", CSTR2SYM(GTK_STOCK_ORIENTATION_PORTRAIT));
|
217
|
+
rb_define_const(mGtkStock, "ORIENTATION_REVERSE_LANDSCAPE", CSTR2SYM(GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE));
|
218
|
+
rb_define_const(mGtkStock, "ORIENTATION_REVERSE_PORTRAIT", CSTR2SYM(GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT));
|
219
|
+
#endif
|
220
|
+
#if GTK_CHECK_VERSION(2,14,0)
|
221
|
+
rb_define_const(mGtkStock, "PAGE_SETUP", CSTR2SYM(GTK_STOCK_PAGE_SETUP));
|
222
|
+
#endif
|
223
|
+
rb_define_const(mGtkStock, "PASTE", CSTR2SYM(GTK_STOCK_PASTE));
|
224
|
+
rb_define_const(mGtkStock, "PREFERENCES", CSTR2SYM(GTK_STOCK_PREFERENCES));
|
225
|
+
rb_define_const(mGtkStock, "PRINT", CSTR2SYM(GTK_STOCK_PRINT));
|
226
|
+
#if GTK_CHECK_VERSION(2,14,0)
|
227
|
+
rb_define_const(mGtkStock, "PRINT_ERROR", CSTR2SYM(GTK_STOCK_PRINT_ERROR));
|
228
|
+
rb_define_const(mGtkStock, "PRINT_PAUSED", CSTR2SYM(GTK_STOCK_PRINT_PAUSED));
|
229
|
+
#endif
|
230
|
+
rb_define_const(mGtkStock, "PRINT_PREVIEW", CSTR2SYM(GTK_STOCK_PRINT_PREVIEW));
|
231
|
+
#if GTK_CHECK_VERSION(2,14,0)
|
232
|
+
rb_define_const(mGtkStock, "PRINT_REPORT", CSTR2SYM(GTK_STOCK_PRINT_REPORT));
|
233
|
+
rb_define_const(mGtkStock, "PRINT_WARNING", CSTR2SYM(GTK_STOCK_PRINT_WARNING));
|
234
|
+
#endif
|
235
|
+
rb_define_const(mGtkStock, "PROPERTIES", CSTR2SYM(GTK_STOCK_PROPERTIES));
|
236
|
+
rb_define_const(mGtkStock, "QUIT", CSTR2SYM(GTK_STOCK_QUIT));
|
237
|
+
rb_define_const(mGtkStock, "REDO", CSTR2SYM(GTK_STOCK_REDO));
|
238
|
+
rb_define_const(mGtkStock, "REFRESH", CSTR2SYM(GTK_STOCK_REFRESH));
|
239
|
+
rb_define_const(mGtkStock, "REMOVE", CSTR2SYM(GTK_STOCK_REMOVE));
|
240
|
+
rb_define_const(mGtkStock, "REVERT_TO_SAVED", CSTR2SYM(GTK_STOCK_REVERT_TO_SAVED));
|
241
|
+
rb_define_const(mGtkStock, "SAVE", CSTR2SYM(GTK_STOCK_SAVE));
|
242
|
+
rb_define_const(mGtkStock, "SAVE_AS", CSTR2SYM(GTK_STOCK_SAVE_AS));
|
243
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
244
|
+
rb_define_const(mGtkStock, "SELECT_ALL", CSTR2SYM(GTK_STOCK_SELECT_ALL));
|
245
|
+
#endif
|
246
|
+
rb_define_const(mGtkStock, "SELECT_COLOR", CSTR2SYM(GTK_STOCK_SELECT_COLOR));
|
247
|
+
rb_define_const(mGtkStock, "SELECT_FONT", CSTR2SYM(GTK_STOCK_SELECT_FONT));
|
248
|
+
rb_define_const(mGtkStock, "SORT_ASCENDING", CSTR2SYM(GTK_STOCK_SORT_ASCENDING));
|
249
|
+
rb_define_const(mGtkStock, "SORT_DESCENDING", CSTR2SYM(GTK_STOCK_SORT_DESCENDING));
|
250
|
+
rb_define_const(mGtkStock, "SPELL_CHECK", CSTR2SYM(GTK_STOCK_SPELL_CHECK));
|
251
|
+
rb_define_const(mGtkStock, "STOP", CSTR2SYM(GTK_STOCK_STOP));
|
252
|
+
rb_define_const(mGtkStock, "STRIKETHROUGH", CSTR2SYM(GTK_STOCK_STRIKETHROUGH));
|
253
|
+
rb_define_const(mGtkStock, "UNDELETE", CSTR2SYM(GTK_STOCK_UNDELETE));
|
254
|
+
rb_define_const(mGtkStock, "UNDERLINE", CSTR2SYM(GTK_STOCK_UNDERLINE));
|
255
|
+
rb_define_const(mGtkStock, "UNDO", CSTR2SYM(GTK_STOCK_UNDO));
|
256
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
257
|
+
rb_define_const(mGtkStock, "UNINDENT", CSTR2SYM(GTK_STOCK_UNINDENT));
|
258
|
+
#endif
|
259
|
+
rb_define_const(mGtkStock, "YES", CSTR2SYM(GTK_STOCK_YES));
|
260
|
+
rb_define_const(mGtkStock, "ZOOM_100", CSTR2SYM(GTK_STOCK_ZOOM_100));
|
261
|
+
rb_define_const(mGtkStock, "ZOOM_FIT", CSTR2SYM(GTK_STOCK_ZOOM_FIT));
|
262
|
+
rb_define_const(mGtkStock, "ZOOM_IN", CSTR2SYM(GTK_STOCK_ZOOM_IN));
|
263
|
+
rb_define_const(mGtkStock, "ZOOM_OUT", CSTR2SYM(GTK_STOCK_ZOOM_OUT));
|
264
|
+
}
|
data/src/rbgtkstyle.c
ADDED
@@ -0,0 +1,722 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkstyle.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:32 $
|
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(w) GTK_STYLE(RVAL2GOBJ(w))
|
18
|
+
#define RVAL2REC(r) (NIL_P(r) ? NULL : (GdkRectangle*)RVAL2BOXED(r, GDK_TYPE_RECTANGLE))
|
19
|
+
#define RVAL2ICONSOURCE(s) ((GtkIconSource*)RVAL2BOXED(s, GTK_TYPE_ICON_SOURCE))
|
20
|
+
#define RVAL2STATE(s) (RVAL2GENUM(s, GTK_TYPE_STATE_TYPE))
|
21
|
+
#define RVAL2SHADOW(s) (RVAL2GENUM(s, GTK_TYPE_SHADOW_TYPE))
|
22
|
+
#define RVAL2ARROW(s) (RVAL2GENUM(s, GTK_TYPE_ARROW_TYPE))
|
23
|
+
#define RVAL2GAP(s) (RVAL2GENUM(s, GTK_TYPE_POSITION_TYPE))
|
24
|
+
#define RVAL2ORI(s) (RVAL2GENUM(s, GTK_TYPE_ORIENTATION))
|
25
|
+
|
26
|
+
static VALUE
|
27
|
+
style_initialize(self)
|
28
|
+
VALUE self;
|
29
|
+
{
|
30
|
+
G_INITIALIZE(self, gtk_style_new());
|
31
|
+
return Qnil;
|
32
|
+
}
|
33
|
+
|
34
|
+
static VALUE
|
35
|
+
style_attached(self)
|
36
|
+
VALUE self;
|
37
|
+
{
|
38
|
+
return CBOOL2RVAL(GTK_STYLE_ATTACHED(_SELF(self)));
|
39
|
+
}
|
40
|
+
|
41
|
+
static VALUE
|
42
|
+
style_copy(self)
|
43
|
+
VALUE self;
|
44
|
+
{
|
45
|
+
return GOBJ2RVAL(gtk_style_copy(_SELF(self)));
|
46
|
+
}
|
47
|
+
|
48
|
+
static VALUE
|
49
|
+
style_attach(self, win)
|
50
|
+
VALUE self, win;
|
51
|
+
{
|
52
|
+
return GOBJ2RVAL(gtk_style_attach(_SELF(self),
|
53
|
+
GDK_WINDOW(RVAL2GOBJ(win))));
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
style_detach(self)
|
58
|
+
VALUE self;
|
59
|
+
{
|
60
|
+
gtk_style_detach(_SELF(self));
|
61
|
+
return self;
|
62
|
+
}
|
63
|
+
|
64
|
+
static VALUE
|
65
|
+
style_set_background(self, win, state_type)
|
66
|
+
VALUE self, win, state_type;
|
67
|
+
{
|
68
|
+
gtk_style_set_background(_SELF(self), GDK_WINDOW(RVAL2GOBJ(win)),
|
69
|
+
RVAL2STATE(state_type));
|
70
|
+
return self;
|
71
|
+
}
|
72
|
+
|
73
|
+
static VALUE
|
74
|
+
style_apply_default_background(self, gdkwindow, set_bg, state_type, area,
|
75
|
+
x, y, width, height)
|
76
|
+
VALUE self, gdkwindow, set_bg, state_type, area, x, y, width, height;
|
77
|
+
{
|
78
|
+
gtk_style_apply_default_background(_SELF(self),
|
79
|
+
GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
80
|
+
RVAL2CBOOL(set_bg), RVAL2STATE(state_type),
|
81
|
+
RVAL2REC(area),
|
82
|
+
NUM2INT(x), NUM2INT(y),
|
83
|
+
NUM2INT(width), NUM2INT(height));
|
84
|
+
return self;
|
85
|
+
}
|
86
|
+
|
87
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
88
|
+
static VALUE
|
89
|
+
style_lookup_color(self, color_name)
|
90
|
+
VALUE self, color_name;
|
91
|
+
{
|
92
|
+
GdkColor color;
|
93
|
+
if (gtk_style_lookup_color(_SELF(self), RVAL2CSTR(color_name), &color)){
|
94
|
+
return GDKCOLOR2RVAL(&color);
|
95
|
+
} else {
|
96
|
+
return Qnil;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
#endif
|
100
|
+
|
101
|
+
static VALUE
|
102
|
+
style_lookup_icon_set(self, stock_id)
|
103
|
+
VALUE self, stock_id;
|
104
|
+
{
|
105
|
+
const gchar *id;
|
106
|
+
GtkIconSet *ret;
|
107
|
+
if (TYPE(stock_id) == T_STRING) {
|
108
|
+
id = RVAL2CSTR(stock_id);
|
109
|
+
} else {
|
110
|
+
id = rb_id2name(SYM2ID(stock_id));
|
111
|
+
}
|
112
|
+
|
113
|
+
ret = gtk_style_lookup_icon_set(_SELF(self), id);
|
114
|
+
return BOXED2RVAL(ret, GTK_TYPE_ICON_SET);
|
115
|
+
}
|
116
|
+
|
117
|
+
static VALUE
|
118
|
+
style_render_icon(self, source, direction, state, size, widget, detail)
|
119
|
+
VALUE self, source, direction, state, size, widget, detail;
|
120
|
+
{
|
121
|
+
return GOBJ2RVAL(gtk_style_render_icon(_SELF(self), RVAL2ICONSOURCE(source),
|
122
|
+
RVAL2GENUM(direction, GTK_TYPE_TEXT_DIRECTION),
|
123
|
+
RVAL2STATE(state),
|
124
|
+
RVAL2GENUM(size, GTK_TYPE_ICON_SIZE),
|
125
|
+
GTK_WIDGET(RVAL2GOBJ(widget)),
|
126
|
+
RVAL2CSTR(detail)));
|
127
|
+
}
|
128
|
+
|
129
|
+
static VALUE
|
130
|
+
style_paint_arrow(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
131
|
+
arrow_type, fill, x, y, width, height)
|
132
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
133
|
+
arrow_type, fill, x, y, width, height;
|
134
|
+
{
|
135
|
+
gtk_paint_arrow(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
136
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
137
|
+
GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail),
|
138
|
+
RVAL2ARROW(arrow_type), RVAL2CBOOL(fill), NUM2INT(x), NUM2INT(y),
|
139
|
+
NUM2INT(width), NUM2INT(height));
|
140
|
+
return self;
|
141
|
+
}
|
142
|
+
|
143
|
+
static VALUE
|
144
|
+
style_paint_box(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
145
|
+
x, y, width, height)
|
146
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
147
|
+
x, y, width, height;
|
148
|
+
{
|
149
|
+
gtk_paint_box(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
150
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
151
|
+
GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail),
|
152
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height));
|
153
|
+
return self;
|
154
|
+
}
|
155
|
+
|
156
|
+
static VALUE
|
157
|
+
style_paint_box_gap(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
158
|
+
x, y, width, height, gap_side, gap_x, gap_width)
|
159
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
160
|
+
x, y, width, height, gap_side, gap_x, gap_width;
|
161
|
+
{
|
162
|
+
gtk_paint_box_gap(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
163
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
164
|
+
GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail),
|
165
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height),
|
166
|
+
RVAL2GAP(gap_side), NUM2INT(gap_x), NUM2INT(gap_width));
|
167
|
+
return self;
|
168
|
+
}
|
169
|
+
|
170
|
+
static VALUE
|
171
|
+
style_paint_check(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
172
|
+
x, y, width, height)
|
173
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
174
|
+
x, y, width, height;
|
175
|
+
{
|
176
|
+
gtk_paint_check(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
177
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
178
|
+
GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail),
|
179
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height));
|
180
|
+
return self;
|
181
|
+
}
|
182
|
+
|
183
|
+
static VALUE
|
184
|
+
style_paint_diamond(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
185
|
+
x, y, width, height)
|
186
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
187
|
+
x, y, width, height;
|
188
|
+
{
|
189
|
+
gtk_paint_diamond(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
190
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
191
|
+
GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail),
|
192
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height));
|
193
|
+
return self;
|
194
|
+
}
|
195
|
+
|
196
|
+
static VALUE
|
197
|
+
style_paint_extension(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
198
|
+
x, y, width, height, gap_side)
|
199
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
200
|
+
x, y, width, height, gap_side;
|
201
|
+
{
|
202
|
+
gtk_paint_extension(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
203
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
204
|
+
GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail),
|
205
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height),
|
206
|
+
RVAL2GAP(gap_side));
|
207
|
+
return self;
|
208
|
+
}
|
209
|
+
|
210
|
+
static VALUE
|
211
|
+
style_paint_flat_box(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
212
|
+
x, y, width, height)
|
213
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
214
|
+
x, y, width, height;
|
215
|
+
{
|
216
|
+
gtk_paint_flat_box(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
217
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
218
|
+
GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail),
|
219
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height));
|
220
|
+
return self;
|
221
|
+
}
|
222
|
+
|
223
|
+
static VALUE
|
224
|
+
style_paint_focus(self, gdkwindow, state_type, area, widget, detail,
|
225
|
+
x, y, width, height)
|
226
|
+
VALUE self, gdkwindow, state_type, area, widget, detail,
|
227
|
+
x, y, width, height;
|
228
|
+
{
|
229
|
+
gtk_paint_focus(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
230
|
+
RVAL2STATE(state_type), RVAL2REC(area),
|
231
|
+
GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail),
|
232
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height));
|
233
|
+
return self;
|
234
|
+
}
|
235
|
+
|
236
|
+
static VALUE
|
237
|
+
style_paint_handle(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
238
|
+
x, y, width, height, orientation)
|
239
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
240
|
+
x, y, width, height, orientation;
|
241
|
+
{
|
242
|
+
gtk_paint_handle(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
243
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
244
|
+
GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail),
|
245
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height),
|
246
|
+
RVAL2ORI(orientation));
|
247
|
+
return self;
|
248
|
+
}
|
249
|
+
|
250
|
+
static VALUE
|
251
|
+
style_paint_hline(self, gdkwindow, state_type, area, widget, detail, x1, x2, y)
|
252
|
+
VALUE self, gdkwindow, state_type, area, widget, detail, x1, x2, y;
|
253
|
+
{
|
254
|
+
gtk_paint_hline(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
255
|
+
RVAL2STATE(state_type), RVAL2REC(area),
|
256
|
+
GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail),
|
257
|
+
NUM2INT(x1), NUM2INT(x2), NUM2INT(y));
|
258
|
+
return self;
|
259
|
+
}
|
260
|
+
|
261
|
+
static VALUE
|
262
|
+
style_paint_option(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
263
|
+
x, y, width, height)
|
264
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
265
|
+
x, y, width, height;
|
266
|
+
{
|
267
|
+
gtk_paint_option(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
268
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
269
|
+
GTK_WIDGET(RVAL2GOBJ(widget)),
|
270
|
+
NIL_P(detail) ? NULL : RVAL2CSTR(detail),
|
271
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height));
|
272
|
+
return self;
|
273
|
+
}
|
274
|
+
|
275
|
+
static VALUE
|
276
|
+
style_paint_polygon(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
277
|
+
points, fill)
|
278
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
279
|
+
points, fill;
|
280
|
+
{
|
281
|
+
int i;
|
282
|
+
GdkPoint* gpoints = g_new (GdkPoint, RARRAY_LEN(points));
|
283
|
+
|
284
|
+
for (i = 0; i < RARRAY_LEN(points); i++){
|
285
|
+
gpoints[i].x = RARRAY_PTR(RARRAY_PTR(points)[i])[0];
|
286
|
+
gpoints[i].y = RARRAY_PTR(RARRAY_PTR(points)[i])[1];
|
287
|
+
}
|
288
|
+
gtk_paint_polygon(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
289
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
290
|
+
GTK_WIDGET(RVAL2GOBJ(widget)),
|
291
|
+
NIL_P(detail) ? NULL : RVAL2CSTR(detail), gpoints,
|
292
|
+
RARRAY_LEN(points), RVAL2CBOOL(fill));
|
293
|
+
return self;
|
294
|
+
}
|
295
|
+
|
296
|
+
static VALUE
|
297
|
+
style_paint_shadow(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
298
|
+
x, y, width, height)
|
299
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
300
|
+
x, y, width, height;
|
301
|
+
{
|
302
|
+
gtk_paint_shadow(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
303
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
304
|
+
GTK_WIDGET(RVAL2GOBJ(widget)),
|
305
|
+
NIL_P(detail) ? NULL : RVAL2CSTR(detail),
|
306
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height));
|
307
|
+
return self;
|
308
|
+
}
|
309
|
+
|
310
|
+
static VALUE
|
311
|
+
style_paint_shadow_gap(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
312
|
+
x, y, width, height, gap_side, gap_x, gap_width)
|
313
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
314
|
+
x, y, width, height, gap_side, gap_x, gap_width;
|
315
|
+
{
|
316
|
+
gtk_paint_shadow_gap(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
317
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
318
|
+
GTK_WIDGET(RVAL2GOBJ(widget)),
|
319
|
+
NIL_P(detail) ? NULL : RVAL2CSTR(detail),
|
320
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height),
|
321
|
+
RVAL2GAP(gap_side), NUM2INT(gap_x), NUM2INT(gap_width));
|
322
|
+
return self;
|
323
|
+
}
|
324
|
+
|
325
|
+
static VALUE
|
326
|
+
style_paint_slider(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
327
|
+
x, y, width, height, orientation)
|
328
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
329
|
+
x, y, width, height, orientation;
|
330
|
+
{
|
331
|
+
gtk_paint_slider(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
332
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
333
|
+
GTK_WIDGET(RVAL2GOBJ(widget)),
|
334
|
+
NIL_P(detail) ? NULL : RVAL2CSTR(detail),
|
335
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height),
|
336
|
+
RVAL2ORI(orientation));
|
337
|
+
return self;
|
338
|
+
}
|
339
|
+
|
340
|
+
static VALUE
|
341
|
+
style_paint_tab(self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
342
|
+
x, y, width, height)
|
343
|
+
VALUE self, gdkwindow, state_type, shadow_type, area, widget, detail,
|
344
|
+
x, y, width, height;
|
345
|
+
{
|
346
|
+
gtk_paint_tab(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
347
|
+
RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area),
|
348
|
+
GTK_WIDGET(RVAL2GOBJ(widget)),
|
349
|
+
NIL_P(detail) ? NULL : RVAL2CSTR(detail),
|
350
|
+
NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height));
|
351
|
+
return self;
|
352
|
+
}
|
353
|
+
|
354
|
+
static VALUE
|
355
|
+
style_paint_vline(self, gdkwindow, state_type, area, widget, detail, y1, y2, x)
|
356
|
+
VALUE self, gdkwindow, state_type, area, widget, detail, y1, y2, x;
|
357
|
+
{
|
358
|
+
gtk_paint_vline(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
359
|
+
RVAL2STATE(state_type), RVAL2REC(area),
|
360
|
+
GTK_WIDGET(RVAL2GOBJ(widget)),
|
361
|
+
NIL_P(detail) ? NULL : RVAL2CSTR(detail),
|
362
|
+
NUM2INT(y1), NUM2INT(y2), NUM2INT(x));
|
363
|
+
return self;
|
364
|
+
}
|
365
|
+
|
366
|
+
static VALUE
|
367
|
+
style_paint_expander(self, gdkwindow, state_type, area, widget, detail,
|
368
|
+
x, y, expander_style)
|
369
|
+
VALUE self, gdkwindow, state_type, area, widget, detail,
|
370
|
+
x, y, expander_style;
|
371
|
+
{
|
372
|
+
gtk_paint_expander(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
373
|
+
RVAL2STATE(state_type), RVAL2REC(area),
|
374
|
+
GTK_WIDGET(RVAL2GOBJ(widget)),
|
375
|
+
NIL_P(detail) ? NULL : RVAL2CSTR(detail),
|
376
|
+
NUM2INT(x), NUM2INT(y), RVAL2GENUM(expander_style, GTK_TYPE_EXPANDER_STYLE));
|
377
|
+
return self;
|
378
|
+
}
|
379
|
+
|
380
|
+
static VALUE
|
381
|
+
style_paint_layout(self, gdkwindow, state_type, use_text, area,
|
382
|
+
widget, detail, x, y, layout)
|
383
|
+
VALUE self, gdkwindow, state_type, use_text, area, widget, detail,
|
384
|
+
x, y, layout;
|
385
|
+
{
|
386
|
+
gtk_paint_layout(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
387
|
+
RVAL2STATE(state_type), RVAL2CBOOL(use_text), RVAL2REC(area),
|
388
|
+
GTK_WIDGET(RVAL2GOBJ(widget)),
|
389
|
+
NIL_P(detail) ? NULL : RVAL2CSTR(detail),
|
390
|
+
NUM2INT(x), NUM2INT(y), PANGO_LAYOUT(RVAL2GOBJ(layout)));
|
391
|
+
return self;
|
392
|
+
}
|
393
|
+
|
394
|
+
static VALUE
|
395
|
+
style_paint_resize_grip(self, gdkwindow, state_type, area, widget, detail,
|
396
|
+
edge, x, y, width, height)
|
397
|
+
VALUE self, gdkwindow, state_type, area, widget, detail, edge, x, y,
|
398
|
+
width, height;
|
399
|
+
{
|
400
|
+
gtk_paint_resize_grip(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)),
|
401
|
+
RVAL2STATE(state_type), RVAL2REC(area),
|
402
|
+
GTK_WIDGET(RVAL2GOBJ(widget)),
|
403
|
+
NIL_P(detail) ? NULL : RVAL2CSTR(detail),
|
404
|
+
RVAL2GENUM(edge, GDK_TYPE_WINDOW_EDGE),
|
405
|
+
NUM2INT(x), NUM2INT(y),
|
406
|
+
NUM2INT(width), NUM2INT(height));
|
407
|
+
return self;
|
408
|
+
}
|
409
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
410
|
+
static VALUE
|
411
|
+
style_s_draw_insertion_cursor(self, widget, drawable, area, location, is_primary, direction, draw_arrow)
|
412
|
+
VALUE self, widget, drawable, area, location, is_primary, direction, draw_arrow;
|
413
|
+
{
|
414
|
+
gtk_draw_insertion_cursor(GTK_WIDGET(RVAL2GOBJ(widget)),
|
415
|
+
GDK_WINDOW(RVAL2GOBJ(drawable)),
|
416
|
+
RVAL2REC(area), RVAL2REC(location),
|
417
|
+
RVAL2CBOOL(is_primary),
|
418
|
+
RVAL2GENUM(direction, GTK_TYPE_TEXT_DIRECTION),
|
419
|
+
RVAL2CBOOL(draw_arrow));
|
420
|
+
return self;
|
421
|
+
}
|
422
|
+
#endif
|
423
|
+
|
424
|
+
#define DEFINE_STYLE_COLOR(type) \
|
425
|
+
static VALUE \
|
426
|
+
style_set_ ## type(self, idx, r, g, b) \
|
427
|
+
VALUE self, idx, r, g, b; \
|
428
|
+
{ \
|
429
|
+
GdkColor *color; \
|
430
|
+
int i = NUM2INT(idx); \
|
431
|
+
\
|
432
|
+
if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); \
|
433
|
+
color = &(_SELF(self) -> type [i]); \
|
434
|
+
color->red = NUM2INT(r); \
|
435
|
+
color->green = NUM2INT(g); \
|
436
|
+
color->blue = NUM2INT(b); \
|
437
|
+
return self; \
|
438
|
+
} \
|
439
|
+
static VALUE \
|
440
|
+
style_ ## type(self, idx) \
|
441
|
+
VALUE self, idx; \
|
442
|
+
{ \
|
443
|
+
int i = NUM2INT(idx); \
|
444
|
+
\
|
445
|
+
if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); \
|
446
|
+
return BOXED2RVAL(&_SELF(self)-> type [i], GDK_TYPE_COLOR); \
|
447
|
+
} \
|
448
|
+
|
449
|
+
DEFINE_STYLE_COLOR(fg);
|
450
|
+
DEFINE_STYLE_COLOR(bg);
|
451
|
+
DEFINE_STYLE_COLOR(light);
|
452
|
+
DEFINE_STYLE_COLOR(dark);
|
453
|
+
DEFINE_STYLE_COLOR(mid);
|
454
|
+
DEFINE_STYLE_COLOR(text);
|
455
|
+
DEFINE_STYLE_COLOR(base);
|
456
|
+
DEFINE_STYLE_COLOR(text_aa);
|
457
|
+
|
458
|
+
static VALUE
|
459
|
+
style_black(self)
|
460
|
+
VALUE self;
|
461
|
+
{
|
462
|
+
return BOXED2RVAL(&_SELF(self)->black, GDK_TYPE_COLOR);
|
463
|
+
}
|
464
|
+
|
465
|
+
static VALUE
|
466
|
+
style_set_black(self, r, g, b)
|
467
|
+
VALUE self, r, g, b;
|
468
|
+
{
|
469
|
+
GdkColor* color = &(_SELF(self)->black);
|
470
|
+
color->red = NUM2INT(r);
|
471
|
+
color->green = NUM2INT(g);
|
472
|
+
color->blue = NUM2INT(b);
|
473
|
+
|
474
|
+
return self;
|
475
|
+
}
|
476
|
+
|
477
|
+
static VALUE
|
478
|
+
style_white(self)
|
479
|
+
VALUE self;
|
480
|
+
{
|
481
|
+
return BOXED2RVAL(&_SELF(self)->white, GDK_TYPE_COLOR);
|
482
|
+
}
|
483
|
+
|
484
|
+
static VALUE
|
485
|
+
style_set_white(self, r, g, b)
|
486
|
+
VALUE self, r, g, b;
|
487
|
+
{
|
488
|
+
GdkColor* color = &(_SELF(self)->white);
|
489
|
+
color->red = NUM2INT(r);
|
490
|
+
color->green = NUM2INT(g);
|
491
|
+
color->blue = NUM2INT(b);
|
492
|
+
return self;
|
493
|
+
}
|
494
|
+
|
495
|
+
static VALUE
|
496
|
+
style_font_desc(self)
|
497
|
+
VALUE self;
|
498
|
+
{
|
499
|
+
PangoFontDescription* desc = _SELF(self)->font_desc;
|
500
|
+
return BOXED2RVAL(desc, PANGO_TYPE_FONT_DESCRIPTION);
|
501
|
+
}
|
502
|
+
|
503
|
+
static VALUE
|
504
|
+
style_set_font_desc(self, font_desc)
|
505
|
+
VALUE self, font_desc;
|
506
|
+
{
|
507
|
+
GtkStyle *style = _SELF(self);
|
508
|
+
if (style->font_desc)
|
509
|
+
pango_font_description_free(style->font_desc);
|
510
|
+
style->font_desc = pango_font_description_copy((PangoFontDescription*)RVAL2BOXED(font_desc, PANGO_TYPE_FONT_DESCRIPTION));
|
511
|
+
return self;
|
512
|
+
}
|
513
|
+
|
514
|
+
static VALUE
|
515
|
+
style_xthickness(self)
|
516
|
+
VALUE self;
|
517
|
+
{
|
518
|
+
return INT2NUM(_SELF(self)->xthickness);
|
519
|
+
}
|
520
|
+
|
521
|
+
static VALUE
|
522
|
+
style_set_xthickness(self, xthickness)
|
523
|
+
VALUE self, xthickness;
|
524
|
+
{
|
525
|
+
_SELF(self)->xthickness = NUM2INT(xthickness);
|
526
|
+
return self;
|
527
|
+
}
|
528
|
+
|
529
|
+
static VALUE
|
530
|
+
style_ythickness(self)
|
531
|
+
VALUE self;
|
532
|
+
{
|
533
|
+
return INT2NUM(_SELF(self)->ythickness);
|
534
|
+
}
|
535
|
+
|
536
|
+
static VALUE
|
537
|
+
style_set_ythickness(self, ythickness)
|
538
|
+
VALUE self, ythickness;
|
539
|
+
{
|
540
|
+
_SELF(self)->ythickness = NUM2INT(ythickness);
|
541
|
+
return self;
|
542
|
+
}
|
543
|
+
|
544
|
+
#define DEFINE_STYLE_GC(type) \
|
545
|
+
static VALUE \
|
546
|
+
style_set_ ## type(self, idx, gc) \
|
547
|
+
VALUE self, idx, gc; \
|
548
|
+
{ \
|
549
|
+
int i = NUM2INT(idx); \
|
550
|
+
\
|
551
|
+
if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); \
|
552
|
+
_SELF(self)-> type [i] = GDK_GC(RVAL2GOBJ(gc));\
|
553
|
+
return self;\
|
554
|
+
} \
|
555
|
+
static VALUE \
|
556
|
+
style_ ## type(self, idx) \
|
557
|
+
VALUE self, idx; \
|
558
|
+
{ \
|
559
|
+
int i = NUM2INT(idx); \
|
560
|
+
\
|
561
|
+
if (i < 0 || 5 < i) rb_raise(rb_eArgError, "state out of range"); \
|
562
|
+
return GOBJ2RVAL(_SELF(self)-> type [i]); \
|
563
|
+
} \
|
564
|
+
|
565
|
+
DEFINE_STYLE_GC(fg_gc);
|
566
|
+
DEFINE_STYLE_GC(bg_gc);
|
567
|
+
DEFINE_STYLE_GC(light_gc);
|
568
|
+
DEFINE_STYLE_GC(dark_gc);
|
569
|
+
DEFINE_STYLE_GC(mid_gc);
|
570
|
+
DEFINE_STYLE_GC(text_gc);
|
571
|
+
DEFINE_STYLE_GC(base_gc);
|
572
|
+
DEFINE_STYLE_GC(text_aa_gc);
|
573
|
+
|
574
|
+
static VALUE
|
575
|
+
style_black_gc(self)
|
576
|
+
VALUE self;
|
577
|
+
{
|
578
|
+
return GOBJ2RVAL(_SELF(self)->black_gc);
|
579
|
+
}
|
580
|
+
|
581
|
+
static VALUE
|
582
|
+
style_set_black_gc(self, gc)
|
583
|
+
VALUE self, gc;
|
584
|
+
{
|
585
|
+
_SELF(self)->black_gc = GDK_GC(RVAL2GOBJ(gc));
|
586
|
+
return self;
|
587
|
+
}
|
588
|
+
|
589
|
+
static VALUE
|
590
|
+
style_white_gc(self)
|
591
|
+
VALUE self;
|
592
|
+
{
|
593
|
+
return GOBJ2RVAL(_SELF(self)->white_gc);
|
594
|
+
}
|
595
|
+
|
596
|
+
static VALUE
|
597
|
+
style_set_white_gc(self, gc)
|
598
|
+
VALUE self, gc;
|
599
|
+
{
|
600
|
+
_SELF(self)->white_gc = GDK_GC(RVAL2GOBJ(gc));
|
601
|
+
return self;
|
602
|
+
}
|
603
|
+
|
604
|
+
static VALUE
|
605
|
+
style_bg_pixmap(self, idx)
|
606
|
+
VALUE self, idx;
|
607
|
+
{
|
608
|
+
int i = NUM2INT(idx);
|
609
|
+
|
610
|
+
if (i < 0 || 5 < i)
|
611
|
+
rb_raise(rb_eArgError, "state out of range");
|
612
|
+
return GOBJ2RVAL(_SELF(self)->bg_pixmap[i]);
|
613
|
+
}
|
614
|
+
|
615
|
+
static VALUE
|
616
|
+
style_set_bg_pixmap(self, idx, bg_pixmap)
|
617
|
+
VALUE self, idx, bg_pixmap;
|
618
|
+
{
|
619
|
+
int i = NUM2INT(idx);
|
620
|
+
GdkPixmap* pixmap = RVAL2GOBJ(bg_pixmap);
|
621
|
+
g_object_ref(G_OBJECT(pixmap));
|
622
|
+
if (i < 0 || 5 < i)
|
623
|
+
rb_raise(rb_eArgError, "state out of range");
|
624
|
+
_SELF(self)->bg_pixmap[i] = pixmap;
|
625
|
+
return self;
|
626
|
+
}
|
627
|
+
|
628
|
+
void
|
629
|
+
Init_gtk_style()
|
630
|
+
{
|
631
|
+
VALUE gStyle = G_DEF_CLASS(GTK_TYPE_STYLE, "Style", mGtk);
|
632
|
+
|
633
|
+
rb_define_method(gStyle, "initialize", style_initialize, 0);
|
634
|
+
rb_define_method(gStyle, "attached?", style_attached, 0);
|
635
|
+
rb_define_method(gStyle, "copy", style_copy, 0);
|
636
|
+
rb_define_method(gStyle, "clone", style_copy, 0);
|
637
|
+
rb_define_method(gStyle, "dup", style_copy, 0);
|
638
|
+
rb_define_method(gStyle, "attach", style_attach, 1);
|
639
|
+
rb_define_method(gStyle, "detach", style_detach, 0);
|
640
|
+
rb_define_method(gStyle, "set_background", style_set_background, 2);
|
641
|
+
rb_define_method(gStyle, "apply_default_background", style_apply_default_background, 8);
|
642
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
643
|
+
rb_define_method(gStyle, "lookup_color", style_lookup_color, 1);
|
644
|
+
#endif
|
645
|
+
rb_define_method(gStyle, "lookup_icon_set", style_lookup_icon_set, 1);
|
646
|
+
rb_define_method(gStyle, "render_icon", style_render_icon, 6);
|
647
|
+
rb_define_method(gStyle, "paint_arrow", style_paint_arrow, 12);
|
648
|
+
rb_define_method(gStyle, "paint_box", style_paint_box, 10);
|
649
|
+
rb_define_method(gStyle, "paint_box_gap", style_paint_box_gap, 13);
|
650
|
+
rb_define_method(gStyle, "paint_check", style_paint_check, 10);
|
651
|
+
rb_define_method(gStyle, "paint_diamond", style_paint_diamond, 10);
|
652
|
+
rb_define_method(gStyle, "paint_extension", style_paint_extension, 10);
|
653
|
+
rb_define_method(gStyle, "paint_flat_box", style_paint_flat_box, 10);
|
654
|
+
rb_define_method(gStyle, "paint_focus", style_paint_focus, 9);
|
655
|
+
rb_define_method(gStyle, "paint_handle", style_paint_handle, 11);
|
656
|
+
rb_define_method(gStyle, "paint_hline", style_paint_hline, 8);
|
657
|
+
rb_define_method(gStyle, "paint_option", style_paint_option, 10);
|
658
|
+
rb_define_method(gStyle, "paint_polygon", style_paint_polygon, 8);
|
659
|
+
rb_define_method(gStyle, "paint_shadow", style_paint_shadow, 10);
|
660
|
+
rb_define_method(gStyle, "paint_shadow_gap", style_paint_shadow_gap, 13);
|
661
|
+
rb_define_method(gStyle, "paint_slider", style_paint_slider, 11);
|
662
|
+
rb_define_method(gStyle, "paint_tab", style_paint_tab, 10);
|
663
|
+
rb_define_method(gStyle, "paint_vline", style_paint_vline, 9);
|
664
|
+
rb_define_method(gStyle, "paint_expander", style_paint_expander, 8);
|
665
|
+
rb_define_method(gStyle, "paint_layout", style_paint_layout, 9);
|
666
|
+
rb_define_method(gStyle, "paint_resize_grip", style_paint_resize_grip, 10);
|
667
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
668
|
+
rb_define_singleton_method(gStyle, "draw_insertion_cursor", style_s_draw_insertion_cursor, 7);
|
669
|
+
#endif
|
670
|
+
rb_define_method(gStyle, "fg", style_fg, 1);
|
671
|
+
rb_define_method(gStyle, "bg", style_bg, 1);
|
672
|
+
rb_define_method(gStyle, "light", style_light, 1);
|
673
|
+
rb_define_method(gStyle, "dark", style_dark, 1);
|
674
|
+
rb_define_method(gStyle, "mid", style_mid, 1);
|
675
|
+
rb_define_method(gStyle, "text", style_text, 1);
|
676
|
+
rb_define_method(gStyle, "base", style_base, 1);
|
677
|
+
rb_define_method(gStyle, "text_aa", style_text_aa, 1);
|
678
|
+
rb_define_method(gStyle, "set_fg", style_set_fg, 4);
|
679
|
+
rb_define_method(gStyle, "set_bg", style_set_bg, 4);
|
680
|
+
rb_define_method(gStyle, "set_light", style_set_light, 4);
|
681
|
+
rb_define_method(gStyle, "set_dark", style_set_dark, 4);
|
682
|
+
rb_define_method(gStyle, "set_mid", style_set_mid, 4);
|
683
|
+
rb_define_method(gStyle, "set_text", style_set_text, 4);
|
684
|
+
rb_define_method(gStyle, "set_base", style_set_base, 4);
|
685
|
+
rb_define_method(gStyle, "set_text_aa", style_set_text_aa, 4);
|
686
|
+
|
687
|
+
rb_define_method(gStyle, "black", style_black, 0);
|
688
|
+
rb_define_method(gStyle, "set_black", style_set_black, 3);
|
689
|
+
rb_define_method(gStyle, "white", style_white, 0);
|
690
|
+
rb_define_method(gStyle, "set_white", style_set_white, 3);
|
691
|
+
rb_define_method(gStyle, "font_desc", style_font_desc, 0);
|
692
|
+
rb_define_method(gStyle, "set_font_desc", style_set_font_desc, 1);
|
693
|
+
rb_define_method(gStyle, "xthickness", style_xthickness, 0);
|
694
|
+
rb_define_method(gStyle, "ythickness", style_ythickness, 0);
|
695
|
+
rb_define_method(gStyle, "set_xthickness", style_set_xthickness, 1);
|
696
|
+
rb_define_method(gStyle, "set_ythickness", style_set_ythickness, 1);
|
697
|
+
|
698
|
+
rb_define_method(gStyle, "fg_gc", style_fg_gc, 1);
|
699
|
+
rb_define_method(gStyle, "bg_gc", style_bg_gc, 1);
|
700
|
+
rb_define_method(gStyle, "light_gc", style_light_gc, 1);
|
701
|
+
rb_define_method(gStyle, "dark_gc", style_dark_gc, 1);
|
702
|
+
rb_define_method(gStyle, "mid_gc", style_mid_gc, 1);
|
703
|
+
rb_define_method(gStyle, "text_gc", style_text_gc, 1);
|
704
|
+
rb_define_method(gStyle, "base_gc", style_base_gc, 1);
|
705
|
+
rb_define_method(gStyle, "text_aa_gc", style_text_aa_gc, 1);
|
706
|
+
rb_define_method(gStyle, "black_gc", style_black_gc, 0);
|
707
|
+
rb_define_method(gStyle, "white_gc", style_white_gc, 0);
|
708
|
+
rb_define_method(gStyle, "bg_pixmap", style_bg_pixmap, 1);
|
709
|
+
rb_define_method(gStyle, "set_fg_gc", style_set_fg_gc, 2);
|
710
|
+
rb_define_method(gStyle, "set_bg_gc", style_set_bg_gc, 2);
|
711
|
+
rb_define_method(gStyle, "set_light_gc", style_set_light_gc, 2);
|
712
|
+
rb_define_method(gStyle, "set_dark_gc", style_set_dark_gc, 2);
|
713
|
+
rb_define_method(gStyle, "set_mid_gc", style_set_mid_gc, 2);
|
714
|
+
rb_define_method(gStyle, "set_text_gc", style_set_text_gc, 2);
|
715
|
+
rb_define_method(gStyle, "set_base_gc", style_set_base_gc, 2);
|
716
|
+
rb_define_method(gStyle, "set_text_aa_gc", style_set_text_aa_gc, 2);
|
717
|
+
rb_define_method(gStyle, "set_black_gc", style_set_black_gc, 1);
|
718
|
+
rb_define_method(gStyle, "set_white_gc", style_set_white_gc, 1);
|
719
|
+
rb_define_method(gStyle, "set_bg_pixmap", style_set_bg_pixmap, 2);
|
720
|
+
|
721
|
+
G_DEF_SETTERS(gStyle);
|
722
|
+
}
|