Module: Iup::DragDropAttributes

Extended by:
AttributeBuilders
Included in:
Canvas, Dialog, Label, List, ScrollBox, Text, Tree
Defined in:
lib/wrapped/drag-drop-attributes.rb

Overview

defines attributes and methods for drag and drop

Steps to use the Drag & Drop support in an IUP application:

AT SOURCE
  • Enable the element as source using the attribute DRAGSOURCE=YES;

  • Define the data types supported by the element for the drag operation using the DRAGTYPES attribute;

  • Register the required callbacks DRAGBEGIN_CB, DRAGDATASIZE_CB and DRAGDATA_CB for drag handling. DRAGEND_CB is the only optional drag callback, all other callbacks and attributes must be set.

AT TARGET
  • Enable the element as target using the attribute DROPTARGET=YES;

  • Define the data types supported by the element for the drop using the DROPTYPES attribute;

  • Register the required callback DROPDATA_CB for handling the data received. This callback and all the drop target attributes must be set too. DROPMOTION_CB is the only optional drop callback.

Instance Method Summary collapse

Methods included from AttributeBuilders

define_attribute, define_id_attribute, define_id_readonly, define_id_writeonly, define_property_attribute, define_property_writeonly, define_readonly, define_writeonly

Instance Method Details

#dragbegin_cb(callback) ⇒ Object

callbacks for drag-n-drop



29
30
31
# File 'lib/wrapped/drag-drop-attributes.rb', line 29

def dragbegin_cb callback
  define_callback callback, 'DRAGBEGIN_CB', :ii_i
end

#dragdata_cb(callback) ⇒ Object

Note: user data assumed to be a string



38
39
40
# File 'lib/wrapped/drag-drop-attributes.rb', line 38

def dragdata_cb callback
  define_callback callback, 'DRAGDATA_CB', :ssi_i
end

#dragdatasize_cb(callback) ⇒ Object



33
34
35
# File 'lib/wrapped/drag-drop-attributes.rb', line 33

def dragdatasize_cb callback
  define_callback callback, 'DRAGDATASIZE_CB', :s_i
end

#dragend_cb(callback) ⇒ Object



42
43
44
# File 'lib/wrapped/drag-drop-attributes.rb', line 42

def dragend_cb callback
  define_callback callback, 'DRAGEND_CB', :i_i
end

#dropdata_cb(callback) ⇒ Object

Note: user data assumed to be a string



47
48
49
# File 'lib/wrapped/drag-drop-attributes.rb', line 47

def dropdata_cb callback
  define_callback callback, 'DROPDATA_CB', :ssiii_i
end

#dropmotion_cb(callback) ⇒ Object



51
52
53
# File 'lib/wrapped/drag-drop-attributes.rb', line 51

def dropmotion_cb callback
  define_callback callback, 'DROPMOTION_CB', :iis_i
end