DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Implementation

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 *
 * The contents of this file are subject to the Netscape Public License
 * Version 1.0 (the "NPL"); you may not use this file except in
 * compliance with the NPL.  You may obtain a copy of the NPL at
 * http://www.mozilla.org/NPL/
 *
 * Software distributed under the NPL is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
 * for the specific language governing rights and limitations under the
 * NPL.
 *
 * The Initial Developer of this code under the NPL is Netscape
 * Communications Corporation.  Portions created by Netscape are
 * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
 * Reserved.

   dragdrop.h --- Very simplistic drag and drop support.
   Created: Terry Weissman <terry@netscape.com>, 22-Aug-95.
 */

#ifndef __xfe_dragdrop_h_
#define __xfe_dragdrop_h_


typedef enum {
  FE_DND_NONE,			/* Deliberate 'no dragging' value. */
  FE_DND_MAIL_MESSAGE,
  FE_DND_MAIL_FOLDER,
  FE_DND_NEWS_MESSAGE,
  FE_DND_NEWS_FOLDER,
  FE_DND_BOOKMARK,
  FE_DND_URL,
  FE_DND_COLUMN,
  FE_DND_ADDRESSBOOK,
  FE_DND_HISTORY,
  FE_DND_LDAP_ENTRY,
  FE_DND_BOOKS_DIRECTORIES
} fe_dnd_Type;



/* Tells a drop site what kind of event is happening to it. _START means that a
   new drag option has appeared.  _DRAG means that it is being moved around.
   _DROP means that it has potentially dropped on this site.  _END means that
   the drag is all done. */
typedef enum {
  FE_DND_START,
  FE_DND_DRAG,
  FE_DND_DROP,
  FE_DND_END
} fe_dnd_Event;

typedef struct fe_dnd_Source fe_dnd_Source;

/* messages sent from the drop site back to the source. */
typedef enum {
  FE_DND_MESSAGE_COPY,
  FE_DND_MESSAGE_MOVE,
  FE_DND_MESSAGE_DELETE
} fe_dnd_Message;

typedef void (*fe_dnd_SourceDropFunc)(fe_dnd_Source *source, fe_dnd_Message, void *closure);

struct fe_dnd_Source {
  Widget widget;		/* Toplevel widget to drag around. */
  int hotx;			/* Where in the widget the cursor should */
  int hoty;			/* "stick". */
  fe_dnd_Type type;		/* Type of thing being dragged. */
  void* closure;		/* Type-specific data about the thing being
				   dragged. */
  fe_dnd_SourceDropFunc func;	/* a way for the drop site to tell the source to do some operation. */
};


typedef void (*fe_dnd_DropFunc)(Widget dropw, void* closure, fe_dnd_Event,
				fe_dnd_Source*, XEvent* event);

XP_BEGIN_PROTOS

/* Register the given widget as a drop site. */
extern void fe_dnd_CreateDrop(Widget w, fe_dnd_DropFunc func, void* closure);

/* Inform the D&D internals that a drag is starting or dragging or dropping or
   finishing.  This will call the callback functions on all the drop sites,
   which have to decide for themselves if the given drag event applies.  The
   only trimming done is that _DROP events are not given to a widget unless
   the mouse is over that widget.

   Note that it is entirely up to the caller to create the source struct before
   calling this, and to destroy the source struct (and its widget) when
   done. */
extern void fe_dnd_DoDrag(fe_dnd_Source* source, XEvent* event,
			  fe_dnd_Event type);


XP_END_PROTOS

#endif /* __xfe_dragdrop_h_ */