kexi

kexievents.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KFORMDESIGNEREVENTS_H
21#define KFORMDESIGNEREVENTS_H
22
23#include <tqvaluelist.h>
24#include <tqguardedptr.h>
25
26class TQDomNode;
27class TQObject;
28
30
38class KEXICORE_EXPORT Event
39{
40 public:
41 Event(TQObject *sender, const TQCString &signal,
42 TQObject *receiver, const TQCString &slot);
43 Event(TQObject *sender, const TQCString &signal,
44 const TQCString &functionName);
45 Event() : m_type(Slot) {;}
46 ~Event() {;}
47
48 enum { Slot=1000, UserFunction, Action };
49 int type() {return m_type; }
50 void setType(int type) { m_type = type; }
51
52 TQObject* sender() const { return m_sender; }
53 TQObject* receiver() const { return m_receiver; }
54 TQCString signal() const { return m_signal; }
55 TQCString slot() const { return m_slot; }
56
57 void setSender(TQObject *o) { m_sender = o; }
58 void setReceiver(TQObject *o) { m_receiver = o; }
59 void setSignal(const TQCString &s) { m_signal = s; }
60 void setSlot(const TQCString &s) { m_slot = s; }
61
62 protected:
63 TQGuardedPtr<TQObject> m_sender;
64 TQCString m_signal;
65 TQGuardedPtr<TQObject> m_receiver;
66 TQCString m_slot;
67 int m_type;
68};
69
70class KEXICORE_EXPORT EventList : protected TQValueList<Event*>
71{
72 public:
73 EventList() {;}
74 ~EventList() {;}
75
78 void addEvent(Event *event);
79 void addEvent(TQObject *sender, const TQCString &signal, TQObject *receiver, const TQCString &slot);
80 void addEvent(TQObject *sender, const TQCString &signal, const TQCString &action);
82 void removeEvent(Event *event);
83
86 EventList* allEventsForObject(TQObject *object);
88 //void renameWidget(const TQCString &oldName, const TQCString &newName);
90 void removeAllEventsForObject(TQObject *object);
91
92 // make some TQValueList function accessible by other classes
93 TQValueListConstIterator<Event*> constBegin() const { return TQValueList<Event*>::constBegin(); }
94 TQValueListConstIterator<Event*> constEnd() const { return TQValueList<Event*>::constEnd(); }
95 bool isEmpty() const { return TQValueList<Event*>::isEmpty(); }
96};
97
98
99#endif
100
A simple class to store events.
Definition kexievents.h:39
int type()
Event types.
Definition kexievents.h:49