summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2006-08-31 18:09:25 +0000
committerSimon Howard2006-08-31 18:09:25 +0000
commit58978769f5a0da03a35e6cca91be8d9cbea60f3b (patch)
tree47668670ff4b50cdea0d404e59c1897f6274ff59
parente9376daee45b53ec5a027244c3561fdbd6818fe6 (diff)
downloadchocolate-doom-58978769f5a0da03a35e6cca91be8d9cbea60f3b.tar.gz
chocolate-doom-58978769f5a0da03a35e6cca91be8d9cbea60f3b.tar.bz2
chocolate-doom-58978769f5a0da03a35e6cca91be8d9cbea60f3b.zip
Allow multiple callbacks for the same signal on widgets
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 572
-rw-r--r--textscreen/txt_widget.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/textscreen/txt_widget.c b/textscreen/txt_widget.c
index 3ca92c9a..1e2f0734 100644
--- a/textscreen/txt_widget.c
+++ b/textscreen/txt_widget.c
@@ -69,18 +69,6 @@ void TXT_SignalConnect(TXT_UNCAST_ARG(widget),
table = widget->callback_table;
- for (i=0; i<table->num_callbacks; ++i)
- {
- if (!strcmp(signal_name, table->callbacks[i].signal_name))
- {
- // Replace existing signal
-
- table->callbacks[i].func = func;
- table->callbacks[i].user_data = user_data;
- break;
- }
- }
-
// Add a new callback to the table
table->callbacks
@@ -102,12 +90,14 @@ void TXT_EmitSignal(TXT_UNCAST_ARG(widget), char *signal_name)
table = widget->callback_table;
+ // Search the table for all callbacks with this name and invoke
+ // the functions.
+
for (i=0; i<table->num_callbacks; ++i)
{
if (!strcmp(table->callbacks[i].signal_name, signal_name))
{
table->callbacks[i].func(widget, table->callbacks[i].user_data);
- break;
}
}
}