Class: Wx::DropTarget
- Inherits:
-
Object
- Object
- Wx::DropTarget
- Defined in:
- lib/wx/doc/gen/drag_drop.rb
Overview
This class represents a target for a drag and drop operation.
A DataObject can be associated with it and by default, this object will be filled with the data from the drag source, if the data formats supported by the data object match the drag source data format. There are various virtual handler functions defined in this class which may be overridden to give visual feedback or react in a more fine-tuned way, e.g. by not accepting data on the whole window area, but only a small portion of it. The normal sequence of calls is #on_enter, #on_drag_over possibly many times, #on_drop and finally #on_data.
Category: Clipboard and Drag & Drop
Direct Known Subclasses
Instance Method Summary collapse
-
#get_data ⇒ Boolean
(also: #data)
This method may only be called from within #on_data.
-
#get_data_object ⇒ Wx::DataObject
(also: #data_object)
Returns the data DataObject associated with the drop target.
-
#get_default_action ⇒ Wx::DragResult
(also: #default_action)
Returns default action for drag and drop or Wx::DragResult::DragNone if this not specified.
-
#initialize(data = nil) ⇒ Wx::DropTarget
constructor
Constructor.
-
#on_data(x, y, defResult) ⇒ Wx::DragResult
Called after #on_drop returns true.
-
#on_drag_over(x, y, defResult) ⇒ Wx::DragResult
Called when the mouse is being dragged over the drop target.
-
#on_drop(x, y) ⇒ Boolean
Called when the user drops a data object on the target.
-
#on_enter(x, y, defResult) ⇒ Wx::DragResult
Called when the mouse enters the drop target.
-
#on_leave ⇒ void
Called when the mouse leaves the drop target.
-
#set_data_object(data) ⇒ void
(also: #data_object=)
Sets the data DataObject associated with the drop target and deletes any previously associated data object.
-
#set_default_action(action) ⇒ void
(also: #default_action=)
Sets the default action for drag and drop.
Constructor Details
#initialize(data = nil) ⇒ Wx::DropTarget
Constructor.
data is the data to be associated with the drop target.
196 |
# File 'lib/wx/doc/gen/drag_drop.rb', line 196 def initialize(data=nil) end |
Instance Method Details
#get_data ⇒ Boolean Also known as: data
This method may only be called from within #on_data.
By default, this method copies the data from the drop source to the Wx::DataObject associated with this drop target, calling its Wx::DataObject#set_data method.
202 |
# File 'lib/wx/doc/gen/drag_drop.rb', line 202 def get_data; end |
#get_data_object ⇒ Wx::DataObject Also known as: data_object
Returns the data Wx::DataObject associated with the drop target.
252 |
# File 'lib/wx/doc/gen/drag_drop.rb', line 252 def get_data_object; end |
#get_default_action ⇒ Wx::DragResult Also known as: default_action
Returns default action for drag and drop or Wx::DragResult::DragNone if this not specified.
271 |
# File 'lib/wx/doc/gen/drag_drop.rb', line 271 def get_default_action; end |
#on_data(x, y, defResult) ⇒ Wx::DragResult
212 |
# File 'lib/wx/doc/gen/drag_drop.rb', line 212 def on_data(x, y, defResult) end |
#on_drag_over(x, y, defResult) ⇒ Wx::DragResult
Called when the mouse is being dragged over the drop target.
By default, this calls functions return the suggested return value defResult.
The desired operation or Wx::DragResult::DragNone. This is used for optical feedback from the side of the drop source, typically in form of changing the icon.
223 |
# File 'lib/wx/doc/gen/drag_drop.rb', line 223 def on_drag_over(x, y, defResult) end |
#on_drop(x, y) ⇒ Boolean
Called when the user drops a data object on the target.
Return false to veto the operation.
true to accept the data, or false to veto the operation.
233 |
# File 'lib/wx/doc/gen/drag_drop.rb', line 233 def on_drop(x, y) end |
#on_enter(x, y, defResult) ⇒ Wx::DragResult
Called when the mouse enters the drop target.
By default, this calls #on_drag_over.
The desired operation or Wx::DragResult::DragNone. This is used for optical feedback from the side of the drop source, typically in form of changing the icon.
244 |
# File 'lib/wx/doc/gen/drag_drop.rb', line 244 def on_enter(x, y, defResult) end |
#on_leave ⇒ void
This method returns an undefined value.
Called when the mouse leaves the drop target.
248 |
# File 'lib/wx/doc/gen/drag_drop.rb', line 248 def on_leave; end |
#set_data_object(data) ⇒ void Also known as: data_object=
This method returns an undefined value.
Sets the data Wx::DataObject associated with the drop target and deletes any previously associated data object.
258 |
# File 'lib/wx/doc/gen/drag_drop.rb', line 258 def set_data_object(data) end |
#set_default_action(action) ⇒ void Also known as: default_action=
This method returns an undefined value.
Sets the default action for drag and drop.
Use Wx::DragResult::DragMove or Wx::DragResult::DragCopy to set default action to move or copy and use Wx::DragResult::DragNone (default) to set default action specified by initialization of dragging (see Wx::DropSource#do_drag_drop)
266 |
# File 'lib/wx/doc/gen/drag_drop.rb', line 266 def set_default_action(action) end |