KDEUI
kmanagerselection.h
Go to the documentation of this file.
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 <kdeui_export.h> 00029 #include <QtCore/QObject> 00030 00031 #ifdef Q_WS_X11 // FIXME(E) 00032 00033 #include <X11/Xlib.h> 00034 #include <fixx11h.h> 00035 00036 00045 class KDEUI_EXPORT KSelectionOwner 00046 : public QObject 00047 { 00048 Q_OBJECT 00049 public: 00058 explicit KSelectionOwner( Atom selection, int screen = -1, QObject* parent = NULL ); 00068 explicit KSelectionOwner( const char* selection, int screen = -1, QObject* parent = NULL ); 00072 virtual ~KSelectionOwner(); 00083 bool claim( bool force, bool force_kill = true ); 00087 void release(); 00092 Window ownerWindow() const; // None if not owning the selection 00096 bool filterEvent( XEvent* ev_P ); // internal 00097 Q_SIGNALS: 00104 void lostOwnership(); 00105 protected: 00110 virtual bool handleMessage( XEvent* ev ); 00120 virtual bool genericReply( Atom target, Atom property, Window requestor ); 00126 virtual void replyTargets( Atom property, Window requestor ); 00133 virtual void getAtoms(); 00139 void setData( long extra1, long extra2 ); 00140 private: 00141 void filter_selection_request( XSelectionRequestEvent& ev_P ); 00142 bool handle_selection( Atom target_P, Atom property_P, Window requestor_P ); 00143 00144 class Private; 00145 Private* const d; 00146 }; 00147 00155 class KDEUI_EXPORT KSelectionWatcher 00156 : public QObject 00157 { 00158 Q_OBJECT 00159 public: 00168 explicit KSelectionWatcher( Atom selection, int screen = -1, QObject* parent = NULL ); 00178 explicit KSelectionWatcher( const char* selection, int screen = -1, QObject* parent = NULL ); 00179 virtual ~KSelectionWatcher(); 00185 Window owner(); 00189 void filterEvent( XEvent* ev_P ); // internal 00190 Q_SIGNALS: 00196 void newOwner( Window owner ); 00203 void lostOwner(); 00204 private: 00205 void init(); 00206 00207 class Private; 00208 Private* const d; 00209 }; 00210 00211 #endif 00212 #endif
KDE 4.6 API Reference