本文整理汇总了C++中BOXED2RVAL函数的典型用法代码示例。如果您正苦于以下问题:C++ BOXED2RVAL函数的具体用法?C++ BOXED2RVAL怎么用?C++ BOXED2RVAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BOXED2RVAL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rg_get_cursor_pos
static VALUE
rg_get_cursor_pos(VALUE self, VALUE index)
{
PangoRectangle strong_pos, weak_pos;
pango_layout_get_cursor_pos(_SELF(self), NUM2INT(index), &strong_pos, &weak_pos);
return rb_ary_new3(2, BOXED2RVAL(&strong_pos, PANGO_TYPE_RECTANGLE),
BOXED2RVAL(&weak_pos, PANGO_TYPE_RECTANGLE));
}
示例2: layout_iter_get_layout_extents
static VALUE
layout_iter_get_layout_extents(VALUE self)
{
PangoRectangle ink_rect, logical_rect;
pango_layout_iter_get_layout_extents(_SELF(self), &ink_rect, &logical_rect);
return rb_assoc_new(BOXED2RVAL(&ink_rect, PANGO_TYPE_RECTANGLE),
BOXED2RVAL(&logical_rect, PANGO_TYPE_RECTANGLE));
}
示例3: sort_func
static gint
sort_func(GtkRecentInfo *a, GtkRecentInfo *b, gpointer func)
{
struct callback_arg arg;
arg.callback = (VALUE)func;
arg.a = BOXED2RVAL(a, GTK_TYPE_RECENT_INFO);
arg.b = BOXED2RVAL(b, GTK_TYPE_RECENT_INFO);
return NUM2INT(G_PROTECT_CALLBACK(invoke_callback, &arg));
}
示例4: rg_pixel_extents
static VALUE
rg_pixel_extents(VALUE self)
{
PangoRectangle rink = {0, 0, 0, 0};
PangoRectangle rlog = {0, 0, 0, 0};
pango_layout_get_pixel_extents(_SELF(self), &rink, &rlog);
return rb_assoc_new(BOXED2RVAL(&rink, PANGO_TYPE_RECTANGLE),
BOXED2RVAL(&rlog, PANGO_TYPE_RECTANGLE));
}
示例5: rg_regex
static VALUE
rg_regex(VALUE self)
{
GRegex *regex;
regex = g_match_info_get_regex(_SELF(self));
return BOXED2RVAL(regex, G_TYPE_REGEX);
}
示例6: rg_wait_for_targets
static VALUE
rg_wait_for_targets(VALUE self)
{
gint i;
VALUE ary = Qnil;
GdkAtom* targets;
gint n_targets = 0;
gboolean ret = gtk_clipboard_wait_for_targets(_SELF(self), &targets, &n_targets);
if (ret){
ary = rb_ary_new();
for (i = 0; i < n_targets; i++){
if ((GdkAtom)targets == (GdkAtom)GDK_NONE){
rb_ary_push(ary, rb_eval_string("Gdk::Atom::NONE"));
}
else
rb_ary_push(ary, BOXED2RVAL(targets, GDK_TYPE_ATOM));
targets++;
}
/* How can I this ?
g_free(&o_targets);
*/
}
return ary;
}
示例7: tvc_cell_get_size
static VALUE
tvc_cell_get_size(VALUE self)
{
GdkRectangle cell_area;
gint x_offset, y_offset, width, height;
VALUE cell;
/* Is this collect implement for cell_area ? */
cell_area.x = -1;
cell_area.y = -1;
cell_area.width = -1;
cell_area.height = -1;
gtk_tree_view_column_cell_get_size(_SELF(self), &cell_area,
&x_offset, &y_offset,
&width, &height);
if (cell_area.x == -1 || cell_area.y == -1 ||
cell_area.width == -1 || cell_area.height == -1){
cell = Qnil;
} else {
cell = BOXED2RVAL(&cell_area, GDK_TYPE_RECTANGLE);
}
return rb_ary_new3(5, cell,
x_offset ? INT2NUM(x_offset) : Qnil,
y_offset ? INT2NUM(y_offset) : Qnil,
width ? INT2NUM(width) : Qnil,
height ? INT2NUM(height) : Qnil);
}
示例8: io_func
static gboolean
io_func(GIOChannel *source, GIOCondition condition, gpointer func)
{
return RVAL2CBOOL(rb_funcall((VALUE)func, id_call, 2,
BOXED2RVAL(source, G_TYPE_IO_CHANNEL),
INT2NUM(condition)));
}
示例9: rg_union
static VALUE
rg_union(VALUE self, VALUE other)
{
GdkRectangle dest;
gdk_rectangle_union(_SELF(self), _SELF(other), &dest);
return BOXED2RVAL(&dest, GDK_TYPE_RECTANGLE);
}
示例10: rg_s_open
static VALUE
rg_s_open(gint argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
{
VALUE arg1, arg2;
VALUE rio;
GIOChannel* io = NULL;
rb_scan_args(argc, argv, "11", &arg1, &arg2);
if (TYPE(arg1) == T_FIXNUM){
#ifdef G_OS_UNIX
io = g_io_channel_unix_new(NUM2INT(arg1));
#elif defined(G_OS_WIN32)
io = g_io_channel_win32_new_fd(NUM2INT(arg1));
#else
rb_raise(rb_eRuntimeError,
"GLib::IOChannel.new(fd) is supported on "
"UNIX and Windows environment only");
#endif
} else {
GError* err = NULL;
io = g_io_channel_new_file(RVAL2CSTR(arg1),
NIL_P(arg2) ? "r" : RVAL2CSTR(arg2), &err);
if (err != NULL) RAISE_GERROR(err);
}
rio = BOXED2RVAL(io, G_TYPE_IO_CHANNEL);
if (rb_block_given_p()) {
return rb_ensure(rb_yield, rio, ioc_close, rio);
}
return rio;
}
示例11: rg_colors
static VALUE
rg_colors(VALUE self)
{
GdkColormap *cmap;
GdkColor *colors;
GdkVisual *visual;
VALUE ary;
int i;
cmap = _SELF(self);
colors = cmap->colors;
visual = gdk_colormap_get_visual(cmap);
if (visual->type == GDK_VISUAL_GRAYSCALE ||
visual->type == GDK_VISUAL_PSEUDO_COLOR) {
ary = rb_ary_new2(cmap->size);
for (i = 0; i < cmap->size; i++) {
rb_ary_push(ary, BOXED2RVAL(colors, GDK_TYPE_COLOR));
colors++;
}
return ary;
} else {
return Qnil;
}
}
示例12: rg_region_intersect
static VALUE
rg_region_intersect(VALUE self, VALUE region)
{
return BOXED2RVAL(gtk_widget_region_intersect(_SELF(self),
(GdkRegion*)RVAL2BOXED(region, GDK_TYPE_REGION)),
GDK_TYPE_REGION);
}
示例13: textview_get_iter_location
static VALUE
textview_get_iter_location(VALUE self, VALUE iter)
{
GdkRectangle rect;
gtk_text_view_get_iter_location(_SELF(self), RVAL2ITR(iter), &rect);
return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE);
}
示例14: rg_clipbox
static VALUE
rg_clipbox(VALUE self)
{
GdkRectangle rect;
gdk_region_get_clipbox(_SELF(self), &rect);
return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE);
}
示例15: textview_get_visible_rect
static VALUE
textview_get_visible_rect(VALUE self)
{
GdkRectangle rect;
gtk_text_view_get_visible_rect(_SELF(self), &rect);
return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE);
}