Crazy Eddie's GUI System  0.8.4
CEGUI::DragContainer Class Reference

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

+ Inheritance diagram for CEGUI::DragContainer:
+ Collaboration diagram for CEGUI::DragContainer:

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.

Static Public Attributes

static const String WidgetTypeName
 Type name for DragContainer.
static const String EventNamespace
 Namespace for global events.
static const String EventDragStarted
static const String EventDragEnded
static const String EventDragPositionChanged
static const String EventDragEnabledChanged
static const String EventDragAlphaChanged
static const String EventDragMouseCursorChanged
static const String EventDragThresholdChanged
static const String EventDragDropTargetChanged

is unknown.

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:
nameImage to be used as the mouse cursor when dragging.
Returns:
Nothing.
Exceptions:
UnknownObjectExceptionthrown if Image
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
bool d_stickyMode
 true when we're in 'sticky' mode.
bool d_pickedUp
 true after been picked-up / dragged via sticky mode
bool d_usingFixedDragOffset
 true if fixed mouse offset is used for dragging position.
UVector2 d_fixedDragOffset
 current fixed mouse offset value.
void setDragCursorImage (const String &name)
WindowgetCurrentDropTarget (void) const
 Return the Window object that is the current drop target for the DragContainer.
bool isStickyModeEnabled () const
 Return whether sticky mode is enable or disabled.
void setStickyModeEnabled (bool setting)
 Enable or disable sticky mode.
bool pickUp (const bool force_sticky=false)
 Immediately pick up the DragContainer and optionally set the sticky mode in order to allow this to happen. Any current interaction (i.e. mouse capture) will be interrupted.
void setFixedDragOffset (const UVector2 &offset)
 Set the fixed mouse cursor dragging offset to be used for this DragContainer.
const UVector2getFixedDragOffset () const
 Return the fixed mouse cursor dragging offset to be used for this DragContainer.
void setUsingFixedDragOffset (const bool enable)
 Set whether the fixed dragging offset - as set with the setFixedDragOffset - function will be used, or whether the built-in positioning will be used.
bool isUsingFixedDragOffset () const
 Return whether the fixed dragging offset - as set with the setFixedDragOffset function - will be used, or whether the built-in positioning will be used.
void getRenderingContext_impl (RenderingContext &ctx) const
 implementation of the default getRenderingContext logic.
bool isDraggingThresholdExceeded (const Vector2f &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 Vector2f &local_mouse)
 Update state for window dragging.
void updateActiveMouseCursor (void) const
 Method to update mouse cursor image.
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 (ElementEventArgs &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.

Detailed Description

Generic drag & drop enabled window class.


Member Function Documentation

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

Update state for window dragging.

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

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.
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.

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.

Return the fixed mouse cursor dragging offset to be used for this DragContainer.

Returns:
UVector2 describing the fixed offset used when dragging this DragContainer.
Note:
This offset is only used if it's use is enabled via the setUsingFixedDragOffset function.

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.
void CEGUI::DragContainer::initialiseDragging ( void  ) [protected]

Initialise the required states to put the window into dragging mode.

Returns:
Nothing.
bool CEGUI::DragContainer::isBeingDragged ( void  ) const

Return whether the DragContainer is currently being dragged.

Returns:

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.
bool CEGUI::DragContainer::isDraggingThresholdExceeded ( const Vector2f local_mouse) [protected]

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

Parameters:
local_mouseMouse 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.

Return whether sticky mode is enable or disabled.

Returns:
  • true if sticky mode is enabled.
  • false if sticky mode is disabled.

Return whether the fixed dragging offset - as set with the setFixedDragOffset function - will be used, or whether the built-in positioning will be used.

Parameters:
enable
  • true to enabled the use of the fixed offset.
  • false to use the regular logic.
virtual void CEGUI::DragContainer::onAlphaChanged ( WindowEventArgs e) [protected, virtual]

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

Parameters:
eWindowEventArgs 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.

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

Handler called when this window loses capture of mouse inputs.

Parameters:
eWindowEventArgs 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.

virtual 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:
eWindowEventArgs 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.

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

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

Parameters:
eWindowEventArgs object.
Returns:
Nothing.
virtual 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:
eDragDropEventArgs 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.
virtual void CEGUI::DragContainer::onDragEnabledChanged ( WindowEventArgs e) [protected, virtual]

Method called when the dragging state is enabled or disabled.

Parameters:
eWindowEventArgs object.
Returns:
Nothing.
virtual void CEGUI::DragContainer::onDragEnded ( WindowEventArgs e) [protected, virtual]

Method called when dragging ends.

Parameters:
eWindowEventArgs object containing any relevant data.
Returns:
Nothing.
virtual void CEGUI::DragContainer::onDragMouseCursorChanged ( WindowEventArgs e) [protected, virtual]

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

Parameters:
eWindowEventArgs object.
Returns:
Nothing.
virtual void CEGUI::DragContainer::onDragPositionChanged ( WindowEventArgs e) [protected, virtual]

Method called when the dragged object position is changed.

Parameters:
eWindowEventArgs object containing any relevant data.
Returns:
Nothing.
virtual void CEGUI::DragContainer::onDragStarted ( WindowEventArgs e) [protected, virtual]

Method called when dragging commences.

Parameters:
eWindowEventArgs object containing any relevant data.
Returns:
Nothing.
virtual void CEGUI::DragContainer::onDragThresholdChanged ( WindowEventArgs e) [protected, virtual]

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

Parameters:
eWindowEventArgs object.
Returns:
Nothing.
virtual void CEGUI::DragContainer::onMouseButtonDown ( MouseEventArgs e) [protected, virtual]

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

Parameters:
eMouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::Window.

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

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

Parameters:
eMouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::Window.

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

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

Parameters:
eMouseEventArgs object. All fields are valid.

Reimplemented from CEGUI::Window.

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

Handler called when the window's position changes.

Parameters:
eWindowEventArgs 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.

bool CEGUI::DragContainer::pickUp ( const bool  force_sticky = false)

Immediately pick up the DragContainer and optionally set the sticky mode in order to allow this to happen. Any current interaction (i.e. mouse capture) will be interrupted.

Parameters:
force_sticky
  • true to automatically enable the sticky mode in order to facilitate picking up the DragContainer.
  • false to ignore the pick up request if the sticky mode is not alraedy enabled (default).
Returns:
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:
alphaAlpha value to use whilst dragging.
Returns:
Nothing.

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:
imageImage object to be used as the mouse cursor while dragging.
Returns:
Nothing.

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.

Set the fixed mouse cursor dragging offset to be used for this DragContainer.

Parameters:
offsetUVector2 describing the fixed offset to be used when dragging this DragContainer.
Note:
This offset is only used if it's use is enabled via the setUsingFixedDragOffset function.

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:
pixelsfloat value indicating the new drag threshold value.
Returns:
Nothing.

Enable or disable sticky mode.

Parameters:
setting
  • true to enable sticky mode.
  • false to disable sticky mode.
void CEGUI::DragContainer::setUsingFixedDragOffset ( const bool  enable)

Set whether the fixed dragging offset - as set with the setFixedDragOffset - function will be used, or whether the built-in positioning will be used.

Parameters:
enable
  • true to enabled the use of the fixed offset.
  • false to use the regular logic.

Member Data Documentation

True when we're being dropped

Event fired when the alpha value used when dragging is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the DragContainer whose drag alpha value has been changed.

Event fired when the drop target changes. Handlers are passed a const DragDropEventArgs reference with WindowEventArgs::window set to the Window that is now the target window and DragDropEventArgs::dragDropItem set to the DragContainer whose target has changed.

Event fired when dragging is enabled or disabled. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the DragContainer whose setting has been changed.

Event fired when the user releases the DragContainer. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the DragContainer that the user has released.

Event fired when the mouse cursor to used when dragging is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the DragContainer whose dragging mouse cursor image has been changed.

Event fired when the drag position has changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the DragContainer whose position has changed due to the user dragging it.

Event fired when the user begins dragging the DragContainer. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the DragContainer that the user has started to drag.

Event fired when the drag pixel threshold is changed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the DragContainer whose dragging pixel threshold has been changed.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends