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

#include <dragdrop.hpp>

Public Types

using RenderCallback = std::function<void(Graphics&, DragPoint const & screenPos)>

Public Member Functions

 DragPayload (std::shared_ptr< void > data=nullptr)
template<typename T>
T * get () const
RenderCallback getGhostRenderer () const
template<typename T>
std::shared_ptr< T > getShared () const
std::string const & getTooltip () const
bool hasData () const
void setData (std::shared_ptr< void > data)
void setGhostRenderer (RenderCallback cb)
void setTooltip (std::string tip)

Detailed Description

Container for arbitrary data carried during a drag operation.

Users can attach arbitrary shared data and optionally provide a ghost renderer and tooltip for visual feedback during drag.

Definition at line 82 of file dragdrop.hpp.

Member Typedef Documentation

◆ RenderCallback

using fcn::DragPayload::RenderCallback = std::function<void(Graphics&, DragPoint const & screenPos)>

Callback used to render a ghost image at a screen position.

Definition at line 88 of file dragdrop.hpp.

Constructor & Destructor Documentation

◆ DragPayload()

fcn::DragPayload::DragPayload ( std::shared_ptr< void > data = nullptr)
explicit

Construct a payload.

Definition at line 24 of file dragdrop.cpp.

Member Function Documentation

◆ get()

template<typename T>
T * fcn::DragPayload::get ( ) const
inline

Get raw pointer to stored data.

Definition at line 108 of file dragdrop.hpp.

Referenced by fcn::DragHandler::getPayload().

◆ getGhostRenderer()

RenderCallback fcn::DragPayload::getGhostRenderer ( ) const
inline

Get the ghost renderer callback.

Definition at line 138 of file dragdrop.hpp.

◆ getShared()

template<typename T>
std::shared_ptr< T > fcn::DragPayload::getShared ( ) const
inline

Get shared pointer to stored data.

Definition at line 99 of file dragdrop.hpp.

◆ getTooltip()

std::string const & fcn::DragPayload::getTooltip ( ) const
inline

Get the tooltip text.

Definition at line 153 of file dragdrop.hpp.

◆ hasData()

bool fcn::DragPayload::hasData ( ) const
inline

True if payload stores data.

Definition at line 123 of file dragdrop.hpp.

◆ setData()

void fcn::DragPayload::setData ( std::shared_ptr< void > data)
inline

Set the stored data.

Definition at line 116 of file dragdrop.hpp.

◆ setGhostRenderer()

void fcn::DragPayload::setGhostRenderer ( RenderCallback cb)
inline

Set the ghost renderer callback.

Definition at line 131 of file dragdrop.hpp.

◆ setTooltip()

void fcn::DragPayload::setTooltip ( std::string tip)
inline

Set tooltip text for the payload.

Definition at line 146 of file dragdrop.hpp.


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