## drag-and-drop.api
## (C) 1996, 1998, Bremen Institute for Safe Systems, Universitaet Bremen
## Author: cxl
# Compiled by:
#
src/lib/tk/src/toolkit/sources.sublib# **************************************************************************
# Apis for drag_and_drop.
# **************************************************************************
# **************************************************************************
# DD_ITEMS is the api for the drag&drop-items, and
# Drag_And_Drop is the export api.
# ***************************************************************************
### "I love Mickey Mouse more than
### any woman I have ever known."
###
### -- Walt Disney
api Drag_And_Drop_Items {
Item;
get_canvas_item_id: Item -> tk::Canvas_Item_Id;
sel_drop_zone: Item -> tk::Rectangle;
is_immobile: Item -> Bool;
grab: Item -> Void;
move: Item -> tk::Coordinate -> Void;
release: Item -> Void;
enter: Item -> List( Item ) -> Bool;
leave: Item -> Void;
select: Item -> Void;
deselect: Item -> Void;
drop: Item -> List( Item ) -> Bool; # FALSE <==> drop is destructive,
# dropped items vanish
# two "semantic" points to take note of:
# - after a drop, a leave is generated for the item which has been dropped on;
# - a leave is generated _only_ if the preceding enter has returned TRUE,
# otherwise we assume the visited item doesn't want to know
Item_List; # = List( item )
item_list_rep: Item_List -> List( Item );
item_list_abs: List( Item ) -> Item_List;
package clipboard: Write_Only_Clipboard; # Write_Only_Clipboard is from
src/lib/tk/src/toolkit/clipboard-g.pkg
sharing clipboard::Part == Item_List;
};
api Drag_And_Drop {
Item;
Dd_Canvas;
exception DRAG_AND_DROP String;
# initialize area
init: tk::Widget_Id -> Dd_Canvas;
# place a new object on d&d canvas
place: Dd_Canvas -> Item -> Void;
# Delete an object from the d&d canvas
delete: Dd_Canvas -> Item -> Void;
# return all items the dropzone of which is at given point
over_drop_zone: Dd_Canvas -> tk::Coordinate -> List( Item );
# .... or inside a given rectangle
drop_zones_in_rectangle: Dd_Canvas -> tk::Rectangle -> List( Item );
# selected items (including grabbed items)
selected_items: Void -> List( Item );
# get all items on a d&d canvas (except selectedItems)
all_items: Dd_Canvas -> List( Item );
# reset to a sane state
reset: Dd_Canvas -> Void;
};
# generic drag_and_drop_g (drag_and_drop_items: Drag_And_Drop_Items) :
# api
# include Drag_And_Drop
# sharing item = drag_and_drop_items::item
# end = ?
#