File: eventHandler.hxx - Tab length: 1 2 4 8 - Lines: on off - No wrap: on off

001: 
002: namespace Pane
003: {
004:   /*
005:   ** Destroy event handler and all attached events (4 parameters)
006:   */
007:   template<typename Return, typename Param1, typename Param2, typename Param3, typename Param4>
008:   /**/              EventHandler<Return, Param1, Param2, Param3, Param4>::~EventHandler ()
009:   {
010:     typename Events::iterator i;
011: 
012:     for (i = this->events.begin (); i != this->events.end (); ++i)
013:       delete (*i);
014:   }
015: 
016:   /*
017:   ** Destroy event handler and all attached events (3 parameters)
018:   */
019:   template<typename Return, typename Param1, typename Param2, typename Param3>
020:   /**/              EventHandler<Return, Param1, Param2, Param3>::~EventHandler ()
021:   {
022:     typename Events::iterator i;
023: 
024:     for (i = this->events.begin (); i != this->events.end (); ++i)
025:       delete (*i);
026:   }
027: 
028:   /*
029:   ** Destroy event handler and all attached events (4 parameters)
030:   */
031:   template<typename Return, typename Param1, typename Param2>
032:   /**/              EventHandler<Return, Param1, Param2>::~EventHandler ()
033:   {
034:     typename Events::iterator i;
035: 
036:     for (i = this->events.begin (); i != this->events.end (); ++i)
037:       delete (*i);
038:   }
039: 
040:   /*
041:   ** Destroy event handler and all attached events (4 parameters)
042:   */
043:   template<typename Return, typename Param1>
044:   /**/              EventHandler<Return, Param1>::~EventHandler ()
045:   {
046:     typename Events::iterator i;
047: 
048:     for (i = this->events.begin (); i != this->events.end (); ++i)
049:       delete (*i);
050:   }
051: 
052:   /*
053:   ** Destroy event handler and all attached events (0 parameter)
054:   */
055:   template<typename Return>
056:   /**/              EventHandler<Return>::~EventHandler ()
057:   {
058:     typename Events::iterator i;
059: 
060:     for (i = this->events.begin (); i != this->events.end (); ++i)
061:       delete (*i);
062:   }
063: 
064:   /*
065:   ** Attach new event to handler (4 parameters)
066:   ** event: event to attach
067:   */
068:   template<typename Return, typename Param1, typename Param2, typename Param3, typename Param4>
069:   void  EventHandler<Return, Param1, Param2, Param3, Param4>::operator += (EventClass* event)
070:   {
071:     this->events.push_back (event);
072:   }
073: 
074:   /*
075:   ** Attach new event to handler (4 parameters)
076:   ** event: event to attach
077:   */
078:   template<typename Return, typename Param1, typename Param2, typename Param3>
079:   void  EventHandler<Return, Param1, Param2, Param3>::operator += (EventClass* event)
080:   {
081:     this->events.push_back (event);
082:   }
083: 
084:   /*
085:   ** Attach new event to handler (4 parameters)
086:   ** event: event to attach
087:   */
088:   template<typename Return, typename Param1, typename Param2>
089:   void  EventHandler<Return, Param1, Param2>::operator += (EventClass* event)
090:   {
091:     this->events.push_back (event);
092:   }
093: 
094:   /*
095:   ** Attach new event to handler (1 parameter)
096:   ** event: event to attach
097:   */
098:   template<typename Return, typename Param1>
099:   void  EventHandler<Return, Param1>::operator += (EventClass* event)
100:   {
101:     this->events.push_back (event);
102:   }
103: 
104:   /*
105:   ** Attach new event to handler (0 parameter)
106:   ** event: event to attach
107:   */
108:   template<typename Return>
109:   void  EventHandler<Return>::operator += (EventClass* event)
110:   {
111:     this->events.push_back (event);
112:   }
113: 
114:   /*
115:   ** Call attached events (4 parameters)
116:   ** param1:  parameter #1
117:   ** param2:  parameter #2
118:   ** param3:  parameter #3
119:   ** param4:  parameter #4
120:   ** return:  true if at least one event was attached, false else
121:   */
122:   template<typename Return, typename Param1, typename Param2, typename Param3, typename Param4>
123:   bool              EventHandler<Return, Param1, Param2, Param3, Param4>::operator () (Param1 param1, Param2 param2, Param3 param3, Param4 param4)
124:   {
125:     typename Events::iterator i;
126: 
127:     for (i = this->events.begin (); i != this->events.end (); ++i)
128:       (**i) (param1, param2, param3, param4);
129: 
130:     return this->events.size () > 0;
131:   }
132: 
133:   /*
134:   ** Call attached events (3 parameters)
135:   ** param1:  parameter #1
136:   ** param2:  parameter #2
137:   ** param3:  parameter #3
138:   ** return:  true if at least one event was attached, false else
139:   */
140:   template<typename Return, typename Param1, typename Param2, typename Param3>
141:   bool              EventHandler<Return, Param1, Param2, Param3>::operator () (Param1 param1, Param2 param2, Param3 param3)
142:   {
143:     typename Events::iterator i;
144: 
145:     for (i = this->events.begin (); i != this->events.end (); ++i)
146:       (**i) (param1, param2, param3);
147: 
148:     return this->events.size () > 0;
149:   }
150: 
151:   /*
152:   ** Call attached events (2 parameters)
153:   ** param1:  parameter #1
154:   ** param2:  parameter #2
155:   ** return:  true if at least one event was attached, false else
156:   */
157:   template<typename Return, typename Param1, typename Param2>
158:   bool              EventHandler<Return, Param1, Param2>::operator () (Param1 param1, Param2 param2)
159:   {
160:     typename Events::iterator i;
161: 
162:     for (i = this->events.begin (); i != this->events.end (); ++i)
163:       (**i) (param1, param2);
164: 
165:     return this->events.size () > 0;
166:   }
167: 
168:   /*
169:   ** Call attached events (1 parameter)
170:   ** param1:  parameter #1
171:   ** return:  true if at least one event was attached, false else
172:   */
173:   template<typename Return, typename Param1>
174:   bool              EventHandler<Return, Param1>::operator () (Param1 param1)
175:   {
176:     typename Events::iterator i;
177: 
178:     for (i = this->events.begin (); i != this->events.end (); ++i)
179:       (**i) (param1);
180: 
181:     return this->events.size () > 0;
182:   }
183: 
184:   /*
185:   ** Call attached events (0 parameter)
186:   ** return:  true if at least one event was attached, false else
187:   */
188:   template<typename Return>
189:   bool              EventHandler<Return>::operator () ()
190:   {
191:     typename Events::iterator i;
192: 
193:     for (i = this->events.begin (); i != this->events.end (); ++i)
194:       (**i) ();
195: 
196:     return this->events.size () > 0;
197:   }
198: }