コード例 #1
0
ファイル: GtkDnD.cpp プロジェクト: kolyden/mirror
void Ctrl::GtkDragDataReceived(GtkWidget *widget, GdkDragContext *context,
                               gint x, gint y, GtkSelectionData *data,
                               guint info, guint time, gpointer user_data)
{
    LLOG("GtkDragDataReceived");
    dnd_data_wait = false;
    if(dnd_data_fmt == "text") {
        guchar *s = gtk_selection_data_get_text(data);
        if(s) {
            dnd_data = (const char *)s;
            g_free(s);
        }
    }
    else if(dnd_data_fmt == "image") {
        Image img = ImageFromPixbufUnref(gtk_selection_data_get_pixbuf(data));
        dnd_data = StoreAsString(img); // Not very optimal...
    }
    else
        dnd_data = GtkDataGet(data);
}
コード例 #2
0
ファイル: GtkDnD.cpp プロジェクト: ultimatepp/mirror
void Ctrl::GtkDragDataReceived(GtkWidget *widget, GdkDragContext *context,
                               gint x, gint y, GtkSelectionData *data,
                               guint info, guint time, gpointer user_data)
{
    LLOG("GtkDragDataReceived " << dnd_data_fmt);
    dnd_data_wait = false;
    if(dnd_data_fmt == "text") {
        guchar *s = gtk_selection_data_get_text(data);
        if(s) {
            dnd_data = (const char *)s;
            g_free(s);
        }
    }
    else if(dnd_data_fmt == "image")
        dnd_data = ImageClipFromPixbufUnref(gtk_selection_data_get_pixbuf(data));
    else if(dnd_data_fmt == "files")
        dnd_data = FilesClipFromUrisFree(gtk_selection_data_get_uris(data));
    else
        dnd_data = GtkDataGet(data);
}