kexi

kexievents.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  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 KFORMDESIGNEREVENTS_H
00021 #define KFORMDESIGNEREVENTS_H
00022 
00023 #include <qvaluelist.h>
00024 #include <qguardedptr.h>
00025 
00026 class QDomNode;
00027 class QObject;
00028 
00030 
00038 class KEXICORE_EXPORT Event
00039 {
00040     public:
00041         Event(QObject *sender, const QCString &signal,
00042             QObject *receiver, const QCString &slot);
00043         Event(QObject *sender, const QCString &signal,
00044             const QCString &functionName);
00045         Event() : m_type(Slot) {;}
00046         ~Event() {;}
00047 
00048         enum { Slot=1000, UserFunction, Action }; 
00049         int  type() {return  m_type; }
00050         void  setType(int type) { m_type = type; }
00051 
00052         QObject*  sender() const { return m_sender; }
00053         QObject*  receiver() const { return m_receiver; }
00054         QCString  signal() const { return m_signal; }
00055         QCString  slot() const { return m_slot; }
00056 
00057         void  setSender(QObject *o) { m_sender = o; }
00058         void  setReceiver(QObject *o) { m_receiver = o; }
00059         void  setSignal(const QCString &s) { m_signal = s; }
00060         void  setSlot(const QCString &s) { m_slot = s; }
00061 
00062     protected:
00063         QGuardedPtr<QObject> m_sender;
00064         QCString m_signal;
00065         QGuardedPtr<QObject> m_receiver;
00066         QCString m_slot;
00067         int  m_type;
00068 };
00069 
00070 class KEXICORE_EXPORT EventList : protected QValueList<Event*>
00071 {
00072     public:
00073         EventList() {;}
00074         ~EventList() {;}
00075 
00078         void addEvent(Event *event);
00079         void addEvent(QObject *sender, const QCString &signal, QObject *receiver, const QCString &slot);
00080         void addEvent(QObject *sender, const QCString &signal, const QCString &action);
00082         void  removeEvent(Event *event);
00083 
00086         EventList*  allEventsForObject(QObject *object);
00088         //void  renameWidget(const QCString &oldName, const QCString &newName);
00090         void  removeAllEventsForObject(QObject *object);
00091 
00092         // make some QValueList function accessible by other classes
00093         QValueListConstIterator<Event*>  constBegin() const { return QValueList<Event*>::constBegin(); } 
00094         QValueListConstIterator<Event*>  constEnd() const { return QValueList<Event*>::constEnd(); } 
00095         bool  isEmpty() const { return QValueList<Event*>::isEmpty(); }
00096 };
00097 
00098 
00099 #endif
00100 
KDE Home | KDE Accessibility Home | Description of Access Keys