github.com/256dpi/max-go@v0.7.0/lib/max/ext_drag.h (about)

     1  // ext_drag.h copyright 2008 cycling '74
     2  // functions for handling drag-and-drop from the max file browser (but not from the mac finder)
     3  
     4  #ifndef __EXT_DRAG_H__
     5  
     6  #define __EXT_DRAG_H__
     7  
     8  #include "ext_prefix.h"
     9  #include "ext_mess.h"
    10  
    11  BEGIN_USING_C_LINKAGE
    12  
    13  enum {
    14  	JDRAG_MATCHFLAGS_ANY = 1		// any item with this role is OK, default is that all must match
    15  };
    16  
    17  typedef struct _jdrag_inquiry
    18  {
    19  	t_symbol *i_role;			// kind of file that works (one inquiry per file kind)
    20  	t_symbol *i_prepend;		// corresponding message
    21  } t_jdrag_inquiry;
    22  
    23  char *jdrag_getitemstring(t_object *dg, long index, long quote, long backslash);
    24  t_object *jdrag_getobject(t_object *dg, long index);
    25  void jdrag_getlocation(t_object *dg, long index, double *xpos, double *ypos);
    26  t_object *jdrag_createobject(t_object *dg, t_object *pv, void *d, long dragobjectindex);
    27  t_object *jdrag_createnewobj(t_object *dg, t_object *pv, char *classname, char *str, long dragobjectindex);
    28  t_object *jdrag_createmessage(t_object *dg, t_object *pv, t_symbol *msg, long ac, t_atom *av, long dragobjectindex);
    29  long jdrag_itemcount(t_object *dg);
    30  
    31  //	dg		the jdrag object
    32  //	rcv		the jbox which will have a message called when the dragged thing is released
    33  //	msg		the message name that will be sent to the box when the dragged thing is released
    34  //	desc	a description to be displayed in a contextual menu for the drop action
    35  //	arg		user data to be passed to the drag function (for example, the t_symbol* of the message to call in the case of jdrag_box_add())
    36  void jdrag_add(t_object *dg, t_object *rcv, t_symbol *msg, const char *desc, void *arg);
    37  
    38  // same as jdrag_add but msg will be sent to rcv for each file in the drag-n-drop
    39  // when using jdrag_add() version caller must iterate directly using jdrag_itemcount, etc.
    40  void jdrag_add_iterated(t_object *dg, t_object *rcv, t_symbol *msg, const char *desc, void *arg);
    41  
    42  void jdrag_process_drop(t_object *dx, t_object *receiver, void *ref, t_symbol *msg, void *src, double x, double y);
    43  
    44  
    45  long jdrag_matchdragrole(t_object *dx, t_symbol *role, long flags);
    46  
    47  
    48  void jdrag_setboxlocation(t_object *dg, t_object *box);
    49  
    50  
    51  void jdrag_object_add(t_object *dg, t_object *obj, t_symbol *msg);
    52  
    53  // a wrapper around jbox_add() used by most ui objects; demonstrated in the pictmeter~ example project in the sdk
    54  void jdrag_box_add(t_object *dg, t_object *box, t_symbol *msg);
    55  
    56  
    57  END_USING_C_LINKAGE
    58  
    59  #endif	// __EXT_DRAG_H__