wx.DropTarget Class Reference

Inheritance diagram for wx.DropTarget:

wx.Object wx.FileDropTarget wx.TextDropTarget

List of all members.

Public Member Functions

 DropTarget (IntPtr wxObject)
 DropTarget (DataObject dataObject)
 DropTarget ()
virtual bool GetData ()
abstract DragResult OnData (int x, int y, DragResult def)
virtual DragResult OnDragOver (int x, int y, DragResult def)
virtual bool OnDrop (int x, int y)
virtual DragResult OnEnter (int x, int y, DragResult def)
virtual void OnLeave ()
void RunErrorHandler (Exception exc)

Public Attributes

event ErrorEventHandler OnError

Protected Member Functions

override void CallDTor ()

Protected Attributes

DataObject m_dataObject = null

Properties

DataObject DataObject [get, set]


Detailed Description

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.

YOU HAVE TO SET A DATA OBJECT (PREFERABLY IN THE CTOR) BEFORE USING THIS INSTANCE. Otherwise, access violations may result.

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 OnEnter(), possibly many times OnDragOver(), OnDrop() and finally OnData().

Cf. Drag and drop overview.


Constructor & Destructor Documentation

wx.DropTarget.DropTarget (  ) 

wx.DropTarget.DropTarget ( DataObject  dataObject  ) 

wx.DropTarget.DropTarget ( IntPtr  wxObject  ) 


Member Function Documentation

override void wx.DropTarget.CallDTor (  )  [protected, virtual]

This will be called by Dispose() to delete the C++ object. Overload this if you have to use another DTor.

Reimplemented from wx.Object.

virtual bool wx.DropTarget.GetData (  )  [virtual]

This method may only be called from within OnData. By default, this method copies the data from the drop source to the wxDataObject associated with this drop target, calling its wx.DataObject.SetData method.

See also:
OnData

Reimplemented in wx.TextDropTarget, and wx.FileDropTarget.

abstract DragResult wx.DropTarget.OnData ( int  x,
int  y,
DragResult  def 
) [pure virtual]

Called after OnDrop() returns true. By default this will usually GetData() and will return the suggested default value def.

Parameters:
x The x coordinate of the mouse.
y The y coordinate of the mouse.
def Suggested default for return value. Determined by SHIFT or CONTROL key states.
See also:
GetData

Implemented in wx.TextDropTarget, and wx.FileDropTarget.

virtual DragResult wx.DropTarget.OnDragOver ( int  x,
int  y,
DragResult  def 
) [virtual]

Called when the mouse is being dragged over the drop target. By default, this calls functions return the suggested return value "def".

Parameters:
x The x coordinate of the mouse.
y The y coordinate of the mouse.
def Suggested default for return value. Determined by SHIFT or CONTROL key states.

virtual bool wx.DropTarget.OnDrop ( int  x,
int  y 
) [virtual]

Called when the user drops a data object on the target. Return false to veto the operation.

Parameters:
x The x coordinate of the mouse.
y The y coordinate of the mouse.
Returns:
Return true to accept the data, false to veto the operation.

Reimplemented in wx.TextDropTarget, and wx.FileDropTarget.

virtual DragResult wx.DropTarget.OnEnter ( int  x,
int  y,
DragResult  def 
) [virtual]

Called when the mouse enters the drop target. By default, this calls OnDragOver().

Parameters:
x The x coordinate of the mouse.
y The y coordinate of the mouse.
def Suggested default for return value. Determined by SHIFT or CONTROL key states.
Returns:
Returns the desired operation or wxDragNone. This is used for optical feedback from the side of the drop source, typically in form of changing the icon.

virtual void wx.DropTarget.OnLeave (  )  [virtual]

Called when the mouse leaves the drop target.

void wx.DropTarget.RunErrorHandler ( Exception  exc  ) 

Runs the defined error handlers to display the error as given by the argument. This will run the default error handler if not skipped by one of the handlers of the error event.

Parameters:
exc The error to be displayed.


Member Data Documentation

DataObject wx.DropTarget.m_dataObject = null [protected]

event ErrorEventHandler wx.DropTarget.OnError

This event will be raised on exceptions.


Property Documentation

DataObject wx.DropTarget.DataObject [get, set]

Getter: Return the data object that is associated with this drop process. Available after OnDrop() for instance OnData().

Setter: Sets the data wxDataObject associated with the drop target and deletes any previously associated data object. Please note, that you must set a data object before this target can be activated.


Manual of the wx.NET   (c) 2003-2011 the wx.NET project at   Get wx.NET at SourceForge.net. Fast, secure and Free Open Source software downloads