summaryrefslogtreecommitdiffstats
path: root/qtsharp/src/bindings/static/QtSignalMap.cs
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit90825e2392b2d70e43c7a25b8a3752299a933894 (patch)
treee33aa27f02b74604afbfd0ea4f1cfca8833d882a /qtsharp/src/bindings/static/QtSignalMap.cs
downloadtdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz
tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'qtsharp/src/bindings/static/QtSignalMap.cs')
-rw-r--r--qtsharp/src/bindings/static/QtSignalMap.cs99
1 files changed, 99 insertions, 0 deletions
diff --git a/qtsharp/src/bindings/static/QtSignalMap.cs b/qtsharp/src/bindings/static/QtSignalMap.cs
new file mode 100644
index 00000000..38ab5ac3
--- /dev/null
+++ b/qtsharp/src/bindings/static/QtSignalMap.cs
@@ -0,0 +1,99 @@
+// QtSignalMap.cs - Hashtable wrapper for prettier code.
+//
+// Copyright (C) 2002 Nick Zigarovich (nick@chemlab.org)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// NOTES
+// o By inheriting from QObject, we can use the child tracking features to
+// ensure that instances of signal maps are deleted by their parents when
+// the parent Dispose()es.
+//
+// FIXME
+// o Override Dispose() and make sure everything gets cleaned up on deletion.
+
+namespace Qt {
+ using System;
+ using System.Collections;
+ using Qt;
+
+ internal class QtSignalMap: QtSupport {
+ private Hashtable signalMap;
+ private string name;
+
+ public string Name {
+ get { return name; }
+ }
+
+ public QtSignalMap (QObject parent): this (parent, "QtSignalMap") {}
+
+ public QtSignalMap (QObject parent, string name): base (QNull.Instance)
+ {
+ this.name = name;
+ signalMap = new Hashtable ();
+ }
+
+ internal override void Delete () {}
+
+ public void Add (QtSignal signal)
+ {
+ signalMap[signal.Identifier] = signal;
+ }
+
+ public QtSignal Remove (string name)
+ {
+ QtSignal ret = signalMap[name] as QtSignal;
+ signalMap.Remove (name);
+ return ret;
+ }
+
+ public bool Contains (string name)
+ {
+ return signalMap.ContainsKey (name);
+ }
+
+ public QtSignal this[string idx] {
+ get {
+ if (signalMap.ContainsKey (idx))
+ return signalMap[idx] as QtSignal;
+ else
+ return null;
+ }
+
+ set { signalMap[idx] = value; }
+ }
+
+ public IDictionaryEnumerator GetEnumerator ()
+ {
+ return signalMap.GetEnumerator ();
+ }
+
+ public void DumpMap()
+ {
+ if (signalMap.Count == 0) {
+ ErrMsg ("** {0}: No signals to dump.", name);
+ ErrMsg ("");
+ }
+ else {
+ IDictionaryEnumerator ide = signalMap.GetEnumerator();
+
+ while (ide.MoveNext ()) {
+ (ide.Value as QtSignal).DumpConnections ();
+ ErrMsg ("");
+ }
+ }
+ }
+ }
+}