Re: dnd internals questions.
- From: Owen Taylor <otaylor redhat com>
- To: Todd Dukes <tdukes ibmoto com>
- Cc: gtk-devel-list redhat com, gtk <gtk-list redhat com>
- Subject: Re: dnd internals questions.
- Date: 01 Jun 1999 22:48:40 -0400
Todd Dukes <tdukes@ibmoto.com> writes:
> I want to change the drag icon used by clist for drags.
>
> I noticed only a few of the widget implement drag_begin.
> This seems to be where the icon is set if is not to be the
> default. I am not sure I understand exactly how the "no icon"
> mode of clist works. Anyone have a clear idea how this works?
>
> I was able to get the drag icons to work by adding the following
> to gtkclist.c:gtk_clist_drag_begin
>
> if (GTK_CLIST_USE_DRAG_ICONS (clist))
> {
> /*
> get the site pixmap if there is one
> */
>
>
> struct /* _GtkDragSourceSite */
> {
> GdkModifierType start_button_mask;
> GtkTargetList *target_list; /* Targets for drag data */
> GdkDragAction actions; /* Possible actions */
> GdkColormap *colormap; /* Colormap for drag icon */
> GdkPixmap *pixmap; /* Icon for drag data */
> GdkBitmap *mask;
>
> /* Stored button press information to detect drag beginning */
> gint state;
> gint x, y;
> } *site;
>
> site = gtk_object_get_data ( GTK_OBJECT ( widget ),
> "gtk-site-data" );
>
> if ( site != NULL &&
> site -> colormap && site -> pixmap &&
> site -> mask )
> {
> gtk_drag_source_set_icon ( widget,
> site -> colormap,
> site -> pixmap,
> site -> mask);
> }
> else
> {
> /* if there was no pixmap, use the default */
> gtk_drag_set_icon_default (context);
> }
> }
>
> The thing that bothers me is that it seems that GtkDragSourceSite was
> intended to be private to gtkdnd.c. Is there a better way to implement
> this?
Yes, GtkDragSourceSite is private, and the above is almost
guaranteed to break with future versions of GTK+. I guess
I really don't understand what you are trying to do, so
But if you want to change the drag icon for reordering
rows in the CList, I think the answer is that it isn't
possible. Basically, the reordering DND is not really
set up to be customized either in drag types, or icons
sorry.
People who want to support both reordering and DND from
a CList widget have so far typically used different
buttons for each operation. It is a bad UI hack, admittedly,
but about the best you can do right now.
> Also, is it possible to control the drag icon used by which modifiers
> ( ctrl, alt, shift ) are held down when the drag begins?
I'm not quite sure what you are asking, but, probably not:
- the cursor for each operation (move, copy, link, ask)
is fixed. (However, you can influence the default operation
by changing the mask of possible operations)
- the assignment of modifier keys to operations is also fixed.
It would be a bad idea to change either item, because it
would confuse the users.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]