Nui
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Nui::WebApi::DataTransfer Class Reference

#include <data_transfer.hpp>

Inheritance diagram for Nui::WebApi::DataTransfer:
Inheritance graph
[legend]
Collaboration diagram for Nui::WebApi::DataTransfer:
Collaboration graph
[legend]

Public Types

enum class  DropEffect { None , Copy , Move , Link }
 
enum class  EffectAllowed {
  None , Copy , CopyLink , CopyMove ,
  Link , LinkMove , Move , All ,
  Uninitialized
}
 

Public Member Functions

 DataTransfer ()
 
 DataTransfer (Nui::val dataTransfer)
 
DropEffect dropEffect () const
 Gets the type of drag-and-drop operation currently selected or sets the operation to a new type.
 
EffectAllowed effectAllowed () const
 Provides all of the types of operations that are possible.
 
FileList files () const
 Contains a list of all the local files available on the data transfer.
 
DataTransferItemList items () const
 Gives a DataTransferItemList object which is a list of all of the drag data.
 
std::vector< std::string > types () const
 The DataTransfer.types read-only property returns the available types that exist in the items.
 
void clearData ()
 Remove the data associated with all types.
 
void clearData (std::string const &format)
 Remove the data associated with a given type.
 
std::string getData (std::string const &format) const
 The DataTransfer.getData() method retrieves drag data (as a string) for the specified type.
 
void setData (std::string const &format, std::string const &data) const
 The DataTransfer.setData() method sets the drag operation's drag data to the specified data and type.
 
void setDragImage (Nui::val imgElement, long xOffset, long yOffset) const
 When a drag occurs, a translucent image is generated from the drag target (the element the dragstart event is fired at), and follows the mouse pointer during the drag.
 
- Public Member Functions inherited from Nui::ValWrapper
 ValWrapper (Nui::val valObject)
 
virtual ~ValWrapper ()=default
 
 ValWrapper (ValWrapper const &)=default
 
 ValWrapper (ValWrapper &&) noexcept=default
 
ValWrapperoperator= (ValWrapper const &)=default
 
ValWrapperoperator= (ValWrapper &&) noexcept=default
 
Nui::val const & val () const &noexcept
 
Nui::val val () &&noexcept
 
 operator Nui::val const & () const &noexcept
 
 operator Nui::val () &&noexcept
 

Additional Inherited Members

- Protected Attributes inherited from Nui::ValWrapper
Nui::val val_
 

Detailed Description

See also
https://developer.mozilla.org/en-US/docs/Web/API/Event

Member Enumeration Documentation

◆ DropEffect

Enumerator
None 
Copy 
Move 
Link 

◆ EffectAllowed

Enumerator
None 
Copy 
CopyLink 
CopyMove 
Link 
LinkMove 
Move 
All 
Uninitialized 

Constructor & Destructor Documentation

◆ DataTransfer() [1/2]

Nui::WebApi::DataTransfer::DataTransfer ( )

◆ DataTransfer() [2/2]

Nui::WebApi::DataTransfer::DataTransfer ( Nui::val  dataTransfer)
explicit

Member Function Documentation

◆ clearData() [1/2]

void Nui::WebApi::DataTransfer::clearData ( )

Remove the data associated with all types.

◆ clearData() [2/2]

void Nui::WebApi::DataTransfer::clearData ( std::string const &  format)

Remove the data associated with a given type.

◆ dropEffect()

DataTransfer::DropEffect Nui::WebApi::DataTransfer::dropEffect ( ) const

Gets the type of drag-and-drop operation currently selected or sets the operation to a new type.

◆ effectAllowed()

DataTransfer::EffectAllowed Nui::WebApi::DataTransfer::effectAllowed ( ) const

Provides all of the types of operations that are possible.

◆ files()

FileList Nui::WebApi::DataTransfer::files ( ) const

Contains a list of all the local files available on the data transfer.

If the drag operation doesn't involve dragging files, this property is an empty list.

◆ getData()

std::string Nui::WebApi::DataTransfer::getData ( std::string const &  format) const

The DataTransfer.getData() method retrieves drag data (as a string) for the specified type.

If the drag operation does not include data, this method returns an empty string.

◆ items()

DataTransferItemList Nui::WebApi::DataTransfer::items ( ) const

Gives a DataTransferItemList object which is a list of all of the drag data.

◆ setData()

void Nui::WebApi::DataTransfer::setData ( std::string const &  format,
std::string const &  data 
) const

The DataTransfer.setData() method sets the drag operation's drag data to the specified data and type.

If data for the given type does not exist, it is added at the end of the drag data store, such that the last item in the types list will be the new type. If data for the given type already exists, the existing data is replaced in the same position. That is, the order of the types list is not changed when replacing data of the same type. Example data types are text/plain and text/uri-list.

◆ setDragImage()

void Nui::WebApi::DataTransfer::setDragImage ( Nui::val  imgElement,
long  xOffset,
long  yOffset 
) const

When a drag occurs, a translucent image is generated from the drag target (the element the dragstart event is fired at), and follows the mouse pointer during the drag.

This image is created automatically, so you do not need to create it yourself. However, if a custom image is desired, the DataTransfer.setDragImage() method can be used to set the custom image to be used. The image will typically be an element but it can also be a <canvas> or any other visible element.

◆ types()

std::vector< std::string > Nui::WebApi::DataTransfer::types ( ) const

The DataTransfer.types read-only property returns the available types that exist in the items.


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