[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: sorry (Drag n Drop)
- From: "VijayaKumar S. Kale" <vsk telco co in>
- To: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Cc: learfox furry ao net
- Subject: Re: sorry (Drag n Drop)
- Date: Sun, 31 Dec 2000 16:30:02 +0530
Thanx for help.
I have gone through it.
What you have suggested is, to implement "drag_motion" to destination.
But I think implementation should be on source. Because "drag_motion" of
destination gets called when pointer moves or enteres on it. And I want to
set pointer(of my choice) from start of dragging, so that it will show me set
pointer any where on the screen even if I have not entered the destination.
Will you plz. clear my doubts.
Thanx
Vijay
------
learfox@furry.ao.net wrote:
> > Is there any function or method to set cursor. Or shall I ungrab source
> > widget and grab it again
> > passing cursor of my choice. But where to ungrab and grab source?
>
> Hi, I'm the original author that wrote the GTK+ Drag and Drop tutorial.
>
> I've experimented with this area of GTK+'s implmentation of DND for quite
> some time.
>
> Although I have never actually tried to change the pointer cursor (as what
> you are trying to do) I have modified drag status during drag and the
> steps to change the cursor may be similar so atleast I can give you a
> lead.
>
> First when you set up your destination widget, use:
>
> gtk_drag_dest_set(
> widget,
> /* GTK_DEST_DEFAULT_MOTION | */
> GTK_DEST_DEFAULT_HIGHLIGHT |
> GTK_DEST_DEFAULT_DROP,
> target_entry, total_target_entries,
> actions
> );
>
> Note that GTK_DEST_DEFAULT_MOTION is commented out, this is so that we can
> handle the "drag_motion" signal. So just below that put:
>
> gtk_signal_connect(
> GTK_OBJECT(widget), "drag_motion",
> GTK_SIGNAL_FUNC(GUIDragMotionCB), cb_data_ptr
> );
>
> Now for our GUIDragMotionCB() function:
>
> gboolean GUIDragMotionCB(
> GtkWidget *widget, GdkDragContext *dc,
> gint x, gint y, guint t,
> gpointer data
> )
> {
> gbool same;
> GtkWidget *source_widget;
> GdkDragAction action;
>
> /* Get source widget and check if it is the same as the
> * destination widget.
> */
> source_widget = gtk_drag_get_source_widget(dc);
> same = ((source_widget == widget) ? TRUE : FALSE);
>
> /* Insert code to get our default action here. */
> /* Change this as needed. */
> action = GDK_ACTION_MOVE;
>
> /* Respond with default drag action (status). First we check
> * the dc's list of actions. If the list only contains
> * move or copy then we select just that, otherwise we return
> * with our default suggested action.
> * If no valid actions are listed then we respond with 0.
> */
>
> /* Only move? */
> if(dc->actions == GDK_ACTION_MOVE)
> gdk_drag_status(dc, GDK_ACTION_MOVE, t);
> /* Only copy? */
> else if(dc->actions == GDK_ACTION_COPY)
> gdk_drag_status(dc, GDK_ACTION_COPY, t);
> /* Our default action in list? */
> else if(dc->actions & action)
> gdk_drag_status(dc, action, t);
> /* All else respond with 0. */
> else
> gdk_drag_status(dc, 0, t);
>
> return(TRUE);
> }
>
> What you've seen above is basically changing the drag action based on
> what the source widget and target widget's attributes.
>
> The modification of a cursor *MIGHT* be done in a similar way.
>
> So I would recommend trying to add some experimental code to the above
> function. Maybe inserting some gdk cursor setting functions or regrabbing
> the pointer (may be messy).
>
> I've been stumped on the same problem you have and this is the best lead I
> can give you at the moment. If I find anything new I'll post it on the
> GTK+ list, good luck!!! :)
>
> --
> 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/
--
---------------------------------------------------------------------
VIJAYKUMAR S. KALE
ESG, TTIL, Telco Campus,PUNE - 411 018
email: vskale@telco.co.in
phone: (off.) +91-212-7402049 (Direct)
+91-212-7402947 (Direct)
(resi.) +91-212-4358085
----------------------------------------------------------------------
~
begin:vcard
n:Kale;Vijaykumar
x-mozilla-html:TRUE
org:TTIL;MSD-CAD(ESG)
adr:;;;;;;
version:2.1
email;internet:vskale@telco.co.in
title:Group Leader
x-mozilla-cpt:;8576
fn:Vijaykumar Kale
end:vcard
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]