JX Application Framework
|
#include <JXSelectionData.h>
Public Member Functions | |
JXSelectionData (JXDisplay *display) | |
JXSelectionData (JXWidget *widget, const JUtf8Byte *id) | |
~JXSelectionData () override | |
JXDisplay * | GetDisplay () const |
JXSelectionManager * | GetSelectionManager () const |
JXDNDManager * | GetDNDManager () 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 |
![]() | |
JBroadcaster () | |
virtual | ~JBroadcaster () |
JBroadcaster & | operator= (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 |
![]() | |
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) |
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.
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.
|
override |
|
inlineprotected |
Add the target to the list if it is not already included.
|
protected |
Create the atom and add it to the list.
|
protectedpure virtual |
Implemented in JXDockDragData, JXDSSSelection, JXFileSelection, JXImageSelection, JXSearchSelection, and JXTextSelection.
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.
|
protectedpure virtual |
Implemented in JXDockDragData, JXDSSSelection, JXFileSelection, JXImageSelection, JXSearchSelection, and JXTextSelection.
|
inline |
JXDNDManager * JXSelectionData::GetDNDManager | ( | ) | const |
Atom JXSelectionData::GetDNDSelectionName | ( | ) | const |
|
inline |
JXSelectionManager * JXSelectionData::GetSelectionManager | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
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.
|
protected |
Remove the type from the list.
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.
|
inline |
void JXSelectionData::SetSelectionInfo | ( | const Atom | selectionName, |
const Time | startTime | ||
) |