40 #ifndef INCLUDED_DISTI_CALLBACK_CALLER_H
41 #define INCLUDED_DISTI_CALLBACK_CALLER_H
50 # define _snprintf snprintf
58 template<
class T,
class O = DisplayObject>
63 typedef void ( T::*MethodType2 )(
DisplayEvent* ev,
void* );
64 typedef void ( T::*MethodType3 )( void );
79 , _callbackData( NULL )
86 , _callbackData( NULL )
87 , _container( container )
93 , _callbackData( callbackData )
94 , _container( container )
100 , _callbackData( NULL )
101 , _container( container )
109 newOne->_callbackData = _callbackData;
110 newOne->_method = _method;
111 newOne->_methodType = _methodType;
112 newOne->_container = _container;
118 _container =
dynamic_cast<T*
>( container );
124 O* targetObject =
dynamic_cast<O*
>( target );
125 if( _method._1 && _methodType == 1 && targetObject )
135 if(
ComponentBase*
const targetComp = dynamic_cast<ComponentBase*>( targetObject ) )
137 obj =
dynamic_cast<T*
>( targetComp->ParentDisplayFrame() );
141 obj =
dynamic_cast<T*
>( targetObject->DisplayObject::Parent() );
152 return ( obj->*( _method._1 ) )( targetObject, ev );
159 void CallType2(
DisplayEvent* ev,
void* callbackData = NULL )
161 if( _method._2 && _methodType == 2 && _container )
163 if( callbackData == NULL )
164 callbackData = _callbackData;
166 ( _container->*( _method._2 ) )( ev, callbackData );
172 if( _method._3 && _methodType == 3 && _container )
174 ( _container->*( _method._3 ) )();
186 typedef void ( T::*MethodType )( void );
190 : _container( container )
191 , _attributeName( attributeName )
204 _container =
dynamic_cast<T*
>( container );
217 _container->NotifyAttributeChanged( _attributeName );
221 ( _container->*( _method ) )();
253 , _emitEvent( emitEvent )
275 std::stringstream strmNew;
276 std::stringstream strmOld;
283 strNew = strmNew.str();
284 strOld = strmOld.str();
286 if( strNew.compare( strOld ) != 0 )
292 if(
DisplayObject* displayObj = dynamic_cast<DisplayObject*>( _container ) )
294 std::string str = std::string( _attribName ) +
" " + strNew;
295 ObjectEvent newEvent( displayObj,
"AttributeChanged", str.c_str() );
296 displayObj->handle( &newEvent );
void EmitAttributeChangedEventProperty()
Definition: callback_caller.h:273
AttributeChangedEventEmitter(AttributeChangedNotifier *container, T &val, const AttributeName &attribName, bool emitEvent=false)
Definition: callback_caller.h:248
~AttributeChangedEventEmitter()
Definition: callback_caller.h:258
T _prevVal
Definition: callback_caller.h:268
The disti::DisplayObject class and global enumerations.
AttributeChangedNotifier * _container
Definition: callback_caller.h:267
Definition: component_base.h:67
The CallbackMethodCallerBase class.
The standard Mouse and keyboard events and event structures.
const AttributeName & _attribName
Definition: callback_caller.h:270
Definition: callback_caller.h:239
T & _curVal
Definition: callback_caller.h:269
Definition: callback_caller_base.h:55
The disti::DisplayFrame class.
Definition: callback_caller.h:183
Definition: callback_caller.h:59
Definition: disti_metadata.h:458
virtual void NotifyAttributeChanged(const AttributeName &name)=0
Definition: disti_metadata.h:85
Definition: bmpimage.h:46