Status & Roadmap
Authors & License
Funding U++
Search on this site

SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo



struct ClipData : public Moveable<ClipData


This structure represents single datatype assigned to clip operation (clipboard or drag&drop). The final data transfered via clip has always to be binary string, but as usually application provides multiple formats (e.g. it can provide .png, .jpg and .gif form Image) and conversion of source to final format can be expensive, ClipData allows to store the source data in original format accompanied with 'rendering' function used to convert it to final format.


Public Members


Value data

Source data.



String (*render)(const Value& data)

Function to convert source data to binary string.



String Render() const

Equivalent to (*render)(data).


Constructor detail


ClipData(const Value& data, String (*render)(const Value& data))

Assigns data and render to respective member variables.



ClipData(const String& data)

Assigns data.to data and trivial "string to string" (no conversion) rendering function to render.




Assigns trivial "string to string" (no conversion) rendering function to render.






class PasteClip

This class represents data source and operation status in clipboard or drag and drop operations (and also in X11 selection operations).



Public Member List


bool IsAvailable(const char *fmtconst

Returns true when data source offers data in format fmt.



String Get(const char *fmtconst

Returns binary data rendered in fmt.



bool Accept()

Sets the status of operation to accepted (target accepts data) and returns true when source should paste the source data into target - during drag&drop operation, it returns false during 'drag' phase to alter appearance of mouse cursor (it should show 'stop' sign when drop is not possible) and 'true' to indicate drop operation.



bool Accept(const char *fmt)

Parameter fmt contains a list of format identifiers separated by semicolon. If any of them is available in the PasteClip, it is set to accepted status and accepted format is stored in PasteClip (to be retrieved by GetFormat method later). If PasteClip is in paste mode, method stores source data rendered in accepted format and returns true. Note that Accept can return false even if format is accepted - this happens in 'drag' stage of drag&drop operation to indicate that target is willing to accept the data.



String GetFormat()

Returns a format accepted by the last Accept(fmt) method returning true.



String Get() const

Returns data rendered by the last Accept(fmt) method returning true.



operator String() const

Same as Get().



String operator ~() const

Same as Get().



void Reject()

Sets PasteClip to rejected status. This can be called after setting it to accepted status to revert the decision. Usually this is used when decision has to take into account the content of actual data to be pasted - in that case data is Accepted first, then after examination of data content, it can be rejected.



int GetAction() const

Gets the proposed action of drag&drop operation (one of DND_COPY, DND_MOVE).



int GetAllowedActions() const

Returns the bitmask of allowed operations of drag&drop operation (DND_COPY, DND_MOVE).



void SetAction(int x)

Changes drop operation to x. This is used when proposed operation is no suitable for particular drop target.



bool IsAccepted() const

Returns true if status is accepted.



bool IsQuery() const

Returns true if PasteClip represents drag phase (no pasting, Accept returns false).



bool IsPaste() const

Returns true if PasteClip represents drop/paste phase (Accept returns true).




Default constructor.



Do you want to contribute?