本文整理汇总了C++中RBGTK_INITIALIZE函数的典型用法代码示例。如果您正苦于以下问题:C++ RBGTK_INITIALIZE函数的具体用法?C++ RBGTK_INITIALIZE怎么用?C++ RBGTK_INITIALIZE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RBGTK_INITIALIZE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gpui_preview_new
static VALUE
gpui_preview_new(int argc, VALUE *argv, VALUE self)
{
VALUE config, canvas, transform, region;
int n_args;
n_args = rb_scan_args(argc, argv, "22",
&config, &canvas, &transform, ®ion);
if (n_args == 2) {
RBGTK_INITIALIZE(self, gnome_print_preview_new(RVAL2GOBJ(config),
RVAL2GOBJ(canvas)));
} else if (n_args == 4) {
RBGTK_INITIALIZE(self,
gnome_print_preview_new_full(RVAL2GOBJ(config),
RVAL2GOBJ(canvas),
get_art_affine(transform),
get_art_drect(region)));
} else {
rb_raise(rb_eArgError,
"wrong number of arguments (%d for 2 or 4)",
argc);
}
return Qnil;
}
示例2: iview_initialize
static VALUE
iview_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE model;
rb_scan_args(argc, argv, "01", &model);
if (NIL_P(model)){
RBGTK_INITIALIZE(self, gtk_icon_view_new());
} else {
G_CHILD_SET(self, id_model, model);
RBGTK_INITIALIZE(self,
gtk_icon_view_new_with_model(GTK_TREE_MODEL(RVAL2GOBJ(model))));
}
return Qnil;
}
示例3: rbtn_initialize
static VALUE
rbtn_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE group_or_stock_id, rbstock_id;
GtkToolItem *widget;
if (rb_scan_args(argc, argv, "02", &group_or_stock_id, &rbstock_id) > 0) {
GSList *group = NULL;
const gchar *stock_id = TYPE(rbstock_id) == T_SYMBOL ?
rb_id2name(SYM2ID(rbstock_id)) :
RVAL2CSTR_ACCEPT_NIL(rbstock_id);
if (TYPE(group_or_stock_id) == T_ARRAY)
/* TODO: This has a potential for leaking. */
group = RVAL2GTKRADIOTOOLBUTTONGSLIST(group_or_stock_id);
else if (rb_obj_is_kind_of(group_or_stock_id, gRToolButton))
group = gtk_radio_tool_button_get_group(_SELF(group_or_stock_id));
if (stock_id == NULL)
widget = gtk_radio_tool_button_new(group);
else
widget = gtk_radio_tool_button_new_from_stock(group, stock_id);
} else {
widget = gtk_radio_tool_button_new(NULL);
}
RBGTK_INITIALIZE(self, widget);
return Qnil;
}
示例4: scalebutton_initialize
static VALUE
scalebutton_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE arg1, arg2, arg3, arg4, arg5;
GtkWidget *widget;
gdouble min = 0;
gdouble max = 100;
gdouble step = 2;
rb_scan_args(argc, argv, "14", &arg1, &arg2, &arg3, &arg4, &arg5);
if (!NIL_P(arg2))
min = NUM2DBL(arg2);
if (!NIL_P(arg3))
max = NUM2DBL(arg3);
if (!NIL_P(arg4))
step = NUM2DBL(arg4);
widget = gtk_scale_button_new(RVAL2GENUM(arg1, GTK_TYPE_ICON_SIZE), min, max, step, NULL);
RBGTK_INITIALIZE(self, widget);
if (!NIL_P(arg5)) {
const gchar **icons = RVAL2STRV(arg5);
gtk_scale_button_set_icons(_SELF(self), icons);
g_free(icons);
}
return Qnil;
}
示例5: rg_initialize
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE button;
GtkWidget *widget = NULL;
rb_scan_args(argc, argv, "01", &button);
if (NIL_P(button)) {
widget = gtk_button_new();
} else if (TYPE(button) == T_HASH) {
VALUE label, mnemonic, stock_id, buffer;
rbg_scan_options(button,
"label", &label,
"mnemonic", &mnemonic,
"stock_id", &stock_id,
NULL);
if (!NIL_P(label))
widget = gtk_button_new_with_label(RVAL2CSTR(label));
else if (!NIL_P(mnemonic))
widget = gtk_button_new_with_mnemonic(RVAL2CSTR(mnemonic));
else if (!NIL_P(stock_id))
widget = gtk_button_new_from_stock(RVAL2GLIBID(stock_id, buffer));
}
if (!widget)
rb_raise(rb_eArgError, "Invalid arguments.");
RBGTK_INITIALIZE(self, widget);
return Qnil;
}
示例6: rg_initialize
static VALUE
rg_initialize(VALUE self)
{
RBGTK_INITIALIZE(self, gtk_font_chooser_widget_new());
return Qnil;
}
示例7: rg_initialize
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE arg, buffer;
GtkToolItem *item = NULL;
rb_scan_args(argc, argv, "01", &arg);
if (NIL_P(arg)) {
item = gtk_toggle_tool_button_new();
} else if (TYPE(arg) == T_HASH) {
VALUE stock_id;
rbg_scan_options(arg,
"stock_id", &stock_id,
NULL);
if (!NIL_P(stock_id))
item = gtk_toggle_tool_button_new_from_stock(RVAL2GLIBID(stock_id, buffer));
} else {
item = gtk_toggle_tool_button_new_from_stock(RVAL2GLIBID(arg, buffer));
}
if (!item)
rb_raise(rb_eArgError, "Invalid arguments.");
RBGTK_INITIALIZE(self, item);
return Qnil;
}
示例8: rg_initialize
static VALUE
rg_initialize(VALUE self, VALUE arrow_t, VALUE shadow_t)
{
RBGTK_INITIALIZE(self, gtk_arrow_new(RVAL2GENUM(arrow_t, GTK_TYPE_ARROW_TYPE),
RVAL2GENUM(shadow_t, GTK_TYPE_SHADOW_TYPE)));
return Qnil;
}
示例9: rg_initialize
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE options, rb_title, rb_parent, rb_manager, rb_button_ary;
const gchar *title;
GtkWindow *parent;
GtkRecentManager *manager;
GtkWidget *dialog;
rb_scan_args(argc, argv, "01", &options);
rbg_scan_options(options,
"title", &rb_title,
"parent", &rb_parent,
"manager", &rb_manager,
"buttons", &rb_button_ary,
NULL);
title = RVAL2CSTR_ACCEPT_NIL(rb_title);
parent = NIL_P(rb_parent) ? NULL : RVAL2GTKWINDOW(rb_parent);
manager = NIL_P(rb_manager) ? NULL : RVAL2GTKRECENTMANAGER(rb_manager);
if (manager) {
dialog = gtk_recent_chooser_dialog_new_for_manager(title, parent, manager, NULL, NULL);
} else {
dialog = gtk_recent_chooser_dialog_new(title, parent, NULL, NULL);
}
RBGTK_INITIALIZE(self, dialog);
if (!NIL_P(rb_button_ary))
rb_funcall2(self, rb_intern("add_buttons"),
RARRAY_LEN(rb_button_ary), RARRAY_PTR(rb_button_ary));
return Qnil;
}
示例10: rg_initialize
static VALUE
rg_initialize(VALUE self, VALUE orientation)
{
RBGTK_INITIALIZE(self, gtk_button_box_new(RVAL2GTKORIENTATION(orientation)));
return Qnil;
}
示例11: rg_initialize
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE title, parent, action, back, button_ary;
GtkWidget* dialog;
const gchar *gtitle;
GtkWindow *gparent;
GtkFileChooserAction gaction;
const gchar *gback;
rb_scan_args(argc, argv, "04*", &title, &parent, &action, &back, &button_ary);
gtitle = NIL_P(title) ? NULL : RVAL2CSTR(title);
gparent = NIL_P(parent) ? NULL : GTK_WINDOW(RVAL2GOBJ(parent));
gaction = NIL_P(action) ? GTK_FILE_CHOOSER_ACTION_OPEN : RVAL2GENUM(action, GTK_TYPE_FILE_CHOOSER_ACTION);
gback = NIL_P(back) ? NULL : RVAL2CSTR(back);
dialog = gtk_file_chooser_dialog_new_with_backend(gtitle,
gparent,
gaction,
gback,
NULL,
NULL);
RBGTK_INITIALIZE(self, dialog);
rbgtk_dialog_add_buttons_internal(self, button_ary);
return Qnil;
}
示例12: rg_initialize
static VALUE
rg_initialize(VALUE self, VALUE arrow_t, VALUE shadow_t)
{
RBGTK_INITIALIZE(self, gtk_arrow_new(RVAL2GTKARROWTYPE(arrow_t),
RVAL2GTKSHADOWTYPE(shadow_t)));
return Qnil;
}
示例13: menutoolbutton_initialize
static VALUE
menutoolbutton_initialize(int argc, VALUE *argv, VALUE self)
{
GtkToolItem* item;
if (argc == 0){
item = gtk_menu_tool_button_new((GtkWidget*)NULL, (const gchar*)NULL);
} else if (TYPE(argv[0]) == T_SYMBOL || TYPE(argv[0]) == T_STRING){
VALUE stock_id;
rb_scan_args(argc, argv, "10", &stock_id);
if (TYPE(stock_id) == T_SYMBOL){
item = gtk_menu_tool_button_new_from_stock(rb_id2name(SYM2ID(stock_id)));
} else {
item = gtk_menu_tool_button_new_from_stock(RVAL2CSTR(stock_id));
}
} else {
VALUE icon_widget, label;
rb_scan_args(argc, argv, "11", &icon_widget, &label);
item = gtk_menu_tool_button_new(GTK_WIDGET(RVAL2GOBJ(icon_widget)),
NIL_P(label) ? (const gchar*)NULL : RVAL2CSTR(label));
}
RBGTK_INITIALIZE(self, item);
return Qnil;
}
示例14: rg_initialize
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE options, rb_parent, rb_file, rb_flags, rb_content_type;
GtkWindow *parent;
GtkDialogFlags flags;
GtkWidget *widget = NULL;
rb_scan_args(argc, argv, "01", &options);
rbg_scan_options(options,
"parent", &rb_parent,
"flags", &rb_flags,
"file", &rb_file,
"content_type", &rb_content_type,
NULL);
parent = NIL_P(rb_parent) ? NULL : RVAL2GTKWINDOW(rb_parent);
flags = NIL_P(rb_flags) ? 0 : RVAL2GTKDIALOGFLAGS(rb_flags);
if (!NIL_P(rb_file))
widget = gtk_app_chooser_dialog_new(parent, flags, RVAL2GFILE(rb_file));
else
widget = gtk_app_chooser_dialog_new_for_content_type(parent,
flags,
RVAL2CSTR(rb_content_type));
RBGTK_INITIALIZE(self, widget);
return Qnil;
}
示例15: tbtn_initialize
static VALUE
tbtn_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE label, use_underline;
GtkWidget *widget;
if (rb_scan_args(argc, argv, "02", &label, &use_underline) > 0) {
if (TYPE(label) == T_STRING){
if (NIL_P(use_underline) || RVAL2CBOOL(use_underline)){
widget = gtk_toggle_button_new_with_mnemonic(RVAL2CSTR(label));
} else {
widget = gtk_toggle_button_new_with_label(RVAL2CSTR(label));
}
} else if (TYPE(label) == T_SYMBOL){
widget = gtk_toggle_button_new_with_label(rb_id2name(SYM2ID(label)));
gtk_button_set_use_stock(GTK_BUTTON(widget), TRUE);
} else {
rb_raise(rb_eArgError, "invalid argument %s (expect Symbol(Gtk::Stock constants) or String)",
rb_class2name(CLASS_OF(label)));
}
} else {
widget = gtk_toggle_button_new();
}
RBGTK_INITIALIZE(self, widget);
return Qnil;
}