gtk2 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/rbgtkiconview.c
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
|
+
/************************************************
|
|
3
|
+
|
|
4
|
+
rbgtkiconview.c -
|
|
5
|
+
|
|
6
|
+
$Author: ggc $
|
|
7
|
+
$Date: 2007/07/13 16:07:31 $
|
|
8
|
+
|
|
9
|
+
Copyright (C) 2005 Masao Mutoh
|
|
10
|
+
************************************************/
|
|
11
|
+
|
|
12
|
+
#include "global.h"
|
|
13
|
+
|
|
14
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
|
15
|
+
|
|
16
|
+
#define _SELF(s) (GTK_ICON_VIEW(RVAL2GOBJ(s)))
|
|
17
|
+
|
|
18
|
+
static ID id_model;
|
|
19
|
+
static ID id_select_path;
|
|
20
|
+
|
|
21
|
+
static VALUE
|
|
22
|
+
iview_initialize(argc, argv, self)
|
|
23
|
+
int argc;
|
|
24
|
+
VALUE *argv;
|
|
25
|
+
VALUE self;
|
|
26
|
+
{
|
|
27
|
+
VALUE model;
|
|
28
|
+
rb_scan_args(argc, argv, "01", &model);
|
|
29
|
+
if (NIL_P(model)){
|
|
30
|
+
RBGTK_INITIALIZE(self, gtk_icon_view_new());
|
|
31
|
+
} else {
|
|
32
|
+
G_CHILD_SET(self, id_model, model);
|
|
33
|
+
RBGTK_INITIALIZE(self,
|
|
34
|
+
gtk_icon_view_new_with_model(GTK_TREE_MODEL(RVAL2GOBJ(model))));
|
|
35
|
+
}
|
|
36
|
+
return Qnil;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Defined as Properties
|
|
40
|
+
void gtk_icon_view_set_model (GtkIconView *icon_view,
|
|
41
|
+
GtkTreeModel *model);
|
|
42
|
+
GtkTreeModel* gtk_icon_view_get_model (GtkIconView *icon_view);
|
|
43
|
+
void gtk_icon_view_set_text_column (GtkIconView *icon_view,
|
|
44
|
+
gint column);
|
|
45
|
+
gint gtk_icon_view_get_text_column (GtkIconView *icon_view);
|
|
46
|
+
void gtk_icon_view_set_markup_column (GtkIconView *icon_view,
|
|
47
|
+
gint column);
|
|
48
|
+
gint gtk_icon_view_get_markup_column (GtkIconView *icon_view);
|
|
49
|
+
void gtk_icon_view_set_pixbuf_column (GtkIconView *icon_view,
|
|
50
|
+
gint column);
|
|
51
|
+
gint gtk_icon_view_get_pixbuf_column (GtkIconView *icon_view);
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
static VALUE
|
|
55
|
+
iview_get_path_at_pos(VALUE self, VALUE x, VALUE y)
|
|
56
|
+
{
|
|
57
|
+
return GTKTREEPATH2RVAL(gtk_icon_view_get_path_at_pos(_SELF(self), NUM2INT(x), NUM2INT(y)));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static void
|
|
61
|
+
iview_foreach_func(iview, path, func)
|
|
62
|
+
GtkIconView* iview;
|
|
63
|
+
GtkTreePath* path;
|
|
64
|
+
gpointer* func;
|
|
65
|
+
{
|
|
66
|
+
rb_funcall((VALUE)func, id_call, 2, GOBJ2RVAL(iview), GTKTREEPATH2RVAL(path));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static VALUE
|
|
70
|
+
iview_selected_foreach(self)
|
|
71
|
+
VALUE self;
|
|
72
|
+
{
|
|
73
|
+
VALUE func = rb_block_proc();
|
|
74
|
+
G_RELATIVE(self, func);
|
|
75
|
+
gtk_icon_view_selected_foreach(_SELF(self),
|
|
76
|
+
(GtkIconViewForeachFunc)iview_foreach_func,
|
|
77
|
+
(gpointer)func);
|
|
78
|
+
return self;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Defined as Properties
|
|
82
|
+
void gtk_icon_view_set_selection_mode
|
|
83
|
+
(GtkIconView *icon_view,
|
|
84
|
+
GtkSelectionMode mode);
|
|
85
|
+
GtkSelectionMode gtk_icon_view_get_selection_mode
|
|
86
|
+
(GtkIconView *icon_view);
|
|
87
|
+
void gtk_icon_view_set_orientation (GtkIconView *icon_view,
|
|
88
|
+
GtkOrientation orientation);
|
|
89
|
+
GtkOrientation gtk_icon_view_get_orientation
|
|
90
|
+
(GtkIconView *icon_view);
|
|
91
|
+
void gtk_icon_view_set_columns (GtkIconView *icon_view,
|
|
92
|
+
gint columns);
|
|
93
|
+
gint gtk_icon_view_get_columns (GtkIconView *icon_view);
|
|
94
|
+
void gtk_icon_view_set_item_width (GtkIconView *icon_view,
|
|
95
|
+
gint item_width);
|
|
96
|
+
gint gtk_icon_view_get_item_width (GtkIconView *icon_view);
|
|
97
|
+
void gtk_icon_view_set_spacing (GtkIconView *icon_view,
|
|
98
|
+
gint spacing);
|
|
99
|
+
gint gtk_icon_view_get_spacing (GtkIconView *icon_view);
|
|
100
|
+
void gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
|
|
101
|
+
gint row_spacing);
|
|
102
|
+
gint gtk_icon_view_get_row_spacing (GtkIconView *icon_view);
|
|
103
|
+
void gtk_icon_view_set_column_spacing
|
|
104
|
+
(GtkIconView *icon_view,
|
|
105
|
+
gint column_spacing);
|
|
106
|
+
gint gtk_icon_view_get_column_spacing
|
|
107
|
+
(GtkIconView *icon_view);
|
|
108
|
+
void gtk_icon_view_set_margin (GtkIconView *icon_view,
|
|
109
|
+
gint margin);
|
|
110
|
+
gint gtk_icon_view_get_margin (GtkIconView *icon_view);
|
|
111
|
+
void gtk_icon_view_set_reorderable (GtkIconView *icon_view,
|
|
112
|
+
gboolean reorderable);
|
|
113
|
+
gboolean gtk_icon_view_get_reorderable (GtkIconView *icon_view);
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
static VALUE
|
|
117
|
+
iview_select_path(self, path)
|
|
118
|
+
VALUE self, path;
|
|
119
|
+
{
|
|
120
|
+
G_CHILD_SET(self, id_select_path, path);
|
|
121
|
+
gtk_icon_view_select_path(_SELF(self), RVAL2GTKTREEPATH(path));
|
|
122
|
+
return self;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
static VALUE
|
|
126
|
+
iview_unselect_path(self, path)
|
|
127
|
+
VALUE self, path;
|
|
128
|
+
{
|
|
129
|
+
G_CHILD_UNSET(self, id_select_path);
|
|
130
|
+
gtk_icon_view_unselect_path(_SELF(self), RVAL2GTKTREEPATH(path));
|
|
131
|
+
return self;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static VALUE
|
|
135
|
+
iview_path_is_selected(self, path)
|
|
136
|
+
VALUE self, path;
|
|
137
|
+
{
|
|
138
|
+
return CBOOL2RVAL(gtk_icon_view_path_is_selected(_SELF(self), RVAL2GTKTREEPATH(path)));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static VALUE
|
|
142
|
+
iview_get_selected_items(self)
|
|
143
|
+
VALUE self;
|
|
144
|
+
{
|
|
145
|
+
GList* list = gtk_icon_view_get_selected_items(_SELF(self));
|
|
146
|
+
VALUE ret = GLIST2ARY2(list, GTK_TYPE_TREE_PATH);
|
|
147
|
+
g_list_foreach(list, (GFunc)gtk_tree_path_free, NULL);
|
|
148
|
+
g_list_free(list);
|
|
149
|
+
return ret;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
static VALUE
|
|
153
|
+
iview_select_all(self)
|
|
154
|
+
VALUE self;
|
|
155
|
+
{
|
|
156
|
+
gtk_icon_view_select_all(_SELF(self));
|
|
157
|
+
return self;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static VALUE
|
|
161
|
+
iview_unselect_all(self)
|
|
162
|
+
VALUE self;
|
|
163
|
+
{
|
|
164
|
+
gtk_icon_view_unselect_all(_SELF(self));
|
|
165
|
+
return self;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
static VALUE
|
|
169
|
+
iview_item_activated(self, path)
|
|
170
|
+
VALUE self, path;
|
|
171
|
+
{
|
|
172
|
+
gtk_icon_view_item_activated(_SELF(self), RVAL2GTKTREEPATH(path));
|
|
173
|
+
return self;
|
|
174
|
+
}
|
|
175
|
+
#endif
|
|
176
|
+
|
|
177
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
|
178
|
+
static VALUE
|
|
179
|
+
iview_create_drag_icon(self, path)
|
|
180
|
+
VALUE self, path;
|
|
181
|
+
{
|
|
182
|
+
return GOBJ2RVAL(gtk_icon_view_create_drag_icon(_SELF(self), RVAL2GTKTREEPATH(path)));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
static VALUE
|
|
186
|
+
iview_enable_model_drag_dest(self, targets, actions)
|
|
187
|
+
VALUE self, targets, actions;
|
|
188
|
+
{
|
|
189
|
+
gtk_icon_view_enable_model_drag_dest(_SELF(self),
|
|
190
|
+
rbgtk_get_target_entry(targets),
|
|
191
|
+
RARRAY_LEN(targets),
|
|
192
|
+
RVAL2GFLAGS(actions, GDK_TYPE_DRAG_ACTION));
|
|
193
|
+
return self;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
static VALUE
|
|
197
|
+
iview_enable_model_drag_source(self, flags, targets, actions)
|
|
198
|
+
VALUE self, flags, targets, actions;
|
|
199
|
+
{
|
|
200
|
+
gtk_icon_view_enable_model_drag_source(_SELF(self),
|
|
201
|
+
RVAL2GFLAGS(flags, GDK_TYPE_MODIFIER_TYPE),
|
|
202
|
+
rbgtk_get_target_entry(targets),
|
|
203
|
+
RARRAY_LEN(targets),
|
|
204
|
+
RVAL2GFLAGS(actions, GDK_TYPE_DRAG_ACTION));
|
|
205
|
+
return self;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
static VALUE
|
|
209
|
+
iview_cursor(self)
|
|
210
|
+
VALUE self;
|
|
211
|
+
{
|
|
212
|
+
GtkTreePath* path;
|
|
213
|
+
GtkCellRenderer* cell;
|
|
214
|
+
gboolean cursor_set = gtk_icon_view_get_cursor(_SELF(self), &path, &cell);
|
|
215
|
+
return cursor_set ? rb_assoc_new(GTKTREEPATH2RVAL(path), GOBJ2RVAL(cell)) : Qnil;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
static VALUE
|
|
219
|
+
iview_get_dest_item_at_pos(self, drag_x, drag_y)
|
|
220
|
+
VALUE self, drag_x, drag_y;
|
|
221
|
+
{
|
|
222
|
+
GtkTreePath* path;
|
|
223
|
+
GtkIconViewDropPosition pos;
|
|
224
|
+
gboolean item_at_pos = gtk_icon_view_get_dest_item_at_pos(_SELF(self), NUM2INT(drag_x), NUM2INT(drag_y), &path, &pos);
|
|
225
|
+
return item_at_pos ? rb_assoc_new(GTKTREEPATH2RVAL(path),
|
|
226
|
+
GENUM2RVAL(pos, GTK_TYPE_ICON_VIEW_DROP_POSITION)) : Qnil;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
static VALUE
|
|
230
|
+
iview_drag_dest_item(self)
|
|
231
|
+
VALUE self;
|
|
232
|
+
{
|
|
233
|
+
GtkTreePath* path;
|
|
234
|
+
GtkIconViewDropPosition pos;
|
|
235
|
+
gtk_icon_view_get_drag_dest_item(_SELF(self), &path, &pos);
|
|
236
|
+
return rb_assoc_new(GTKTREEPATH2RVAL(path),
|
|
237
|
+
GENUM2RVAL(pos, GTK_TYPE_ICON_VIEW_DROP_POSITION));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
static VALUE
|
|
241
|
+
iview_get_item_at_pos(self, x, y)
|
|
242
|
+
VALUE self, x, y;
|
|
243
|
+
{
|
|
244
|
+
GtkTreePath* path;
|
|
245
|
+
GtkCellRenderer* cell;
|
|
246
|
+
gboolean item_at_pos = gtk_icon_view_get_item_at_pos(_SELF(self), NUM2INT(x), NUM2INT(y), &path, &cell);
|
|
247
|
+
return item_at_pos ? rb_assoc_new(GTKTREEPATH2RVAL(path), GOBJ2RVAL(cell)) : Qnil;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
static VALUE
|
|
251
|
+
iview_visible_range(self)
|
|
252
|
+
VALUE self;
|
|
253
|
+
{
|
|
254
|
+
GtkTreePath* start_path;
|
|
255
|
+
GtkTreePath* end_path;
|
|
256
|
+
|
|
257
|
+
gboolean valid_paths = gtk_icon_view_get_visible_range(_SELF(self), &start_path, &end_path);
|
|
258
|
+
|
|
259
|
+
return valid_paths ? rb_assoc_new(GTKTREEPATH2RVAL(start_path),
|
|
260
|
+
GTKTREEPATH2RVAL(end_path)) : Qnil;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
static VALUE
|
|
264
|
+
iview_scroll_to_path(self, path, use_align, row_align, col_align)
|
|
265
|
+
VALUE self, path, use_align, row_align, col_align;
|
|
266
|
+
{
|
|
267
|
+
gtk_icon_view_scroll_to_path(_SELF(self),
|
|
268
|
+
RVAL2GTKTREEPATH(path),
|
|
269
|
+
RVAL2CBOOL(use_align),
|
|
270
|
+
NUM2DBL(row_align),
|
|
271
|
+
NUM2DBL(col_align));
|
|
272
|
+
return self;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
static VALUE
|
|
276
|
+
iview_set_cursor(self, path, cell, start_editing)
|
|
277
|
+
VALUE self, path, cell, start_editing;
|
|
278
|
+
{
|
|
279
|
+
gtk_icon_view_set_cursor(_SELF(self), RVAL2GTKTREEPATH(path),
|
|
280
|
+
NIL_P(cell) ? NULL : RVAL2GOBJ(cell), RVAL2CBOOL(start_editing));
|
|
281
|
+
return self;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
static VALUE
|
|
285
|
+
iview_set_drag_dest_item(self, path, pos)
|
|
286
|
+
VALUE self, path, pos;
|
|
287
|
+
{
|
|
288
|
+
gtk_icon_view_set_drag_dest_item(_SELF(self),
|
|
289
|
+
NIL_P(path) ? NULL : RVAL2GTKTREEPATH(path),
|
|
290
|
+
RVAL2GENUM(pos, GTK_TYPE_ICON_VIEW_DROP_POSITION));
|
|
291
|
+
return self;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
static VALUE
|
|
295
|
+
iview_unset_model_drag_dest(self)
|
|
296
|
+
VALUE self;
|
|
297
|
+
{
|
|
298
|
+
gtk_icon_view_unset_model_drag_dest(_SELF(self));
|
|
299
|
+
return self;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
static VALUE
|
|
303
|
+
iview_unset_model_drag_source(self)
|
|
304
|
+
VALUE self;
|
|
305
|
+
{
|
|
306
|
+
gtk_icon_view_unset_model_drag_source(_SELF(self));
|
|
307
|
+
return self;
|
|
308
|
+
}
|
|
309
|
+
#endif
|
|
310
|
+
|
|
311
|
+
void
|
|
312
|
+
Init_gtk_iconview()
|
|
313
|
+
{
|
|
314
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
|
315
|
+
VALUE iview = G_DEF_CLASS(GTK_TYPE_ICON_VIEW, "IconView", mGtk);
|
|
316
|
+
|
|
317
|
+
id_model = rb_intern("model");
|
|
318
|
+
id_select_path = rb_intern("select_path");
|
|
319
|
+
|
|
320
|
+
rb_define_method(iview, "initialize", iview_initialize, -1);
|
|
321
|
+
rb_define_method(iview, "get_path_at_pos", iview_get_path_at_pos, 2);
|
|
322
|
+
rb_define_alias(iview, "get_path", "get_path_at_pos");
|
|
323
|
+
rb_define_method(iview, "selected_each", iview_selected_foreach, 0);
|
|
324
|
+
rb_define_method(iview, "select_path", iview_select_path, 1);
|
|
325
|
+
rb_define_method(iview, "unselect_path", iview_unselect_path, 1);
|
|
326
|
+
rb_define_method(iview, "path_is_selected?", iview_path_is_selected, 1);
|
|
327
|
+
rb_define_method(iview, "selected_items", iview_get_selected_items, 0);
|
|
328
|
+
rb_define_method(iview, "select_all", iview_select_all, 0);
|
|
329
|
+
rb_define_method(iview, "unselect_all", iview_unselect_all, 0);
|
|
330
|
+
rb_define_method(iview, "item_activated", iview_item_activated, 1);
|
|
331
|
+
#endif
|
|
332
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
|
333
|
+
rb_define_method(iview, "create_drag_icon", iview_create_drag_icon, 1);
|
|
334
|
+
rb_define_method(iview, "enable_model_drag_dest", iview_enable_model_drag_dest, 2);
|
|
335
|
+
rb_define_method(iview, "enable_model_drag_source", iview_enable_model_drag_source, 3);
|
|
336
|
+
rb_define_method(iview, "cursor", iview_cursor, 0);
|
|
337
|
+
rb_define_method(iview, "get_dest_item", iview_get_dest_item_at_pos, 2);
|
|
338
|
+
rb_define_method(iview, "drag_dest_item", iview_drag_dest_item, 0);
|
|
339
|
+
rb_define_method(iview, "get_item", iview_get_item_at_pos, 2);
|
|
340
|
+
rb_define_method(iview, "visible_range", iview_visible_range, 0);
|
|
341
|
+
rb_define_method(iview, "scroll_to_path", iview_scroll_to_path, 4);
|
|
342
|
+
rb_define_method(iview, "set_cursor", iview_set_cursor, 3);
|
|
343
|
+
rb_define_method(iview, "set_drag_dest_item", iview_set_drag_dest_item, 2);
|
|
344
|
+
rb_define_method(iview, "unset_model_drag_dest", iview_unset_model_drag_dest, 0);
|
|
345
|
+
rb_define_method(iview, "unset_model_drag_source", iview_unset_model_drag_source, 0);
|
|
346
|
+
|
|
347
|
+
/* GtkIconViewDropPosition */
|
|
348
|
+
G_DEF_CLASS(GTK_TYPE_ICON_VIEW_DROP_POSITION, "Type", iview);
|
|
349
|
+
G_DEF_CONSTANTS(iview, GTK_TYPE_ICON_VIEW_DROP_POSITION, "GTK_ICON_VIEW_");
|
|
350
|
+
#endif
|
|
351
|
+
}
|
data/src/rbgtkimage.c
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
|
2
|
+
/************************************************
|
|
3
|
+
|
|
4
|
+
rbgtkimage.c -
|
|
5
|
+
|
|
6
|
+
$Author: ggc $
|
|
7
|
+
$Date: 2005/09/23 22:02:07 $
|
|
8
|
+
|
|
9
|
+
Copyright (C) 2002-2005 Masao Mutoh
|
|
10
|
+
************************************************/
|
|
11
|
+
|
|
12
|
+
#include "global.h"
|
|
13
|
+
|
|
14
|
+
#define _SELF(s) (GTK_IMAGE(RVAL2GOBJ(s)))
|
|
15
|
+
/*
|
|
16
|
+
Use properties instead.
|
|
17
|
+
void gtk_image_get_icon_set (GtkImage *image,
|
|
18
|
+
GtkIconSet **icon_set,
|
|
19
|
+
GtkIconSize *size);
|
|
20
|
+
void gtk_image_get_image (GtkImage *image,
|
|
21
|
+
GdkImage **gdk_image,
|
|
22
|
+
GdkBitmap **mask);
|
|
23
|
+
GtkImageType gtk_image_get_storage_type (GtkImage *image);
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
static VALUE
|
|
27
|
+
image_initialize(argc, argv, self)
|
|
28
|
+
int argc;
|
|
29
|
+
VALUE *argv;
|
|
30
|
+
VALUE self;
|
|
31
|
+
{
|
|
32
|
+
VALUE arg1, arg2;
|
|
33
|
+
GType gtype;
|
|
34
|
+
GtkWidget* widget = NULL;
|
|
35
|
+
|
|
36
|
+
rb_scan_args(argc, argv, "02", &arg1, &arg2);
|
|
37
|
+
|
|
38
|
+
if (NIL_P(arg1)){
|
|
39
|
+
widget = gtk_image_new();
|
|
40
|
+
} else if (TYPE(arg1) == T_STRING && argc == 1){
|
|
41
|
+
widget = gtk_image_new_from_file(RVAL2CSTR(arg1));
|
|
42
|
+
} else if (TYPE(arg1) == T_SYMBOL){
|
|
43
|
+
widget = gtk_image_new_from_stock(rb_id2name(SYM2ID(arg1)),
|
|
44
|
+
RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE));
|
|
45
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
|
46
|
+
} else if (TYPE(arg1) == T_STRING){
|
|
47
|
+
widget = gtk_image_new_from_icon_name(RVAL2CSTR(arg1),
|
|
48
|
+
RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE));
|
|
49
|
+
#endif
|
|
50
|
+
} else {
|
|
51
|
+
gtype = RVAL2GTYPE(arg1);
|
|
52
|
+
if (gtype == GDK_TYPE_IMAGE){
|
|
53
|
+
widget = gtk_image_new_from_image(GDK_IMAGE(RVAL2GOBJ(arg1)),
|
|
54
|
+
GDK_BITMAP(RVAL2GOBJ(arg2)));
|
|
55
|
+
} else if (gtype == GDK_TYPE_PIXBUF){
|
|
56
|
+
widget = gtk_image_new_from_pixbuf(GDK_PIXBUF(RVAL2GOBJ(arg1)));
|
|
57
|
+
} else if (gtype == GDK_TYPE_PIXMAP){
|
|
58
|
+
widget = gtk_image_new_from_pixmap(GDK_PIXMAP(RVAL2GOBJ(arg1)),
|
|
59
|
+
GDK_BITMAP(RVAL2GOBJ(arg2)));
|
|
60
|
+
} else if (gtype == GTK_TYPE_ICON_SET){
|
|
61
|
+
widget = gtk_image_new_from_icon_set((GtkIconSet*)RVAL2BOXED(arg1, GTK_TYPE_ICON_SET), RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE));
|
|
62
|
+
} else if (g_type_is_a(gtype, GDK_TYPE_PIXBUF_ANIMATION)) {
|
|
63
|
+
widget = gtk_image_new_from_animation(GDK_PIXBUF_ANIMATION(RVAL2GOBJ(arg1)));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
RBGTK_INITIALIZE(self, widget);
|
|
67
|
+
return Qnil;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static VALUE
|
|
71
|
+
image_set(argc, argv, self)
|
|
72
|
+
int argc;
|
|
73
|
+
VALUE *argv;
|
|
74
|
+
VALUE self;
|
|
75
|
+
{
|
|
76
|
+
VALUE arg1, arg2;
|
|
77
|
+
GType gtype;
|
|
78
|
+
|
|
79
|
+
rb_scan_args(argc, argv, "11", &arg1, &arg2);
|
|
80
|
+
|
|
81
|
+
if (TYPE(arg1) == T_STRING && argc == 1){
|
|
82
|
+
gtk_image_set_from_file(_SELF(self), RVAL2CSTR(arg1));
|
|
83
|
+
} else if (TYPE(arg1) == T_SYMBOL){
|
|
84
|
+
gtk_image_set_from_stock(_SELF(self), rb_id2name(SYM2ID(arg1)),
|
|
85
|
+
RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE));
|
|
86
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
|
87
|
+
} else if (TYPE(arg1) == T_STRING){
|
|
88
|
+
gtk_image_set_from_icon_name(_SELF(self), RVAL2CSTR(arg1),
|
|
89
|
+
RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE));
|
|
90
|
+
#endif
|
|
91
|
+
} else {
|
|
92
|
+
gtype = RVAL2GTYPE(arg1);
|
|
93
|
+
if (gtype == GDK_TYPE_IMAGE){
|
|
94
|
+
gtk_image_set_from_image(_SELF(self), GDK_IMAGE(RVAL2GOBJ(arg1)),
|
|
95
|
+
GDK_BITMAP(RVAL2GOBJ(arg2)));
|
|
96
|
+
} else if (gtype == GDK_TYPE_PIXBUF){
|
|
97
|
+
gtk_image_set_from_pixbuf(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(arg1)));
|
|
98
|
+
|
|
99
|
+
} else if (gtype == GDK_TYPE_PIXMAP){
|
|
100
|
+
gtk_image_set_from_pixmap(_SELF(self), GDK_PIXMAP(RVAL2GOBJ(arg1)),
|
|
101
|
+
GDK_BITMAP(RVAL2GOBJ(arg2)));
|
|
102
|
+
} else if (gtype == GTK_TYPE_ICON_SET){
|
|
103
|
+
gtk_image_set_from_icon_set(_SELF(self),
|
|
104
|
+
(GtkIconSet*)RVAL2BOXED(arg1, GTK_TYPE_ICON_SET),
|
|
105
|
+
RVAL2GENUM(arg2, GTK_TYPE_ICON_SIZE));
|
|
106
|
+
} else if (g_type_is_a(gtype, GDK_TYPE_PIXBUF_ANIMATION)) {
|
|
107
|
+
gtk_image_set_from_animation(_SELF(self), GDK_PIXBUF_ANIMATION(RVAL2GOBJ(arg1)));
|
|
108
|
+
} else {
|
|
109
|
+
rb_raise(rb_eArgError, "invalid argument: %s", rb_class2name(arg1));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return self;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Defined as property
|
|
117
|
+
void gtk_image_get_icon_name (GtkImage *image,
|
|
118
|
+
G_CONST_RETURN gchar **icon_name,
|
|
119
|
+
GtkIconSize *size);
|
|
120
|
+
void gtk_image_set_pixel_size (GtkImage *image,
|
|
121
|
+
gint pixel_size);
|
|
122
|
+
gint gtk_image_get_pixel_size (GtkImage *image);
|
|
123
|
+
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
|
127
|
+
static VALUE
|
|
128
|
+
image_clear(self)
|
|
129
|
+
VALUE self;
|
|
130
|
+
{
|
|
131
|
+
gtk_image_clear(_SELF(self));
|
|
132
|
+
return self;
|
|
133
|
+
}
|
|
134
|
+
#endif
|
|
135
|
+
|
|
136
|
+
void
|
|
137
|
+
Init_gtk_image()
|
|
138
|
+
{
|
|
139
|
+
VALUE gImage = G_DEF_CLASS(GTK_TYPE_IMAGE, "Image", mGtk);
|
|
140
|
+
rb_define_method(gImage, "initialize", image_initialize, -1);
|
|
141
|
+
rb_define_method(gImage, "set", image_set, -1);
|
|
142
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
|
143
|
+
rb_define_method(gImage, "clear", image_clear, 0);
|
|
144
|
+
#endif
|
|
145
|
+
|
|
146
|
+
/* GtkImageType */
|
|
147
|
+
G_DEF_CLASS(GTK_TYPE_IMAGE_TYPE, "Type", gImage);
|
|
148
|
+
G_DEF_CONSTANTS(gImage, GTK_TYPE_IMAGE_TYPE, "GTK_IMAGE_");
|
|
149
|
+
|
|
150
|
+
G_SET_SYMBOL_PROPERTY(GTK_TYPE_IMAGE, "stock");
|
|
151
|
+
|
|
152
|
+
}
|