CEGUI::DragContainer Class Reference

Generic drag & drop enabled window class. More...

Inheritance diagram for CEGUI::DragContainer:

Inheritance graph
[legend]
Collaboration diagram for CEGUI::DragContainer:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 DragContainer (const String &type, const String &name)
 Constructor for DragContainer objects.
virtual ~DragContainer (void)
 Destructor for DragContainer objects.
bool isDraggingEnabled (void) const
 Return whether dragging is currently enabled for this DragContainer.
void setDraggingEnabled (bool setting)
 Set whether dragging is currently enabled for this DragContainer.
bool isBeingDragged (void) const
 Return whether the DragContainer is currently being dragged.
float getPixelDragThreshold (void) const
 Return the current drag threshold in pixels.
void setPixelDragThreshold (float pixels)
 Set the current drag threshold in pixels.
float getDragAlpha (void) const
 Return the alpha value that will be set on the DragContainer while a drag operation is in progress.
void setDragAlpha (float alpha)
 Set the alpha value to be set on the DragContainer when a drag operation is in progress.
const ImagegetDragCursorImage (void) const
 Return the Image currently set to be used for the mouse cursor when a drag operation is in progress.
void setDragCursorImage (const Image *image)
 Set the Image to be used for the mouse cursor when a drag operation is in progress.
void setDragCursorImage (MouseCursorImage image)
 Set the Image to be used for the mouse cursor when a drag operation is in progress.
void setDragCursorImage (const String &imageset, const String &image)
 Set the Image to be used for the mouse cursor when a drag operation is in progress.
WindowgetCurrentDropTarget (void) const
 Return the Window object that is the current drop target for the DragContainer.

Static Public Attributes

static const String WidgetTypeName
 Type name for DragContainer.
static const String EventNamespace
 Namespace for global events.
static const String EventDragStarted
 Name of the event fired when the user begins dragging the thumb.
static const String EventDragEnded
 Name of the event fired when the user releases the thumb.
static const String EventDragPositionChanged
 Event fired when the drag position has changed.
static const String EventDragEnabledChanged
 Event fired when dragging is enabled or disabled.
static const String EventDragAlphaChanged
 Event fired when the alpha value used when dragging is changed.
static const String EventDragMouseCursorChanged
 Event fired when the mouse cursor used when dragging is changed.
static const String EventDragThresholdChanged
 Event fired when the drag pixel threshold is changed.
static const String EventDragDropTargetChanged
 Event fired when the drop target changes.

Protected Member Functions

bool isDraggingThresholdExceeded (const Point &local_mouse)
 Return whether the required minimum movement threshold before initiating dragging has been exceeded.
void initialiseDragging (void)
 Initialise the required states to put the window into dragging mode.
void doDragging (const Point &local_mouse)
 Update state for window dragging.
void updateActiveMouseCursor (void) const
 Method to update mouse cursor image.
virtual bool testClassName_impl (const String &class_name) const
 Return whether this window was inherited from the given class name at some point in the inheritance hierarchy.
virtual void onMouseButtonDown (MouseEventArgs &e)
 Handler called when a mouse button has been depressed within this window's area.
virtual void onMouseButtonUp (MouseEventArgs &e)
 Handler called when a mouse button has been released within this window's area.
virtual void onMouseMove (MouseEventArgs &e)
 Handler called when the mouse cursor has been moved within this window's area.
virtual void onCaptureLost (WindowEventArgs &e)
 Handler called when this window loses capture of mouse inputs.
virtual void onAlphaChanged (WindowEventArgs &e)
 Handler called when the window's alpha blend value is changed.
virtual void onClippingChanged (WindowEventArgs &e)
 Handler called when the window's setting for being clipped by it's parent is changed.
virtual void onMoved (WindowEventArgs &e)
 Handler called when the window's position changes.
virtual void onDragStarted (WindowEventArgs &e)
 Method called when dragging commences.
virtual void onDragEnded (WindowEventArgs &e)
 Method called when dragging ends.
virtual void onDragPositionChanged (WindowEventArgs &e)
 Method called when the dragged object position is changed.
virtual void onDragEnabledChanged (WindowEventArgs &e)
 Method called when the dragging state is enabled or disabled.
virtual void onDragAlphaChanged (WindowEventArgs &e)
 Method called when the alpha value to use when dragging is changed.
virtual void onDragMouseCursorChanged (WindowEventArgs &e)
 Method called when the mouse cursor to use when dragging is changed.
virtual void onDragThresholdChanged (WindowEventArgs &e)
 Method called when the movement threshold required to trigger dragging is changed.
virtual void onDragDropTargetChanged (DragDropEventArgs &e)
 Method called when the current drop target of this DragContainer changes.

Protected Attributes

bool d_draggingEnabled
 True when dragging is enabled.
bool d_leftMouseDown
 True when left mouse button is down.
bool d_dragging
 true when being dragged.
UVector2 d_dragPoint
 point we are being dragged at.
UVector2 d_startPosition
 position prior to dragging.
float d_dragThreshold
 Pixels mouse must move before dragging commences.
float d_dragAlpha
 Alpha value to set when dragging.
float d_storedAlpha
 Alpha value to re-set when dragging ends.
bool d_storedClipState
 Parent clip state to re-set.
Windowd_dropTarget
 Target window for possible drop operation.
const Imaged_dragCursorImage
 Image to use for mouse cursor when dragging.
bool d_dropflag
 True when we're being dropped.


Detailed Description

Generic drag & drop enabled window class.

Member Function Documentation

void CEGUI::DragContainer::doDragging ( const Point local_mouse  )  [protected]

Update state for window dragging.

Parameters:
local_mouse Mouse position as a pixel offset from the top-left corner of this window.
Returns:
Nothing.

References d_dragPoint, CEGUI::Vector2::d_x, CEGUI::Vector2::d_y, CEGUI::Window::getPosition(), onDragPositionChanged(), and CEGUI::Window::setPosition().

Referenced by onMouseMove().

Window * CEGUI::DragContainer::getCurrentDropTarget ( void   )  const

Return the Window object that is the current drop target for the DragContainer.

The drop target for a DragContainer is basically the Window that the DragContainer is within while being dragged. The drop target may be 0 to indicate no target.

Returns:
Pointer to a Window object that contains the DragContainer whilst being dragged, or 0 to indicate no current target.

References d_dropTarget.

float CEGUI::DragContainer::getDragAlpha ( void   )  const

Return the alpha value that will be set on the DragContainer while a drag operation is in progress.

Returns:
Current alpha value to use whilst dragging.

References d_dragAlpha.

const Image * CEGUI::DragContainer::getDragCursorImage ( void   )  const

Return the Image currently set to be used for the mouse cursor when a drag operation is in progress.

Returns:
Image object currently set to be used as the mouse cursor when dragging.

References d_dragCursorImage, CEGUI::DefaultMouseCursor, CEGUI::System::getDefaultMouseCursor(), and CEGUI::System::getSingleton().

Referenced by updateActiveMouseCursor().

float CEGUI::DragContainer::getPixelDragThreshold ( void   )  const

Return the current drag threshold in pixels.

The drag threshold is the number of pixels that the mouse must be moved with the left button held down in order to commence a drag operation.

Returns:
float value indicating the current drag threshold value.

References d_dragThreshold.

void CEGUI::DragContainer::initialiseDragging ( void   )  [protected]

bool CEGUI::DragContainer::isBeingDragged ( void   )  const

Return whether the DragContainer is currently being dragged.

Returns:

References d_dragging.

bool CEGUI::DragContainer::isDraggingEnabled ( void   )  const

Return whether dragging is currently enabled for this DragContainer.

Returns:
  • true if dragging is enabled and the DragContainer may be dragged.
  • false if dragging is disabled and the DragContainer may not be dragged.

References d_draggingEnabled.

bool CEGUI::DragContainer::isDraggingThresholdExceeded ( const Point local_mouse  )  [protected]

Return whether the required minimum movement threshold before initiating dragging has been exceeded.

Parameters:
local_mouse Mouse position as a pixel offset from the top-left corner of this window.
Returns:
  • true if the threshold has been exceeded and dragging should be initiated.
  • false if the threshold has not been exceeded.

References CEGUI::UDim::asAbsolute(), d_dragPoint, d_dragThreshold, CEGUI::Size::d_height, CEGUI::Window::d_pixelSize, CEGUI::Size::d_width, CEGUI::UVector2::d_x, CEGUI::Vector2::d_x, CEGUI::UVector2::d_y, and CEGUI::Vector2::d_y.

Referenced by onMouseMove().

void CEGUI::DragContainer::onAlphaChanged ( WindowEventArgs e  )  [protected, virtual]

Handler called when the window's alpha blend value is changed.

Parameters:
e WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'.

Reimplemented from CEGUI::Window.

References CEGUI::Window::d_alpha, d_dragAlpha, d_dragging, and d_storedAlpha.

Referenced by onDragAlphaChanged().

void CEGUI::DragContainer::onCaptureLost ( WindowEventArgs e  )  [protected, virtual]

Handler called when this window loses capture of mouse inputs.

Parameters:
e WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'.

Reimplemented from CEGUI::Window.

References d_dragging, d_dropTarget, d_leftMouseDown, d_startPosition, d_storedAlpha, d_storedClipState, CEGUI::EventArgs::handled, CEGUI::Window::setAlpha(), CEGUI::Window::setClippedByParent(), CEGUI::Window::setPosition(), and updateActiveMouseCursor().

void CEGUI::DragContainer::onClippingChanged ( WindowEventArgs e  )  [protected, virtual]

Handler called when the window's setting for being clipped by it's parent is changed.

Parameters:
e WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'.

Reimplemented from CEGUI::Window.

References CEGUI::Window::d_clippedByParent, d_dragging, and d_storedClipState.

void CEGUI::DragContainer::onDragAlphaChanged ( WindowEventArgs e  )  [protected, virtual]

Method called when the alpha value to use when dragging is changed.

Parameters:
e WindowEventArgs object.
Returns:
Nothing.

References CEGUI::Window::d_alpha, d_dragging, d_storedAlpha, EventDragAlphaChanged, EventNamespace, CEGUI::EventSet::fireEvent(), and onAlphaChanged().

Referenced by setDragAlpha().

void CEGUI::DragContainer::onDragDropTargetChanged ( DragDropEventArgs e  )  [protected, virtual]

Method called when the current drop target of this DragContainer changes.

Note:
This event fires just prior to the target field being changed. The default implementation changes the drop target, you can examine the old and new targets before calling the default implementation to make the actual change (and fire appropriate events for the Window objects involved).
Parameters:
e DragDropEventArgs object initialised as follows:
  • dragDropItem is initialised to the DragContainer triggering the event (typically 'this').
  • window is initialised to point to the Window which will be the new drop target.
Returns:
Nothing.

References d_dropTarget, EventDragDropTargetChanged, EventNamespace, CEGUI::EventSet::fireEvent(), CEGUI::Window::getParent(), CEGUI::Window::isDragDropTarget(), CEGUI::Window::notifyDragDropItemEnters(), CEGUI::Window::notifyDragDropItemLeaves(), and CEGUI::WindowEventArgs::window.

Referenced by onDragPositionChanged().

void CEGUI::DragContainer::onDragEnabledChanged ( WindowEventArgs e  )  [protected, virtual]

Method called when the dragging state is enabled or disabled.

Parameters:
e WindowEventArgs object.
Returns:
Nothing.

References d_dragging, d_draggingEnabled, EventDragEnabledChanged, EventNamespace, CEGUI::EventSet::fireEvent(), and CEGUI::Window::releaseInput().

Referenced by setDraggingEnabled().

void CEGUI::DragContainer::onDragEnded ( WindowEventArgs e  )  [protected, virtual]

Method called when dragging ends.

Parameters:
e WindowEventArgs object containing any relevant data.
Returns:
Nothing.

References d_dropflag, d_dropTarget, EventDragEnded, EventNamespace, CEGUI::EventSet::fireEvent(), and CEGUI::Window::notifyDragDropItemDropped().

Referenced by onMouseButtonUp().

void CEGUI::DragContainer::onDragMouseCursorChanged ( WindowEventArgs e  )  [protected, virtual]

Method called when the mouse cursor to use when dragging is changed.

Parameters:
e WindowEventArgs object.
Returns:
Nothing.

References EventDragMouseCursorChanged, EventNamespace, CEGUI::EventSet::fireEvent(), and updateActiveMouseCursor().

Referenced by setDragCursorImage().

void CEGUI::DragContainer::onDragPositionChanged ( WindowEventArgs e  )  [protected, virtual]

void CEGUI::DragContainer::onDragStarted ( WindowEventArgs e  )  [protected, virtual]

Method called when dragging commences.

Parameters:
e WindowEventArgs object containing any relevant data.
Returns:
Nothing.

References EventDragStarted, EventNamespace, CEGUI::EventSet::fireEvent(), and initialiseDragging().

Referenced by onMouseMove().

void CEGUI::DragContainer::onDragThresholdChanged ( WindowEventArgs e  )  [protected, virtual]

Method called when the movement threshold required to trigger dragging is changed.

Parameters:
e WindowEventArgs object.
Returns:
Nothing.

References EventDragThresholdChanged, EventNamespace, and CEGUI::EventSet::fireEvent().

Referenced by setPixelDragThreshold().

void CEGUI::DragContainer::onMouseButtonDown ( MouseEventArgs e  )  [protected, virtual]

void CEGUI::DragContainer::onMouseButtonUp ( MouseEventArgs e  )  [protected, virtual]

Handler called when a mouse button has been released within this window's area.

Parameters:
e MouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::Window.

References CEGUI::MouseEventArgs::button, d_dragging, CEGUI::EventArgs::handled, CEGUI::LeftButton, onDragEnded(), and CEGUI::Window::releaseInput().

void CEGUI::DragContainer::onMouseMove ( MouseEventArgs e  )  [protected, virtual]

Handler called when the mouse cursor has been moved within this window's area.

Parameters:
e MouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::Window.

References d_dragging, d_leftMouseDown, doDragging(), isDraggingThresholdExceeded(), onDragStarted(), CEGUI::MouseEventArgs::position, and CEGUI::CoordConverter::screenToWindow().

void CEGUI::DragContainer::onMoved ( WindowEventArgs e  )  [protected, virtual]

Handler called when the window's position changes.

Parameters:
e WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'.

Reimplemented from CEGUI::Window.

References d_dropflag, d_startPosition, and CEGUI::Window::getPosition().

void CEGUI::DragContainer::setDragAlpha ( float  alpha  ) 

Set the alpha value to be set on the DragContainer when a drag operation is in progress.

This method can be used while a drag is in progress to update the alpha. Note that the normal setAlpha method does not affect alpha while a drag is in progress, but once the drag operation has ended, any value set via setAlpha will be restored.

Parameters:
alpha Alpha value to use whilst dragging.
Returns:
Nothing.

References d_dragAlpha, and onDragAlphaChanged().

void CEGUI::DragContainer::setDragCursorImage ( const String imageset,
const String image 
)

Set the Image to be used for the mouse cursor when a drag operation is in progress.

This method may be used during a drag operation to update the current mouse cursor image.

Parameters:
imageset String holding the name of the Imageset that contains the Image to be used.
image Image defined for the Imageset imageset to be used as the mouse cursor when dragging.
Returns:
Nothing.
Exceptions:
UnknownObjectException thrown if either imageset or image are unknown.

References setDragCursorImage().

void CEGUI::DragContainer::setDragCursorImage ( MouseCursorImage  image  ) 

Set the Image to be used for the mouse cursor when a drag operation is in progress.

This method may be used during a drag operation to update the current mouse cursor image.

Parameters:
image One of the MouseCursorImage enumerated values.
Returns:
Nothing.

References setDragCursorImage().

void CEGUI::DragContainer::setDragCursorImage ( const Image image  ) 

Set the Image to be used for the mouse cursor when a drag operation is in progress.

This method may be used during a drag operation to update the current mouse cursor image.

Parameters:
image Image object to be used as the mouse cursor while dragging.
Returns:
Nothing.

References d_dragCursorImage, and onDragMouseCursorChanged().

Referenced by setDragCursorImage().

void CEGUI::DragContainer::setDraggingEnabled ( bool  setting  ) 

Set whether dragging is currently enabled for this DragContainer.

Parameters:
setting 
  • true to enable dragging so that the DragContainer may be dragged.
  • false to disabled dragging so that the DragContainer may not be dragged.
Returns:
Nothing.

References d_draggingEnabled, and onDragEnabledChanged().

void CEGUI::DragContainer::setPixelDragThreshold ( float  pixels  ) 

Set the current drag threshold in pixels.

The drag threshold is the number of pixels that the mouse must be moved with the left button held down in order to commence a drag operation.

Parameters:
pixels float value indicating the new drag threshold value.
Returns:
Nothing.

References d_dragThreshold, and onDragThresholdChanged().

virtual bool CEGUI::DragContainer::testClassName_impl ( const String class_name  )  const [inline, protected, virtual]

Return whether this window was inherited from the given class name at some point in the inheritance hierarchy.

Parameters:
class_name The class name that is to be checked.
Returns:
true if this window was inherited from class_name. false if not.

Reimplemented from CEGUI::Window.

References CEGUI::Window::testClassName_impl().


Generated on Thu Nov 27 20:34:34 2008 for Crazy Eddies GUI System by  doxygen 1.5.7.1