kdecore Library API Documentation

kmanagerselection.h

00001 /**************************************************************************** 00002 00003 $Id: kmanagerselection.h,v 1.9 2004/01/21 10:06:52 lunakl 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 #ifdef Q_WS_X11 // FIXME(E) 00032 00033 #include <X11/Xlib.h> 00034 00035 class KSelectionOwnerPrivate; 00036 00046 class KSelectionOwner 00047 : public QObject 00048 { 00049 Q_OBJECT 00050 public: 00057 KSelectionOwner( Atom selection, int screen = -1, QObject* parent = NULL ); 00065 KSelectionOwner( const char* selection, int screen = -1, QObject* parent = NULL ); 00069 virtual ~KSelectionOwner(); 00080 bool claim( bool force, bool force_kill = true ); 00084 void release(); 00089 Window ownerWindow() const; // None if not owning the selection 00093 bool filterEvent( XEvent* ev_P ); // internal 00094 signals: 00101 void lostOwnership(); 00102 protected: 00107 virtual bool handleMessage( XEvent* ev ); 00117 virtual bool genericReply( Atom target, Atom property, Window requestor ); 00123 virtual void replyTargets( Atom property, Window requestor ); 00130 virtual void getAtoms(); 00136 void setData( long extra1, long extra2 ); 00137 private: 00138 void filter_selection_request( XSelectionRequestEvent& ev_P ); 00139 bool handle_selection( Atom target_P, Atom property_P, Window requestor_P ); 00140 const Atom selection; 00141 const int screen; 00142 Window window; 00143 Time timestamp; 00144 long extra1, extra2; 00145 static Atom manager_atom; 00146 static Atom xa_multiple; 00147 static Atom xa_targets; 00148 static Atom xa_timestamp; 00149 protected: 00150 virtual void virtual_hook( int id, void* data ); 00151 private: 00152 KSelectionOwnerPrivate* d; 00153 }; 00154 00155 class KSelectionWatcherPrivate; 00156 00165 class KSelectionWatcher 00166 : public QObject 00167 { 00168 Q_OBJECT 00169 public: 00176 KSelectionWatcher( Atom selection_P, int screen_P = -1, QObject* parent = NULL ); 00184 KSelectionWatcher( const char* selection_P, int screen_P = -1, QObject* parent = NULL ); 00185 virtual ~KSelectionWatcher(); 00189 Window owner(); 00193 void filterEvent( XEvent* ev_P ); // internal 00194 signals: 00200 void newOwner( Window owner ); 00207 void lostOwner(); 00208 private: 00209 void init(); 00210 const Atom selection; 00211 const int screen; 00212 Window selection_owner; 00213 static Atom manager_atom; 00214 protected: 00215 virtual void virtual_hook( int id, void* data ); 00216 private: 00217 KSelectionWatcherPrivate* d; 00218 }; 00219 00220 #endif 00221 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 17 11:26:08 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003