# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # Allow only copying. # Drag_CopyOnly = 0 # Allow moving too (copying is always allowed). # Drag_AllowMove = 1 # Allow moving and make it default operation. # Drag_DefaultMove = 3 # Result returned from a {Wx::DropSource#do_drag_drop} call. # # # # @wxrb_require USE_DRAG_AND_DROP class DragResult < Wx::Enum # Error prevented the D&D operation from completing. # DragError = Wx::DragResult.new(0) # Drag target didn't accept the data. # DragNone = Wx::DragResult.new(1) # The data was successfully copied. # DragCopy = Wx::DragResult.new(2) # The data was successfully moved (MSW only). # DragMove = Wx::DragResult.new(3) # Operation is a drag-link. # DragLink = Wx::DragResult.new(4) # The operation was cancelled by user (not an error). # DragCancel = Wx::DragResult.new(5) end # DragResult # Returns true if res indicates that something was done during a DnD operation, i.e. # is neither error nor none nor cancel. # @param res [Wx::DragResult] # @return [Boolean] def self.is_drag_result_ok(res) end # This class represents a source for a drag and drop operation. # Category: Clipboard and Drag & Drop # @see Drag and Drop Overview # @see wxDataObject Overview # @see Wx::DropTarget # @see Wx::TextDropTarget # @see Wx::FileDropTarget # # # @wxrb_require USE_DRAG_AND_DROP class DropSource < ::Object # @overload initialize(win=nil, iconCopy=Wx::NULL_CURSOR, iconMove=Wx::NULL_CURSOR, iconNone=Wx::NULL_CURSOR) # This constructor requires that you must call {Wx::DropSource#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. # @param win [Wx::Window] The window which initiates the drag and drop operation. # @param iconCopy [Wx::Cursor] The icon or cursor used for feedback for copy operation. # @param iconMove [Wx::Cursor] The icon or cursor used for feedback for move operation. # @param iconNone [Wx::Cursor] The icon or cursor used for feedback when operation can't be done. # @return [Wx::DropSource] # @wxrb_require WXMSW|WXOSX # @overload initialize(data, win=nil, iconCopy=Wx::NULL_CURSOR, iconMove=Wx::NULL_CURSOR, iconNone=Wx::NULL_CURSOR) # 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. # @param data [Wx::DataObject] The data associated with the drop source. # @param win [Wx::Window] The window which initiates the drag and drop operation. # @param iconCopy [Wx::Cursor] The icon or cursor used for feedback for copy operation. # @param iconMove [Wx::Cursor] The icon or cursor used for feedback for move operation. # @param iconNone [Wx::Cursor] The icon or cursor used for feedback when operation can't be done. # @return [Wx::DropSource] # @wxrb_require WXMSW|WXOSX def initialize(*args) end # 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. # @param flags [Integer] 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. # @return [Wx::DragResult] def do_drag_drop(flags=Wx::Drag_CopyOnly) end # Returns the {Wx::DataObject} object that has been assigned previously. # @return [Wx::DataObject] def get_data_object; end alias_method :data_object, :get_data_object # 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. # @param effect [Wx::DragResult] The effect to implement. One of {Wx::DragResult::DragCopy}, {Wx::DragResult::DragMove}, {Wx::DragResult::DragLink} and {Wx::DragResult::DragNone}. # @return [Boolean] def give_feedback(effect) end # Set the icon to use for a certain drag result. # Availability: only available for the WXMSW, WXOSX/Cocoa ports. # @param res [Wx::DragResult] The drag result to set the icon for. # @param cursor [Wx::Cursor] The icon to show when this drag result occurs. # @return [void] # @wxrb_require WXMSW|WXOSX def set_cursor(res, cursor) end # Sets the data {Wx::DataObject} associated with the drop source. # This will not delete any previously associated data. # @param data [Wx::DataObject] # @return [void] def set_data(data) end alias_method :data=, :set_data end # DropSource # This class represents a target for a drag and drop operation. # A {Wx::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 {Wx::DropTarget#on_enter}, {Wx::DropTarget#on_drag_over} possibly many times, {Wx::DropTarget#on_drop} and finally {Wx::DropTarget#on_data}. # # Category: Clipboard and Drag & Drop # @see Drag and Drop Overview # @see wxDataObject Overview # @see Wx::DropSource # @see Wx::TextDropTarget # @see Wx::FileDropTarget # @see Wx::DataFormat # @see Wx::DataObject # # # @wxrb_require USE_DRAG_AND_DROP class DropTarget < ::Object # Constructor. # data is the data to be associated with the drop target. # @param data [Wx::DataObject] # @return [Wx::DropTarget] def initialize(data=nil) end # This method may only be called from within {Wx::DropTarget#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. # @return [Boolean] def get_data; end alias_method :data, :get_data # Called after {Wx::DropTarget#on_drop} returns true. # By default this will usually {Wx::DropTarget#get_data} and will return the suggested default value defResult. # @param x [Integer] # @param y [Integer] # @param defResult [Wx::DragResult] # @return [Wx::DragResult] def on_data(x, y, defResult) end # 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. # @param x [Integer] The x coordinate of the mouse. # @param y [Integer] The y coordinate of the mouse. # @param defResult [Wx::DragResult] Suggested value for return value. Determined by SHIFT or CONTROL key states. # @return [Wx::DragResult] def on_drag_over(x, y, defResult) end # 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. # @param x [Integer] The x coordinate of the mouse. # @param y [Integer] The y coordinate of the mouse. # @return [Boolean] def on_drop(x, y) end # Called when the mouse enters the drop target. # By default, this calls {Wx::DropTarget#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. # @param x [Integer] The x coordinate of the mouse. # @param y [Integer] The y coordinate of the mouse. # @param defResult [Wx::DragResult] Suggested default for return value. Determined by SHIFT or CONTROL key states. # @return [Wx::DragResult] def on_enter(x, y, defResult) end # Called when the mouse leaves the drop target. # @return [void] def on_leave; end # Returns the data {Wx::DataObject} associated with the drop target. # @return [Wx::DataObject] def get_data_object; end alias_method :data_object, :get_data_object # Sets the data {Wx::DataObject} associated with the drop target and deletes any previously associated data object. # @param data [Wx::DataObject] # @return [void] def set_data_object(data) end alias_method :data_object=, :set_data_object # 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}) # @param action [Wx::DragResult] # @return [void] def set_default_action(action) end alias_method :default_action=, :set_default_action # Returns default action for drag and drop or {Wx::DragResult::DragNone} if this not specified. # @return [Wx::DragResult] def get_default_action; end alias_method :default_action, :get_default_action end # DropTarget # This is a drop target which accepts files (dragged from File Manager or Explorer). # Category: Clipboard and Drag & Drop # @see Drag and Drop Overview # @see Wx::DropSource # @see Wx::DropTarget # @see Wx::TextDropTarget # # # @wxrb_require USE_DRAG_AND_DROP class FileDropTarget < DropTarget # Constructor. # @return [Wx::FileDropTarget] def initialize; end # Override this function to receive dropped files. # Return true to accept the data, or false to veto the operation. # @param x [Integer] The x coordinate of the mouse. # @param y [Integer] The y coordinate of the mouse. # @param filenames [Array] An array of filenames. # @return [Boolean] def on_drop_files(x, y, filenames) end end # FileDropTarget # A predefined drop target for dealing with text data. # Category: Clipboard and Drag & Drop # @see Drag and Drop Overview # @see Wx::DropSource # @see Wx::DropTarget # @see Wx::FileDropTarget # # # @wxrb_require USE_DRAG_AND_DROP class TextDropTarget < DropTarget # Constructor. # @return [Wx::TextDropTarget] def initialize; end # Override this function to receive dropped text. # Return true to accept the data, or false to veto the operation. # @param x [Integer] The x coordinate of the mouse. # @param y [Integer] The y coordinate of the mouse. # @param data [String] The data being dropped: a {Wx::String}. # @return [Boolean] def on_drop_text(x, y, data) end end # TextDropTarget end