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 <tqwidget.h> 00029 #include <tqcstring.h> 00030 #include <tqmap.h> 00031 #include <tdelibs_export.h> 00032 00033 #ifdef Q_MOC_RUN 00034 #define Q_WS_X11 00035 #endif // Q_MOC_RUN 00036 00037 #ifdef Q_WS_X11 00038 #include <X11/X.h> 00039 00040 class TQString; 00041 00042 class KXMessagesPrivate; 00051 // KDE4 - make this internal for TDEStartupInfo only? 00052 class TDECORE_EXPORT KXMessages 00053 : public TQWidget 00054 { 00055 Q_OBJECT 00056 public: 00066 KXMessages( const char* accept_broadcast, TQWidget* parent, bool obsolete ); 00071 KXMessages( const char* accept_broadcast = NULL, TQWidget* parent = NULL ); 00072 00073 virtual ~KXMessages(); 00084 void sendMessage( WId w, const char* msg_type, const TQString& message, 00085 bool obsolete ); 00090 void sendMessage( WId w, const char* msg_type, const TQString& message ); 00099 void broadcastMessage( const char* msg_type, const TQString& message, 00100 int screen, bool obsolete ); 00105 void broadcastMessage( const char* msg_type, const TQString& message ); 00106 00120 static bool sendMessageX( Display* disp, WId w, const char* msg_type, 00121 const TQString& message, bool obsolete ); 00126 static bool sendMessageX( Display* disp, WId w, const char* msg_type, 00127 const TQString& message ); 00128 00141 static bool broadcastMessageX( Display* disp, const char* msg_type, 00142 const TQString& message, int screen, bool obsolete ); 00147 static bool broadcastMessageX( Display* disp, const char* msg_type, 00148 const TQString& message ); 00149 signals: 00154 void gotMessage( const TQString& message ); 00155 protected: 00159 virtual bool x11Event( XEvent* ev ); 00160 private: 00161 static void send_message_internal( WId w_P, const TQString& msg_P, long mask_P, 00162 Display* disp, Atom atom1_P, Atom atom2_P, Window handle_P ); 00163 TQWidget* handle; 00164 Atom accept_atom2; 00165 TQCString cached_atom_name_; // KDE4 unused 00166 Atom accept_atom1; 00167 TQMap< WId, TQCString > incoming_messages; 00168 KXMessagesPrivate* d; 00169 }; 00170 00171 #endif 00172 #endif