Class: Wx::DropSource

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/drag_drop.rb

Overview

This class represents a source for a drag and drop operation.

Category: Clipboard and Drag & Drop

See Also:

Requires:

  • USE_DRAG_AND_DROP

Instance Method Summary collapse

Constructor Details

#initialize(win = nil, iconCopy = Wx::NULL_CURSOR, iconMove = Wx::NULL_CURSOR, iconNone = Wx::NULL_CURSOR) ⇒ Wx::DropSource #initialize(data, win = nil, iconCopy = Wx::NULL_CURSOR, iconMove = Wx::NULL_CURSOR, iconNone = Wx::NULL_CURSOR) ⇒ Wx::DropSource #initialize(win = nil, iconCopy = Wx::NULL_ICON, iconMove = Wx::NULL_ICON, iconNone = Wx::NULL_ICON) ⇒ Wx::DropSource #initialize(data, win = nil, iconCopy = Wx::NULL_ICON, iconMove = Wx::NULL_ICON, iconNone = Wx::NULL_ICON) ⇒ Wx::DropSource

Returns a new instance of DropSource.

Overloads:

  • #initialize(win = nil, iconCopy = Wx::NULL_CURSOR, iconMove = Wx::NULL_CURSOR, iconNone = Wx::NULL_CURSOR) ⇒ Wx::DropSource

    This constructor requires that you must call #set_data later.

    Note that the type of iconCopy and subsequent parameters differs between different ports: these are cursors under Windows and OS X but icons for GTK. You should use the macro drop_icon in portable programs instead of directly using either of these types. Availability: only available for the WXMSW, WXOSX/Cocoa ports.

    Parameters:

    • win (Wx::Window) (defaults to: nil)

      The window which initiates the drag and drop operation.

    • iconCopy (Wx::Cursor) (defaults to: Wx::NULL_CURSOR)

      The icon or cursor used for feedback for copy operation.

    • iconMove (Wx::Cursor) (defaults to: Wx::NULL_CURSOR)

      The icon or cursor used for feedback for move operation.

    • iconNone (Wx::Cursor) (defaults to: Wx::NULL_CURSOR)

      The icon or cursor used for feedback when operation can’t be done.

    Requires:

    • WXMSW or WXOSX
  • #initialize(data, win = nil, iconCopy = Wx::NULL_CURSOR, iconMove = Wx::NULL_CURSOR, iconNone = Wx::NULL_CURSOR) ⇒ Wx::DropSource

    The constructor taking a Wx::DataObject.

    Note that the type of iconCopy and subsequent parameters differs between different ports: these are cursors under Windows and OS X but icons for GTK. You should use the macro drop_icon in portable programs instead of directly using either of these types. Availability: only available for the WXMSW, WXOSX/Cocoa ports.

    Parameters:

    • data (Wx::DataObject)

      The data associated with the drop source.

    • win (Wx::Window) (defaults to: nil)

      The window which initiates the drag and drop operation.

    • iconCopy (Wx::Cursor) (defaults to: Wx::NULL_CURSOR)

      The icon or cursor used for feedback for copy operation.

    • iconMove (Wx::Cursor) (defaults to: Wx::NULL_CURSOR)

      The icon or cursor used for feedback for move operation.

    • iconNone (Wx::Cursor) (defaults to: Wx::NULL_CURSOR)

      The icon or cursor used for feedback when operation can’t be done.

    Requires:

    • WXMSW or WXOSX
  • #initialize(win = nil, iconCopy = Wx::NULL_ICON, iconMove = Wx::NULL_ICON, iconNone = Wx::NULL_ICON) ⇒ Wx::DropSource

    This constructor requires that you must call #set_data later.

    This is the WXGTK-specific version of the constructor taking Icon instead of Cursor as the other ports. Availability: only available for the WXGTK port.

    Parameters:

    • win (Wx::Window) (defaults to: nil)

      The window which initiates the drag and drop operation.

    • iconCopy (Wx::Icon) (defaults to: Wx::NULL_ICON)

      The icon or cursor used for feedback for copy operation.

    • iconMove (Wx::Icon) (defaults to: Wx::NULL_ICON)

      The icon or cursor used for feedback for move operation.

    • iconNone (Wx::Icon) (defaults to: Wx::NULL_ICON)

      The icon or cursor used for feedback when operation can’t be done.

    Requires:

    • WXGTK
  • #initialize(data, win = nil, iconCopy = Wx::NULL_ICON, iconMove = Wx::NULL_ICON, iconNone = Wx::NULL_ICON) ⇒ Wx::DropSource

    The constructor taking a Wx::DataObject.

    This is the WXGTK-specific version of the constructor taking Icon instead of Cursor as the other ports. Availability: only available for the WXGTK port.

    Parameters:

    • data (Wx::DataObject)

      The data associated with the drop source.

    • win (Wx::Window) (defaults to: nil)

      The window which initiates the drag and drop operation.

    • iconCopy (Wx::Icon) (defaults to: Wx::NULL_ICON)

      The icon or cursor used for feedback for copy operation.

    • iconMove (Wx::Icon) (defaults to: Wx::NULL_ICON)

      The icon or cursor used for feedback for move operation.

    • iconNone (Wx::Icon) (defaults to: Wx::NULL_ICON)

      The icon or cursor used for feedback when operation can’t be done.

    Requires:

    • WXGTK


120
# File 'lib/wx/doc/gen/drag_drop.rb', line 120

def initialize(*args) end

Instance Method Details

#do_drag_drop(flags = Wx::Drag_CopyOnly) ⇒ Wx::DragResult

Starts the drag-and-drop operation which will terminate when the user releases the mouse.

Call this in response to a mouse button press, for example.

The operation requested by the user, may be Wx::DragResult::DragCopy, Wx::DragResult::DragMove, Wx::DragResult::DragLink, Wx::DragResult::DragCancel or Wx::DragResult::DragNone if an error occurred.

Parameters:

  • flags (Integer) (defaults to: Wx::Drag_CopyOnly)

    If Wx::Drag_AllowMove is included in the flags, data may be moved and not only copied as is the case for the default Wx::Drag_CopyOnly. If Wx::Drag_DefaultMove is specified (which includes the previous flag), moving is not only possible but becomes the default operation.

Returns:



129
# File 'lib/wx/doc/gen/drag_drop.rb', line 129

def do_drag_drop(flags=Wx::Drag_CopyOnly) end

#get_data_objectWx::DataObject Also known as: data_object

Returns the Wx::DataObject object that has been assigned previously.

Returns:



133
# File 'lib/wx/doc/gen/drag_drop.rb', line 133

def get_data_object; end

#give_feedback(effect) ⇒ Boolean

You may give some custom UI feedback during the drag and drop operation by overriding this function.

It is called on each mouse move, so your implementation must not be too slow.

false if you want default feedback, or true if you implement your own feedback. The return value is ignored under GTK.

Parameters:

Returns:

  • (Boolean)


143
# File 'lib/wx/doc/gen/drag_drop.rb', line 143

def give_feedback(effect) end

#set_cursor(res, cursor) ⇒ void

This method returns an undefined value.

Set the icon to use for a certain drag result.

Availability: only available for the WXMSW, WXOSX/Cocoa ports.

Parameters:

  • res (Wx::DragResult)

    The drag result to set the icon for.

  • cursor (Wx::Cursor)

    The icon to show when this drag result occurs.

Requires:

  • WXMSW or WXOSX


152
# File 'lib/wx/doc/gen/drag_drop.rb', line 152

def set_cursor(res, cursor) end

#set_data(data) ⇒ void Also known as: data=

This method returns an undefined value.

Sets the data Wx::DataObject associated with the drop source.

This will not delete any previously associated data.

Parameters:



168
# File 'lib/wx/doc/gen/drag_drop.rb', line 168

def set_data(data) end

#set_icon(res, icon) ⇒ void

This method returns an undefined value.

Set the icon to use for a certain drag result.

Availability: only available for the WXGTK port.

Parameters:

  • res (Wx::DragResult)

    The drag result to set the icon for.

  • icon (Wx::Icon)

    The icon to show when this drag result occurs.

Requires:

  • WXGTK


161
# File 'lib/wx/doc/gen/drag_drop.rb', line 161

def set_icon(res, icon) end