Module: Gtk::Selection

Defined in:
ext/gtk2/rbgtkselection.c

Class Method Summary collapse

Class Method Details

.add_target(widget, selection, target, info) ⇒ Object



45
46
47
48
49
50
51
# File 'ext/gtk2/rbgtkselection.c', line 45

static VALUE
gtkdrag_selection_add_target(VALUE self, VALUE widget, VALUE selection, VALUE target, VALUE info)
{
    gtk_selection_add_target(RVAL2WIDGET(widget), RVAL2ATOM(selection),
                             RVAL2ATOM(target), NUM2INT(info));
    return self;
}

.add_targets(widget, selection, targets) ⇒ Object



53
54
55
56
57
58
59
60
# File 'ext/gtk2/rbgtkselection.c', line 53

static VALUE
gtkdrag_selection_add_targets(VALUE self, VALUE widget, VALUE selection, VALUE targets)
{
    gtk_selection_add_targets(RVAL2WIDGET(widget), 
                              RVAL2ATOM(selection),
                              rbgtk_get_target_entry(targets), RARRAY_LEN(targets));
    return self;
}

.clear_targets(widget, selection) ⇒ Object



62
63
64
65
66
67
# File 'ext/gtk2/rbgtkselection.c', line 62

static VALUE
gtkdrag_selection_clear_targets(VALUE self, VALUE widget, VALUE selection)
{
    gtk_selection_clear_targets(RVAL2WIDGET(widget), RVAL2ATOM(selection));
    return self;
}

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



69
70
71
72
73
74
75
76
# File 'ext/gtk2/rbgtkselection.c', line 69

static VALUE
gtkdrag_selection_convert(VALUE self, VALUE widget, VALUE selection, VALUE target, VALUE time)
{
    gboolean ret = gtk_selection_convert(RVAL2WIDGET(widget), 
                                         RVAL2ATOM(selection), RVAL2ATOM(target),
                                         NUM2INT(time));
    return CBOOL2RVAL(ret);
}

.include_image?(targets, writable) ⇒ Boolean

Returns:

  • (Boolean)


86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'ext/gtk2/rbgtkselection.c', line 86

static VALUE
targets_include_image(VALUE self, VALUE targets, VALUE writable)
{
  gint i;
  gint len = RARRAY_LEN(targets);
  GdkAtom* gtargets = ALLOCA_N(GdkAtom, len);

  for (i = 0; i < len; i++){
    gtargets[i] = RVAL2ATOM(RARRAY_PTR(targets)[i]);
  }

  return CBOOL2RVAL(gtk_targets_include_image(gtargets, len, RVAL2CBOOL(writable)));
}

.include_rich_text?(targets, buffer) ⇒ Boolean

Returns:

  • (Boolean)


126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'ext/gtk2/rbgtkselection.c', line 126

static VALUE
targets_include_rich_text(VALUE self, VALUE targets, VALUE buffer)
{
  gint i;
  gint len = RARRAY_LEN(targets);
  GdkAtom* gtargets = ALLOCA_N(GdkAtom, len);

  for (i = 0; i < len; i++){
    gtargets[i] = RVAL2ATOM(RARRAY_PTR(targets)[i]);
  }

  return CBOOL2RVAL(gtk_targets_include_rich_text(gtargets, len, RVAL2GOBJ(buffer)));
}

.include_text?(targets) ⇒ Boolean

Returns:

  • (Boolean)


100
101
102
103
104
105
106
107
108
109
110
# File 'ext/gtk2/rbgtkselection.c', line 100

static VALUE
targets_include_text(VALUE self, VALUE targets)
{
  gint i;
  gint len = RARRAY_LEN(targets);
  GdkAtom* gtargets = ALLOCA_N(GdkAtom, len);
  for (i = 0; i < len; i++){
    gtargets[i] = RVAL2ATOM(RARRAY_PTR(targets)[i]);
  }
  return CBOOL2RVAL(gtk_targets_include_text(gtargets, len));
}

.include_uri?(targets) ⇒ Boolean

Returns:

  • (Boolean)


112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'ext/gtk2/rbgtkselection.c', line 112

static VALUE
targets_include_uri(VALUE self, VALUE targets)
{
  gint i;
  gint len = RARRAY_LEN(targets);
  GdkAtom* gtargets = ALLOCA_N(GdkAtom, len);

  for (i = 0; i < len; i++){
    gtargets[i] = RVAL2ATOM(RARRAY_PTR(targets)[i]);
  }

  return CBOOL2RVAL(gtk_targets_include_uri(gtargets, len));
}

.owner_set(*args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'ext/gtk2/rbgtkselection.c', line 21

static VALUE
gtkdrag_selection_owner_set(int argc, VALUE *argv, VALUE self)
{
    gboolean ret;

    if (argc == 3){
        VALUE widget, selection, time;
        rb_scan_args(argc, argv, "30", &widget, &selection, &time);
        ret = gtk_selection_owner_set(RVAL2WIDGET(widget), 
                                      RVAL2ATOM(selection), NUM2INT(time));
    } else {
#if GTK_CHECK_VERSION(2,2,0)
        VALUE display, widget, selection, time;
        rb_scan_args(argc, argv, "40", &display, &widget, &selection, &time);
        ret = gtk_selection_owner_set_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
                                                  RVAL2WIDGET(widget), 
                                                  RVAL2ATOM(selection), NUM2INT(time));
#else
        rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
#endif
    }
    return CBOOL2RVAL(ret);
}

.remove_all(widget) ⇒ Object



78
79
80
81
82
83
# File 'ext/gtk2/rbgtkselection.c', line 78

static VALUE
gtkdrag_selection_remove_all(VALUE self, VALUE widget)
{
    gtk_selection_remove_all(RVAL2WIDGET(widget));
    return self;
}