24 #define DND_EMPTY_ERROR -0+DRAGNDROP_ERROR_OFFSET 25 #define DND_WHICHTARGET_ERROR -1+DRAGNDROP_ERROR_OFFSET 31 errors[
DND_EMPTY_ERROR]=std::string(
"The DragNDrop known target list is empty. Fill the target list by constructing with a GdkDragContext, or possibly by using the operator<<. ");
32 errors[
DND_WHICHTARGET_ERROR]=std::string(
"The DragNDrop known target list is not empty and has more the one entry, please overload the Widget::chooseTheTargetToUse method to specify which target you want to use in this drop method. ");
66 class DragNDrop :
public std::vector<GtkTargetEntry> {
78 static_cast<DragNDrop*
>(data)->addToTargets(GDK_POINTER_TO_ATOM (targetData));
85 gte.target=gdk_atom_name(targetData);
103 destFlags=(GtkDestDefaults)(GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT);
104 dragAction=GDK_ACTION_COPY;
105 modifierType=GDK_BUTTON1_MASK;
120 g_list_foreach(gdk_drag_context_list_targets(context), reinterpret_cast<GFunc>(addToTargetsStatic),
this);
157 destFlags=destFlagsIn;
182 dragAction=dragActionIn;
234 modifierType=modifierTypeIn;
251 return &operator[](0);
266 for (std::vector<GtkTargetEntry>::iterator gtei=begin(); gtei<end(); gtei++)
267 if (strcmp(gtei->target, gte.target)==0)
268 if (gtei->flags==gte.flags)
269 if (gtei->info==gte.info) {
282 #endif // DRAGNDROP_H_ GdkDragAction dragAction
Action to take once the data is dropped.
#define DND_WHICHTARGET_ERROR
GdkModifierType getModifierType()
void setDestDefaults(GtkDestDefaults destFlagsIn)
void getModifierType(GdkModifierType modifierTypeIn)
static void addToTargetsStatic(gpointer targetData, gpointer data)
GtkDestDefaults getDestDefaults()
void setDragAction(GdkDragAction dragActionIn)
std::map< int, std::string > errors
This will contain a map between error numbers and descriptive std::strings for the errors...
DragNDrop & operator<<(const GtkTargetEntry >e)
DragNDrop & operator>>(const GtkTargetEntry >e)
gpointer userData
If we want DND callbacks to operate on different user data, then this will store it here...
void setUserData(gpointer w)
virtual ~DragNDrop()
Destructor.
GtkDestDefaults destFlags
The drop flags, see setDestDefaults.
void addToTargets(GdkAtom targetData)
GdkDragAction getDragAction()
GdkModifierType modifierType
The modifier which initiates the drag and drop process.
DragNDrop & operator<<(Widget &w)
GtkTargetEntry * getTargetArray()
DragNDrop(GdkDragContext *context)