当前位置: 首页>>代码示例>>C++>>正文


C++ G_RELATIVE函数代码示例

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


在下文中一共展示了G_RELATIVE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rg_insert

static VALUE
rg_insert(int argc, VALUE *argv, VALUE self)
{
    GtkWidget* ret = NULL;
    VALUE type = Qnil;
    VALUE pos, widget, stock_id, element_type, text, ttext, ptext, icon, func;

    if (argc > 1) type = argv[1];

    if (NIL_P(type) || TYPE(type) == T_STRING){
        rb_scan_args(argc, argv, "15", &pos, &text, &ttext, &ptext, &icon, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);
        ret = gtk_toolbar_insert_item(_SELF(self),N_RVAL2CSTR(text),
                                      N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                      N_RVAL2WIDGET(icon),
                                      GTK_SIGNAL_FUNC(exec_callback),
                                      (gpointer)func,
                                      NUM2INT(pos));
    } else if (TYPE(type) == T_FIXNUM) {
        rb_scan_args(argc, argv, "17", &pos, &element_type, &widget, &text, &ttext, &ptext, &icon, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);

        ret = gtk_toolbar_insert_element(_SELF(self),
                                         RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE),
                                         N_RVAL2WIDGET(widget), 
                                         N_RVAL2CSTR(text), N_RVAL2CSTR(ttext),
                                         N_RVAL2CSTR(ptext), N_RVAL2WIDGET(icon),
                                         GTK_SIGNAL_FUNC(exec_callback),
                                         (gpointer)func,
                                         NUM2INT(pos));
        if (RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE) == GTK_TOOLBAR_CHILD_SPACE) 
            ret = NULL;
    } else if (TYPE(type) == T_SYMBOL) {
        rb_scan_args(argc, argv, "14", &pos, &stock_id, &ttext, &ptext, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);

        ret = gtk_toolbar_insert_stock(_SELF(self), rb_id2name(SYM2ID(stock_id)),
                                       N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                       GTK_SIGNAL_FUNC(exec_callback),
                                       (gpointer)func, NUM2INT(pos));
#if GTK_CHECK_VERSION(2,4,0)
    } else if (rb_obj_is_kind_of(type, GTYPE2CLASS(GTK_TYPE_TOOL_ITEM))){
        rb_scan_args(argc, argv, "20", &pos, &widget);
        gtk_toolbar_insert(_SELF(self), GTK_TOOL_ITEM(RVAL2GOBJ(widget)),
                           NUM2INT(pos));
        return widget;
#endif
    } else {
        rb_scan_args(argc, argv, "22", &pos, &widget, &ttext, &ptext);
        gtk_toolbar_insert_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)),
                                  N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                  NUM2INT(pos));
        return widget;
    }

    return ret ? GOBJ2RVAL(ret) : Qnil;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:60,代码来源:rbgtktoolbar.c

示例2: tvc_set_cell_data_func

static VALUE
tvc_set_cell_data_func(VALUE self, VALUE renderer)
{
    volatile VALUE func = rb_block_proc();
    G_RELATIVE(self, func);
    G_RELATIVE(renderer, func);
    gtk_tree_view_column_set_cell_data_func(_SELF(self), RVAL2CELLRENDERER(renderer),
                                            (GtkTreeCellDataFunc)cell_data_func, (gpointer)func, NULL);
    return self;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:10,代码来源:rbgtktreeviewcolumn.c

示例3: rg_append

static VALUE
rg_append(int argc, VALUE *argv, VALUE self)
{
    GtkWidget* ret = NULL;
    VALUE type = Qnil;
    VALUE widget, stock_id, element_type, text, ttext, ptext, icon, func;

    if (argc > 0) type = argv[0];

    if (NIL_P(type) || TYPE(type) == T_STRING){
        rb_scan_args(argc, argv, "05", &text, &ttext, &ptext, &icon, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);

        ret = gtk_toolbar_append_item(_SELF(self), N_RVAL2CSTR(text),
                                      N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                      N_RVAL2WIDGET(icon),
                                      GTK_SIGNAL_FUNC(exec_callback),
                                      (gpointer)func);
    } else if (TYPE(type) == T_FIXNUM) {
        rb_scan_args(argc, argv, "07", &element_type, &widget, &text, &ttext, &ptext, &icon, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);

        ret = gtk_toolbar_append_element(_SELF(self), 
                                         RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE), 
                                         N_RVAL2WIDGET(widget), N_RVAL2CSTR(text),
                                         N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                         N_RVAL2WIDGET(icon),
                                         GTK_SIGNAL_FUNC(exec_callback),
                                         (gpointer)func);
        if (RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE) == GTK_TOOLBAR_CHILD_SPACE) 
            ret = NULL;
    } else if (TYPE(type) == T_SYMBOL) {
        rb_scan_args(argc, argv, "13", &stock_id, &ttext, &ptext, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);

        ret = gtk_toolbar_insert_stock(_SELF(self), rb_id2name(SYM2ID(stock_id)),
                                       N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                       GTK_SIGNAL_FUNC(exec_callback),
                                       (gpointer)func, -1);
    } else {
        rb_scan_args(argc, argv, "12", &widget, &ttext, &ptext);
        gtk_toolbar_append_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)),
                                  N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext));
        return widget;
    }

    return ret ? GOBJ2RVAL(ret) : Qnil;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:51,代码来源:rbgtktoolbar.c

示例4: rg_add_radio_actions

static VALUE
rg_add_radio_actions(int argc, VALUE *argv, VALUE self)
{
    GtkActionGroup *group = _SELF(self);
    VALUE rbentries, rbvalue, proc;
    long n;
    GtkRadioActionEntry *entries;
    gint value;

    rb_scan_args(argc, argv, "12", &rbentries, &rbvalue, &proc);

    value = NIL_P(rbvalue) ? -1 : NUM2INT(rbvalue);

    if (NIL_P(proc) && rb_block_given_p()) {
        proc = rb_block_proc();
        /* TODO: How do we remove this proc when all the radio actions passed
         * have been removed? */
        G_RELATIVE(self, proc);
    }

    entries = RVAL2GTKRADIOACTIONENTRIES(rbentries, n);

    gtk_action_group_add_radio_actions(group,
                                       entries,
                                       n,
                                       value,
                                       G_CALLBACK(activate_radio_action),
                                       (gpointer)proc);

    g_free(entries);

    return self;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:33,代码来源:rbgtkactiongroup.c

示例5: rg_popup

/* the proc should return [x, y, push_in] */
static VALUE
rg_popup(VALUE self, VALUE pshell, VALUE pitem, VALUE button, VALUE activate_time)
{
    GtkWidget *gpshell = NULL;
    GtkWidget *gpitem = NULL;
    GtkMenuPositionFunc pfunc = NULL;
    gpointer data = NULL;
    VALUE func;

    if (rb_block_given_p()) {
        func = rb_block_proc();
        pfunc = (GtkMenuPositionFunc)menu_pos_func;
        data = (gpointer)func;
        G_RELATIVE(self, func);
    }
    if (!NIL_P(pshell)){
        gpshell = RVAL2WIDGET(pshell);
    }
    if (!NIL_P(pitem)) {
        gpitem = RVAL2WIDGET(pitem);
    }

    gtk_menu_popup(_SELF(self), gpshell, gpitem,
                   pfunc, data, NUM2UINT(button),
                   NUM2UINT(activate_time));
    return self;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:28,代码来源:rbgtkmenu.c

示例6: ifact_s_from_widget

static VALUE
ifact_s_from_widget(VALUE self, VALUE widget)
{
    VALUE obj = GOBJ2RVAL(gtk_item_factory_from_widget(RVAL2WIDGET(widget)));
    G_RELATIVE(obj, self);
    return obj;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgtkitemfactory.c

示例7: actiongroup_add_radio_actions

static VALUE
actiongroup_add_radio_actions(int argc, VALUE *argv, VALUE self)
{
    VALUE entries, value, proc;
    guint i;
    guint n_entries;
    GtkRadioActionEntry* gentries;

    rb_scan_args(argc, argv, "12", &entries, &value, &proc);

    if (NIL_P(value)) value = -1;
    if (NIL_P(proc) && rb_block_given_p()){
        proc = rb_block_proc();
        G_RELATIVE(self, proc);
    }
    n_entries = (guint)RARRAY_LEN(entries);
    gentries = g_new0(GtkRadioActionEntry, n_entries);

    for (i = 0; i < n_entries; i++){
        VALUE entry;
	int size;

	entry = RARRAY_PTR(entries)[i];
	size = RARRAY_LEN(entry);
        if (size < 1)
            rb_raise(rb_eArgError, "wrong array parameter");

        gentries[i].name = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[0]);

        if (size < 2) continue;

        if (NIL_P(RARRAY_PTR(entry)[1])){
            gentries[i].stock_id = NULL;
        } else if (SYMBOL_P(RARRAY_PTR(entry)[1])){
            gentries[i].stock_id = rb_id2name(SYM2ID(RARRAY_PTR(entry)[1]));
        } else if (TYPE(RARRAY_PTR(entry)[1]) == T_STRING){
            gentries[i].stock_id = RVAL2CSTR(RARRAY_PTR(entry)[1]);
        } else{
            rb_raise(rb_eArgError,
		     "invalid argument %s (expect Symbol or String)",
                     rb_class2name(CLASS_OF(RARRAY_PTR(entry)[1])));
        }

        if (size < 3) continue;
        gentries[i].label = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[2]);
        if (size < 4) continue;
        gentries[i].accelerator = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[3]);
        if (size < 4) continue;
        gentries[i].tooltip = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[4]);
        if (size < 5) continue;
        gentries[i].value = NUM2INT(RARRAY_PTR(entry)[5]);
    }
    gtk_action_group_add_radio_actions(_SELF(self), gentries,
				       n_entries, NUM2INT(value),
                                       G_CALLBACK(activate_radio_action),
				       (gpointer)proc);
    g_free(gentries);

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

示例8: rg_m_async_with_pipes

static VALUE
rg_m_async_with_pipes(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
{
    GError *err = NULL;
    gboolean ret;
    GPid child_pid;
    VALUE func = Qnil;
    gchar **gargv;
    gchar **genvp;
    gint standard_input, standard_output, standard_error;

    if (rb_block_given_p()) {
        func = rb_block_proc();
        G_RELATIVE(self, func);
    }

    gargv = (gchar **)RVAL2STRV(argv);
    genvp = (gchar **)RVAL2STRV_ACCEPT_NIL(envp);
    ret = g_spawn_async_with_pipes(NIL_P(working_directory) ? NULL : RVAL2CSTR(working_directory),
                                   gargv, genvp, NUM2INT(flags),
                                   (GSpawnChildSetupFunc)child_setup, 
                                   (gpointer)func,
                                   &child_pid, 
                                   &standard_input, &standard_output,
                                   &standard_error, &err);
    g_free(gargv);
    g_free(genvp);
    if (!ret)
        RAISE_GERROR(err);

    return rb_ary_new3(4, INT2NUM((gint)child_pid), 
                       rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_input)),
                       rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_output)),
                       rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_error)));
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:35,代码来源:rbglib_spawn.c

示例9: rg_m_async

static VALUE
rg_m_async(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
{
    GError *err = NULL;
    gboolean ret;
    GPid child_pid;
    VALUE func = Qnil;
    gchar **gargv;
    gchar **genvp;

    if (rb_block_given_p()) {
        func = rb_block_proc();
        G_RELATIVE(self, func);
    }

    gargv = (gchar **)RVAL2STRV(argv);
    genvp = (gchar **)RVAL2STRV_ACCEPT_NIL(envp);
    ret = g_spawn_async(NIL_P(working_directory) ? NULL : RVAL2CSTR(working_directory),
                        gargv, genvp, NUM2INT(flags),
                        (GSpawnChildSetupFunc)child_setup, (gpointer)func,
                        &child_pid, &err);
    g_free(gargv);
    g_free(genvp);
    if (!ret)
        RAISE_GERROR(err);

    return INT2NUM((int)child_pid);
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:28,代码来源:rbglib_spawn.c

示例10: lb_set_uri_hook

static VALUE
lb_set_uri_hook(VALUE self)
{
    VALUE func = rb_block_proc();
    G_RELATIVE(self, func);
    gtk_link_button_set_uri_hook((GtkLinkButtonUriFunc)link_func, (gpointer)func, (GDestroyNotify)NULL);
    return self;
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:8,代码来源:rbgtklinkbutton.c

示例11: rg_set_forward_page_func

static VALUE
rg_set_forward_page_func(VALUE self)
{
    VALUE func = rb_block_proc();
    G_RELATIVE(self, func);
    gtk_assistant_set_forward_page_func(_SELF(self), (GtkAssistantPageFunc)ass_page_func, (gpointer)func, NULL);
    return self;
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:8,代码来源:rbgtkassistant.c

示例12: rg_add_watch

static VALUE
rg_add_watch(VALUE self, VALUE condition)
{
    VALUE func = rb_block_proc();
    G_RELATIVE(self, func);
    return UINT2NUM(g_io_add_watch(_SELF(self), NUM2INT(condition), 
                                   (GIOFunc)io_func, (gpointer)func));
}
开发者ID:htrb,项目名称:ruby-gnome2,代码行数:8,代码来源:rbglib_iochannel.c

示例13: gdkevent_s_handler_set

static VALUE
gdkevent_s_handler_set(VALUE self)
{
    volatile VALUE func = rb_block_proc();
    G_RELATIVE(self, func);

    gdk_event_handler_set((GdkEventFunc)handler_func, (gpointer)func, NULL);
    return self;
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:9,代码来源:rbgdkevent.c

示例14: rg_m_init_add

static VALUE
rg_m_init_add(VALUE self)
{
    volatile VALUE func = rb_block_proc();

    gtk_init_add((GtkFunction)gtk_m_function2, (gpointer)func);
    G_RELATIVE(self, func);
    return Qnil;
}
开发者ID:masaakiaoyagi,项目名称:ruby-gnome2,代码行数:9,代码来源:rbgtk.c

示例15: rg_s_set_window_creation_hook

static VALUE
rg_s_set_window_creation_hook(VALUE self)
{
    VALUE func = rb_block_proc();
    G_RELATIVE(self, func);
    gtk_notebook_set_window_creation_hook((GtkNotebookWindowCreationFunc)creation_func, 
                                          (gpointer)func, (GDestroyNotify)NULL);
    return self;
}    
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:9,代码来源:rbgtknotebook.c


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