Class: Wx::DragImage
Overview
This class is used when you wish to drag an object on the screen, and a simple cursor is not enough.
On Windows, the Win32 API is used to achieve smooth dragging. On other platforms, GenericDragImage is used. Applications may also prefer to use GenericDragImage on Windows, too. To use this class, when you wish to start dragging an image, create a DragImage object and store it somewhere you can access it as the drag progresses. Call #begin_drag to start, and #end_drag to stop the drag. To move the image, initially call #show and then #move. If you wish to update the screen contents during the drag (for example, highlight an item as in the dragimag sample), first call #hide, update the screen, call #move, and then call #show. You can drag within one window, or you can use full-screen dragging either across the whole screen, or just restricted to one area of the screen to save resources. If you want the user to drag between two windows, then you will need to use full-screen dragging. If you wish to draw the image yourself, use GenericDragImage and override do_draw_image and get_image_rect.
Category: Clipboard and Drag & Drop
Instance Method Summary collapse
- #begin_drag(*args) ⇒ Object
-
#end_drag ⇒ Boolean
Call this when the drag has finished.
-
#hide ⇒ Boolean
Hides the image.
-
#initialize(*args) ⇒ DragImage
constructor
A new instance of DragImage.
-
#move(pt) ⇒ Boolean
Call this to move the image to a new position.
-
#show ⇒ Boolean
Shows the image.
Methods inherited from Object
#clone, #dup, #is_same_as, #un_share
Constructor Details
#initialize ⇒ Wx::DragImage #initialize(image, cursor = Wx::NULL_CURSOR) ⇒ Wx::DragImage #initialize(image, cursor = Wx::NULL_CURSOR) ⇒ Wx::DragImage #initialize(text, cursor = Wx::NULL_CURSOR) ⇒ Wx::DragImage #initialize(treeCtrl, id) ⇒ Wx::DragImage #initialize(listCtrl, id) ⇒ Wx::DragImage
Returns a new instance of DragImage.
51 |
# File 'lib/wx/doc/gen/drag_image.rb', line 51 def initialize(*args) end |
Instance Method Details
#begin_drag(hotspot, window, fullScreen = false, rect = nil) ⇒ Boolean #begin_drag(hotspot, window, boundingWindow) ⇒ Boolean
73 |
# File 'lib/wx/doc/gen/drag_image.rb', line 73 def begin_drag(*args) end |
#end_drag ⇒ Boolean
Call this when the drag has finished.
This function automatically releases mouse capture.
83 |
# File 'lib/wx/doc/gen/drag_image.rb', line 83 def end_drag; end |
#hide ⇒ Boolean
89 |
# File 'lib/wx/doc/gen/drag_image.rb', line 89 def hide; end |
#move(pt) ⇒ Boolean
Call this to move the image to a new position.
The image will only be shown if #show has been called previously (for example at the start of the drag).
You can move the image either when the image is hidden or shown, but in general dragging will be smoother if you move the image when it is shown.
98 |
# File 'lib/wx/doc/gen/drag_image.rb', line 98 def move(pt) end |
#show ⇒ Boolean
Shows the image.
Call this at least once when dragging.
104 |
# File 'lib/wx/doc/gen/drag_image.rb', line 104 def show; end |