lib
eventslot.h
00001 /*************************************************************************** 00002 * eventslot.h 00003 * This file is part of the KDE project 00004 * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org) 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this program; see the file COPYING. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 ***************************************************************************/ 00019 00020 #ifndef KROSS_API_EVENTSLOT_H 00021 #define KROSS_API_EVENTSLOT_H 00022 00023 #include <qstring.h> 00024 #include <qobject.h> 00025 #include <ksharedptr.h> 00026 00027 #include "event.h" 00028 00029 namespace Kross { namespace Api { 00030 00036 class EventSlot : public Event<EventSlot> 00037 { 00038 public: 00039 00043 typedef KSharedPtr<EventSlot> Ptr; 00044 00055 EventSlot(const QString& name, QObject* receiver, QCString slot); 00056 00060 virtual ~EventSlot(); 00061 00063 virtual const QString getClassName() const; 00064 00066 virtual Object::Ptr call(const QString& name, KSharedPtr<List> arguments); 00067 00068 /* 00069 private: 00070 EventManager* m_eventmanager; 00071 QGuardedPtr<QObject> m_sender; 00072 QCString m_signal; 00073 QCString m_slot; 00074 QString m_function; 00075 QValueList<EventSlot*> m_slots; 00076 protected: 00077 void call(const QVariant&); 00078 public slots: 00079 // Stupid signals and slots. To get the passed 00080 // arguments we need to have all cases of slots 00081 // avaiable for EventManager::connect() signals. 00082 void callback(); 00083 void callback(short); 00084 void callback(int); 00085 void callback(int, int); 00086 void callback(int, int, int); 00087 void callback(int, int, int, int); 00088 void callback(int, int, int, int, int); 00089 void callback(int, int, int, int, bool); 00090 void callback(int, bool); 00091 void callback(int, int, bool); 00092 void callback(int, int, const QString&); 00093 void callback(uint); 00094 void callback(long); 00095 void callback(ulong); 00096 void callback(double); 00097 void callback(const char*); 00098 void callback(bool); 00099 void callback(const QString&); 00100 void callback(const QString&, int); 00101 void callback(const QString&, int, int); 00102 void callback(const QString&, uint); 00103 void callback(const QString&, bool); 00104 void callback(const QString&, bool, bool); 00105 void callback(const QString&, bool, int); 00106 void callback(const QString&, const QString&); 00107 void callback(const QString&, const QString&, const QString&); 00108 void callback(const QStringList&); 00109 void callback(const QVariant&); 00110 // The following both slots are more generic to 00111 // handle Kross::Api::Object instances. 00112 //void callback(Kross::Api::Object*); 00113 //void callback(Kross::Api::List*); 00114 */ 00115 private: 00116 QObject* m_receiver; 00117 QCString m_slot; 00118 }; 00119 00120 }} 00121 00122 #endif 00123