File: cs_234.html

package info (click to toggle)
crystalspace 0.94-20020412-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 62,276 kB
  • ctags: 52,843
  • sloc: cpp: 274,783; ansic: 6,608; perl: 6,276; objc: 3,952; asm: 2,942; python: 2,354; php: 542; pascal: 530; sh: 430; makefile: 370; awk: 193
file content (131 lines) | stat: -rw-r--r-- 6,532 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created by texi2html 1.64 -->
<!-- 
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
 
-->
<HTML>
<HEAD>
<TITLE>Crystal Space: AWS Component Signals</TITLE>

<META NAME="description" CONTENT="Crystal Space: AWS Component Signals">
<META NAME="keywords" CONTENT="Crystal Space: AWS Component Signals">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">

</HEAD>

<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">

<A NAME="SEC567"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_233.html#SEC566"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_235.html#SEC568"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_230.html#SEC563"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_231.html#SEC564"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_235.html#SEC568"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<HR SIZE=1>
<H4> 7.12.3.3 Sending and Receiving Signals </H4>
<!--docid::SEC567::-->
<P>

AWS supports signal sources and sinks. A signal is simply a
bit of information that lets someone know that something
happened. A signal source is an object that gives out signals.
A signal sink is an object that receives them. A signal slot is
a conduit that manages a connection between sources and sinks.
All AWS components are signal sources. They are derived
from `<SAMP>awsSource</SAMP>', and thus support all the functionality of
that class.
</P><P>

Signals are very distinct from Events. Signals are usually not
sent for vents like `<SAMP>MouseDown</SAMP>', etc. A signal usually
indicates that something important happened to the source. Good
examples of signals are `<SAMP>TextChanged</SAMP>' for a text-box or
`<SAMP>ButtonClicked</SAMP>' for a command button. These indicate that
the user has gone through a series of complex motions, and has
triggered the component to do something that it was programmed
for. Signals do not include extra parameter information, simply a
32-bit value that indicates what happened.
</P><P>

Signals are unique to each component. Therefore, you never have
to worry about namespace conflicts. For instance, if you want notification
when a command button is clicked, you can connect your "button clicked"
handler to the button like this:
</P><P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>awsSlot slot(mySink);
slot.Connect(cmdbutton,
  awsButton::sButtonClicked,
  doSomethingUsefulTrigger);
</pre></td></tr></table></P><P>

The parameter to the slot is the class that contains your sink.
This can be any class derived from `<SAMP>iAwsSink</SAMP>'. For the connect
call, the first parameter is the signal source that you are
connecting to, the second is the signal you want notification of, and
the final parameter is the identifier of the trigger you want activated
on the sink when signaled. A single slot can map between a
number of sources, signals, and triggers. To get the trigger identifier
(which may change every time your application is run) you merely
need to call <CODE>GetTriggerID()</CODE> on the sink with the name of the
trigger that you want.
</P><P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>unsigned long trigger = mySink-&#62;GetTriggerID("LoginUser");
</pre></td></tr></table></P><P>

What this means is that you don't have to override the `<SAMP>awsButton</SAMP>'
class to find out what's going on. In fact, you don't even have
to know about the button. All you need to know is that it
supports the signal. If it doesn't support the signal, by the
way, you will simply never get any information about it. Your slot will
never become active.
</P><P>

A slot maps back to a sink's trigger. A single slot is <EM>always</EM>
bound to a single sink, but there may be other slots bound to the
same sink. When a trigger gets activated, it's passed in a
reference to the source of the signal. That way it can get any
information that it needs out of that source. A trigger could use
this information to find out what type of component the source is
and cast it to the correct type. The primary means for doing that
resides in the <CODE>GetProperty()</CODE> and <CODE>SetProperty</CODE> methods. These
allow you to request a property by name from a random component.
If the component does not support the property, the call will
fail in a graceful manner.
<A NAME="AWS Trigger Reference"></A>
<HR SIZE=1>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_233.html#SEC566"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_235.html#SEC568"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_230.html#SEC563"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_231.html#SEC564"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_235.html#SEC568"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>  
<FONT SIZE="-1">
This document was generated

using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>

</BODY>
</HTML>