📄 ceguidragcontainer.h
字号:
/*!
\brief
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.
\return
Pointer to a Window object that contains the DragContainer whilst being dragged, or
0 to indicate no current target.
*/
Window* getCurrentDropTarget(void) const;
protected:
/*************************************************************************
Protected Implementation Methods
*************************************************************************/
/*!
\brief
Return whether the required minimum movement threshold before initiating dragging
has been exceeded.
\param local_mouse
Mouse position as a pixel offset from the top-left corner of this window.
\return
- true if the threshold has been exceeded and dragging should be initiated.
- false if the threshold has not been exceeded.
*/
bool isDraggingThresholdExceeded(const Point& local_mouse);
/*!
\brief
Initialise the required states to put the window into dragging mode.
\return
Nothing.
*/
void initialiseDragging(void);
/*!
\brief
Update state for window dragging.
\param local_mouse
Mouse position as a pixel offset from the top-left corner of this window.
\return
Nothing.
*/
void doDragging(const Point& local_mouse);
/*!
\brief
Method to update mouse cursor image
*/
void updateActiveMouseCursor(void) const;
/*!
\brief
Return whether this window was inherited from the given class name at some point in the inheritance hierarchy.
\param class_name
The class name that is to be checked.
\return
true if this window was inherited from \a class_name. false if not.
*/
virtual bool testClassName_impl(const String& class_name) const
{
if (class_name=="DragContainer") return true;
return Window::testClassName_impl(class_name);
}
/*************************************************************************
Overrides of methods in Window
*************************************************************************/
/*************************************************************************
Overrides for Event handler methods
*************************************************************************/
virtual void onMouseButtonDown(MouseEventArgs& e);
virtual void onMouseButtonUp(MouseEventArgs& e);
virtual void onMouseMove(MouseEventArgs& e);
virtual void onCaptureLost(WindowEventArgs& e);
virtual void onAlphaChanged(WindowEventArgs& e);
virtual void onClippingChanged(WindowEventArgs& e);/*Window::drawSelf(z);*/
virtual void onMoved(WindowEventArgs& e);
/*************************************************************************
New Event handler methods
*************************************************************************/
/*!
\brief
Method called when dragging commences
\param e
WindowEventArgs object containing any relevant data.
\return
Nothing.
*/
virtual void onDragStarted(WindowEventArgs& e);
/*!
\brief
Method called when dragging ends.
\param e
WindowEventArgs object containing any relevant data.
\return
Nothing.
*/
virtual void onDragEnded(WindowEventArgs& e);
/*!
\brief
Method called when the dragged object position is changed.
\param e
WindowEventArgs object containing any relevant data.
\return
Nothing.
*/
virtual void onDragPositionChanged(WindowEventArgs& e);
/*!
\brief
Method called when the dragging state is enabled or disabled
\param e
WindowEventArgs object.
\return
Nothing.
*/
virtual void onDragEnabledChanged(WindowEventArgs& e);
/*!
\brief
Method called when the alpha value to use when dragging is changed.
\param e
WindowEventArgs object.
\return
Nothing.
*/
virtual void onDragAlphaChanged(WindowEventArgs& e);
/*!
\brief
Method called when the mouse cursor to use when dragging is changed.
\param e
WindowEventArgs object.
\return
Nothing.
*/
virtual void onDragMouseCursorChanged(WindowEventArgs& e);
/*!
\brief
Method called when the movement threshold required to trigger dragging is changed.
\param e
WindowEventArgs object.
\return
Nothing.
*/
virtual void onDragThresholdChanged(WindowEventArgs& e);
/*!
\brief
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).
\param 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.
\return
Nothing.
*/
virtual void onDragDropTargetChanged(DragDropEventArgs& e);
/*************************************************************************
Data
*************************************************************************/
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.
Window* d_dropTarget; //!< Target window for possible drop operation.
const Image* d_dragCursorImage; //!< Image to use for mouse cursor when dragging.
bool d_dropflag; //!< True when we're being dropped
private:
/*************************************************************************
Static properties for the Spinner widget
*************************************************************************/
static DragContainerProperties::DragAlpha d_dragAlphaProperty;
static DragContainerProperties::DragCursorImage d_dragCursorImageProperty;
static DragContainerProperties::DraggingEnabled d_dragEnabledProperty;
static DragContainerProperties::DragThreshold d_dragThresholdProperty;
/*************************************************************************
Implementation methods
*************************************************************************/
/*!
\brief
Adds properties specific to the DragContainer base class.
\return
Nothing.
*/
void addDragContainerProperties(void);
};
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUIDragContainer_h_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -