gtk2 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +6664 -0
- data/README +33 -0
- data/Rakefile +71 -0
- data/extconf.rb +116 -0
- data/src/global.h +33 -0
- data/src/init.c +39 -0
- data/src/lib/gtk2.rb +13 -0
- data/src/lib/gtk2/base.rb +95 -0
- data/src/makeinits.rb +57 -0
- data/src/makekeysyms.rb +5 -0
- data/src/rbgdk.c +395 -0
- data/src/rbgdk.h +50 -0
- data/src/rbgdkatom.c +122 -0
- data/src/rbgdkcairo.c +100 -0
- data/src/rbgdkcolor.c +151 -0
- data/src/rbgdkcolormap.c +142 -0
- data/src/rbgdkconst.c +29 -0
- data/src/rbgdkconversions.h +18 -0
- data/src/rbgdkcursor.c +115 -0
- data/src/rbgdkdevice.c +235 -0
- data/src/rbgdkdisplay.c +634 -0
- data/src/rbgdkdisplaymanager.c +50 -0
- data/src/rbgdkdragcontext.c +280 -0
- data/src/rbgdkdraw.c +487 -0
- data/src/rbgdkevent.c +1020 -0
- data/src/rbgdkgc.c +456 -0
- data/src/rbgdkgeometry.c +272 -0
- data/src/rbgdkimage.c +155 -0
- data/src/rbgdkinput.c +70 -0
- data/src/rbgdkkeymap.c +153 -0
- data/src/rbgdkkeysyms.h +2174 -0
- data/src/rbgdkkeyval.c +105 -0
- data/src/rbgdkpango.c +171 -0
- data/src/rbgdkpangorenderer.c +132 -0
- data/src/rbgdkpixbuf.c +178 -0
- data/src/rbgdkpixmap.c +255 -0
- data/src/rbgdkproperty.c +342 -0
- data/src/rbgdkrectangle.c +146 -0
- data/src/rbgdkregion.c +242 -0
- data/src/rbgdkrgb.c +197 -0
- data/src/rbgdkscreen.c +535 -0
- data/src/rbgdkselection.c +161 -0
- data/src/rbgdkthreads.c +68 -0
- data/src/rbgdktimecoord.c +118 -0
- data/src/rbgdkvisual.c +273 -0
- data/src/rbgdkwindow.c +1302 -0
- data/src/rbgdkwindowattr.c +213 -0
- data/src/rbgdkx11.c +256 -0
- data/src/rbgtk.c +93 -0
- data/src/rbgtk.h +121 -0
- data/src/rbgtkaboutdialog.c +195 -0
- data/src/rbgtkaccelerator.c +78 -0
- data/src/rbgtkaccelgroup.c +216 -0
- data/src/rbgtkaccelgroupentry.c +85 -0
- data/src/rbgtkaccelkey.c +116 -0
- data/src/rbgtkaccellabel.c +46 -0
- data/src/rbgtkaccelmap.c +162 -0
- data/src/rbgtkaccessible.c +29 -0
- data/src/rbgtkaction.c +277 -0
- data/src/rbgtkactiongroup.c +377 -0
- data/src/rbgtkadjustment.c +153 -0
- data/src/rbgtkalignment.c +71 -0
- data/src/rbgtkallocation.c +171 -0
- data/src/rbgtkarrow.c +47 -0
- data/src/rbgtkaspectframe.c +46 -0
- data/src/rbgtkassistant.c +230 -0
- data/src/rbgtkbbox.c +47 -0
- data/src/rbgtkbin.c +31 -0
- data/src/rbgtkbindingset.c +192 -0
- data/src/rbgtkborder.c +80 -0
- data/src/rbgtkbox.c +142 -0
- data/src/rbgtkbuildable.c +115 -0
- data/src/rbgtkbuilder.c +154 -0
- data/src/rbgtkbutton.c +151 -0
- data/src/rbgtkcalendar.c +159 -0
- data/src/rbgtkcelleditable.c +49 -0
- data/src/rbgtkcelllayout.c +144 -0
- data/src/rbgtkcellrenderer.c +139 -0
- data/src/rbgtkcellrendereraccel.c +42 -0
- data/src/rbgtkcellrenderercombo.c +37 -0
- data/src/rbgtkcellrendererpixbuf.c +33 -0
- data/src/rbgtkcellrendererprogress.c +37 -0
- data/src/rbgtkcellrendererspin.c +38 -0
- data/src/rbgtkcellrenderertext.c +45 -0
- data/src/rbgtkcellrenderertoggle.c +32 -0
- data/src/rbgtkcellview.c +134 -0
- data/src/rbgtkcheckbutton.c +55 -0
- data/src/rbgtkcheckmenuitem.c +56 -0
- data/src/rbgtkclipboard.c +473 -0
- data/src/rbgtkcolorbutton.c +63 -0
- data/src/rbgtkcolorsel.c +175 -0
- data/src/rbgtkcolorselectiondialog.c +72 -0
- data/src/rbgtkcombo.c +117 -0
- data/src/rbgtkcombobox.c +240 -0
- data/src/rbgtkcomboboxentry.c +60 -0
- data/src/rbgtkconst.c +163 -0
- data/src/rbgtkcontainer.c +776 -0
- data/src/rbgtkconversions.h +26 -0
- data/src/rbgtkcurve.c +105 -0
- data/src/rbgtkdialog.c +244 -0
- data/src/rbgtkdrag.c +436 -0
- data/src/rbgtkdrawingarea.c +31 -0
- data/src/rbgtkeditable.c +152 -0
- data/src/rbgtkentry.c +161 -0
- data/src/rbgtkentrycompletion.c +167 -0
- data/src/rbgtkeventbox.c +31 -0
- data/src/rbgtkexpander.c +67 -0
- data/src/rbgtkfilechooser.c +403 -0
- data/src/rbgtkfilechooserbutton.c +72 -0
- data/src/rbgtkfilechooserdialog.c +58 -0
- data/src/rbgtkfilechooserwidget.c +50 -0
- data/src/rbgtkfilefilter.c +139 -0
- data/src/rbgtkfilesel.c +155 -0
- data/src/rbgtkfixed.c +72 -0
- data/src/rbgtkfontbutton.c +69 -0
- data/src/rbgtkfontselection.c +30 -0
- data/src/rbgtkfontselectiondialog.c +106 -0
- data/src/rbgtkframe.c +64 -0
- data/src/rbgtkgamma.c +47 -0
- data/src/rbgtkhandlebox.c +42 -0
- data/src/rbgtkhbbox.c +31 -0
- data/src/rbgtkhbox.c +38 -0
- data/src/rbgtkhpaned.c +31 -0
- data/src/rbgtkhruler.c +31 -0
- data/src/rbgtkhscale.c +45 -0
- data/src/rbgtkhscrollbar.c +38 -0
- data/src/rbgtkhseparator.c +30 -0
- data/src/rbgtkiconfactory.c +80 -0
- data/src/rbgtkiconinfo.c +118 -0
- data/src/rbgtkiconset.c +87 -0
- data/src/rbgtkiconsize.c +90 -0
- data/src/rbgtkiconsource.c +176 -0
- data/src/rbgtkicontheme.c +309 -0
- data/src/rbgtkiconview.c +351 -0
- data/src/rbgtkimage.c +152 -0
- data/src/rbgtkimagemenuitem.c +52 -0
- data/src/rbgtkimcontext.c +134 -0
- data/src/rbgtkimcontextsimple.c +48 -0
- data/src/rbgtkimmulticontext.c +38 -0
- data/src/rbgtkinits.c +473 -0
- data/src/rbgtkinputdialog.c +30 -0
- data/src/rbgtkinvisible.c +68 -0
- data/src/rbgtkitem.c +51 -0
- data/src/rbgtkitemfactory.c +312 -0
- data/src/rbgtklabel.c +168 -0
- data/src/rbgtklayout.c +91 -0
- data/src/rbgtklinkbutton.c +68 -0
- data/src/rbgtkliststore.c +412 -0
- data/src/rbgtkmacros.h +26 -0
- data/src/rbgtkmain.c +532 -0
- data/src/rbgtkmenu.c +272 -0
- data/src/rbgtkmenubar.c +48 -0
- data/src/rbgtkmenuitem.c +171 -0
- data/src/rbgtkmenushell.c +128 -0
- data/src/rbgtkmenutoolbutton.c +74 -0
- data/src/rbgtkmessagedialog.c +102 -0
- data/src/rbgtkmisc.c +63 -0
- data/src/rbgtknotebook.c +484 -0
- data/src/rbgtkobject.c +186 -0
- data/src/rbgtkoptionmenu.c +65 -0
- data/src/rbgtkpagesetup.c +196 -0
- data/src/rbgtkpagesetupunixdialog.c +80 -0
- data/src/rbgtkpaned.c +114 -0
- data/src/rbgtkpapersize.c +186 -0
- data/src/rbgtkplug.c +84 -0
- data/src/rbgtkprintcontext.c +124 -0
- data/src/rbgtkprinter.c +155 -0
- data/src/rbgtkprintjob.c +151 -0
- data/src/rbgtkprintoperation.c +152 -0
- data/src/rbgtkprintoperationpreview.c +54 -0
- data/src/rbgtkprintsettings.c +794 -0
- data/src/rbgtkprintunixdialog.c +98 -0
- data/src/rbgtkprogress.c +21 -0
- data/src/rbgtkprogressbar.c +72 -0
- data/src/rbgtkradioaction.c +102 -0
- data/src/rbgtkradiobutton.c +83 -0
- data/src/rbgtkradiomenuitem.c +115 -0
- data/src/rbgtkradiotoolbutton.c +99 -0
- data/src/rbgtkrange.c +98 -0
- data/src/rbgtkrc.c +228 -0
- data/src/rbgtkrcstyle.c +184 -0
- data/src/rbgtkrecentaction.c +52 -0
- data/src/rbgtkrecentchooser.c +276 -0
- data/src/rbgtkrecentchooserdialog.c +59 -0
- data/src/rbgtkrecentchoosermenu.c +55 -0
- data/src/rbgtkrecentchooserwidget.c +45 -0
- data/src/rbgtkrecentdata.c +152 -0
- data/src/rbgtkrecentfilter.c +180 -0
- data/src/rbgtkrecentfilterinfo.c +197 -0
- data/src/rbgtkrecentinfo.c +232 -0
- data/src/rbgtkrecentmanager.c +164 -0
- data/src/rbgtkruler.c +82 -0
- data/src/rbgtkscale.c +47 -0
- data/src/rbgtkscalebutton.c +115 -0
- data/src/rbgtkscrollbar.c +21 -0
- data/src/rbgtkscrolledwindow.c +160 -0
- data/src/rbgtkselection.c +171 -0
- data/src/rbgtkselectiondata.c +333 -0
- data/src/rbgtkseparator.c +21 -0
- data/src/rbgtkseparatormenuitem.c +28 -0
- data/src/rbgtkseparatortoolitem.c +40 -0
- data/src/rbgtksettings.c +225 -0
- data/src/rbgtksizegroup.c +74 -0
- data/src/rbgtksocket.c +72 -0
- data/src/rbgtkspinbutton.c +138 -0
- data/src/rbgtkstatusbar.c +90 -0
- data/src/rbgtkstatusicon.c +120 -0
- data/src/rbgtkstock.c +264 -0
- data/src/rbgtkstyle.c +722 -0
- data/src/rbgtktable.c +190 -0
- data/src/rbgtktargetlist.c +148 -0
- data/src/rbgtktearoffmenuitem.c +30 -0
- data/src/rbgtktextappearance.c +173 -0
- data/src/rbgtktextattributes.c +209 -0
- data/src/rbgtktextbuffer.c +993 -0
- data/src/rbgtktextchild.c +49 -0
- data/src/rbgtktextiter.c +553 -0
- data/src/rbgtktextmark.c +87 -0
- data/src/rbgtktexttag.c +66 -0
- data/src/rbgtktexttagtable.c +94 -0
- data/src/rbgtktextview.c +351 -0
- data/src/rbgtktoggleaction.c +76 -0
- data/src/rbgtktogglebutton.c +84 -0
- data/src/rbgtktoggletoolbutton.c +70 -0
- data/src/rbgtktoolbar.c +373 -0
- data/src/rbgtktoolbutton.c +75 -0
- data/src/rbgtktoolitem.c +184 -0
- data/src/rbgtktooltip.c +76 -0
- data/src/rbgtktooltips.c +107 -0
- data/src/rbgtktreedragdest.c +19 -0
- data/src/rbgtktreedragsource.c +19 -0
- data/src/rbgtktreeiter.c +259 -0
- data/src/rbgtktreemodel.c +256 -0
- data/src/rbgtktreemodelfilter.c +214 -0
- data/src/rbgtktreemodelsort.c +113 -0
- data/src/rbgtktreepath.c +195 -0
- data/src/rbgtktreerowreference.c +168 -0
- data/src/rbgtktreeselection.c +235 -0
- data/src/rbgtktreesortable.c +127 -0
- data/src/rbgtktreestore.c +379 -0
- data/src/rbgtktreeview.c +881 -0
- data/src/rbgtktreeviewcolumn.c +331 -0
- data/src/rbgtkuimanager.c +210 -0
- data/src/rbgtkvbbox.c +31 -0
- data/src/rbgtkvbox.c +38 -0
- data/src/rbgtkviewport.c +33 -0
- data/src/rbgtkvolumebutton.c +36 -0
- data/src/rbgtkvpaned.c +31 -0
- data/src/rbgtkvruler.c +30 -0
- data/src/rbgtkvscale.c +45 -0
- data/src/rbgtkvscrollbar.c +38 -0
- data/src/rbgtkvseparator.c +30 -0
- data/src/rbgtkwidget.c +1414 -0
- data/src/rbgtkwindow.c +822 -0
- data/src/rbgtkwindowgroup.c +48 -0
- data/test/gtk-test-utils.rb +15 -0
- data/test/run-test.rb +30 -0
- data/test/test_gc.rb +25 -0
- data/test/test_gdk.rb +18 -0
- data/test/test_gdk_color.rb +10 -0
- data/test/test_gdk_display.rb +37 -0
- data/test/test_gdk_event.rb +11 -0
- data/test/test_gdk_gc.rb +7 -0
- data/test/test_gdk_keymap.rb +8 -0
- data/test/test_gdk_pango.rb +9 -0
- data/test/test_gdk_selection_data.rb +17 -0
- data/test/test_gdk_window.rb +29 -0
- data/test/test_gdk_window_attribute.rb +9 -0
- data/test/test_gtk_about_dialog.rb +14 -0
- data/test/test_gtk_buildable.rb +66 -0
- data/test/test_gtk_builder.rb +188 -0
- data/test/test_gtk_entry.rb +18 -0
- data/test/test_gtk_icon_theme.rb +30 -0
- data/test/test_gtk_image.rb +8 -0
- data/test/test_gtk_list_store.rb +65 -0
- data/test/test_gtk_menu_item.rb +13 -0
- data/test/test_gtk_rc_style.rb +14 -0
- data/test/test_gtk_tree_path.rb +20 -0
- data/test/test_gtk_unix_print.rb +14 -0
- data/test/test_gtk_widget.rb +32 -0
- metadata +393 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcolorbutton.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2004/05/30 16:41:13 $
|
8
|
+
|
9
|
+
Copyright (C) 2004 Masao Mutoh
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
15
|
+
|
16
|
+
static VALUE
|
17
|
+
colorbutton_initialize(argc, argv, self)
|
18
|
+
int argc;
|
19
|
+
VALUE* argv;
|
20
|
+
VALUE self;
|
21
|
+
{
|
22
|
+
VALUE color;
|
23
|
+
GtkWidget* widget;
|
24
|
+
|
25
|
+
rb_scan_args(argc, argv, "01", &color);
|
26
|
+
|
27
|
+
if (NIL_P(color)){
|
28
|
+
widget = gtk_color_button_new();
|
29
|
+
} else {
|
30
|
+
widget = gtk_color_button_new_with_color(RVAL2GDKCOLOR(color));
|
31
|
+
}
|
32
|
+
|
33
|
+
RBGTK_INITIALIZE(self, widget);
|
34
|
+
return Qnil;
|
35
|
+
}
|
36
|
+
|
37
|
+
/* Defined as property.
|
38
|
+
void gtk_color_button_set_color (GtkColorButton *color_button,
|
39
|
+
const GdkColor *color);
|
40
|
+
void gtk_color_button_get_color (GtkColorButton *color_button,
|
41
|
+
GdkColor *color);
|
42
|
+
void gtk_color_button_set_alpha (GtkColorButton *color_button,
|
43
|
+
guint16 alpha);
|
44
|
+
guint16 gtk_color_button_get_alpha (GtkColorButton *color_button);
|
45
|
+
void gtk_color_button_set_use_alpha (GtkColorButton *color_button,
|
46
|
+
gboolean use_alpha);
|
47
|
+
gboolean gtk_color_button_get_use_alpha (GtkColorButton *color_button);
|
48
|
+
void gtk_color_button_set_title (GtkColorButton *color_button,
|
49
|
+
const gchar *title);
|
50
|
+
G_CONST_RETURN gchar* gtk_color_button_get_title
|
51
|
+
(GtkColorButton *color_button);
|
52
|
+
*/
|
53
|
+
|
54
|
+
#endif
|
55
|
+
|
56
|
+
void
|
57
|
+
Init_gtk_colorbutton()
|
58
|
+
{
|
59
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
60
|
+
VALUE gColorbutton = G_DEF_CLASS(GTK_TYPE_COLOR_BUTTON, "ColorButton", mGtk);
|
61
|
+
rb_define_method(gColorbutton, "initialize", colorbutton_initialize, -1);
|
62
|
+
#endif
|
63
|
+
}
|
data/src/rbgtkcolorsel.c
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcolorsel.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 14:27:09 $
|
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(s) (GTK_COLOR_SELECTION(RVAL2GOBJ(self)))
|
18
|
+
|
19
|
+
static VALUE gColorSel;
|
20
|
+
|
21
|
+
static VALUE
|
22
|
+
colorsel_initialize(self)
|
23
|
+
VALUE self;
|
24
|
+
{
|
25
|
+
RBGTK_INITIALIZE(self, gtk_color_selection_new());
|
26
|
+
return Qnil;
|
27
|
+
}
|
28
|
+
|
29
|
+
static VALUE
|
30
|
+
colorsel_get_previous_alpha(self)
|
31
|
+
VALUE self;
|
32
|
+
{
|
33
|
+
return INT2NUM(gtk_color_selection_get_previous_alpha(_SELF(self)));
|
34
|
+
}
|
35
|
+
|
36
|
+
static VALUE
|
37
|
+
colorsel_set_previous_alpha(self, alpha)
|
38
|
+
VALUE self, alpha;
|
39
|
+
{
|
40
|
+
gtk_color_selection_set_previous_alpha(_SELF(self), NUM2INT(alpha));
|
41
|
+
return self;
|
42
|
+
}
|
43
|
+
|
44
|
+
static VALUE
|
45
|
+
colorsel_set_previous_color(self, color)
|
46
|
+
VALUE self, color;
|
47
|
+
{
|
48
|
+
gtk_color_selection_set_previous_color(_SELF(self), RVAL2GDKCOLOR(color));
|
49
|
+
return self;
|
50
|
+
}
|
51
|
+
|
52
|
+
static VALUE
|
53
|
+
colorsel_get_previous_color(self)
|
54
|
+
VALUE self;
|
55
|
+
{
|
56
|
+
GdkColor color;
|
57
|
+
gtk_color_selection_get_previous_color(_SELF(self), &color);
|
58
|
+
return GDKCOLOR2RVAL(&color);
|
59
|
+
}
|
60
|
+
|
61
|
+
static VALUE
|
62
|
+
colorsel_is_adjusting(self)
|
63
|
+
VALUE self;
|
64
|
+
{
|
65
|
+
return CBOOL2RVAL(gtk_color_selection_is_adjusting(_SELF(self)));
|
66
|
+
}
|
67
|
+
|
68
|
+
static VALUE
|
69
|
+
colorsel_s_palette_from_string(self, str)
|
70
|
+
VALUE self, str;
|
71
|
+
{
|
72
|
+
GdkColor* gcolors;
|
73
|
+
gint i, n_colors;
|
74
|
+
VALUE ary = Qnil;
|
75
|
+
gboolean ret = gtk_color_selection_palette_from_string(RVAL2CSTR(str),
|
76
|
+
&gcolors, &n_colors);
|
77
|
+
|
78
|
+
if (ret) {
|
79
|
+
ary = rb_ary_new();
|
80
|
+
for (i = 0; i < n_colors; i++) {
|
81
|
+
rb_ary_push(ary, GDKCOLOR2RVAL(&gcolors[i]));
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
return ary;
|
86
|
+
}
|
87
|
+
|
88
|
+
static VALUE
|
89
|
+
colorsel_s_palette_to_string(argc, argv, self)
|
90
|
+
int argc;
|
91
|
+
VALUE* argv;
|
92
|
+
VALUE self;
|
93
|
+
{
|
94
|
+
GdkColor* gcolors;
|
95
|
+
GdkColor* gcolor;
|
96
|
+
VALUE colors;
|
97
|
+
gint i, len;
|
98
|
+
|
99
|
+
if (argc > 1) {
|
100
|
+
rb_scan_args(argc, argv, "*", &colors);
|
101
|
+
} else {
|
102
|
+
rb_scan_args(argc, argv, "10", &colors);
|
103
|
+
}
|
104
|
+
|
105
|
+
len = RARRAY_LEN(colors);
|
106
|
+
gcolors = ALLOCA_N(GdkColor, len);
|
107
|
+
|
108
|
+
for (i = 0; i < len; i++) {
|
109
|
+
gcolor = RVAL2GDKCOLOR(RARRAY_PTR(colors)[i]);
|
110
|
+
gcolors[i] = *gcolor;
|
111
|
+
}
|
112
|
+
|
113
|
+
return CSTR2RVAL(gtk_color_selection_palette_to_string((const GdkColor*)gcolors, len));
|
114
|
+
}
|
115
|
+
|
116
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
117
|
+
static void
|
118
|
+
screen_func(screen, colors, n_colors)
|
119
|
+
GdkScreen* screen;
|
120
|
+
const GdkColor* colors;
|
121
|
+
gint n_colors;
|
122
|
+
{
|
123
|
+
int i;
|
124
|
+
VALUE func = rb_cvar_get(gColorSel, rb_intern("__palette_proc__"));
|
125
|
+
VALUE ary = rb_ary_new();
|
126
|
+
for (i = 0; i < n_colors; i++){
|
127
|
+
ary = rb_ary_push(ary, GDKCOLOR2RVAL((GdkColor *)&colors[i]));
|
128
|
+
}
|
129
|
+
if (! NIL_P(func))
|
130
|
+
rb_funcall(func, id_call, 2, GOBJ2RVAL(screen), ary);
|
131
|
+
}
|
132
|
+
|
133
|
+
static VALUE
|
134
|
+
colorsel_s_set_change_palette_hook(self)
|
135
|
+
VALUE self;
|
136
|
+
{
|
137
|
+
VALUE func = rb_block_proc();
|
138
|
+
|
139
|
+
rb_cv_set(gColorSel, "__palette_proc__", func);
|
140
|
+
gtk_color_selection_set_change_palette_with_screen_hook(
|
141
|
+
(GtkColorSelectionChangePaletteWithScreenFunc)screen_func);
|
142
|
+
return self;
|
143
|
+
}
|
144
|
+
#endif
|
145
|
+
|
146
|
+
/* Don't implement them.
|
147
|
+
GtkColorSelectionChangePaletteFunc gtk_color_selection_set_change_palette_hook
|
148
|
+
(GtkColorSelectionChangePaletteFunc func);
|
149
|
+
void (*GtkColorSelectionChangePaletteWithScreenFunc)
|
150
|
+
(GdkScreen *screen,
|
151
|
+
const GdkColor *colors,
|
152
|
+
gint n_colors);
|
153
|
+
*/
|
154
|
+
|
155
|
+
void
|
156
|
+
Init_gtk_color_selection()
|
157
|
+
{
|
158
|
+
gColorSel = G_DEF_CLASS(GTK_TYPE_COLOR_SELECTION, "ColorSelection", mGtk);
|
159
|
+
|
160
|
+
rb_define_method(gColorSel, "initialize", colorsel_initialize, 0);
|
161
|
+
rb_define_method(gColorSel, "previous_alpha", colorsel_get_previous_alpha, 0);
|
162
|
+
rb_define_method(gColorSel, "set_previous_alpha", colorsel_set_previous_alpha, 1);
|
163
|
+
rb_define_method(gColorSel, "set_previous_color", colorsel_set_previous_color, 1);
|
164
|
+
rb_define_method(gColorSel, "previous_color", colorsel_get_previous_color, 0);
|
165
|
+
rb_define_method(gColorSel, "adjusting?", colorsel_is_adjusting, 0);
|
166
|
+
|
167
|
+
rb_define_singleton_method(gColorSel, "palette_to_string", colorsel_s_palette_to_string, -1);
|
168
|
+
rb_define_singleton_method(gColorSel, "palette_from_string", colorsel_s_palette_from_string, 1);
|
169
|
+
|
170
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
171
|
+
rb_define_singleton_method(gColorSel, "set_change_palette_hook", colorsel_s_set_change_palette_hook, 0);
|
172
|
+
#endif
|
173
|
+
|
174
|
+
G_DEF_SETTERS(gColorSel);
|
175
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcolorselectiondialog.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2003/01/19 14:28:24 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 Masao Mutoh
|
10
|
+
|
11
|
+
This file is devided from rbgtkcolorsel.c.
|
12
|
+
rbgtkcolorsel.c:
|
13
|
+
Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
14
|
+
Daisuke Kanda,
|
15
|
+
Hiroshi Igarashi
|
16
|
+
************************************************/
|
17
|
+
#include "global.h"
|
18
|
+
|
19
|
+
#define _SELF(s) (GTK_COLOR_SELECTION_DIALOG(RVAL2GOBJ(s)))
|
20
|
+
|
21
|
+
static VALUE
|
22
|
+
cdialog_initialize(argc, argv, self)
|
23
|
+
int argc;
|
24
|
+
VALUE *argv;
|
25
|
+
VALUE self;
|
26
|
+
{
|
27
|
+
VALUE title;
|
28
|
+
rb_scan_args(argc, argv, "01", &title);
|
29
|
+
RBGTK_INITIALIZE(self, gtk_color_selection_dialog_new(NIL_P(title) ? NULL : RVAL2CSTR(title)));
|
30
|
+
return Qnil;
|
31
|
+
}
|
32
|
+
|
33
|
+
static VALUE
|
34
|
+
cdialog_get_colorsel(self)
|
35
|
+
VALUE self;
|
36
|
+
{
|
37
|
+
return GOBJ2RVAL(_SELF(self)->colorsel);
|
38
|
+
}
|
39
|
+
|
40
|
+
static VALUE
|
41
|
+
cdialog_get_ok_button(self)
|
42
|
+
VALUE self;
|
43
|
+
{
|
44
|
+
return GOBJ2RVAL(_SELF(self)->ok_button);
|
45
|
+
}
|
46
|
+
|
47
|
+
static VALUE
|
48
|
+
cdialog_get_cancel_button(self)
|
49
|
+
VALUE self;
|
50
|
+
{
|
51
|
+
return GOBJ2RVAL(_SELF(self)->cancel_button);
|
52
|
+
}
|
53
|
+
|
54
|
+
static VALUE
|
55
|
+
cdialog_get_help_button(self)
|
56
|
+
VALUE self;
|
57
|
+
{
|
58
|
+
return GOBJ2RVAL(_SELF(self)->help_button);
|
59
|
+
}
|
60
|
+
|
61
|
+
void
|
62
|
+
Init_gtk_color_selection_dialog()
|
63
|
+
{
|
64
|
+
VALUE gColorSelDialog = G_DEF_CLASS(GTK_TYPE_COLOR_SELECTION_DIALOG,
|
65
|
+
"ColorSelectionDialog", mGtk);
|
66
|
+
|
67
|
+
rb_define_method(gColorSelDialog, "initialize", cdialog_initialize, -1);
|
68
|
+
rb_define_method(gColorSelDialog, "colorsel", cdialog_get_colorsel, 0);
|
69
|
+
rb_define_method(gColorSelDialog, "ok_button", cdialog_get_ok_button, 0);
|
70
|
+
rb_define_method(gColorSelDialog, "cancel_button", cdialog_get_cancel_button, 0);
|
71
|
+
rb_define_method(gColorSelDialog, "help_button", cdialog_get_help_button, 0);
|
72
|
+
}
|
data/src/rbgtkcombo.c
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcombo.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
|
+
#ifndef GTK_DISABLE_DEPRECATED /* Since 2.4 */
|
18
|
+
|
19
|
+
static VALUE
|
20
|
+
combo_set_popdown_strings(self, ary)
|
21
|
+
VALUE self, ary;
|
22
|
+
{
|
23
|
+
int i;
|
24
|
+
GList *glist = NULL;
|
25
|
+
|
26
|
+
Check_Type(ary, T_ARRAY);
|
27
|
+
for (i=0; i<RARRAY_LEN(ary); i++) {
|
28
|
+
glist = g_list_append(glist, RVAL2CSTR(RARRAY_PTR(ary)[i]));
|
29
|
+
}
|
30
|
+
gtk_combo_set_popdown_strings(GTK_COMBO(RVAL2GOBJ(self)), glist);
|
31
|
+
g_list_free(glist);
|
32
|
+
return self;
|
33
|
+
}
|
34
|
+
|
35
|
+
static VALUE
|
36
|
+
combo_initialize(argc, argv, self)
|
37
|
+
int argc;
|
38
|
+
VALUE *argv;
|
39
|
+
VALUE self;
|
40
|
+
{
|
41
|
+
VALUE ary;
|
42
|
+
GtkWidget* widget = NULL;
|
43
|
+
|
44
|
+
rb_scan_args(argc, argv, "01", &ary);
|
45
|
+
widget = gtk_combo_new();
|
46
|
+
|
47
|
+
RBGTK_INITIALIZE(self, widget);
|
48
|
+
|
49
|
+
if (! NIL_P(ary)){
|
50
|
+
combo_set_popdown_strings(self, ary);
|
51
|
+
}
|
52
|
+
|
53
|
+
return Qnil;
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
combo_set_val_in_list(self, val, ok)
|
58
|
+
VALUE self, val, ok;
|
59
|
+
{
|
60
|
+
gtk_combo_set_value_in_list(GTK_COMBO(RVAL2GOBJ(self)),
|
61
|
+
RVAL2CBOOL(val), RVAL2CBOOL(ok));
|
62
|
+
return self;
|
63
|
+
}
|
64
|
+
|
65
|
+
static VALUE
|
66
|
+
combo_set_use_arrows(self, val)
|
67
|
+
VALUE self, val;
|
68
|
+
{
|
69
|
+
gtk_combo_set_use_arrows(GTK_COMBO(RVAL2GOBJ(self)),
|
70
|
+
RVAL2CBOOL(val));
|
71
|
+
return self;
|
72
|
+
}
|
73
|
+
|
74
|
+
static VALUE
|
75
|
+
combo_set_use_arrows_always(self, val)
|
76
|
+
VALUE self, val;
|
77
|
+
{
|
78
|
+
gtk_combo_set_use_arrows_always(GTK_COMBO(RVAL2GOBJ(self)),
|
79
|
+
RVAL2CBOOL(val));
|
80
|
+
return self;
|
81
|
+
}
|
82
|
+
|
83
|
+
static VALUE
|
84
|
+
combo_disable_activate(self)
|
85
|
+
VALUE self;
|
86
|
+
{
|
87
|
+
gtk_combo_disable_activate(GTK_COMBO(RVAL2GOBJ(self)));
|
88
|
+
return self;
|
89
|
+
}
|
90
|
+
|
91
|
+
static VALUE
|
92
|
+
combo_entry(self)
|
93
|
+
VALUE self;
|
94
|
+
{
|
95
|
+
return GOBJ2RVAL(GTK_COMBO(RVAL2GOBJ(self))->entry);
|
96
|
+
}
|
97
|
+
#endif
|
98
|
+
|
99
|
+
void
|
100
|
+
Init_gtk_combo()
|
101
|
+
{
|
102
|
+
#ifndef GTK_DISABLE_DEPRECATED /* Since 2.4 */
|
103
|
+
VALUE gCombo = G_DEF_CLASS(GTK_TYPE_COMBO, "Combo", mGtk);
|
104
|
+
|
105
|
+
rb_define_method(gCombo, "initialize", combo_initialize, -1);
|
106
|
+
rb_define_method(gCombo, "set_value_in_list", combo_set_val_in_list, 2);
|
107
|
+
rb_define_method(gCombo, "set_use_arrows", combo_set_use_arrows, 1);
|
108
|
+
rb_define_method(gCombo, "set_use_arrows_always", combo_set_use_arrows_always, 1);
|
109
|
+
rb_define_method(gCombo, "set_popdown_strings", combo_set_popdown_strings, 1);
|
110
|
+
rb_define_method(gCombo, "disable_activate", combo_disable_activate, 0);
|
111
|
+
|
112
|
+
rb_define_method(gCombo, "entry", combo_entry, 0);
|
113
|
+
|
114
|
+
G_DEF_SETTERS(gCombo);
|
115
|
+
#endif
|
116
|
+
}
|
117
|
+
|
data/src/rbgtkcombobox.c
ADDED
@@ -0,0 +1,240 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkcombobox.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:31 $
|
8
|
+
|
9
|
+
Copyright (C) 2004 Masao Mutoh
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
15
|
+
|
16
|
+
#define _SELF(self) (GTK_COMBO_BOX(RVAL2GOBJ(self)))
|
17
|
+
#define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w)))
|
18
|
+
|
19
|
+
static VALUE
|
20
|
+
combobox_initialize(argc, argv, self)
|
21
|
+
int argc;
|
22
|
+
VALUE* argv;
|
23
|
+
VALUE self;
|
24
|
+
{
|
25
|
+
VALUE model_or_false;
|
26
|
+
GtkWidget* widget;
|
27
|
+
|
28
|
+
rb_scan_args(argc, argv, "01", &model_or_false);
|
29
|
+
|
30
|
+
if (rb_obj_is_kind_of(model_or_false, GTYPE2CLASS(GTK_TYPE_TREE_MODEL))){
|
31
|
+
widget = gtk_combo_box_new_with_model(GTK_TREE_MODEL(RVAL2GOBJ(model_or_false)));
|
32
|
+
} else if (NIL_P(model_or_false) || TYPE(model_or_false) == T_TRUE){
|
33
|
+
widget = gtk_combo_box_new_text();
|
34
|
+
} else if (TYPE(model_or_false) == T_FALSE){
|
35
|
+
widget = gtk_combo_box_new();
|
36
|
+
} else {
|
37
|
+
rb_raise(rb_eArgError, "invalid 2nd argument %s (except true/false or Gtk::TreeModel)",
|
38
|
+
rb_class2name(CLASS_OF(model_or_false)));
|
39
|
+
}
|
40
|
+
|
41
|
+
RBGTK_INITIALIZE(self, widget);
|
42
|
+
return Qnil;
|
43
|
+
}
|
44
|
+
|
45
|
+
/* Defined as properties.
|
46
|
+
void gtk_combo_box_set_wrap_width (GtkComboBox *combo_box,
|
47
|
+
gint width);
|
48
|
+
void gtk_combo_box_set_row_span_column
|
49
|
+
(GtkComboBox *combo_box,
|
50
|
+
gint row_span);
|
51
|
+
void gtk_combo_box_set_column_span_column
|
52
|
+
(GtkComboBox *combo_box,
|
53
|
+
gint column_span);
|
54
|
+
gint gtk_combo_box_get_active (GtkComboBox *combo_box);
|
55
|
+
void gtk_combo_box_set_active (GtkComboBox *combo_box,
|
56
|
+
gint index);
|
57
|
+
*/
|
58
|
+
|
59
|
+
static VALUE
|
60
|
+
combobox_get_active_iter(self)
|
61
|
+
VALUE self;
|
62
|
+
{
|
63
|
+
GtkTreeIter iter;
|
64
|
+
VALUE val = Qnil;
|
65
|
+
gboolean ret = gtk_combo_box_get_active_iter(_SELF(self), &iter);
|
66
|
+
if (ret){
|
67
|
+
iter.user_data3 = (gpointer)gtk_combo_box_get_model(_SELF(self));
|
68
|
+
val = BOXED2RVAL(&iter, GTK_TYPE_TREE_ITER);
|
69
|
+
}
|
70
|
+
return val;
|
71
|
+
}
|
72
|
+
|
73
|
+
static VALUE
|
74
|
+
combobox_set_active_iter(self, iter)
|
75
|
+
VALUE self, iter;
|
76
|
+
{
|
77
|
+
gtk_combo_box_set_active_iter(_SELF(self), RVAL2GTKTREEITER(iter));
|
78
|
+
return self;
|
79
|
+
}
|
80
|
+
|
81
|
+
/* Defined as properties
|
82
|
+
GtkTreeModel* gtk_combo_box_get_model (GtkComboBox *combo_box);
|
83
|
+
void gtk_combo_box_set_model (GtkComboBox *combo_box,
|
84
|
+
GtkTreeModel *model);
|
85
|
+
*/
|
86
|
+
|
87
|
+
|
88
|
+
static VALUE
|
89
|
+
combobox_append_text(self, text)
|
90
|
+
VALUE self, text;
|
91
|
+
{
|
92
|
+
gtk_combo_box_append_text(_SELF(self), RVAL2CSTR(text));
|
93
|
+
return self;
|
94
|
+
}
|
95
|
+
|
96
|
+
static VALUE
|
97
|
+
combobox_insert_text(self, position, text)
|
98
|
+
VALUE self, position, text;
|
99
|
+
{
|
100
|
+
gtk_combo_box_insert_text(_SELF(self), NUM2INT(position), RVAL2CSTR(text));
|
101
|
+
return self;
|
102
|
+
}
|
103
|
+
|
104
|
+
static VALUE
|
105
|
+
combobox_prepend_text(self, text)
|
106
|
+
VALUE self, text;
|
107
|
+
{
|
108
|
+
gtk_combo_box_prepend_text(_SELF(self), RVAL2CSTR(text));
|
109
|
+
return self;
|
110
|
+
}
|
111
|
+
|
112
|
+
static VALUE
|
113
|
+
combobox_remove_text(self, position)
|
114
|
+
VALUE self, position;
|
115
|
+
{
|
116
|
+
gtk_combo_box_remove_text(_SELF(self), NUM2INT(position));
|
117
|
+
return self;
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
static VALUE
|
122
|
+
combobox_popup(self)
|
123
|
+
VALUE self;
|
124
|
+
{
|
125
|
+
gtk_combo_box_popup(_SELF(self));
|
126
|
+
return self;
|
127
|
+
}
|
128
|
+
|
129
|
+
static VALUE
|
130
|
+
combobox_popdown(self)
|
131
|
+
VALUE self;
|
132
|
+
{
|
133
|
+
gtk_combo_box_popdown(_SELF(self));
|
134
|
+
return self;
|
135
|
+
}
|
136
|
+
|
137
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
138
|
+
/* Defined as Property
|
139
|
+
void gtk_combo_box_set_add_tearoffs (GtkComboBox *combo_box,
|
140
|
+
gboolean add_tearoffs);
|
141
|
+
gboolean gtk_combo_box_get_add_tearoffs (GtkComboBox *combo_box);
|
142
|
+
gint gtk_combo_box_get_column_span_column
|
143
|
+
(GtkComboBox *combo_box);
|
144
|
+
gint gtk_combo_box_get_wrap_width (GtkComboBox *combo_box);
|
145
|
+
|
146
|
+
gboolean gtk_combo_box_get_focus_on_click
|
147
|
+
(GtkComboBox *combo);
|
148
|
+
gint gtk_combo_box_get_row_span_column
|
149
|
+
(GtkComboBox *combo_box);
|
150
|
+
*/
|
151
|
+
|
152
|
+
static VALUE
|
153
|
+
combobox_get_active_text(self)
|
154
|
+
VALUE self;
|
155
|
+
{
|
156
|
+
return CSTR2RVAL2(gtk_combo_box_get_active_text(_SELF(self)));
|
157
|
+
}
|
158
|
+
|
159
|
+
static VALUE
|
160
|
+
combobox_get_popup_accessible(self)
|
161
|
+
VALUE self;
|
162
|
+
{
|
163
|
+
return GOBJ2RVAL(gtk_combo_box_get_popup_accessible(_SELF(self)));
|
164
|
+
}
|
165
|
+
|
166
|
+
/* How can I implement this?
|
167
|
+
GtkTreeViewRowSeparatorFunc gtk_combo_box_get_row_separator_func
|
168
|
+
(GtkComboBox *combo_box);
|
169
|
+
*/
|
170
|
+
|
171
|
+
static gboolean
|
172
|
+
row_separator_func(model, iter, func)
|
173
|
+
GtkTreeModel* model;
|
174
|
+
GtkTreeIter* iter;
|
175
|
+
gpointer* func;
|
176
|
+
{
|
177
|
+
iter->user_data3 = model;
|
178
|
+
return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(model),
|
179
|
+
GTKTREEITER2RVAL(iter)));
|
180
|
+
}
|
181
|
+
|
182
|
+
static VALUE
|
183
|
+
combobox_set_row_separator_func(self)
|
184
|
+
VALUE self;
|
185
|
+
{
|
186
|
+
VALUE func = rb_block_proc();
|
187
|
+
G_RELATIVE(self, func);
|
188
|
+
gtk_combo_box_set_row_separator_func(_SELF(self),
|
189
|
+
(GtkTreeViewRowSeparatorFunc)row_separator_func,
|
190
|
+
(gpointer)func, NULL);
|
191
|
+
return self;
|
192
|
+
}
|
193
|
+
|
194
|
+
/* This calls g_object_notify(combo, "focus_on_click");
|
195
|
+
If you want to set "focus_on_click" property only,
|
196
|
+
call GLib::Object.set_property.
|
197
|
+
*/
|
198
|
+
static VALUE
|
199
|
+
combobox_set_focus_on_click(self, val)
|
200
|
+
VALUE self, val;
|
201
|
+
{
|
202
|
+
gtk_combo_box_set_focus_on_click(_SELF(self), RVAL2CBOOL(val));
|
203
|
+
return self;
|
204
|
+
}
|
205
|
+
|
206
|
+
#endif
|
207
|
+
#endif
|
208
|
+
|
209
|
+
/* Defined as Properties
|
210
|
+
void gtk_combo_box_set_title (GtkComboBox *combo_box,
|
211
|
+
const gchar *title);
|
212
|
+
const gchar* gtk_combo_box_get_title (GtkComboBox *combo_box);
|
213
|
+
*/
|
214
|
+
|
215
|
+
void
|
216
|
+
Init_gtk_combobox()
|
217
|
+
{
|
218
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
219
|
+
VALUE gCombobox = G_DEF_CLASS(GTK_TYPE_COMBO_BOX, "ComboBox", mGtk);
|
220
|
+
|
221
|
+
rb_define_method(gCombobox, "initialize", combobox_initialize, -1);
|
222
|
+
rb_define_method(gCombobox, "active_iter", combobox_get_active_iter, 0);
|
223
|
+
rb_define_method(gCombobox, "set_active_iter", combobox_set_active_iter, 1);
|
224
|
+
rb_define_method(gCombobox, "append_text", combobox_append_text, 1);
|
225
|
+
rb_define_method(gCombobox, "insert_text", combobox_insert_text, 2);
|
226
|
+
rb_define_method(gCombobox, "prepend_text", combobox_prepend_text, 1);
|
227
|
+
rb_define_method(gCombobox, "remove_text", combobox_remove_text, 1);
|
228
|
+
rb_define_method(gCombobox, "popup", combobox_popup, 0);
|
229
|
+
rb_define_method(gCombobox, "popdown", combobox_popdown, 0);
|
230
|
+
|
231
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
232
|
+
rb_define_method(gCombobox, "active_text", combobox_get_active_text, 0);
|
233
|
+
rb_define_method(gCombobox, "popup_accessible", combobox_get_popup_accessible, 0);
|
234
|
+
rb_define_method(gCombobox, "set_row_separator_func", combobox_set_row_separator_func, 0);
|
235
|
+
rb_define_method(gCombobox, "set_focus_on_click", combobox_set_focus_on_click, 1);
|
236
|
+
#endif
|
237
|
+
|
238
|
+
G_DEF_SETTERS(gCombobox);
|
239
|
+
#endif
|
240
|
+
}
|