FifeGUI 0.2.0
A C++ GUI library designed for games.
fcn::DragHandler Class Reference

#include <dragdrop.hpp>

Public Member Functions

bool beginDrag (Widget *source, std::unique_ptr< DragPayload > payload, int mouseX, int mouseY)
bool beginDragFromWidget (Widget *source, int mouseX, int mouseY)
void cancel ()
 DragHandler (Gui *gui)
DropResult drop (int mouseX, int mouseY)
WidgetgetActiveDropTarget () const
WidgetgetHoveredWidget () const
WidgetgetModalWidget () const
DragPayload const * getPayload () const
DragRenderConfig const & getRenderConfig () const
DragState getState () const
void render (Graphics &graphics)
void setModalWidget (Widget *modal)
void setRenderConfig (DragRenderConfig config)
void update (int mouseX, int mouseY)

Static Public Member Functions

static WidgetfindWidgetAt (Widget *root, int x, int y, bool mustBeVisible=true, bool mustBeEnabled=true)

Detailed Description

Manages drag and drop operations for a Gui instance.

Tracks drag state, active payload, hovered widget and provides rendering hooks for ghost and highlight visuals.

Definition at line 216 of file dragdrop.hpp.

Constructor & Destructor Documentation

◆ DragHandler()

fcn::DragHandler::DragHandler ( Gui * gui)
explicit

Create a drag handler for a GUI.

Definition at line 28 of file dragdrop.cpp.

Member Function Documentation

◆ beginDrag()

bool fcn::DragHandler::beginDrag ( Widget * source,
std::unique_ptr< DragPayload > payload,
int mouseX,
int mouseY )

Start a drag with the given payload.

Definition at line 52 of file dragdrop.cpp.

References fcn::Dragging.

◆ beginDragFromWidget()

bool fcn::DragHandler::beginDragFromWidget ( Widget * source,
int mouseX,
int mouseY )

Start a drag from a widget without explicit payload.

Definition at line 64 of file dragdrop.cpp.

◆ cancel()

void fcn::DragHandler::cancel ( )

Cancel the current drag.

Definition at line 128 of file dragdrop.cpp.

References fcn::Dragging, and fcn::Idle.

◆ drop()

DropResult fcn::DragHandler::drop ( int mouseX,
int mouseY )

Drop at the given position.

Definition at line 102 of file dragdrop.cpp.

References fcn::Accepted, fcn::Cancelled, fcn::Dragging, and fcn::Idle.

◆ findWidgetAt()

Widget * fcn::DragHandler::findWidgetAt ( Widget * root,
int x,
int y,
bool mustBeVisible = true,
bool mustBeEnabled = true )
static

Find a widget at the given coordinates.

Definition at line 166 of file dragdrop.cpp.

References fcn::Widget::getWidgetAt().

◆ getActiveDropTarget()

Widget * fcn::DragHandler::getActiveDropTarget ( ) const

Get the active drop target widget.

Definition at line 42 of file dragdrop.cpp.

◆ getHoveredWidget()

Widget * fcn::DragHandler::getHoveredWidget ( ) const

Get the widget currently hovered by the drag.

Definition at line 37 of file dragdrop.cpp.

◆ getModalWidget()

Widget * fcn::DragHandler::getModalWidget ( ) const

Get the modal widget if any.

Definition at line 161 of file dragdrop.cpp.

◆ getPayload()

DragPayload const * fcn::DragHandler::getPayload ( ) const

Get the active payload.

Definition at line 47 of file dragdrop.cpp.

References fcn::DragPayload::get().

◆ getRenderConfig()

DragRenderConfig const & fcn::DragHandler::getRenderConfig ( ) const

Get the current render config.

Definition at line 152 of file dragdrop.cpp.

◆ getState()

DragState fcn::DragHandler::getState ( ) const

Get the current drag state.

Definition at line 32 of file dragdrop.cpp.

◆ render()

void fcn::DragHandler::render ( Graphics & graphics)

Render drag related visuals.

Definition at line 142 of file dragdrop.cpp.

◆ setModalWidget()

void fcn::DragHandler::setModalWidget ( Widget * modal)

Set a modal widget to ignore hits.

Definition at line 157 of file dragdrop.cpp.

◆ setRenderConfig()

void fcn::DragHandler::setRenderConfig ( DragRenderConfig config)

Set how drag visuals are rendered.

Definition at line 147 of file dragdrop.cpp.

◆ update()

void fcn::DragHandler::update ( int mouseX,
int mouseY )

Update drag position.

Definition at line 70 of file dragdrop.cpp.

References fcn::Dragging, and fcn::Widget::getWidgetAt().


The documentation for this class was generated from the following files: