strfwd.h \
Systemcall.cpp \
Systemcall.h \
+ SignalSlot.cpp \
+ SignalSlot.h \
+ SignalSlotPrivate.h \
tempname.cpp \
textutils.h \
Translator.h \
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file SignalSlot.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include "SignalSlot.h"
+#include "SignalSlotPrivate.h"
+
+namespace lyx {
+
+/////////////////////////////////////////////////////////////////////
+//
+// Signal
+//
+/////////////////////////////////////////////////////////////////////
+
+Signal::Signal()
+ : impl(new SignalImpl)
+{}
+
+
+Signal::~Signal()
+{
+ delete impl;
+}
+
+
+void Signal::fire()
+{
+ impl->fire();
+}
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// Slot
+//
+/////////////////////////////////////////////////////////////////////
+
+void SlotImpl::called()
+{
+ owner_.called();
+}
+
+Slot::Slot()
+ : impl(new SlotImpl(*this))
+{}
+
+Slot::~Slot()
+{
+ delete impl;
+}
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// Connect
+//
+/////////////////////////////////////////////////////////////////////
+
+void connect(Signal & sig, Slot & slot)
+{
+ QObject::connect(sig.impl, SIGNAL(fire()), slot.impl, SLOT(called()));
+}
+
+} // namespace lyx
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file SignalSlot.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef SIGNALSLOT_H
+#define SIGNALSLOT_H
+
+namespace lyx {
+
+class Slot;
+class SlotImpl;
+class SignalImpl;
+
+class Signal
+{
+public:
+ Signal();
+ ~Signal();
+ void fire();
+private:
+ Signal(Signal const &);
+ void operator=(Signal const &);
+ SignalImpl * impl;
+ friend void connect(Signal & sig, Slot & slot);
+};
+
+class Slot
+{
+public:
+ Slot();
+ virtual ~Slot();
+ virtual void called() {}
+private:
+ Slot(Slot const &);
+ void operator=(Slot const &);
+ SlotImpl * impl;
+ friend void connect(Signal & sig, Slot & slot);
+};
+
+void connect(Signal & sig, Slot & slot);
+
+} // namespace lyx
+
+#endif
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file SignalSlotPrivate.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef SIGNALSLOTPRIVATE_H
+#define SIGNALSLOTPRIVATE_H
+
+#include <QObject>
+
+namespace lyx {
+
+class SignalImpl : public QObject
+{
+ Q_OBJECT
+public:
+ SignalImpl() {}
+ virtual ~SignalImpl() {}
+
+Q_SIGNALS:
+ void fire();
+ friend class Signal;
+};
+
+
+class Slot;
+class SlotImpl : public QObject
+{
+ Q_OBJECT
+public:
+ SlotImpl(Slot & owner) : owner_(owner) {}
+ virtual ~SlotImpl() {}
+public Q_SLOTS:
+ void called();
+private:
+ Slot & owner_;
+};
+
+} // namespace lyx
+
+#endif // SIGNALSLOTPRIVATE_H