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


C++ G_INITIALIZE函数代码示例

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


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

示例1: initialize

static VALUE
initialize(VALUE self, VALUE name, VALUE left_gravity)
{
    if (NIL_P(name))
        G_INITIALIZE(self, gtk_text_mark_new(NULL, RVAL2CBOOL(left_gravity)));
    else
        G_INITIALIZE(self, gtk_text_mark_new(RVAL2CSTR(name), RVAL2CBOOL(left_gravity)));
    return Qnil;
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:9,代码来源:rbgtktextmark.c

示例2: rg_initialize

static VALUE
rg_initialize(VALUE self, VALUE num)
{
    guint atom = FIX2INT(num);
    if (atom == 0){
        /* This is a trick for passing 0(NULL) */
        G_INITIALIZE(self, GUINT_TO_POINTER(1));
        _SELF(self) = GUINT_TO_POINTER(GDK_NONE);
    } else {
        G_INITIALIZE(self, GUINT_TO_POINTER(atom));
    }

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

示例3: initialize_receiver

static void
initialize_receiver(VALUE receiver, GITypeInfo *info, GIArgument *value)
{
    GIBaseInfo *interface_info;
    GIInfoType interface_type;

    if (g_type_info_get_tag(info) != GI_TYPE_TAG_INTERFACE) {
        rb_raise(rb_eRuntimeError, "TODO: returned value isn't interface");
    }

    interface_info = g_type_info_get_interface(info);
    interface_type = g_base_info_get_type(interface_info);
    g_base_info_unref(interface_info);
    switch (interface_type) {
    case GI_INFO_TYPE_OBJECT:
        G_INITIALIZE(receiver, value->v_pointer);
        break;
    case GI_INFO_TYPE_STRUCT:
        G_INITIALIZE(receiver, value->v_pointer);
        break;
    case GI_INFO_TYPE_INVALID:
    case GI_INFO_TYPE_FUNCTION:
    case GI_INFO_TYPE_CALLBACK:
    case GI_INFO_TYPE_BOXED:
    case GI_INFO_TYPE_ENUM:
    case GI_INFO_TYPE_FLAGS:
    case GI_INFO_TYPE_INTERFACE:
    case GI_INFO_TYPE_CONSTANT:
    case GI_INFO_TYPE_INVALID_0:
        rb_raise(rb_eRuntimeError,
                 "TODO: returned value isn't object, struct or union");
        break;
    case GI_INFO_TYPE_UNION:
        G_INITIALIZE(receiver, value->v_pointer);
        break;
    case GI_INFO_TYPE_VALUE:
    case GI_INFO_TYPE_SIGNAL:
    case GI_INFO_TYPE_VFUNC:
    case GI_INFO_TYPE_PROPERTY:
    case GI_INFO_TYPE_FIELD:
    case GI_INFO_TYPE_ARG:
    case GI_INFO_TYPE_TYPE:
    case GI_INFO_TYPE_UNRESOLVED:
    default:
        rb_raise(rb_eRuntimeError,
                 "TODO: returned value isn't object, struct or union");
        break;
    }
}
开发者ID:ruby-gnome2,项目名称:ruby-gnome2,代码行数:49,代码来源:rb-gi-constructor-info.c

示例4: async_start_initialize

static VALUE
async_start_initialize(VALUE self, VALUE src, VALUE new_base_time)
{
    G_INITIALIZE(self, gst_message_new_async_start(RVAL2GST_OBJ(src),
                                                   RVAL2CBOOL(new_base_time)));
    return Qnil;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgst-message.c

示例5: application_initialize

static VALUE
application_initialize(VALUE self, VALUE src, VALUE structure)
{
    G_INITIALIZE(self, gst_message_new_application(RVAL2GST_OBJ(src),
                                                   RVAL2GST_STRUCT(structure)));
    return Qnil;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgst-message.c

示例6: buffering_initialize

static VALUE
buffering_initialize(VALUE self, VALUE src, VALUE percent)
{
    G_INITIALIZE(self, gst_message_new_buffering(RVAL2GST_OBJ(src),
                                                 NUM2INT(percent)));
    return Qnil;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgst-message.c

示例7: rg_initialize

static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE points_or_rectangle, rbfill_rule;
    GdkRegion *region;

    rb_scan_args(argc, argv, "02", &points_or_rectangle, &rbfill_rule);
    if (NIL_P(points_or_rectangle)) {
        region = gdk_region_new();
    } else if (TYPE(points_or_rectangle) == T_ARRAY) {
        GdkFillRule fill_rule = RVAL2GENUM(rbfill_rule, GDK_TYPE_FILL_RULE);
        long n;
        GdkPoint *points = RVAL2GDKPOINTS(points_or_rectangle, &n);

        region = gdk_region_polygon(points, n, fill_rule);

        g_free(points);
    } else if (RVAL2GTYPE(points_or_rectangle) == GDK_TYPE_RECTANGLE) {
        region = gdk_region_rectangle((GdkRectangle*)RVAL2BOXED(points_or_rectangle, 
                                                                GDK_TYPE_RECTANGLE));
    } else {
        rb_raise(rb_eArgError, 
                 "invalid argument %s (expect array of Gdk::Point or Gdk::Rectangle, nil)",
                 rb_class2name(CLASS_OF(points_or_rectangle)));
    }

    G_INITIALIZE(self, region);

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

示例8: rg_initialize

static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
    GtkPaperSize *size;

    if (argc <= 1) {
        VALUE name;
        rb_scan_args(argc, argv, "01", &name);
        size = gtk_paper_size_new(RVAL2CSTR_ACCEPT_NIL(name));
    } else if (argc == 4) {
        size = gtk_paper_size_new_from_ppd(RVAL2CSTR(argv[0]),
                                           RVAL2CSTR(argv[1]),
                                           NUM2DBL(argv[2]),
                                           NUM2DBL(argv[3]));
    } else if (argc == 5) {
        size = gtk_paper_size_new_custom(RVAL2CSTR(argv[0]),
                                         RVAL2CSTR(argv[1]),
                                         NUM2DBL(argv[2]),
                                         NUM2DBL(argv[3]),
                                         RVAL2UNIT(argv[4]));
    } else {
        rb_raise(rb_eArgError,
                 "wrong number of arguments (%d for 0, 1, 4 or 5)", argc);
    }

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

示例9: rb_rsvg_handle_initialize

static VALUE
rb_rsvg_handle_initialize(int argc, VALUE *argv, VALUE self)
{
    RsvgHandle *handle;
    VALUE gz;
    rb_scan_args(argc, argv, "01", &gz);

#if LIBRSVG_CHECK_VERSION(2, 11, 0)
    handle = rsvg_handle_new();
#else
    if (RVAL2CBOOL(gz)) {
#  ifdef HAVE_LIBRSVG_RSVG_GZ_H
        handle = rsvg_handle_new_gz();
#  else
        rb_warning("gz handling is not supported in your librsvg");
        handle = rsvg_handle_new();
#  endif
    } else {
        handle = rsvg_handle_new();
    }
#endif

#ifdef RSVG_TYPE_HANDLE
    G_INITIALIZE(self, handle);
#else
    DATA_PTR(self) = handle;
#endif

    rb_ivar_set(self, id_closed, Qfalse);
    return Qnil;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:31,代码来源:rbrsvg.c

示例10: rg_initialize

static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE path;
    GtkTreePath* widget;

    if (argc == 1) {
        path = argv[0];
        if (TYPE(path) == T_STRING){
            widget = gtk_tree_path_new_from_string(RVAL2CSTR(path));
        } else {
            widget = gtk_tree_path_new();
            gtk_tree_path_append_index(widget, NUM2INT(path));
        }
        if (widget == NULL)
            rb_raise(rb_eArgError, "Invalid path %s was passed.", RVAL2CSTR(path));
    } else {
        int i;
        widget = gtk_tree_path_new();
        for (i = 0; i < argc; i++)
            gtk_tree_path_append_index(widget, NUM2INT(argv[i]));
    }

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

示例11: initialize_loader

/* Image Data in Memory */
static VALUE
initialize_loader(int argc, VALUE *argv, VALUE self)
{
    GdkPixbufLoader* loader;
    GError* error = NULL;
    VALUE arg1, is_mime_type;

    rb_scan_args(argc, argv, "02", &arg1, &is_mime_type);

    if (NIL_P(arg1)) {
        loader = gdk_pixbuf_loader_new();
    } else {
        if (is_mime_type == Qtrue) {
#if RBGDK_PIXBUF_CHECK_VERSION(2,4,0)
            loader = gdk_pixbuf_loader_new_with_mime_type(RVAL2CSTR(arg1), &error);
#else
            rb_warning("Not supported GTK+-2.0/2.2.");
            loader = gdk_pixbuf_loader_new();
#endif
        } else {
            /* Default behavior */
            loader = gdk_pixbuf_loader_new_with_type(RVAL2CSTR(arg1), &error);
        }
        if(error) RAISE_GERROR(error);
    }
    
    G_INITIALIZE(self, loader);
    return Qnil;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:30,代码来源:rbgdk-pixbuf-loader.c

示例12: rg_initialize

/* Class method: new(name, category)
 * name: mark name (string)
 * category: marker category (string)
 *
 * Returns: a newly created Gtk::SourceMark object.
 */
static VALUE
rg_initialize(VALUE self, VALUE name, VALUE category)
{
    G_INITIALIZE (self,
              gtk_source_mark_new (RVAL2CSTR(name), RVAL2CSTR_ACCEPT_SYMBOL(category)));
    return Qnil;
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:13,代码来源:rbgtksourcemark.c

示例13: rg_initialize

static VALUE
rg_initialize(VALUE self)
{
        G_INITIALIZE(self, g_app_launch_context_new());

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

示例14: geo_initialize

static VALUE
geo_initialize(VALUE self)
{
    GdkGeometry g;
    G_INITIALIZE(self, &g);
    return Qnil;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:7,代码来源:rbgdkgeometry.c

示例15: socketservice_initialize

static VALUE
socketservice_initialize(VALUE self)
{
        G_INITIALIZE(self, g_socket_service_new());

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


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