Re: Drag and Drop.



On Thu, 23 Aug 2001 16:14:52 +0200, Markus Lausser said:
   /* now my problems:
      1. gtk_selection_data_set() copies the data, but i dont want to do
         that, i just need a link to the data.
      2. after the selection_data_set() i dont have to information whether it
         is a file or a folder any longer. (i dont want to use a struct with
         a type field and a datapointer in it) */
   if (folder)
     gtk_selection_data_set (data, data->target, GTK_TYPE_POINTER,
                          folder, sizeof(?what?));
   if (file)
     gtk_selection_data_set (data, data->target, GTK_TYPE_POINTER,
                             file, sizeof(?what?));
 }
 
 callback drag_data_received(...) {
   void* data_pointer;
 
   data_pointer = selection_data->data;
   /* but now i dont know, whether it is a file or a folder..*/  
   
 }
 
 Anyone can help me out, or is there any good example?
 
 Markus.

Did you use the target structure to define the targets? Remember
that GTK+/GDK reffers to target as type.

Also you can check the target type in the drag context.

gboolean target_supported = FALSE;
GList *next = dc->targets;
while(next != NULL)
{
 const gchar *atom_name = (const gchar *)gdk_atom_name(
  (GdkAtom)next->data
 );
 if(atom_name != NULL)
 {
  /* Check it, it's a string. */
  if(we_support_it(atom_name, "folder"))
   target_supported = TRUE;
 }
 next = next->next;
}

-- 
--
Sincerely,                  ,"-_                         \|/
-Capt. Taura M.             ,   O=__                    --X--
.__                          ,_JNMNNEO=_                 /|\
OMNOUMmnne.                  {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
                  http://furry.ao.net/~learfox/






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