JX Application Framework
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
JXSelectionData Class Referenceabstract

#include <JXSelectionData.h>

Inheritance diagram for JXSelectionData:
[legend]

Public Member Functions

 JXSelectionData (JXDisplay *display)
 
 JXSelectionData (JXWidget *widget, const JUtf8Byte *id)
 
 ~JXSelectionData () override
 
JXDisplayGetDisplay () const
 
JXSelectionManagerGetSelectionManager () const
 
JXDNDManagerGetDNDManager () const
 
Atom GetDNDSelectionName () const
 
Atom GetSelectionName () const
 
Time GetStartTime () const
 
bool IsCurrent () const
 
bool GetEndTime (Time *t) const
 
void SetSelectionInfo (const Atom selectionName, const Time startTime)
 
void SetEndTime (const Time endTime)
 
const JArray< Atom > & GetTypeList () const
 
void Resolve () const
 
bool Convert (const Atom requestType, Atom *returnType, unsigned char **data, JSize *dataLength, JSize *bitsPerBlock) const
 
- Public Member Functions inherited from JBroadcaster
 JBroadcaster ()
 
virtual ~JBroadcaster ()
 
JBroadcasteroperator= (const JBroadcaster &source)
 
bool HasSenders () const
 
JSize GetSenderCount () const
 
bool HasRecipients () const
 
JSize GetRecipientCount () const
 
virtual JString ToString () const
 
template<class T >
void ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f)
 

Protected Member Functions

Atom AddType (const JUtf8Byte *name)
 
void AddType (const Atom type)
 
void RemoveType (const Atom type)
 
virtual void AddTypes (const Atom selectionName)=0
 
virtual bool ConvertData (const Atom requestType, Atom *returnType, unsigned char **data, JSize *dataLength, JSize *bitsPerBlock) const =0
 
void ReceiveGoingAway (JBroadcaster *sender) override
 
- Protected Member Functions inherited from JBroadcaster
 JBroadcaster (const JBroadcaster &source)
 
void ListenTo (const JBroadcaster *sender)
 
void StopListening (const JBroadcaster *sender)
 
void ClearWhenGoingAway (const JBroadcaster *sender, void *pointerToMember)
 
void StopListening (const JBroadcaster *sender, const std::type_info &messageType)
 
template<class T >
void Send (JBroadcaster *recipient, const T &message)
 
template<class T >
void Broadcast (const T &message)
 
virtual void Receive (JBroadcaster *sender, const Message &message)
 
void SendWithFeedback (JBroadcaster *recipient, Message *message)
 
void BroadcastWithFeedback (Message *message)
 
virtual void ReceiveWithFeedback (JBroadcaster *sender, Message *message)
 

Detailed Description

This defines the interface for all objects that encapsulate data
placed in an X selection.  Each object is restricted to work on a
single X display since the atom id's are different on each one.

Remember to always provide access to the data so derived classes
can extend your class by providing additional types.

Constructor & Destructor Documentation

◆ JXSelectionData() [1/2]

JXSelectionData::JXSelectionData ( JXDisplay display)

The second form is used for delayed evaluation. The id must be something unique to a particular class so each class in the inheritance line that implements GetSelectionData() can either do the work or pass it to its base class. In most cases, the class name is sufficient.

◆ JXSelectionData() [2/2]

JXSelectionData::JXSelectionData ( JXWidget widget,
const JUtf8Byte id 
)

◆ ~JXSelectionData()

JXSelectionData::~JXSelectionData ( )
override

Member Function Documentation

◆ AddType() [1/2]

void JXSelectionData::AddType ( const Atom  type)
inlineprotected

Add the target to the list if it is not already included.

◆ AddType() [2/2]

Atom JXSelectionData::AddType ( const JUtf8Byte name)
protected

Create the atom and add it to the list.

◆ AddTypes()

virtual void JXSelectionData::AddTypes ( const Atom  selectionName)
protectedpure virtual

◆ Convert()

bool JXSelectionData::Convert ( const Atom  requestType,
Atom *  returnType,
unsigned char **  data,
JSize dataLength,
JSize bitsPerBlock 
) const

Handles certain types and passes everything else off to ConvertData().

When adding special types to this function, remember to update SetSelectionInfo() to add the jnew types.

◆ ConvertData()

virtual bool JXSelectionData::ConvertData ( const Atom  requestType,
Atom *  returnType,
unsigned char **  data,
JSize dataLength,
JSize bitsPerBlock 
) const
protectedpure virtual

◆ GetDisplay()

JXDisplay * JXSelectionData::GetDisplay ( ) const
inline

◆ GetDNDManager()

JXDNDManager * JXSelectionData::GetDNDManager ( ) const

◆ GetDNDSelectionName()

Atom JXSelectionData::GetDNDSelectionName ( ) const

◆ GetEndTime()

bool JXSelectionData::GetEndTime ( Time *  t) const
inline

◆ GetSelectionManager()

JXSelectionManager * JXSelectionData::GetSelectionManager ( ) const

◆ GetSelectionName()

Atom JXSelectionData::GetSelectionName ( ) const
inline

◆ GetStartTime()

Time JXSelectionData::GetStartTime ( ) const
inline

◆ GetTypeList()

const JArray< Atom > & JXSelectionData::GetTypeList ( ) const
inline

◆ IsCurrent()

bool JXSelectionData::IsCurrent ( ) const
inline

◆ ReceiveGoingAway()

void JXSelectionData::ReceiveGoingAway ( JBroadcaster sender)
overrideprotectedvirtual

Call AddType() for whatever types are appropriate for the given selection. Derived class must convert data to the specified type and return true, or return false if the conversion cannot be accomplished.

returnType must be actual data type. For example, when "TEXT" is requested, one often returns XA_STRING.

data must be allocated with "new unsigned char[]" and will be deleted by the caller. *dataLength must be set to the length of *data.

bitsPerBlock must be set to the number of bits per element of data. e.g. If data is text, *bitsPerBlock=8. If data is an int, *bitsPerBlock=sizeof(int)*8

Since X performs byte swapping when *bitsPerBlock > 8, mixed data should be packed one byte at a time to ensure that it can be correctly decoded. The given sender has been deleted.

Reimplemented from JBroadcaster.

◆ RemoveType()

void JXSelectionData::RemoveType ( const Atom  type)
protected

Remove the type from the list.

◆ Resolve()

void JXSelectionData::Resolve ( ) const

Asks its data source to set the data. This is required for DND where the data should not be converted until it is needed, allowing the mouse drag to begin immediately.

This cannot be called by JXSelectionManager because it doesn't know how the data is being used.

◆ SetEndTime()

void JXSelectionData::SetEndTime ( const Time  endTime)
inline

◆ SetSelectionInfo()

void JXSelectionData::SetSelectionInfo ( const Atom  selectionName,
const Time  startTime 
)

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