• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RBGTK_INITIALIZE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中RBGTK_INITIALIZE函数的典型用法代码示例。如果您正苦于以下问题:C++ RBGTK_INITIALIZE函数的具体用法?C++ RBGTK_INITIALIZE怎么用?C++ RBGTK_INITIALIZE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RBGTK_INITIALIZE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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, &region);

    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;
}
开发者ID:pkorenev,项目名称:ruby-gnome2,代码行数:25,代码来源:rbgpui-print-preview.c


示例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;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:14,代码来源:rbgtkiconview.c


示例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;
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:30,代码来源:rbgtkradiotoolbutton.c


示例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;
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:33,代码来源:rbgtkscalebutton.c


示例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;
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:31,代码来源:rbgtk-button.c


示例6: rg_initialize

static VALUE
rg_initialize(VALUE self)
{
    RBGTK_INITIALIZE(self, gtk_font_chooser_widget_new());

    return Qnil;
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgtk-font-chooser-widget.c


示例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;
}
开发者ID:masaakiaoyagi,项目名称:ruby-gnome2,代码行数:27,代码来源:rbgtktoggletoolbutton.c


示例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;
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgtkarrow.c


示例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;
}
开发者ID:masaakiaoyagi,项目名称:ruby-gnome2,代码行数:32,代码来源:rbgtkrecentchooserdialog.c


示例10: rg_initialize

static VALUE
rg_initialize(VALUE self, VALUE orientation)
{
    RBGTK_INITIALIZE(self, gtk_button_box_new(RVAL2GTKORIENTATION(orientation)));

    return Qnil;
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgtk-button-box.c


示例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;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:25,代码来源:rbgtkfilechooserdialog.c


示例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;
}
开发者ID:masaakiaoyagi,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgtkarrow.c


示例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;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:27,代码来源:rbgtkmenutoolbutton.c


示例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;
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:28,代码来源:rbgtk-app-chooser-dialog.c


示例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;
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:27,代码来源:rbgtktogglebutton.c


示例16: rg_initialize

static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE arg;
    GtkToolItem *item = NULL;

    rb_scan_args(argc, argv, "01", &arg);
    if (NIL_P(arg)) {
        item = gtk_tool_button_new(NULL, NULL);
    } else if (TYPE(arg) == T_HASH) {
        VALUE icon_widget, label, stock_id, buffer;
        rbg_scan_options(arg,
                         "icon_widget", &icon_widget,
                         "label", &label,
                         "stock_id", &stock_id,
                         NULL);

        if (!NIL_P(icon_widget))
            item = gtk_tool_button_new(RVAL2GTKWIDGET(icon_widget),
                                       RVAL2CSTR_ACCEPT_NIL(label));
        else if (!NIL_P(stock_id))
            item = gtk_tool_button_new_from_stock(RVAL2GLIBID(stock_id, buffer));
    }
    if (!item)
        rb_raise(rb_eArgError, "Invalid arguments.");

    RBGTK_INITIALIZE(self, item);

    return Qnil;
}
开发者ID:masaakiaoyagi,项目名称:ruby-gnome2,代码行数:30,代码来源:rbgtktoolbutton.c


示例17: rg_initialize

static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE label, use_underline_or_accel_group;
    GtkWidget *widget = NULL;

    if (rb_scan_args(argc, argv, "02", &label, &use_underline_or_accel_group) > 0) {
        if (TYPE(label) == T_STRING){
            if (NIL_P(use_underline_or_accel_group) || RVAL2CBOOL(use_underline_or_accel_group)){
                widget = gtk_image_menu_item_new_with_mnemonic(RVAL2CSTR(label));
            } else {
                widget = gtk_image_menu_item_new_with_label(RVAL2CSTR(label));
            }
        } else if (TYPE(label) == T_SYMBOL){
            widget = gtk_image_menu_item_new_from_stock(rb_id2name(SYM2ID(label)),
                                                        NIL_P(use_underline_or_accel_group) ? NULL :
                                                        GTK_ACCEL_GROUP(RVAL2GOBJ(use_underline_or_accel_group)));
        } else {
            rb_raise(rb_eArgError, "invalid argument %s (expect Symbol(Gtk::Stock constants) or String)", 
                     rb_class2name(CLASS_OF(label)));
        }
    } else {
        widget = gtk_image_menu_item_new();
    }

    RBGTK_INITIALIZE(self, widget);
    return Qnil;
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:28,代码来源:rbgtkimagemenuitem.c


示例18: rg_initialize

static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE title, action, backend;
    GtkWidget* widget;

    rb_scan_args(argc, argv, "12", &title, &action, &backend);

    if (TYPE(title) == T_STRING) {
        if (NIL_P(backend)){
            widget = gtk_file_chooser_button_new(RVAL2CSTR(title),
                                                 RVAL2GENUM(action, GTK_TYPE_FILE_CHOOSER_ACTION));
        } else {
            widget = gtk_file_chooser_button_new_with_backend(RVAL2CSTR(title), 
                                                              RVAL2GENUM(action, 
                                                                         GTK_TYPE_FILE_CHOOSER_ACTION),
                                                              RVAL2CSTR(backend));
        }
    } else {
        widget = gtk_file_chooser_button_new_with_dialog(GTK_WIDGET(RVAL2GOBJ(title)));
    }

    RBGTK_INITIALIZE(self, widget);
    return Qnil;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:25,代码来源:rbgtkfilechooserbutton.c


示例19: cview_initialize

static VALUE
cview_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE text;
    VALUE with_markup = Qnil;
    GtkWidget *widget = NULL;

    rb_scan_args(argc, argv, "02", &text, &with_markup);
    
    if (NIL_P(text)) {
        widget = gtk_cell_view_new();
    } else {
        G_CHILD_SET(self, id_text, text);
        if (TYPE(text) == T_STRING){
            if (NIL_P(with_markup) || RVAL2CBOOL(with_markup)){
                widget = gtk_cell_view_new_with_markup(RVAL2CSTR(text));
            } else {
                widget = gtk_cell_view_new_with_text(RVAL2CSTR(text));
            }
        } else if (rb_obj_is_kind_of(text, GTYPE2CLASS(GDK_TYPE_PIXBUF))){
            widget = gtk_cell_view_new_with_pixbuf(GDK_PIXBUF(RVAL2GOBJ(text)));
        } else {
            rb_raise(rb_eArgError, 
                     "invalid argument %s (expect String or Gdk::Pixbuf)", 
                     rb_class2name(CLASS_OF(text)));
        }
    }

    RBGTK_INITIALIZE(self, widget);

    return Qnil;
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:32,代码来源:rbgtkcellview.c


示例20: rg_initialize

static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE options, rb_parent, rb_flags, rb_type, rb_buttons_type, rb_message;
    GtkWindow *parent;
    GtkDialogFlags flags;
    GtkMessageType type;
    GtkButtonsType buttons_type;
    const gchar *message;
    GtkWidget *dialog;

    rb_scan_args(argc, argv, "01", &options);
    rbg_scan_options(options,
                     "parent", &rb_parent,
                     "flags", &rb_flags,
                     "type", &rb_type,
                     "buttons_type", &rb_buttons_type,
                     "message", &rb_message,
                     NULL);
    parent = NIL_P(rb_parent) ? NULL : RVAL2GTKWINDOW(rb_parent);
    flags = NIL_P(rb_flags) ? 0 : RVAL2GTKDIALOGFLAGS(rb_flags);
    type = NIL_P(rb_type) ? GTK_MESSAGE_INFO : RVAL2GTKMESSAGETYPE(rb_type);
    buttons_type = NIL_P(rb_buttons_type) ? GTK_BUTTONS_OK : RVAL2GTKBUTTONSTYPE(rb_buttons_type);
    message = NIL_P(rb_message) ? "" : RVAL2CSTR(rb_message);

    dialog = gtk_message_dialog_new(parent, flags, type, buttons_type, "%s", message);
    RBGTK_INITIALIZE(self, dialog);

    return Qnil;
}
开发者ID:masaakiaoyagi,项目名称:ruby-gnome2,代码行数:30,代码来源:rbgtkmessagedialog.c



注:本文中的RBGTK_INITIALIZE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ RBOOL函数代码示例发布时间:2022-05-30
下一篇:
C++ RBExactQuery函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap