tdecore
kmanagerselection.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __KMANAGERSELECTION_H
00026 #define __KMANAGERSELECTION_H
00027
00028 #include <tqobject.h>
00029 #include <tdelibs_export.h>
00030
00031 #ifdef Q_MOC_RUN
00032 #define Q_WS_X11
00033 #endif // Q_MOC_RUN
00034
00035 #ifdef Q_WS_X11 // FIXME(E)
00036
00037 #include <X11/Xlib.h>
00038
00039 class TDESelectionOwnerPrivate;
00040
00050 class TDECORE_EXPORT TDESelectionOwner
00051 : public TQObject
00052 {
00053 Q_OBJECT
00054 public:
00063 TDESelectionOwner( Atom selection, int screen = -1, TQObject* parent = NULL );
00073 TDESelectionOwner( const char* selection, int screen = -1, TQObject* parent = NULL );
00077 virtual ~TDESelectionOwner();
00088 bool claim( bool force, bool force_kill = true );
00092 void release();
00097 Window ownerWindow() const;
00101 bool filterEvent( XEvent* ev_P );
00102 signals:
00109 void lostOwnership();
00110 protected:
00115 virtual bool handleMessage( XEvent* ev );
00125 virtual bool genericReply( Atom target, Atom property, Window requestor );
00131 virtual void replyTargets( Atom property, Window requestor );
00138 virtual void getAtoms();
00144 void setData( long extra1, long extra2 );
00145 private:
00146 void filter_selection_request( XSelectionRequestEvent& ev_P );
00147 bool handle_selection( Atom target_P, Atom property_P, Window requestor_P );
00148 const Atom selection;
00149 const int screen;
00150 Window window;
00151 Time timestamp;
00152 long extra1, extra2;
00153 static Atom manager_atom;
00154 static Atom xa_multiple;
00155 static Atom xa_targets;
00156 static Atom xa_timestamp;
00157 protected:
00158 virtual void virtual_hook( int id, void* data );
00159 private:
00160 TDESelectionOwnerPrivate* d;
00161 };
00162
00163 class TDESelectionWatcherPrivate;
00164
00173 class TDECORE_EXPORT TDESelectionWatcher
00174 : public TQObject
00175 {
00176 Q_OBJECT
00177 public:
00186 TDESelectionWatcher( Atom selection, int screen = -1, TQObject* parent = NULL );
00196 TDESelectionWatcher( const char* selection, int screen = -1, TQObject* parent = NULL );
00197 virtual ~TDESelectionWatcher();
00201 Window owner();
00205 void filterEvent( XEvent* ev_P );
00206 signals:
00212 void newOwner( Window owner );
00219 void lostOwner();
00220 private:
00221 void init();
00222 const Atom selection;
00223 const int screen;
00224 Window selection_owner;
00225 static Atom manager_atom;
00226 protected:
00227 virtual void virtual_hook( int id, void* data );
00228 private:
00229 TDESelectionWatcherPrivate* d;
00230 };
00231
00232 #endif
00233 #endif