kdecore Library API Documentation

kmanagerselection.h

00001 /****************************************************************************
00002 
00003  $Id: kmanagerselection.h,v 1.12 2004/12/04 06:08:53 bhards Exp $
00004 
00005  Copyright (C) 2003 Lubos Lunak        <l.lunak@kde.org>
00006 
00007 Permission is hereby granted, free of charge, to any person obtaining a
00008 copy of this software and associated documentation files (the "Software"),
00009 to deal in the Software without restriction, including without limitation
00010 the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011 and/or sell copies of the Software, and to permit persons to whom the
00012 Software is furnished to do so, subject to the following conditions:
00013 
00014 The above copyright notice and this permission notice shall be included in
00015 all copies or substantial portions of the Software.
00016 
00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00021 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00022 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00023 DEALINGS IN THE SOFTWARE.
00024 
00025 ****************************************************************************/
00026 
00027 #ifndef __KMANAGERSELECTION_H
00028 #define __KMANAGERSELECTION_H
00029 
00030 #include <qobject.h>
00031 #include <kdelibs_export.h>
00032 
00033 #ifdef Q_WS_X11 // FIXME(E)
00034 
00035 #include <X11/Xlib.h>
00036 
00037 class KSelectionOwnerPrivate;
00038 
00048 class KDECORE_EXPORT KSelectionOwner
00049     : public QObject
00050     {
00051     Q_OBJECT
00052     public:
00059         KSelectionOwner( Atom selection, int screen = -1, QObject* parent = NULL );
00067         KSelectionOwner( const char* selection, int screen = -1, QObject* parent = NULL );
00071     virtual ~KSelectionOwner();
00082         bool claim( bool force, bool force_kill = true );
00086         void release();
00091         Window ownerWindow() const; // None if not owning the selection
00095     bool filterEvent( XEvent* ev_P ); // internal
00096     signals:
00103         void lostOwnership();
00104     protected:
00109         virtual bool handleMessage( XEvent* ev );
00119         virtual bool genericReply( Atom target, Atom property, Window requestor );
00125         virtual void replyTargets( Atom property, Window requestor );
00132         virtual void getAtoms();
00138         void setData( long extra1, long extra2 );
00139     private:
00140         void filter_selection_request( XSelectionRequestEvent& ev_P );
00141         bool handle_selection( Atom target_P, Atom property_P, Window requestor_P );
00142         const Atom selection;
00143         const int screen;
00144         Window window;
00145         Time timestamp;
00146         long extra1, extra2;
00147         static Atom manager_atom;
00148         static Atom xa_multiple;
00149         static Atom xa_targets;
00150         static Atom xa_timestamp;
00151     protected:
00152         virtual void virtual_hook( int id, void* data );
00153     private:
00154         KSelectionOwnerPrivate* d;
00155     };
00156 
00157 class KSelectionWatcherPrivate;
00158 
00167 class KDECORE_EXPORT KSelectionWatcher
00168     : public QObject
00169     {
00170     Q_OBJECT
00171     public:
00178         KSelectionWatcher( Atom selection_P, int screen_P = -1, QObject* parent = NULL );
00186         KSelectionWatcher( const char* selection_P, int screen_P = -1, QObject* parent = NULL );
00187     virtual ~KSelectionWatcher();
00191         Window owner();
00195         void filterEvent( XEvent* ev_P ); // internal
00196     signals:
00202         void newOwner( Window owner );
00209         void lostOwner();
00210     private:
00211         void init();
00212         const Atom selection;
00213         const int screen;
00214         Window selection_owner;
00215         static Atom manager_atom;
00216     protected:
00217         virtual void virtual_hook( int id, void* data );
00218     private:
00219         KSelectionWatcherPrivate* d;
00220     };
00221 
00222 #endif
00223 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 30 10:09:39 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003