Re: Drag n Drop

a few days ago, this was posted to the gtk-list by 
"Florent. Devin" <Florent Devin lifl fr>

I found a solution, but I am not sure it is a good way to do that.
I use ctree but clist is the same.
I connect the event signal to the ctree
  gtk_signal_connect (GTK_OBJECT (ctree), "event", GTK_SIGNAL_FUNC
(ctree_event), NULL);
then in my callback I send the signal drag with this
  static gint where_press;
  if (GASPARD_VERY_CHAT) g_print ("Enter in ctree_event\n");
  switch (ev->type) {
    case GDK_BUTTON_PRESS : {
      switch (ev->button.button) {
        case 1 : {
          drag_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, 
                        gtk_widget_get_colormap (mainApp_Window),
                        &drag_mask, NULL, GASPARD_DRAG_ICON);
          gtk_drag_source_set (ctree, GDK_BUTTON1_MASK, target_slot, 1,
          gtk_drag_source_set_icon (ctree, 
                                    drag_icon, drag_mask);
          gdk_pixmap_unref (drag_icon);
          gdk_pixmap_unref (drag_mask);
          gtk_signal_connect (GTK_OBJECT (ctree), "drag_data_get",
                              GTK_SIGNAL_FUNC (source_drag_data_get));
          gtk_signal_connect (GTK_OBJECT (ctree), "drag_data_delete",
                              GTK_SIGNAL_FUNC (source_drag_data_delete),

And that is all I have to do. The advantage of this method is that you
can have a
different icon, for every different line in the clist
Hope this help

BTW, please turn off the generation of HTML and the vcard nonsense in
your browser/email client. You doubled (or more) the size of your
email message with this nonsense.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]