Hi, Am Montag, den 02.01.2006, 20:43 +0100 schrieb Mattias Gaertner: > On Mon, 02 Jan 2006 20:20:12 +0100 > dannym <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > Am Montag, den 02.01.2006, 19:48 +0100 schrieb Christian U.: > > > Seems taht nobody have used something bevore... > > > We don___t need LM_DROPFILES for Linux i do need it in windows, iam > > > underway to implement it in windows. > > > Also I have found documentations for qt (kde) so thers also no big > > > problem. > > > Does the gtk+ drag/drop support work also for not gtk applications ? > > > At example with kfm ? > > > > yes, XDND is a freedesktop standard, so it works with everything that > > honors it. Gnome honors it, KDE honors it and firefox honors it (the > > latter a little bit only). > > http://www.newplanetsoftware.com/xdnd/dragging_files.html > > > > Are you only talking about dragging+dropping files or do you want > > dragging+dropping work for anything else too? (text, images, .....) > > > > > Or is it needed to use the lib of the wm ? > > > > No, as far as I know the window manager does not take part in drag&drop. > > What would it do? > > > > > > > > What schould we do to implement drag & drop correct @ Matthias ? > > > Implement it in the Interface (I think that___s the best choice) > > > Or implement it in an special unit that musnt come with lazarus ? > > Drag&Drop needs to be completed in the interface and controls.pp. > For Drag&Drop between applications we need to gather the different ways of > winapi, gtk, qt and carbon and find a platform independent interface for the > LCL. > How does it work under gtk2, carbon, winapi? Examples would be nice.
gtk2 (python, as that is where i used it most): action = gtk.gdk.ACTION_COPY # the TARGET_TYPE_URL_LIST is just some numeric id for _us_, not for gtk. # the "0" is just some flags whether to pre-limit drops to the same application or the same widget or not at all (0 = not at all). dndDests = [ ( "text/uri-list", 0, TARGET_TYPE_URI_LIST ), # text: ( "text/plain", 0, TARGET_TYPE_TEXT ), ( "UTF8_STRING", 0, TARGET_TYPE_TEXT ), ( "text/unicode", 0, TARGET_TYPE_TEXT ), # netscape...weird ( "STRING", 0, TARGET_TYPE_TEXT ) ] self.drag_dest_set( gtk.DEST_DEFAULT_ALL, #gtk.DEST_DEFAULT_DROP|gtk.DEST_DEFAULT_HIGHLIGHT| gtk.DEST_DEFAULT_MOTION, targets, action) self.connect("drag-data-received", self.drag_data_received_cb) def drag_data_received_cb(self, widget, context, x, y, sdata, info, time): items = sdata.data.split("\r\n") # not sure of the line endings - # but it is standardized in some RFC, can't remember for item in items: if item.startswith("file:"): # item: "file://full-hostname/path/to/file" if item.split("/", 3)[2] != socket.gethostname(): # wtf # failed, do not delete source context.finish(False, False, time) else: # ok # most use the local encoding for that url, # NOT neccessarily UTF-8 elif item.startswith("http:"): # official http URLs are required to use urlencoded UTF-8 # so, no whacky characters/encodings,... else..... # 1st parameter: successful? # 2nd parameter: source_should_delete_original? context.finish(True, False, time) That is a little example supporting XDND drop of url-list (uris, encoded file paths) only. (It is possible to change the highlighting or do it oneself used when hovering somewhere with a grabbed item, but I didn't do that here) (It is also possible to make it change the mouse pointer or whatever really depending on whether it's ok to drop at the current place or not, but I didn't do that here) > > > > I think the best way could be to implement it in the interface and make > > > it useable in OnDragOver/OnDragDrop of the Form or OnDragFiles or > > > something similar ... > > > > In my opinion having a OnDropFiles or so would be nice to have. Note > > that XDND (X Drag and Drop) and XDS (X Drag Save) payloads are somewhat > > sophisticated, so I'm not sure if OnDropFiles can do much stuff on > > behalf of the programmer. That is, even with OnDropFiles provided, it > > still will be a bit of work for the actual application programmer to get > > some useful data out of the drop :) > > > > Do we want to handle the "drag" part of "drag&drop" too ? :) > > Of course. Okay :) the dragging part is totally distinct from the dropping part so we can do them one at a time in order not to get confused :) [skipping for now] (common functions for them only are gtk_drag_set_icon_* and gtk_drag_finish, gtk_drag_get_data, gtk_drag_get_source_widget, gtk_drag_highlight, gtk_drag_unhighlight, gtk_drag_check_threshold - these all operates on "the drag context", "context" in the example) > > Mattias cheers, Danny _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives