本文整理汇总了C++中RVAL2GOBJ函数的典型用法代码示例。如果您正苦于以下问题:C++ RVAL2GOBJ函数的具体用法?C++ RVAL2GOBJ怎么用?C++ RVAL2GOBJ使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RVAL2GOBJ函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rbclt_flow_layout_get_column_width
static VALUE
rbclt_flow_layout_get_column_width (VALUE self)
{
ClutterFlowLayout *flow_layout = CLUTTER_FLOW_LAYOUT (RVAL2GOBJ (self));
gfloat min_width, max_width;
VALUE answer = rb_hash_new();
clutter_flow_layout_get_column_width (flow_layout, &min_width, &max_width);
rb_hash_aset (answer, rb_intern("min"), rb_float_new (min_width));
rb_hash_aset (answer, rb_intern("max"), rb_float_new (max_width));
return answer;
}
示例2: rbclt_behaviour_rotate_get_center
static VALUE
rbclt_behaviour_rotate_get_center (VALUE self)
{
ClutterBehaviourRotate *brotate = CLUTTER_BEHAVIOUR_ROTATE (RVAL2GOBJ (self));
ClutterVertex vertex;
int x, y, z;
clutter_behaviour_rotate_get_center (brotate, &x, &y, &z);
vertex.x = CLUTTER_UNITS_FROM_INT (x);
vertex.y = CLUTTER_UNITS_FROM_INT (y);
vertex.z = CLUTTER_UNITS_FROM_INT (z);
return BOXED2RVAL (&vertex, CLUTTER_TYPE_VERTEX);
}
示例3: WebNetworkResponse_uri_equals
static VALUE
WebNetworkResponse_uri_equals(VALUE self, VALUE __v_uri)
{
char * uri; char * __orig_uri;
WebKitNetworkResponse *_self = ((WebKitNetworkResponse*)RVAL2GOBJ(self));
__orig_uri = uri = ( NIL_P(__v_uri) ? NULL : StringValuePtr(__v_uri) );
#line 214 "/home/geoff/Projects/gtk-webkit-ruby/ext/webkit/webkit.cr"
webkit_network_response_set_uri(_self, uri);
return __v_uri;
}
示例4: rg_write_contents
static VALUE
rg_write_contents(int argc, VALUE *argv, VALUE self)
{
VALUE stream, flags, rb_cancellable;
GCancellable *cancellable;
gboolean result;
GError *error = NULL;
rb_scan_args(argc, argv, "21", &stream, &flags, &rb_cancellable);
cancellable = NIL_P(rb_cancellable) ? NULL : RVAL2GOBJ(rb_cancellable);
result = vte_terminal_write_contents(_SELF(self),
RVAL2GOBJ(stream),
RVAL2GENUM(flags, VTE_TYPE_TERMINAL_WRITE_FLAGS),
cancellable,
&error);
if (error)
RAISE_GERROR(error);
return CBOOL2RVAL(result);
}
示例5: WebView_set_custom_encoding
static VALUE
WebView_set_custom_encoding(VALUE self, VALUE __v_encoding)
{
char * encoding; char * __orig_encoding;
WebKitWebView *_self = ((WebKitWebView*)RVAL2GOBJ(self));
__orig_encoding = encoding = ( NIL_P(__v_encoding) ? NULL : StringValuePtr(__v_encoding) );
#line 135 "/home/geoff/Projects/gtk-webkit-ruby/ext/webkit/webkit.cr"
webkit_web_view_set_custom_encoding(_self, encoding);
return self;
}
示例6: rbclt_behaviour_rotate_get_bounds
static VALUE
rbclt_behaviour_rotate_get_bounds (VALUE self)
{
ClutterBehaviourRotate *brotate = CLUTTER_BEHAVIOUR_ROTATE (RVAL2GOBJ (self));
gdouble angle_start, angle_end;
clutter_behaviour_rotate_get_bounds (brotate,
&angle_start,
&angle_end);
return rb_ary_new3 (2, rb_float_new (angle_start), rb_float_new (angle_end));
}
示例7: rg_m_owner_set
static VALUE
rg_m_owner_set(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
{
VALUE owner, selection, time, send_event;
int ret;
if (argc == 4){
rb_scan_args(argc, argv, "40", &owner, &selection, &time, &send_event);
ret = gdk_selection_owner_set(GDK_WINDOW(RVAL2GOBJ(owner)),
RVAL2ATOM(selection),
NUM2UINT(time), RVAL2CBOOL(send_event));
} else {
VALUE display = Qnil;
rb_scan_args(argc, argv, "50", &display, &owner, &selection, &time, &send_event);
ret = gdk_selection_owner_set_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
GDK_WINDOW(RVAL2GOBJ(owner)),
RVAL2ATOM(selection),
NUM2UINT(time), RVAL2CBOOL(send_event));
}
return CBOOL2RVAL(ret);
}
示例8: rb_gst_x_overlay_set_xwindow_id_with_buswatch
static VALUE
rb_gst_x_overlay_set_xwindow_id_with_buswatch(VALUE self, VALUE bus,
VALUE x_window_id)
{
struct xid_callback_data* xid_cb_data;
GObject *sink;
xid_cb_data = g_slice_new(struct xid_callback_data);
xid_cb_data->xid = NUM2ULL(x_window_id);
xid_cb_data->bus = RVAL2GOBJ(bus);
sink = RVAL2GOBJ(self);
g_object_set_qdata_full(sink, xoverlay_xid_data_quark,
xid_cb_data, xid_callback_data_destroy_cb);
gst_bus_enable_sync_message_emission(GST_BUS(xid_cb_data->bus));
xid_cb_data->cb_id =
g_signal_connect_object(xid_cb_data->bus, "sync-message",
G_CALLBACK(bus_sync_func_cb), sink, 0);
return self;
}
示例9: rbclt_behaviour_opacity_get_bounds
static VALUE
rbclt_behaviour_opacity_get_bounds (VALUE self)
{
ClutterBehaviourOpacity *behaviour
= CLUTTER_BEHAVIOUR_OPACITY (RVAL2GOBJ (self));
guint8 opacity_start, opacity_end;
clutter_behaviour_opacity_get_bounds (behaviour,
&opacity_start, &opacity_end);
return rb_ary_new3 (2, INT2NUM (opacity_start), INT2NUM (opacity_end));
}
示例10: rg_initialize
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE arg1;
GtkAdjustment *adj = NULL;
rb_scan_args(argc, argv, "01", &arg1);
if (!NIL_P(arg1)) adj = GTK_ADJUSTMENT(RVAL2GOBJ(arg1));
RBGTK_INITIALIZE(self, gtk_hscrollbar_new(adj));
return Qnil;
}
示例11: WebView_load_uri
static VALUE
WebView_load_uri(VALUE self, VALUE __v_uri)
{
char * uri; char * __orig_uri;
WebKitWebView *_self = ((WebKitWebView*)RVAL2GOBJ(self));
__orig_uri = uri = ( NIL_P(__v_uri) ? NULL : StringValuePtr(__v_uri) );
#line 111 "/home/geoff/Projects/gtk-webkit-ruby/ext/webkit/webkit.cr"
webkit_web_view_load_uri(_self, uri);
return Qnil;
}
示例12: rg_set_colormap
static VALUE
rg_set_colormap(VALUE self, VALUE colormap)
{
VALUE old_colormap;
old_colormap = GOBJ2RVAL(gdk_drawable_get_colormap(_SELF(self)));
G_CHILD_REMOVE(self, old_colormap);
G_CHILD_ADD(self, colormap);
gdk_drawable_set_colormap(_SELF(self), GDK_COLORMAP(RVAL2GOBJ(colormap)));
return self;
}
示例13: WebView_execute_script
static VALUE
WebView_execute_script(VALUE self, VALUE __v_script)
{
char * script; char * __orig_script;
WebKitWebView *_self = ((WebKitWebView*)RVAL2GOBJ(self));
__orig_script = script = ( NIL_P(__v_script) ? NULL : StringValuePtr(__v_script) );
#line 102 "/home/geoff/Projects/gtk-webkit-ruby/ext/webkit/webkit.cr"
webkit_web_view_execute_script(_self, script);
return Qnil;
}
示例14: rbclt_container_child_get
static VALUE
rbclt_container_child_get (int argc, VALUE *argv, VALUE self)
{
ClutterContainer *container = CLUTTER_CONTAINER (RVAL2GOBJ (self));
ClutterActor *actor;
VALUE ary = rb_ary_new ();
int i;
if (argc < 2)
rb_raise (rb_eArgError, "wrong number of arguments (%d for %d)", argc, 2);
if (!CLUTTER_IS_ACTOR (actor = (ClutterActor *) RVAL2GOBJ (argv[0])))
rb_raise (rb_eArgError, "actor required");
for (i = 1; i < argc; i++)
{
GValue value;
const char *prop = StringValuePtr (argv[i]);
GObjectClass *klass
= G_OBJECT_CLASS (g_type_class_ref (G_TYPE_FROM_INSTANCE (container)));
GParamSpec *pspec
= clutter_container_class_find_child_property (klass, prop);
g_type_class_unref (klass);
if (pspec == NULL)
rb_raise (rb_eArgError, "child property not found \"%s\"", prop);
memset (&value, 0, sizeof (VALUE));
g_value_init (&value, pspec->value_type);
clutter_container_child_get_property (container, actor, prop, &value);
rb_ary_push (ary, GVAL2RVAL (&value));
g_value_unset (&value);
}
if (RARRAY_LEN (ary) == 1)
return RARRAY_PTR (ary)[0];
else
return ary;
}
示例15: rbclt_container_child_set
static VALUE
rbclt_container_child_set (int argc, VALUE *argv, VALUE self)
{
ClutterContainer *container = CLUTTER_CONTAINER (RVAL2GOBJ (self));
ClutterActor *actor;
int i;
if (argc < 2)
rb_raise (rb_eArgError, "wrong number of arguments (%d for %d)", argc, 2);
else if ((argc & 1) == 0)
rb_raise (rb_eArgError, "wrong number of arguments "
"(prop-value pairs needed)");
if (!CLUTTER_IS_ACTOR (actor = (ClutterActor *) RVAL2GOBJ (argv[0])))
rb_raise (rb_eArgError, "actor required");
for (i = 1; i < argc; i += 2)
{
GValue value;
const char *prop = StringValuePtr (argv[i]);
GObjectClass *klass
= G_OBJECT_CLASS (g_type_class_ref (G_TYPE_FROM_INSTANCE (container)));
GParamSpec *pspec
= clutter_container_class_find_child_property (klass, prop);
g_type_class_unref (klass);
if (pspec == NULL)
rb_raise (rb_eArgError, "child property not found \"%s\"", prop);
memset (&value, 0, sizeof (VALUE));
g_value_init (&value, pspec->value_type);
rbgobj_rvalue_to_gvalue (argv[i + 1], &value);
clutter_container_child_set_property (container, actor, prop, &value);
g_value_unset (&value);
}
return self;
}