Ejemplo n.º 1
0
int
clip_GTK_DRAGSETICONPIXMAP(ClipMachine * cm)
{
        C_object  *ccontext = _fetch_co_arg(cm);
	C_object *ccolormap = _fetch_cobject(cm, _clip_spar(cm, 2));
        C_object   *cpixmap = _fetch_cobject(cm, _clip_spar(cm, 3));
        C_object     *cmask = _fetch_cobject(cm, _clip_spar(cm, 4));
        gint          hot_x = _clip_parni(cm, 5);
        gint          hot_y = _clip_parni(cm, 6);

	if (!ccontext || ccontext->type != GDK_TYPE_DRAG_CONTEXT)
        	goto err;
	CHECKCOBJ(ccolormap, GDK_IS_COLORMAP(ccolormap->object));
	CHECKCOBJ(cpixmap, GDK_IS_PIXMAP(cpixmap->object));
	CHECKCOBJ(cmask, GDK_IS_BITMAP(cmask));
	CHECKARG(5, NUMERIC_t);
	CHECKARG(6, NUMERIC_t);

        gtk_drag_set_icon_pixmap((GdkDragContext*)ccontext->object,
        	GDK_COLORMAP(ccolormap->object),
                GDK_PIXMAP(cpixmap->object),
                GDK_BITMAP(cmask->object),
        	hot_x, hot_y );

	return 0;
err:
	return 1;
}
Ejemplo n.º 2
0
static VALUE
rg_m_set_icon(int argc, VALUE *argv, VALUE self)
{
    VALUE context, obj, pixmap = Qnil, mask = Qnil, hot_x, hot_y;

    if (argc == 6) {
        rb_scan_args(argc, argv, "60", &context, &obj, &pixmap, &mask, &hot_x, &hot_y);
        gtk_drag_set_icon_pixmap(RVAL2DC(context),
                                 GDK_COLORMAP(RVAL2GOBJ(obj)), 
                                 GDK_PIXMAP(RVAL2GOBJ(pixmap)),
                                 GDK_BITMAP(RVAL2GOBJ(mask)), 
                                 NUM2INT(hot_x), NUM2INT(hot_y));
    } else {
        rb_scan_args(argc, argv, "40", &context, &obj, &hot_x, &hot_y);

        if (TYPE(obj) == T_SYMBOL){
            gtk_drag_set_icon_stock(RVAL2DC(context), rb_id2name(SYM2ID(obj)),
                                    NUM2INT(hot_x), NUM2INT(hot_y));
        } else if (rb_obj_is_kind_of(obj, GTYPE2CLASS(GTK_TYPE_WIDGET))){
            gtk_drag_set_icon_widget(RVAL2DC(context), RVAL2WIDGET(obj),
                                     NUM2INT(hot_x), NUM2INT(hot_y));
        } else if (rb_obj_is_kind_of(obj, GTYPE2CLASS(GDK_TYPE_PIXBUF))){
            gtk_drag_set_icon_pixbuf(RVAL2DC(context),
                                     GDK_PIXBUF(RVAL2GOBJ(obj)),
                                     NUM2INT(hot_x), NUM2INT(hot_y));
        } else {
            rb_raise(rb_eArgError, "invalid argument %s", rb_class2name(CLASS_OF(obj)));
        }
    }
    return self;
}