Module: Gdk::Selection

Defined in:
ext/gtk2/rbgdkselection.c

Constant Summary collapse

PRIMARY =

Constants

GATOM2RVAL(GDK_SELECTION_PRIMARY)
SECONDARY =
GATOM2RVAL(GDK_SELECTION_SECONDARY)
CLIPBOARD =
GATOM2RVAL(GDK_SELECTION_CLIPBOARD)
TYPE_ATOM =

GdkSelectionType

GATOM2RVAL(GDK_SELECTION_TYPE_ATOM)
TYPE_BITMAP =
GATOM2RVAL(GDK_SELECTION_TYPE_BITMAP)
TYPE_COLORMAP =
GATOM2RVAL(GDK_SELECTION_TYPE_COLORMAP)
TYPE_DRAWABLE =
GATOM2RVAL(GDK_SELECTION_TYPE_DRAWABLE)
TYPE_INTEGER =
GATOM2RVAL(GDK_SELECTION_TYPE_INTEGER)
TYPE_PIXMAP =
GATOM2RVAL(GDK_SELECTION_TYPE_PIXMAP)
TYPE_WINDOW =
GATOM2RVAL(GDK_SELECTION_TYPE_WINDOW)
TYPE_STRING =
GATOM2RVAL(GDK_SELECTION_TYPE_STRING)
TARGET_BITMAP =

GdkTarget

GATOM2RVAL(GDK_TARGET_BITMAP)
TARGET_COLORMAP =
GATOM2RVAL(GDK_TARGET_COLORMAP)
TARGET_DRAWABLE =
GATOM2RVAL(GDK_TARGET_DRAWABLE)
TARGET_PIXMAP =
GATOM2RVAL(GDK_TARGET_PIXMAP)
TARGET_STRING =
GATOM2RVAL(GDK_TARGET_STRING)

Class Method Summary collapse

Class Method Details

.convert(requestor, selection, target, time) ⇒ Object



64
65
66
67
68
69
70
71
# File 'ext/gtk2/rbgdkselection.c', line 64

static VALUE
gdkselection_convert(VALUE self, VALUE requestor, VALUE selection, VALUE target, VALUE time)
{
    gdk_selection_convert(GDK_WINDOW(RVAL2GOBJ(requestor)), 
                          RVAL2ATOM(selection), 
                          RVAL2ATOM(target), NUM2INT(time));
    return self;
}

.owner_get(*args) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'ext/gtk2/rbgdkselection.c', line 44

static VALUE
gdkselection_owner_get(int argc, VALUE *argv, VALUE self)
{
    VALUE selection;

    if (argc == 1) {
        rb_scan_args(argc, argv, "10", &selection);
        return GOBJ2RVAL(gdk_selection_owner_get(RVAL2ATOM(selection)));
    } else {
#if GTK_CHECK_VERSION(2,2,0)
      VALUE display = Qnil;
      rb_scan_args(argc, argv, "20", &display, &selection);
      return GOBJ2RVAL(gdk_selection_owner_get_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
                                                           RVAL2ATOM(selection)));
#else
      rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
#endif
    }
}

.owner_set(*args) ⇒ Object



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
# File 'ext/gtk2/rbgdkselection.c', line 17

static VALUE
gdkselection_owner_set(int argc, VALUE *argv, 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 {
#if GTK_CHECK_VERSION(2,2,0)
      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));
#else
      rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
#endif

    }
    return CBOOL2RVAL(ret);
}

.property_get(requestor) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'ext/gtk2/rbgdkselection.c', line 73

static VALUE
gdkselection_property_get(VALUE self, VALUE requestor)
{
    guchar *data;
    GdkAtom prop_type;
    gint prop_format;
    VALUE ary;

    gdk_selection_property_get(GDK_WINDOW(RVAL2GOBJ(requestor)), &data, 
                               &prop_type, &prop_format);

    ary = rb_ary_new3(3, CSTR2RVAL((const char*)data), GATOM2RVAL(prop_type), 
                      INT2NUM(prop_format));
    g_free(data);
    return ary;
}

.send_notify(*args) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'ext/gtk2/rbgdkselection.c', line 90

static VALUE
gdkselection_send_notify(int argc, VALUE *argv, VALUE self)
{
    VALUE requestor, selection, target, property, time;

    if (argc == 5) {
        rb_scan_args(argc, argv, "50", &requestor, &selection, &target, &property, &time);
        gdk_selection_send_notify(NUM2UINT(requestor), RVAL2ATOM(selection),
                                  RVAL2ATOM(target), 
                                  NIL_P(property) ? GDK_NONE : RVAL2ATOM(property), 
                                  NUM2INT(time));
    } else {
#if GTK_CHECK_VERSION(2,2,0)
      VALUE display = Qnil;
      rb_scan_args(argc, argv, "60", &display, &requestor, &selection, &target, &property, &time);
      gdk_selection_send_notify_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
                                            NUM2UINT(requestor), RVAL2ATOM(selection),
                                            RVAL2ATOM(target), 
                                            NIL_P(property) ? GDK_NONE : RVAL2ATOM(property), 
                                            NUM2INT(time));
#else
      rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
#endif
    }
    return self;
}