Package RASCAL.DragNDrop

DescriptionEvent definitions for handling the Drag'N'Drop protocol (datasave and dataload). Includes a stack implementation for handling multiple dataloads.
Authorbbracke
Date2005/11/21 20:14:33
Revision1.1
 

Clauses

Quick access : ClausesGenericsDefinitionsSubprograms


 
Context clauses
Ada.Strings.Unbounded
Interfaces.C
RASCAL.OS
 
Use clauses
Ada.Strings.Unbounded
Interfaces.C
RASCAL.OS
 

Definitions

Quick access : ClausesGenericsDefinitionsSubprograms


Types
Name Declaration
Message_DataSave_Pointeraccess Message_DataSave
Message_DataSaveAck_Pointeraccess Message_DataSaveAck
Message_DataLoad_Pointeraccess Message_DataLoad
Message_DataLoadAck_Pointeraccess Message_DataLoadAck
Message_DataOpen_Pointeraccess Message_DataOpen
Message_DataSaved_Pointeraccess Message_DataSaved
Message_RamFetch_Pointeraccess Message_RamFetch
Message_RamTransmit_Pointeraccess Message_RamTransmit
   
Message_DataSave record
This indicates that the sender wants to save data to the receiver.

Normal use
十t User has terminated a drag
十t You get the first four words with Wimp_GetPointerInfo.
十t You send message to mentioned window.

Possible responses from other task
十t It sends DataSaveAck
十t It sends RamFetch

You should store the my_ref of each data save message,
to check against any future DataSaved message you might receive.
Component Type Default
Leaf_NameChar_Array (1..208)
File_TypeInteger
SizeInteger
Screen_YInteger
Screen_XInteger
IconIcon_Handle_Type
WindowWimp_Handle_Type
HeaderMessage_Event_Header
   
AMEL_Message_DataSave abstract tagged record
inheritance from Message_EventListener (Message_Event_DataSave)
Component Type Default
EventMessage_DataSave_Pointer
   
Message_DataSaveAck record
Icon nr, and screen x,y are preserved from the DataSave message.
This is usually followed by a DataLoad message.
Component Type Default
Full_PathChar_Array (1..208)
File_TypeInteger
SizeInteger
Screen_YInteger
Screen_XInteger
IconIcon_Handle_Type
WindowWimp_Handle_Type
HeaderMessage_Event_Header
   
AMEL_Message_DataSaveAck abstract tagged record
inheritance from Message_EventListener (Message_Event_DataSaveAck)
Component Type Default
EventMessage_DataSaveAck_Pointer
   
Message_DataLoad record
Receiver of message should load, and answer with DataLoadAck if successfull.
The column and row information is not present in RISC OS 2.
Component Type Default
RowInteger
ColumnInteger
Full_PathChar_Array (1..200)
File_TypeInteger
SizeInteger
Screen_YInteger
Screen_XInteger
IconIcon_Handle_Type
WindowWimp_Handle_Type
HeaderMessage_Event_Header
   
AMEL_Message_DataLoad abstract tagged record
inheritance from Message_EventListener (Message_Event_DataLoad)
Component Type Default
EventMessage_DataLoad_Pointer
   
Message_DataLoadAck record
This is sent as an answer to a DataLoad message.
All that should be done, is to change message type to 4 (DataLoadAck), and fill in the your_ref field.
Component Type Default
Full_PathChar_Array (1..208)
File_TypeInteger
SizeInteger
Screen_YInteger
Screen_XInteger
IconIcon_Handle_Type
WindowWimp_Handle_Type
HeaderMessage_Event_Header
   
AMEL_Message_DataLoadAck abstract tagged record
inheritance from Message_EventListener (Message_Event_DataLoadAck)
Component Type Default
EventMessage_DataLoadAck_Pointer
   
Message_DataOpen record
This message is broadcasted when the user doubleclicks on a file.
If the receiver wants to load the file, he should acknowledge this message by returning a DataLoadAck message.
If no one acknowledges the message, the filer will try to run It.
Component Type Default
Full_PathChar_Array (1..208)
File_TypeInteger
ZeroInteger
Y_OffsetInteger
X_OffsetInteger
UnusedInteger
WindowWimp_Handle_Type
HeaderMessage_Event_Header
   
AMEL_Message_DataOpen abstract tagged record
inheritance from Message_EventListener (Message_Event_DataOpen)
Component Type Default
EventMessage_DataOpen_Pointer
   
Message_DataSaved record
This message is sent back to the originator of a saved file if at some later time it becomes "safe" (i.e. on disc).
You should compare the your_ref in this message with the my_ref you stored when you sent the original DataSave message.
If they tally the file can now be marked as safe, unless the user had edited it in the meantime.

Probably the best implementation is for your program to store the my_ref with the file, but zero it on any modification, as 0 will not be a valid your_ref.
It appears that this message is designed for cases where one program saves a file to another program, and then that second program saves the unmodified file to disc.
Component Type Default
HeaderMessage_Event_Header
   
AMEL_Message_DataSaved abstract tagged record
inheritance from Message_EventListener (Message_Event_DataSaved)
Component Type Default
EventMessage_DataSaved_Pointer
   
Message_RamFetch record
Component Type Default
Buffer_SizeInteger
Buffer_PointerInteger
HeaderMessage_Event_Header
   
AMEL_Message_RamFetch abstract tagged record
inheritance from Message_EventListener (Message_Event_RamFetch)
Component Type Default
EventMessage_RamFetch_Pointer
   
Message_RamTransmit record
After receiving a RamFetch message, you write data to buffer, using Wimp_TransferBlock,
and then send back this message.
Component Type Default
Amount_UsedInteger
Buffer_PointerInteger
HeaderMessage_Event_Header
   
AMEL_Message_RamTransmit abstract tagged record
inheritance from Message_EventListener (Message_Event_RamTransmit)
Component Type Default
EventMessage_RamTransmit_Pointer
  
Pragmas
Convention(C, Message_DataSave)
Convention(C, Message_DataSaveAck)
Convention(C, Message_DataLoad)
Convention(C, Message_DataLoadAck)
Convention(C, Message_DataOpen)
Convention(C, Message_DataSaved)
Convention(C, Message_RamFetch)
Convention(C, Message_RamTransmit)
 

Subprograms

Quick access : ClausesGenericsDefinitionsSubprograms


  
Empty function
Returnboolean
Is the stack empty ?
  
Push_DragObject procedure
Add a new DragNDrop object to the stack.
Parameter name Type Mode Default
PathUnbounded_Stringin
WindowWimp_Handle_Typein0
IconIcon_Handle_Typein0
  
Pop_DragObject procedure
Return data of first drag object in the stack and removes that element from the stack.
Parameter name Type Mode Default
PathUnbounded_Stringout
WindowWimp_Handle_Typeout
IconIcon_Handle_Typeout