Re: sorry (Drag n Drop)
- From: learfox furry ao net
- To: GTK Application Development List <gtk-app-devel-list gnome org>
- Cc: vsk telco co in
- Subject: Re: sorry (Drag n Drop)
- Date: Sun, 31 Dec 2000 01:30:17 -0800 (PST)
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/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]