Module: SDL2::Clipboard

Defined in:
clipboard.c

Class Method Summary (collapse)

Class Method Details

+ (Boolean) has_text?

Returns:

  • (Boolean)


25
26
27
28
# File 'clipboard.c', line 25

static VALUE Clipboard_s_has_text_p(VALUE self)
{
    return INT2BOOL(SDL_HasClipboardText());
}

+ (Object) text



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'clipboard.c', line 4

static VALUE Clipboard_s_text(VALUE self)
{
    if (SDL_HasClipboardText()) {
        char* text = SDL_GetClipboardText();
        VALUE str;
        if (!text)
            SDL_ERROR();
        str = utf8str_new_cstr(text);
        SDL_free(text);
        return str;
    } else {
        return Qnil;
    }
}

+ (Object) text=



19
20
21
22
23
# File 'clipboard.c', line 19

static VALUE Clipboard_s_set_text(VALUE self, VALUE text)
{
    HANDLE_ERROR(SDL_SetClipboardText(StringValueCStr(text)));
    return text;
}