JX Application Framework
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
JXSelectionManager Class Reference

#include <JXSelectionManager.h>

Inheritance diagram for JXSelectionManager:
[legend]

Public Types

enum  DeleteMethod {
  kArrayDelete ,
  kXFree ,
  kCFree
}
 
enum  {
  kSelectionWindPropAtomIndex ,
  kIncrementalSendAtomIndex ,
  kTargetsAtomIndex ,
  kTimeStampAtomIndex ,
  kUtf8StringAtomIndex ,
  kMultipleAtomIndex ,
  kMimePlainTextAtomIndex ,
  kMimePlainTextUTF8AtomIndex ,
  kURLAtomIndex ,
  kDeleteSelectionAtomIndex ,
  kNULLAtomIndex ,
  kGnomeClipboardAtomIndex ,
  kAtomCount
}
 

Public Member Functions

 JXSelectionManager (JXDisplay *display)
 
 ~JXSelectionManager () override
 
bool GetAvailableTypes (const Atom selectionName, const Time time, JArray< Atom > *typeList)
 
bool GetData (const Atom selectionName, const Time time, const Atom requestType, Atom *returnType, unsigned char **data, JSize *dataLength, DeleteMethod *delMethod)
 
void DeleteData (unsigned char **data, const DeleteMethod delMethod)
 
void SendDeleteRequest (const Atom selectionName, const Time time)
 
bool OwnedSelection (const Atom selectionName, const Time time)
 
bool OwnsSelection (const Atom selectionName)
 
bool GetData (const Atom selectionName, const Time time, const JXSelectionData **data)
 
bool SetData (const Atom selectionName, JXSelectionData *data)
 
void ClearData (const Atom selectionName, const Time endTime)
 
JXDisplayGetDisplay ()
 
Atom GetTargetsXAtom () const
 
Atom GetTimeStampXAtom () const
 
Atom GetUtf8StringXAtom () const
 
Atom GetMultipleXAtom () const
 
Atom GetMimePlainTextXAtom () const
 
Atom GetMimePlainTextUTF8XAtom () const
 
Atom GetURLXAtom () const
 
Atom GetDeleteSelectionXAtom () const
 
Atom GetNULLXAtom () const
 
void HandleSelectionRequest (const XSelectionRequestEvent &selReqEvent)
 
- 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

void ReceiveWithFeedback (JBroadcaster *sender, Message *message) 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 ReceiveGoingAway (JBroadcaster *sender)
 

Friends

class JXDNDManager
 

Detailed Description

Global object to interface with X Selection mechanism.

Nobody else seems to support MULTIPLE, so I see no reason to support
it here.  If we ever need to support it, here is the basic idea:

    Pass in filled JArray<Atom>* and empty JArray<char*>*
    We remove the unconverted types from JArray<Atom> and
        fill in the JArray<char*> with the converted data

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kSelectionWindPropAtomIndex 
kIncrementalSendAtomIndex 
kTargetsAtomIndex 
kTimeStampAtomIndex 
kUtf8StringAtomIndex 
kMultipleAtomIndex 
kMimePlainTextAtomIndex 
kMimePlainTextUTF8AtomIndex 
kURLAtomIndex 
kDeleteSelectionAtomIndex 
kNULLAtomIndex 
kGnomeClipboardAtomIndex 
kAtomCount 

◆ DeleteMethod

Enumerator
kArrayDelete 
kXFree 
kCFree 

Constructor & Destructor Documentation

◆ JXSelectionManager()

JXSelectionManager::JXSelectionManager ( JXDisplay display)

◆ ~JXSelectionManager()

JXSelectionManager::~JXSelectionManager ( )
override

Member Function Documentation

◆ ClearData()

void JXSelectionManager::ClearData ( const Atom  selectionName,
const Time  endTime 
)

time can be CurrentTime.

We have to pass endTime to GetData() because sometimes we have to rewrite the history book: We called SetData() while we thought we owned the selection, but there was a SelectionClear event on its way, which means that, in reality, we lost ownership for a short while.

◆ DeleteData()

void JXSelectionManager::DeleteData ( unsigned char **  data,
const DeleteMethod  delMethod 
)

This must be called with all data returned by GetData(). The DeleteMethod must be the method returned by GetData().

◆ GetAvailableTypes()

bool JXSelectionManager::GetAvailableTypes ( const Atom  selectionName,
const Time  time,
JArray< Atom > *  typeList 
)

time can be CurrentTime.

◆ GetData() [1/2]

bool JXSelectionManager::GetData ( const Atom  selectionName,
const Time  time,
const Atom  requestType,
Atom *  returnType,
unsigned char **  data,
JSize dataLength,
DeleteMethod delMethod 
)

time can be CurrentTime.

Caller is responsible for calling DeleteData() on the data
that is returned.

◆ GetData() [2/2]

bool JXSelectionManager::GetData ( const Atom  selectionName,
const Time  time,
const JXSelectionData **  data 
)

time can be CurrentTime.

In the private version, if index != nullptr, it contains the index into itsDataList.

◆ GetDeleteSelectionXAtom()

Atom JXSelectionManager::GetDeleteSelectionXAtom ( ) const
inline

◆ GetDisplay()

JXDisplay * JXSelectionManager::GetDisplay ( )
inline

◆ GetMimePlainTextUTF8XAtom()

Atom JXSelectionManager::GetMimePlainTextUTF8XAtom ( ) const
inline

◆ GetMimePlainTextXAtom()

Atom JXSelectionManager::GetMimePlainTextXAtom ( ) const
inline

◆ GetMultipleXAtom()

Atom JXSelectionManager::GetMultipleXAtom ( ) const
inline

◆ GetNULLXAtom()

Atom JXSelectionManager::GetNULLXAtom ( ) const
inline

◆ GetTargetsXAtom()

Atom JXSelectionManager::GetTargetsXAtom ( ) const
inline

◆ GetTimeStampXAtom()

Atom JXSelectionManager::GetTimeStampXAtom ( ) const
inline

◆ GetURLXAtom()

Atom JXSelectionManager::GetURLXAtom ( ) const
inline

◆ GetUtf8StringXAtom()

Atom JXSelectionManager::GetUtf8StringXAtom ( ) const
inline

◆ HandleSelectionRequest()

void JXSelectionManager::HandleSelectionRequest ( const XSelectionRequestEvent &  selReqEvent)

◆ OwnedSelection()

bool JXSelectionManager::OwnedSelection ( const Atom  selectionName,
const Time  time 
)
inline

◆ OwnsSelection()

bool JXSelectionManager::OwnsSelection ( const Atom  selectionName)
inline

◆ ReceiveWithFeedback()

void JXSelectionManager::ReceiveWithFeedback ( JBroadcaster sender,
Message message 
)
overrideprotectedvirtual

This catches errors while sending and receiving data.

Reimplemented from JBroadcaster.

◆ SendDeleteRequest()

void JXSelectionManager::SendDeleteRequest ( const Atom  selectionName,
const Time  time 
)

Implements the DELETE selection protocol.

window should be any one that X can attach the data to. Widgets can simply pass in the result from GetWindow().

time can be CurrentTime.

◆ SetData()

bool JXSelectionManager::SetData ( const Atom  selectionName,
JXSelectionData data 
)

Set the data for the given selection.

'data' must be allocated on the heap.
We take ownership of 'data' even if the function returns false.

Friends And Related Symbol Documentation

◆ JXDNDManager

friend class JXDNDManager
friend

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