1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2011 Ruby-GNOME2 Project Team
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
* Copyright (C) 2002 Neil Conway
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#include "rbgtk3private.h"
#ifdef HAVE_GTK_PLUG_GET_TYPE
#include <gtk/gtkx.h>
#define RG_TARGET_NAMESPACE cPlug
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE socket_id;
Window id;
if (rb_scan_args(argc, argv, "01", &socket_id) == 0)
id = 0;
else {
#ifdef GDK_NATIVE_WINDOW_POINTER
id = GUINT_TO_POINTER(NUM2ULONG(socket_id));
#else
id = NUM2UINT(socket_id);
#endif
}
RBGTK_INITIALIZE(self, gtk_plug_new(id));
return Qnil;
}
static VALUE
rg_construct(VALUE self, VALUE socket_id)
{
#ifdef GDK_NATIVE_WINDOW_POINTER
gtk_plug_construct(RVAL2GTKPLUG(self), GUINT_TO_POINTER(NUM2ULONG(socket_id)));
#else
gtk_plug_construct(RVAL2GTKPLUG(self), (guint32)NUM2UINT(socket_id));
#endif
return self;
}
static VALUE
rg_id(VALUE self)
{
Window id = gtk_plug_get_id(RVAL2GTKPLUG(self));
#ifdef GDK_NATIVE_WINDOW_POINTER
return UINT2NUM(GPOINTER_TO_UINT(id));
#else
return UINT2NUM(id);
#endif
}
#endif
void
Init_gtk_plug(VALUE mGtk)
{
#ifdef HAVE_GTK_PLUG_GET_TYPE
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_PLUG, "Plug", mGtk);
RG_DEF_METHOD(initialize, -1);
RG_DEF_METHOD(construct, 1);
RG_DEF_METHOD(id, 0);
#endif
}
|