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,128 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkmenushell.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:31 $
|
8
|
+
|
9
|
+
Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
10
|
+
Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
11
|
+
Daisuke Kanda,
|
12
|
+
Hiroshi Igarashi
|
13
|
+
************************************************/
|
14
|
+
|
15
|
+
#include "global.h"
|
16
|
+
|
17
|
+
#define _SELF(self) (GTK_MENU_SHELL(RVAL2GOBJ(self)))
|
18
|
+
#define RVAL2WIDGET(w) (GTK_WIDGET(RVAL2GOBJ(w)))
|
19
|
+
|
20
|
+
static VALUE
|
21
|
+
mshell_append(self, child)
|
22
|
+
VALUE self, child;
|
23
|
+
{
|
24
|
+
gtk_menu_shell_append(_SELF(self),RVAL2WIDGET(child));
|
25
|
+
G_CHILD_ADD(self, child);
|
26
|
+
return self;
|
27
|
+
}
|
28
|
+
|
29
|
+
static VALUE
|
30
|
+
mshell_prepend(self, child)
|
31
|
+
VALUE self, child;
|
32
|
+
{
|
33
|
+
gtk_menu_shell_prepend(_SELF(self), RVAL2WIDGET(child));
|
34
|
+
G_CHILD_ADD(self, child);
|
35
|
+
return self;
|
36
|
+
}
|
37
|
+
|
38
|
+
static VALUE
|
39
|
+
mshell_insert(self, child, pos)
|
40
|
+
VALUE self, child, pos;
|
41
|
+
{
|
42
|
+
gtk_menu_shell_insert(_SELF(self), RVAL2WIDGET(child),
|
43
|
+
NUM2INT(pos));
|
44
|
+
G_CHILD_ADD(self, child);
|
45
|
+
return self;
|
46
|
+
}
|
47
|
+
|
48
|
+
static VALUE
|
49
|
+
mshell_deactivate(self)
|
50
|
+
VALUE self;
|
51
|
+
{
|
52
|
+
gtk_menu_shell_deactivate(_SELF(self));
|
53
|
+
return self;
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
mshell_select_item(self, menu_item)
|
58
|
+
VALUE self, menu_item;
|
59
|
+
{
|
60
|
+
gtk_menu_shell_select_item(_SELF(self), RVAL2WIDGET(menu_item));
|
61
|
+
return self;
|
62
|
+
}
|
63
|
+
|
64
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
65
|
+
static VALUE
|
66
|
+
mshell_select_first(self, search_sensitive)
|
67
|
+
VALUE self, search_sensitive;
|
68
|
+
{
|
69
|
+
gtk_menu_shell_select_first(_SELF(self), RVAL2CBOOL(search_sensitive));
|
70
|
+
return self;
|
71
|
+
}
|
72
|
+
#endif
|
73
|
+
|
74
|
+
static VALUE
|
75
|
+
mshell_deselect(self)
|
76
|
+
VALUE self;
|
77
|
+
{
|
78
|
+
gtk_menu_shell_deselect(_SELF(self));
|
79
|
+
return self;
|
80
|
+
}
|
81
|
+
|
82
|
+
static VALUE
|
83
|
+
mshell_activate_item(self, menu_item, force_deactivate)
|
84
|
+
VALUE self, menu_item, force_deactivate;
|
85
|
+
{
|
86
|
+
gtk_menu_shell_activate_item(_SELF(self), RVAL2WIDGET(menu_item),
|
87
|
+
RVAL2CBOOL(force_deactivate));
|
88
|
+
return self;
|
89
|
+
}
|
90
|
+
|
91
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
92
|
+
static VALUE
|
93
|
+
mshell_cancel(self)
|
94
|
+
VALUE self;
|
95
|
+
{
|
96
|
+
gtk_menu_shell_cancel(_SELF(self));
|
97
|
+
return self;
|
98
|
+
}
|
99
|
+
#endif
|
100
|
+
|
101
|
+
/* Defined as properties
|
102
|
+
void gtk_menu_shell_set_take_focus (GtkMenuShell *menu_shell,
|
103
|
+
gboolean take_focus);
|
104
|
+
gboolean gtk_menu_shell_get_take_focus (GtkMenuShell *menu_shell);
|
105
|
+
*/
|
106
|
+
|
107
|
+
void
|
108
|
+
Init_gtk_menu_shell()
|
109
|
+
{
|
110
|
+
VALUE gMenuShell = G_DEF_CLASS(GTK_TYPE_MENU_SHELL, "MenuShell", mGtk);
|
111
|
+
|
112
|
+
rb_define_method(gMenuShell, "append", mshell_append, 1);
|
113
|
+
rb_define_method(gMenuShell, "prepend", mshell_prepend, 1);
|
114
|
+
rb_define_method(gMenuShell, "insert", mshell_insert, 2);
|
115
|
+
rb_define_method(gMenuShell, "deactivate", mshell_deactivate, 0);
|
116
|
+
rb_define_method(gMenuShell, "select_item", mshell_select_item, 1);
|
117
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
118
|
+
rb_define_method(gMenuShell, "select_first", mshell_select_first, 1);
|
119
|
+
#endif
|
120
|
+
rb_define_method(gMenuShell, "deselect", mshell_deselect, 0);
|
121
|
+
rb_define_method(gMenuShell, "activate_item", mshell_activate_item, 2);
|
122
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
123
|
+
rb_define_method(gMenuShell, "cancel", mshell_cancel, 0);
|
124
|
+
#endif
|
125
|
+
/* GtkMenuDirectionType */
|
126
|
+
G_DEF_CLASS(GTK_TYPE_MENU_DIRECTION_TYPE, "DirectionType", gMenuShell);
|
127
|
+
G_DEF_CONSTANTS(gMenuShell, GTK_TYPE_MENU_DIRECTION_TYPE, "GTK_MENU_");
|
128
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkmenutoolbutton.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2005/05/05 19:57:29 $
|
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(self) (GTK_MENU_TOOL_BUTTON(RVAL2GOBJ(self)))
|
17
|
+
|
18
|
+
static VALUE
|
19
|
+
menutoolbutton_initialize(argc, argv, self)
|
20
|
+
int argc;
|
21
|
+
VALUE *argv;
|
22
|
+
VALUE self;
|
23
|
+
{
|
24
|
+
GtkToolItem* item;
|
25
|
+
|
26
|
+
if (argc == 0){
|
27
|
+
item = gtk_menu_tool_button_new((GtkWidget*)NULL, (const gchar*)NULL);
|
28
|
+
} else if (TYPE(argv[0]) == T_SYMBOL || TYPE(argv[0]) == T_STRING){
|
29
|
+
VALUE stock_id;
|
30
|
+
rb_scan_args(argc, argv, "10", &stock_id);
|
31
|
+
|
32
|
+
if (TYPE(stock_id) == T_SYMBOL){
|
33
|
+
item = gtk_menu_tool_button_new_from_stock(rb_id2name(SYM2ID(stock_id)));
|
34
|
+
} else {
|
35
|
+
item = gtk_menu_tool_button_new_from_stock(RVAL2CSTR(stock_id));
|
36
|
+
}
|
37
|
+
} else {
|
38
|
+
VALUE icon_widget, label;
|
39
|
+
rb_scan_args(argc, argv, "11", &icon_widget, &label);
|
40
|
+
|
41
|
+
item = gtk_menu_tool_button_new(GTK_WIDGET(RVAL2GOBJ(icon_widget)),
|
42
|
+
NIL_P(label) ? (const gchar*)NULL : RVAL2CSTR(label));
|
43
|
+
}
|
44
|
+
|
45
|
+
RBGTK_INITIALIZE(self, item);
|
46
|
+
return Qnil;
|
47
|
+
}
|
48
|
+
|
49
|
+
static VALUE
|
50
|
+
menutoolbutton_set_arrow_tooltip(argc, argv, self)
|
51
|
+
int argc;
|
52
|
+
VALUE *argv;
|
53
|
+
VALUE self;
|
54
|
+
{
|
55
|
+
VALUE tooltips, tip_text, tip_private;
|
56
|
+
|
57
|
+
rb_scan_args(argc, argv, "12", &tooltips, &tip_text, &tip_private);
|
58
|
+
gtk_menu_tool_button_set_arrow_tooltip(_SELF(self), GTK_TOOLTIPS(RVAL2GOBJ(self)),
|
59
|
+
NIL_P(tip_text) ? NULL : RVAL2CSTR(tip_text),
|
60
|
+
NIL_P(tip_private) ? NULL : RVAL2CSTR(tip_private));
|
61
|
+
return self;
|
62
|
+
}
|
63
|
+
#endif
|
64
|
+
|
65
|
+
void
|
66
|
+
Init_gtk_menutoolbutton()
|
67
|
+
{
|
68
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
69
|
+
VALUE gMenuToolButton = G_DEF_CLASS(GTK_TYPE_MENU_TOOL_BUTTON, "MenuToolButton", mGtk);
|
70
|
+
|
71
|
+
rb_define_method(gMenuToolButton, "initialize", menutoolbutton_initialize, -1);
|
72
|
+
rb_define_method(gMenuToolButton, "set_arrow_tooltip", menutoolbutton_set_arrow_tooltip, -1);
|
73
|
+
#endif
|
74
|
+
}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkmessagedialog.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2006/10/21 16:58:00 $
|
8
|
+
|
9
|
+
Copyright (C) 2002-2006 Masao Mutoh
|
10
|
+
************************************************/
|
11
|
+
|
12
|
+
#include "global.h"
|
13
|
+
|
14
|
+
#define _SELF(s) (GTK_MESSAGE_DIALOG(RVAL2GOBJ(s)))
|
15
|
+
|
16
|
+
static VALUE
|
17
|
+
mdiag_initialize(argc, argv, self)
|
18
|
+
int argc;
|
19
|
+
VALUE *argv;
|
20
|
+
VALUE self;
|
21
|
+
{
|
22
|
+
VALUE parent, flags, type, buttons, message;
|
23
|
+
GtkWidget* w;
|
24
|
+
|
25
|
+
rb_scan_args(argc, argv, "41", &parent, &flags, &type, &buttons, &message);
|
26
|
+
|
27
|
+
w = gtk_message_dialog_new(NIL_P(parent) ? NULL : GTK_WINDOW(RVAL2GOBJ(parent)),
|
28
|
+
RVAL2GFLAGS(flags, GTK_TYPE_DIALOG_FLAGS),
|
29
|
+
RVAL2GENUM(type, GTK_TYPE_MESSAGE_TYPE),
|
30
|
+
RVAL2GENUM(buttons, GTK_TYPE_BUTTONS_TYPE),
|
31
|
+
"%s",
|
32
|
+
NIL_P(message) ? "": RVAL2CSTR(message));
|
33
|
+
RBGTK_INITIALIZE(self, w);
|
34
|
+
return Qnil;
|
35
|
+
}
|
36
|
+
|
37
|
+
/*
|
38
|
+
Don't implement. Use Gtk::MessageDialog#set_markup.
|
39
|
+
GtkWidget* gtk_message_dialog_new_with_markup
|
40
|
+
(GtkWindow *parent,
|
41
|
+
GtkDialogFlags flags,
|
42
|
+
GtkMessageType type,
|
43
|
+
GtkButtonsType buttons,
|
44
|
+
const gchar *message_format,
|
45
|
+
...);
|
46
|
+
*/
|
47
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
48
|
+
static VALUE
|
49
|
+
mdiag_set_markup(self, str)
|
50
|
+
VALUE self, str;
|
51
|
+
{
|
52
|
+
gtk_message_dialog_set_markup(_SELF(self), RVAL2CSTR(str));
|
53
|
+
return self;
|
54
|
+
}
|
55
|
+
#endif
|
56
|
+
|
57
|
+
/* Defined as properties.
|
58
|
+
void gtk_message_dialog_set_image (GtkMessageDialog *dialog,
|
59
|
+
GtkWidget *image);
|
60
|
+
*/
|
61
|
+
|
62
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
63
|
+
static VALUE
|
64
|
+
mdiag_format_secondary_text(self, text)
|
65
|
+
VALUE self, text;
|
66
|
+
{
|
67
|
+
gtk_message_dialog_format_secondary_text(_SELF(self), RVAL2CSTR(text), NULL);
|
68
|
+
return self;
|
69
|
+
}
|
70
|
+
|
71
|
+
static VALUE
|
72
|
+
mdiag_format_secondary_markup(self, markup)
|
73
|
+
VALUE self, markup;
|
74
|
+
{
|
75
|
+
gtk_message_dialog_format_secondary_markup(_SELF(self), RVAL2CSTR(markup), NULL);
|
76
|
+
return self;
|
77
|
+
}
|
78
|
+
#endif
|
79
|
+
|
80
|
+
void
|
81
|
+
Init_gtk_message_dialog()
|
82
|
+
{
|
83
|
+
VALUE gMessageDialog = G_DEF_CLASS(GTK_TYPE_MESSAGE_DIALOG, "MessageDialog", mGtk);
|
84
|
+
|
85
|
+
rb_define_method(gMessageDialog, "initialize", mdiag_initialize, -1);
|
86
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
87
|
+
rb_define_method(gMessageDialog, "set_markup", mdiag_set_markup, 1);
|
88
|
+
#endif
|
89
|
+
#if GTK_CHECK_VERSION(2,6,0)
|
90
|
+
rb_define_method(gMessageDialog, "set_secondary_text", mdiag_format_secondary_text, 1);
|
91
|
+
rb_define_method(gMessageDialog, "set_secondary_markup", mdiag_format_secondary_markup, 1);
|
92
|
+
#endif
|
93
|
+
G_DEF_SETTERS(gMessageDialog);
|
94
|
+
|
95
|
+
/* GtkMessageType */
|
96
|
+
G_DEF_CLASS(GTK_TYPE_MESSAGE_TYPE, "Type", gMessageDialog);
|
97
|
+
G_DEF_CONSTANTS(gMessageDialog, GTK_TYPE_MESSAGE_TYPE, "GTK_MESSAGE_");
|
98
|
+
|
99
|
+
/* GtkButtonsType */
|
100
|
+
G_DEF_CLASS(GTK_TYPE_BUTTONS_TYPE, "ButtonsType", gMessageDialog);
|
101
|
+
G_DEF_CONSTANTS(gMessageDialog, GTK_TYPE_BUTTONS_TYPE, "GTK_");
|
102
|
+
}
|
data/src/rbgtkmisc.c
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtkmisc.c -
|
5
|
+
|
6
|
+
$Author: mutoh $
|
7
|
+
$Date: 2003/02/01 16:46:23 $
|
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_MISC(RVAL2GOBJ(s)))
|
18
|
+
|
19
|
+
static VALUE
|
20
|
+
misc_set_align(self, xalign, yalign)
|
21
|
+
VALUE self, xalign, yalign;
|
22
|
+
{
|
23
|
+
gtk_misc_set_alignment(_SELF(self), NUM2DBL(xalign), NUM2DBL(yalign));
|
24
|
+
return self;
|
25
|
+
}
|
26
|
+
|
27
|
+
static VALUE
|
28
|
+
misc_set_padding(self, xpad, ypad)
|
29
|
+
VALUE self, xpad, ypad;
|
30
|
+
{
|
31
|
+
gtk_misc_set_padding(_SELF(self), NUM2DBL(xpad), NUM2DBL(ypad));
|
32
|
+
return self;
|
33
|
+
}
|
34
|
+
|
35
|
+
static VALUE
|
36
|
+
misc_get_align(self)
|
37
|
+
VALUE self;
|
38
|
+
{
|
39
|
+
gfloat xalign, yalign;
|
40
|
+
gtk_misc_get_alignment(_SELF(self), &xalign, &yalign);
|
41
|
+
|
42
|
+
return rb_ary_new3(2, rb_float_new(xalign), rb_float_new(yalign));
|
43
|
+
}
|
44
|
+
|
45
|
+
static VALUE
|
46
|
+
misc_get_padding(self)
|
47
|
+
VALUE self;
|
48
|
+
{
|
49
|
+
gint xpad, ypad;
|
50
|
+
gtk_misc_get_padding(_SELF(self), &xpad, &ypad);
|
51
|
+
|
52
|
+
return rb_ary_new3(2, INT2NUM(xpad), INT2NUM(ypad));
|
53
|
+
}
|
54
|
+
void
|
55
|
+
Init_gtk_misc()
|
56
|
+
{
|
57
|
+
VALUE gMisc = G_DEF_CLASS(GTK_TYPE_MISC, "Misc", mGtk);
|
58
|
+
|
59
|
+
rb_define_method(gMisc, "set_alignment", misc_set_align, 2);
|
60
|
+
rb_define_method(gMisc, "set_padding", misc_set_padding, 2);
|
61
|
+
rb_define_method(gMisc, "alignment", misc_get_align, 0);
|
62
|
+
rb_define_method(gMisc, "padding", misc_get_padding, 0);
|
63
|
+
}
|
data/src/rbgtknotebook.c
ADDED
@@ -0,0 +1,484 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgtknotebook.c -
|
5
|
+
|
6
|
+
$Author: ggc $
|
7
|
+
$Date: 2007/07/13 16:07:31 $
|
8
|
+
|
9
|
+
Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
10
|
+
Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
11
|
+
Daisuke Kanda,
|
12
|
+
Hiroshi Igarashi
|
13
|
+
************************************************/
|
14
|
+
|
15
|
+
#include "global.h"
|
16
|
+
|
17
|
+
#define _SELF(self) GTK_NOTEBOOK(RVAL2GOBJ(self))
|
18
|
+
#define RVAL2WIDGET(w) GTK_WIDGET(RVAL2GOBJ(w))
|
19
|
+
#define GTK_TYPE_NOTEBOOK_PAGE (gtk_notebookpage_get_type())
|
20
|
+
|
21
|
+
static VALUE
|
22
|
+
note_initialize(self)
|
23
|
+
VALUE self;
|
24
|
+
{
|
25
|
+
RBGTK_INITIALIZE(self, gtk_notebook_new());
|
26
|
+
return Qnil;
|
27
|
+
}
|
28
|
+
|
29
|
+
static VALUE
|
30
|
+
note_append_page(argc, argv, self)
|
31
|
+
int argc;
|
32
|
+
VALUE *argv;
|
33
|
+
VALUE self;
|
34
|
+
{
|
35
|
+
VALUE child, label;
|
36
|
+
|
37
|
+
rb_scan_args(argc, argv, "11", &child, &label);
|
38
|
+
gtk_notebook_append_page(_SELF(self),
|
39
|
+
RVAL2WIDGET(child),
|
40
|
+
NIL_P(label) ? NULL : RVAL2WIDGET(label));
|
41
|
+
G_CHILD_ADD(self, child);
|
42
|
+
|
43
|
+
return self;
|
44
|
+
}
|
45
|
+
|
46
|
+
static VALUE
|
47
|
+
note_append_page_menu(argc, argv, self)
|
48
|
+
int argc;
|
49
|
+
VALUE *argv;
|
50
|
+
VALUE self;
|
51
|
+
{
|
52
|
+
VALUE child, tab_label, menu_label;
|
53
|
+
|
54
|
+
rb_scan_args(argc, argv, "12", &child, &tab_label, &menu_label);
|
55
|
+
gtk_notebook_append_page_menu(_SELF(self),
|
56
|
+
RVAL2WIDGET(child),
|
57
|
+
RVAL2WIDGET(tab_label),
|
58
|
+
NIL_P(menu_label) ? NULL :
|
59
|
+
RVAL2WIDGET(menu_label));
|
60
|
+
return self;
|
61
|
+
}
|
62
|
+
|
63
|
+
static VALUE
|
64
|
+
note_prepend_page(argc, argv, self)
|
65
|
+
int argc;
|
66
|
+
VALUE *argv;
|
67
|
+
VALUE self;
|
68
|
+
{
|
69
|
+
VALUE child, label;
|
70
|
+
|
71
|
+
rb_scan_args(argc, argv, "11", &child, &label);
|
72
|
+
gtk_notebook_prepend_page(_SELF(self),
|
73
|
+
RVAL2WIDGET(child),
|
74
|
+
NIL_P(label) ? NULL : RVAL2WIDGET(label));
|
75
|
+
return self;
|
76
|
+
}
|
77
|
+
|
78
|
+
static VALUE
|
79
|
+
note_prepend_page_menu(argc, argv, self)
|
80
|
+
int argc;
|
81
|
+
VALUE *argv;
|
82
|
+
VALUE self;
|
83
|
+
{
|
84
|
+
VALUE child, tab_label, menu_label;
|
85
|
+
|
86
|
+
rb_scan_args(argc, argv, "12", &child, &tab_label, &menu_label);
|
87
|
+
gtk_notebook_prepend_page_menu(_SELF(self),
|
88
|
+
RVAL2WIDGET(child),
|
89
|
+
RVAL2WIDGET(tab_label),
|
90
|
+
NIL_P(menu_label) ? NULL :
|
91
|
+
RVAL2WIDGET(menu_label));
|
92
|
+
return self;
|
93
|
+
}
|
94
|
+
|
95
|
+
static VALUE
|
96
|
+
note_insert_page(argc, argv, self)
|
97
|
+
int argc;
|
98
|
+
VALUE *argv;
|
99
|
+
VALUE self;
|
100
|
+
{
|
101
|
+
VALUE pos, child, label;
|
102
|
+
|
103
|
+
rb_scan_args(argc, argv, "21", &pos, &child, &label);
|
104
|
+
gtk_notebook_insert_page(_SELF(self),
|
105
|
+
RVAL2WIDGET(child),
|
106
|
+
NIL_P(label) ? NULL : RVAL2WIDGET(label),
|
107
|
+
NUM2INT(pos));
|
108
|
+
return self;
|
109
|
+
}
|
110
|
+
|
111
|
+
static VALUE
|
112
|
+
note_insert_page_menu(argc, argv, self)
|
113
|
+
int argc;
|
114
|
+
VALUE *argv;
|
115
|
+
VALUE self;
|
116
|
+
{
|
117
|
+
VALUE pos, child, tab_label, menu_label;
|
118
|
+
|
119
|
+
rb_scan_args(argc, argv, "22", &pos, &child, &tab_label, &menu_label);
|
120
|
+
gtk_notebook_insert_page_menu(_SELF(self),
|
121
|
+
RVAL2WIDGET(child),
|
122
|
+
RVAL2WIDGET(tab_label),
|
123
|
+
RVAL2WIDGET(menu_label),
|
124
|
+
NUM2INT(pos));
|
125
|
+
return self;
|
126
|
+
}
|
127
|
+
|
128
|
+
static VALUE
|
129
|
+
note_remove_page(self, pos)
|
130
|
+
VALUE self, pos;
|
131
|
+
{
|
132
|
+
gtk_notebook_remove_page(_SELF(self), NUM2INT(pos));
|
133
|
+
return self;
|
134
|
+
}
|
135
|
+
|
136
|
+
static VALUE
|
137
|
+
note_page_num(self, child)
|
138
|
+
VALUE self, child;
|
139
|
+
{
|
140
|
+
return INT2FIX(gtk_notebook_page_num(_SELF(self),
|
141
|
+
RVAL2WIDGET(child)));
|
142
|
+
}
|
143
|
+
|
144
|
+
static VALUE
|
145
|
+
note_next_page(self)
|
146
|
+
VALUE self;
|
147
|
+
{
|
148
|
+
gtk_notebook_next_page(_SELF(self));
|
149
|
+
return self;
|
150
|
+
}
|
151
|
+
|
152
|
+
static VALUE
|
153
|
+
note_prev_page(self)
|
154
|
+
VALUE self;
|
155
|
+
{
|
156
|
+
gtk_notebook_prev_page(_SELF(self));
|
157
|
+
return self;
|
158
|
+
}
|
159
|
+
|
160
|
+
static VALUE
|
161
|
+
note_reorder_child(self, child, pos)
|
162
|
+
VALUE self, child, pos;
|
163
|
+
{
|
164
|
+
gtk_notebook_reorder_child(_SELF(self), RVAL2WIDGET(child),
|
165
|
+
NUM2INT(pos));
|
166
|
+
return self;
|
167
|
+
}
|
168
|
+
|
169
|
+
static VALUE
|
170
|
+
note_get_menu_label(self, child)
|
171
|
+
VALUE self, child;
|
172
|
+
{
|
173
|
+
return GOBJ2RVAL(gtk_notebook_get_menu_label(_SELF(self),
|
174
|
+
RVAL2WIDGET(child)));
|
175
|
+
}
|
176
|
+
|
177
|
+
static VALUE
|
178
|
+
note_get_nth_page(self, page_num)
|
179
|
+
VALUE self, page_num;
|
180
|
+
{
|
181
|
+
GtkWidget *page = gtk_notebook_get_nth_page(_SELF(self),
|
182
|
+
NUM2INT(page_num));
|
183
|
+
return page ? GOBJ2RVAL(page) : Qnil;
|
184
|
+
}
|
185
|
+
|
186
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
187
|
+
static VALUE
|
188
|
+
note_get_n_pages(self)
|
189
|
+
VALUE self;
|
190
|
+
{
|
191
|
+
return INT2NUM(gtk_notebook_get_n_pages(_SELF(self)));
|
192
|
+
}
|
193
|
+
#endif
|
194
|
+
|
195
|
+
static VALUE
|
196
|
+
note_get_tab_label(self, child)
|
197
|
+
VALUE self, child;
|
198
|
+
{
|
199
|
+
return GOBJ2RVAL(gtk_notebook_get_tab_label(_SELF(self),
|
200
|
+
RVAL2WIDGET(child)));
|
201
|
+
}
|
202
|
+
|
203
|
+
static VALUE
|
204
|
+
note_query_tab_label_packing(self, child)
|
205
|
+
VALUE self, child;
|
206
|
+
{
|
207
|
+
gboolean expand, fill;
|
208
|
+
GtkPackType pack_type;
|
209
|
+
VALUE ary;
|
210
|
+
|
211
|
+
gtk_notebook_query_tab_label_packing(_SELF(self),
|
212
|
+
RVAL2WIDGET(child),
|
213
|
+
&expand, &fill, &pack_type);
|
214
|
+
ary = rb_ary_new2(3);
|
215
|
+
rb_ary_push(ary, CBOOL2RVAL(expand));
|
216
|
+
rb_ary_push(ary, CBOOL2RVAL(fill));
|
217
|
+
rb_ary_push(ary, GENUM2RVAL(pack_type, GTK_TYPE_PACK_TYPE));
|
218
|
+
return ary;
|
219
|
+
}
|
220
|
+
|
221
|
+
static VALUE
|
222
|
+
note_set_menu_label(self, child, label)
|
223
|
+
VALUE self, child, label;
|
224
|
+
{
|
225
|
+
gtk_notebook_set_menu_label(_SELF(self),
|
226
|
+
RVAL2WIDGET(child),
|
227
|
+
NIL_P(label)?NULL:RVAL2WIDGET(label));
|
228
|
+
return self;
|
229
|
+
}
|
230
|
+
|
231
|
+
static VALUE
|
232
|
+
note_set_menu_label_text(self, child, text)
|
233
|
+
VALUE self, child, text;
|
234
|
+
{
|
235
|
+
gtk_notebook_set_menu_label_text(_SELF(self),
|
236
|
+
RVAL2WIDGET(child),
|
237
|
+
RVAL2CSTR(text));
|
238
|
+
return self;
|
239
|
+
}
|
240
|
+
|
241
|
+
static VALUE
|
242
|
+
note_set_tab_label(self, child, label)
|
243
|
+
VALUE self, child, label;
|
244
|
+
{
|
245
|
+
gtk_notebook_set_tab_label(_SELF(self),
|
246
|
+
RVAL2WIDGET(child),
|
247
|
+
NIL_P(label)?NULL:RVAL2WIDGET(label));
|
248
|
+
return self;
|
249
|
+
}
|
250
|
+
|
251
|
+
static VALUE
|
252
|
+
note_set_tab_label_packing(self, child, expand, fill, pack_type)
|
253
|
+
VALUE self, child, expand, fill, pack_type;
|
254
|
+
{
|
255
|
+
gtk_notebook_set_tab_label_packing(_SELF(self),
|
256
|
+
RVAL2WIDGET(child),
|
257
|
+
RVAL2CBOOL(expand), RVAL2CBOOL(fill),
|
258
|
+
RVAL2GENUM(pack_type, GTK_TYPE_PACK_TYPE));
|
259
|
+
return self;
|
260
|
+
}
|
261
|
+
|
262
|
+
static VALUE
|
263
|
+
note_set_tab_label_text(self, child, text)
|
264
|
+
VALUE self, child, text;
|
265
|
+
{
|
266
|
+
gtk_notebook_set_tab_label_text(_SELF(self),
|
267
|
+
RVAL2WIDGET(child),
|
268
|
+
RVAL2CSTR(text));
|
269
|
+
return self;
|
270
|
+
}
|
271
|
+
|
272
|
+
static VALUE
|
273
|
+
note_get_menu_label_text(self, child)
|
274
|
+
VALUE self, child;
|
275
|
+
{
|
276
|
+
return CSTR2RVAL(gtk_notebook_get_menu_label_text(_SELF(self),
|
277
|
+
RVAL2WIDGET(child)));
|
278
|
+
}
|
279
|
+
|
280
|
+
static VALUE
|
281
|
+
note_get_tab_label_text(self, child)
|
282
|
+
VALUE self, child;
|
283
|
+
{
|
284
|
+
return CSTR2RVAL(gtk_notebook_get_tab_label_text(_SELF(self),
|
285
|
+
RVAL2WIDGET(child)));
|
286
|
+
}
|
287
|
+
|
288
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
289
|
+
static VALUE
|
290
|
+
note_get_tab_reorderable(self, child)
|
291
|
+
VALUE self, child;
|
292
|
+
{
|
293
|
+
return CBOOL2RVAL(gtk_notebook_get_tab_reorderable(_SELF(self),
|
294
|
+
GTK_WIDGET(RVAL2GOBJ(child))));
|
295
|
+
}
|
296
|
+
static VALUE
|
297
|
+
note_set_tab_reorderable(self, child, reorderable)
|
298
|
+
VALUE self, child, reorderable;
|
299
|
+
{
|
300
|
+
gtk_notebook_set_tab_reorderable(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)),
|
301
|
+
RVAL2CBOOL(reorderable));
|
302
|
+
return self;
|
303
|
+
}
|
304
|
+
|
305
|
+
static VALUE
|
306
|
+
note_get_tab_detachable(self, child)
|
307
|
+
VALUE self, child;
|
308
|
+
{
|
309
|
+
return CBOOL2RVAL(gtk_notebook_get_tab_detachable(_SELF(self),
|
310
|
+
GTK_WIDGET(RVAL2GOBJ(child))));
|
311
|
+
}
|
312
|
+
static VALUE
|
313
|
+
note_set_tab_detachable(self, child, detachable)
|
314
|
+
VALUE self, child, detachable;
|
315
|
+
{
|
316
|
+
gtk_notebook_set_tab_detachable(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)),
|
317
|
+
RVAL2CBOOL(detachable));
|
318
|
+
return self;
|
319
|
+
}
|
320
|
+
|
321
|
+
static GtkNotebook*
|
322
|
+
creation_func(source, page, x, y, func)
|
323
|
+
GtkNotebook *source;
|
324
|
+
GtkWidget *page;
|
325
|
+
gint x;
|
326
|
+
gint y;
|
327
|
+
gpointer func;
|
328
|
+
{
|
329
|
+
VALUE ret;
|
330
|
+
ret = rb_funcall((VALUE)func, id_call, 4, GOBJ2RVAL(source), GOBJ2RVAL(page),
|
331
|
+
INT2NUM(x), INT2NUM(y));
|
332
|
+
return NIL_P(ret) ? (GtkNotebook*)NULL : GTK_NOTEBOOK(RVAL2GOBJ(ret));
|
333
|
+
}
|
334
|
+
|
335
|
+
static VALUE
|
336
|
+
note_set_window_creation_hook(self)
|
337
|
+
VALUE self;
|
338
|
+
{
|
339
|
+
VALUE func = rb_block_proc();
|
340
|
+
G_RELATIVE(self, func);
|
341
|
+
gtk_notebook_set_window_creation_hook((GtkNotebookWindowCreationFunc)creation_func,
|
342
|
+
(gpointer)func, (GDestroyNotify)NULL);
|
343
|
+
return self;
|
344
|
+
}
|
345
|
+
#endif
|
346
|
+
|
347
|
+
/***********************************************/
|
348
|
+
/*
|
349
|
+
* Gtk::NotebookPage
|
350
|
+
*/
|
351
|
+
typedef struct {
|
352
|
+
VALUE parent;
|
353
|
+
GtkNotebookPage* page;
|
354
|
+
} GtkNotebookPageData;
|
355
|
+
|
356
|
+
GtkNotebookPageData*
|
357
|
+
notebookpage_copy (const GtkNotebookPage* page)
|
358
|
+
{
|
359
|
+
GtkNotebookPageData* data;
|
360
|
+
g_return_val_if_fail (page != NULL, NULL);
|
361
|
+
data = g_new(GtkNotebookPageData, 1);
|
362
|
+
data->page = (GtkNotebookPage*)page;
|
363
|
+
return data;
|
364
|
+
}
|
365
|
+
|
366
|
+
GType
|
367
|
+
gtk_notebookpage_get_type(void)
|
368
|
+
{
|
369
|
+
static GType our_type = 0;
|
370
|
+
if (our_type == 0)
|
371
|
+
our_type = g_boxed_type_register_static ("GtkNotebookPageData",
|
372
|
+
(GBoxedCopyFunc)notebookpage_copy,
|
373
|
+
(GBoxedFreeFunc)g_free);
|
374
|
+
return our_type;
|
375
|
+
}
|
376
|
+
|
377
|
+
static VALUE
|
378
|
+
signal_g2r_func(num, values)
|
379
|
+
guint num;
|
380
|
+
const GValue* values;
|
381
|
+
{
|
382
|
+
GtkNotebookPageData npp;
|
383
|
+
npp.parent = GVAL2RVAL(&values[0]);
|
384
|
+
npp.page = (GtkNotebookPage*)g_value_get_pointer(&values[1]);
|
385
|
+
return rb_ary_new3(3, GVAL2RVAL(&values[0]), BOXED2RVAL(&npp, GTK_TYPE_NOTEBOOK_PAGE),
|
386
|
+
GVAL2RVAL(&values[2]));
|
387
|
+
}
|
388
|
+
|
389
|
+
/* Defined as the "page" property.
|
390
|
+
*/
|
391
|
+
|
392
|
+
/* Defined as properties
|
393
|
+
// "enable-popup" property
|
394
|
+
void gtk_notebook_popup_enable (GtkNotebook *notebook);
|
395
|
+
void gtk_notebook_popup_disable (GtkNotebook *notebook);
|
396
|
+
|
397
|
+
void gtk_notebook_set_group_id (GtkNotebook *notebook,
|
398
|
+
gint group_id);
|
399
|
+
gint gtk_notebook_get_group_id (GtkNotebook *notebook);
|
400
|
+
|
401
|
+
// "homogeneous" property
|
402
|
+
void gtk_notebook_set_homogeneous_tabs
|
403
|
+
(GtkNotebook *notebook,
|
404
|
+
gboolean homogeneous);
|
405
|
+
// "page" property.
|
406
|
+
#define gtk_notebook_current_page
|
407
|
+
#define gtk_notebook_set_page
|
408
|
+
gint gtk_notebook_get_current_page (GtkNotebook *notebook);
|
409
|
+
void gtk_notebook_set_current_page (GtkNotebook *notebook,
|
410
|
+
gint page_num);
|
411
|
+
|
412
|
+
gboolean gtk_notebook_get_scrollable (GtkNotebook *notebook);
|
413
|
+
void gtk_notebook_set_scrollable (GtkNotebook *notebook,
|
414
|
+
gboolean scrollable);
|
415
|
+
|
416
|
+
void gtk_notebook_set_show_border (GtkNotebook *notebook,
|
417
|
+
gboolean show_border);
|
418
|
+
gboolean gtk_notebook_get_show_border (GtkNotebook *notebook);
|
419
|
+
|
420
|
+
gboolean gtk_notebook_get_show_tabs (GtkNotebook *notebook);
|
421
|
+
void gtk_notebook_set_show_tabs (GtkNotebook *notebook,
|
422
|
+
gboolean show_tabs);
|
423
|
+
|
424
|
+
GtkPositionType gtk_notebook_get_tab_pos (GtkNotebook *notebook);
|
425
|
+
void gtk_notebook_set_tab_pos (GtkNotebook *notebook,
|
426
|
+
GtkPositionType pos);
|
427
|
+
|
428
|
+
void gtk_notebook_set_tab_hborder (GtkNotebook *notebook,
|
429
|
+
guint tab_hborder);
|
430
|
+
void gtk_notebook_set_tab_border (GtkNotebook *notebook,
|
431
|
+
guint border_width);
|
432
|
+
void gtk_notebook_set_tab_vborder (GtkNotebook *notebook,
|
433
|
+
guint tab_vborder);
|
434
|
+
*/
|
435
|
+
|
436
|
+
/*****************************************/
|
437
|
+
|
438
|
+
void
|
439
|
+
Init_gtk_notebook()
|
440
|
+
{
|
441
|
+
VALUE gNotebook = G_DEF_CLASS(GTK_TYPE_NOTEBOOK, "Notebook", mGtk);
|
442
|
+
G_DEF_CLASS(GTK_TYPE_NOTEBOOK_PAGE, "NotebookPage", mGtk);
|
443
|
+
|
444
|
+
rb_define_method(gNotebook, "initialize", note_initialize, 0);
|
445
|
+
rb_define_method(gNotebook, "append_page", note_append_page, -1);
|
446
|
+
rb_define_method(gNotebook, "append_page_menu", note_append_page_menu, -1);
|
447
|
+
rb_define_method(gNotebook, "prepend_page", note_prepend_page, -1);
|
448
|
+
rb_define_method(gNotebook, "prepend_page_menu", note_prepend_page_menu, -1);
|
449
|
+
rb_define_method(gNotebook, "insert_page", note_insert_page, -1);
|
450
|
+
rb_define_method(gNotebook, "insert_page_menu", note_insert_page_menu, -1);
|
451
|
+
rb_define_method(gNotebook, "remove_page", note_remove_page, 1);
|
452
|
+
rb_define_method(gNotebook, "page_num", note_page_num, 1);
|
453
|
+
rb_define_method(gNotebook, "next_page", note_next_page, 0);
|
454
|
+
rb_define_method(gNotebook, "prev_page", note_prev_page, 0);
|
455
|
+
rb_define_method(gNotebook, "reorder_child", note_reorder_child, 2);
|
456
|
+
rb_define_method(gNotebook, "get_menu_label", note_get_menu_label, 1);
|
457
|
+
rb_define_method(gNotebook, "get_nth_page", note_get_nth_page, 1);
|
458
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
459
|
+
rb_define_method(gNotebook, "n_pages", note_get_n_pages, 0);
|
460
|
+
#endif
|
461
|
+
rb_define_method(gNotebook, "get_tab_label", note_get_tab_label, 1);
|
462
|
+
rb_define_method(gNotebook, "query_tab_label_packing", note_query_tab_label_packing, 1);
|
463
|
+
rb_define_method(gNotebook, "set_menu_label", note_set_menu_label, 2);
|
464
|
+
rb_define_method(gNotebook, "set_menu_label_text", note_set_menu_label_text, 2);
|
465
|
+
rb_define_method(gNotebook, "set_tab_label", note_set_tab_label, 2);
|
466
|
+
rb_define_method(gNotebook, "set_tab_label_packing", note_set_tab_label_packing, 4);
|
467
|
+
rb_define_method(gNotebook, "set_tab_label_text", note_set_tab_label_text, 2);
|
468
|
+
rb_define_method(gNotebook, "get_menu_label_text", note_get_menu_label_text, 1);
|
469
|
+
rb_define_method(gNotebook, "get_tab_label_text", note_get_tab_label_text, 1);
|
470
|
+
|
471
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
472
|
+
rb_define_method(gNotebook, "get_tab_reorderable", note_get_tab_reorderable, 1);
|
473
|
+
rb_define_method(gNotebook, "set_tab_reorderable", note_set_tab_reorderable, 2);
|
474
|
+
rb_define_method(gNotebook, "get_tab_detachable", note_get_tab_detachable, 1);
|
475
|
+
rb_define_method(gNotebook, "set_tab_detachable", note_set_tab_detachable, 2);
|
476
|
+
rb_define_singleton_method(gNotebook, "set_window_creation_hook", note_set_window_creation_hook, 0);
|
477
|
+
#endif
|
478
|
+
/* GtkNotebookTab */
|
479
|
+
rb_define_const(gNotebook, "TAB_FIRST", GTK_NOTEBOOK_TAB_FIRST);
|
480
|
+
rb_define_const(gNotebook, "TAB_LAST", GTK_NOTEBOOK_TAB_LAST);
|
481
|
+
|
482
|
+
G_DEF_SETTERS(gNotebook);
|
483
|
+
G_DEF_SIGNAL_FUNC(gNotebook, "switch_page", (GValToRValSignalFunc)signal_g2r_func);
|
484
|
+
}
|