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 00057 EventSlot(const QString& name, Object::Ptr parent, QObject* receiver, QCString slot); 00058 00062 virtual ~EventSlot(); 00063 00065 virtual const QString getClassName() const; 00066 00068 virtual Object::Ptr call(const QString& name, KSharedPtr<List> arguments); 00069 00070 /* 00071 private: 00072 EventManager* m_eventmanager; 00073 QGuardedPtr<QObject> m_sender; 00074 QCString m_signal; 00075 QCString m_slot; 00076 QString m_function; 00077 QValueList<EventSlot*> m_slots; 00078 protected: 00079 void call(const QVariant&); 00080 public slots: 00081 // Stupid signals and slots. To get the passed 00082 // arguments we need to have all cases of slots 00083 // avaiable for EventManager::connect() signals. 00084 void callback(); 00085 void callback(short); 00086 void callback(int); 00087 void callback(int, int); 00088 void callback(int, int, int); 00089 void callback(int, int, int, int); 00090 void callback(int, int, int, int, int); 00091 void callback(int, int, int, int, bool); 00092 void callback(int, bool); 00093 void callback(int, int, bool); 00094 void callback(int, int, const QString&); 00095 void callback(uint); 00096 void callback(long); 00097 void callback(ulong); 00098 void callback(double); 00099 void callback(const char*); 00100 void callback(bool); 00101 void callback(const QString&); 00102 void callback(const QString&, int); 00103 void callback(const QString&, int, int); 00104 void callback(const QString&, uint); 00105 void callback(const QString&, bool); 00106 void callback(const QString&, bool, bool); 00107 void callback(const QString&, bool, int); 00108 void callback(const QString&, const QString&); 00109 void callback(const QString&, const QString&, const QString&); 00110 void callback(const QStringList&); 00111 void callback(const QVariant&); 00112 // The following both slots are more generic to 00113 // handle Kross::Api::Object instances. 00114 //void callback(Kross::Api::Object*); 00115 //void callback(Kross::Api::List*); 00116 */ 00117 private: 00118 QObject* m_receiver; 00119 QCString m_slot; 00120 }; 00121 00122 }} 00123 00124 #endif 00125