kxmessages.h
00001 /**************************************************************************** 00002 00003 Copyright (C) 2001-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 __KXMESSAGES_H 00026 #define __KXMESSAGES_H 00027 00028 #include <qwidget.h> 00029 #include <qcstring.h> 00030 #include <qmap.h> 00031 #include <kdelibs_export.h> 00032 #ifdef Q_WS_X11 00033 #include <X11/X.h> 00034 00035 class QString; 00036 00037 class KXMessagesPrivate; 00046 // KDE4 - make this internal for KStartupInfo only? 00047 class KDECORE_EXPORT KXMessages 00048 : public QWidget 00049 { 00050 Q_OBJECT 00051 public: 00061 KXMessages( const char* accept_broadcast, QWidget* parent, bool obsolete ); 00066 KXMessages( const char* accept_broadcast = NULL, QWidget* parent = NULL ); 00067 00068 virtual ~KXMessages(); 00079 void sendMessage( WId w, const char* msg_type, const QString& message, 00080 bool obsolete ); 00085 void sendMessage( WId w, const char* msg_type, const QString& message ); 00094 void broadcastMessage( const char* msg_type, const QString& message, 00095 int screen, bool obsolete ); 00100 void broadcastMessage( const char* msg_type, const QString& message ); 00101 00115 static bool sendMessageX( Display* disp, WId w, const char* msg_type, 00116 const QString& message, bool obsolete ); 00121 static bool sendMessageX( Display* disp, WId w, const char* msg_type, 00122 const QString& message ); 00123 00136 static bool broadcastMessageX( Display* disp, const char* msg_type, 00137 const QString& message, int screen, bool obsolete ); 00142 static bool broadcastMessageX( Display* disp, const char* msg_type, 00143 const QString& message ); 00144 signals: 00149 void gotMessage( const QString& message ); 00150 protected: 00154 virtual bool x11Event( XEvent* ev ); 00155 private: 00156 static void send_message_internal( WId w_P, const QString& msg_P, long mask_P, 00157 Display* disp, Atom atom1_P, Atom atom2_P, Window handle_P ); 00158 QWidget* handle; 00159 Atom accept_atom2; 00160 QCString cached_atom_name_; // KDE4 unused 00161 Atom accept_atom1; 00162 QMap< WId, QCString > incoming_messages; 00163 KXMessagesPrivate* d; 00164 }; 00165 00166 #endif 00167 #endif