kdecore Library API Documentation

kmanagerselection.h

00001 /**************************************************************************** 00002 00003 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> 00004 00005 Permission is hereby granted, free of charge, to any person obtaining a 00006 copy of this software and associated documentation files (the "Software"), 00007 to deal in the Software without restriction, including without limitation 00008 the rights to use, copy, modify, merge, publish, distribute, sublicense, 00009 and/or sell copies of the Software, and to permit persons to whom the 00010 Software is furnished to do so, subject to the following conditions: 00011 00012 The above copyright notice and this permission notice shall be included in 00013 all copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00018 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00020 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00021 DEALINGS IN THE SOFTWARE. 00022 00023 ****************************************************************************/ 00024 00025 #ifndef __KMANAGERSELECTION_H 00026 #define __KMANAGERSELECTION_H 00027 00028 #include <qobject.h> 00029 #include <kdelibs_export.h> 00030 00031 #ifdef Q_WS_X11 // FIXME(E) 00032 00033 #include <X11/Xlib.h> 00034 00035 class KSelectionOwnerPrivate; 00036 00046 class KDECORE_EXPORT KSelectionOwner 00047 : public QObject 00048 { 00049 Q_OBJECT 00050 public: 00059 KSelectionOwner( Atom selection, int screen = -1, QObject* parent = NULL ); 00069 KSelectionOwner( const char* selection, int screen = -1, QObject* parent = NULL ); 00073 virtual ~KSelectionOwner(); 00084 bool claim( bool force, bool force_kill = true ); 00088 void release(); 00093 Window ownerWindow() const; // None if not owning the selection 00097 bool filterEvent( XEvent* ev_P ); // internal 00098 signals: 00105 void lostOwnership(); 00106 protected: 00111 virtual bool handleMessage( XEvent* ev ); 00121 virtual bool genericReply( Atom target, Atom property, Window requestor ); 00127 virtual void replyTargets( Atom property, Window requestor ); 00134 virtual void getAtoms(); 00140 void setData( long extra1, long extra2 ); 00141 private: 00142 void filter_selection_request( XSelectionRequestEvent& ev_P ); 00143 bool handle_selection( Atom target_P, Atom property_P, Window requestor_P ); 00144 const Atom selection; 00145 const int screen; 00146 Window window; 00147 Time timestamp; 00148 long extra1, extra2; 00149 static Atom manager_atom; 00150 static Atom xa_multiple; 00151 static Atom xa_targets; 00152 static Atom xa_timestamp; 00153 protected: 00154 virtual void virtual_hook( int id, void* data ); 00155 private: 00156 KSelectionOwnerPrivate* d; 00157 }; 00158 00159 class KSelectionWatcherPrivate; 00160 00169 class KDECORE_EXPORT KSelectionWatcher 00170 : public QObject 00171 { 00172 Q_OBJECT 00173 public: 00182 KSelectionWatcher( Atom selection, int screen = -1, QObject* parent = NULL ); 00192 KSelectionWatcher( const char* selection, int screen = -1, QObject* parent = NULL ); 00193 virtual ~KSelectionWatcher(); 00197 Window owner(); 00201 void filterEvent( XEvent* ev_P ); // internal 00202 signals: 00208 void newOwner( Window owner ); 00215 void lostOwner(); 00216 private: 00217 void init(); 00218 const Atom selection; 00219 const int screen; 00220 Window selection_owner; 00221 static Atom manager_atom; 00222 protected: 00223 virtual void virtual_hook( int id, void* data ); 00224 private: 00225 KSelectionWatcherPrivate* d; 00226 }; 00227 00228 #endif 00229 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:03:30 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003