40 #ifndef INCLUDED_DISTI_CALLBACK_CALLER_H
41 #define INCLUDED_DISTI_CALLBACK_CALLER_H
50 # define _snprintf snprintf
59 template<
class T,
class O = DisplayObject>
64 typedef void ( T::*MethodType2 )(
DisplayEvent* ev,
void* );
65 typedef void ( T::*MethodType3 )( void );
80 , _callbackData( NULL )
87 , _callbackData( NULL )
88 , _container( container )
94 , _callbackData( callbackData )
95 , _container( container )
101 , _callbackData( NULL )
102 , _container( container )
110 newOne->_callbackData = _callbackData;
111 newOne->_method = _method;
112 newOne->_methodType = _methodType;
113 newOne->_container = _container;
119 _container =
dynamic_cast<T*
>( container );
125 O* targetObject =
dynamic_cast<O*
>( target );
126 if( _method._1 && _methodType == 1 && targetObject )
132 obj =
dynamic_cast<T*
>( targetObject->DisplayObject::Parent() );
135 return ( obj->*( _method._1 ) )( targetObject, ev );
141 void CallType2(
DisplayEvent* ev,
void* callbackData = NULL )
143 if( _method._2 && _methodType == 2 && _container )
145 if( callbackData == NULL )
146 callbackData = _callbackData;
148 ( _container->*( _method._2 ) )( ev, callbackData );
154 if( _method._3 && _methodType == 3 && _container )
156 ( _container->*( _method._3 ) )();
168 typedef void ( T::*MethodType )( void );
172 : _container( container )
173 , _attributeName( attributeName )
186 _container =
dynamic_cast<T*
>( container );
199 _container->NotifyAttributeChanged( _attributeName );
203 ( _container->*( _method ) )();
235 , _emitEvent( emitEvent )
257 std::stringstream strmNew;
258 std::stringstream strmOld;
265 strNew = strmNew.str();
266 strOld = strmOld.str();
268 if( strNew.compare( strOld ) != 0 )
274 if(
DisplayObject* displayObj = dynamic_cast<DisplayObject*>( _container ) )
276 std::string str = std::string( _attribName ) +
" " + strNew;
277 ObjectEvent newEvent( displayObj,
"AttributeChanged", str.c_str() );
278 displayObj->handle( &newEvent );
void EmitAttributeChangedEventProperty()
Definition: callback_caller.h:255
AttributeChangedEventEmitter(AttributeChangedNotifier *container, T &val, const AttributeName &attribName, bool emitEvent=false)
Definition: callback_caller.h:230
~AttributeChangedEventEmitter()
Definition: callback_caller.h:240
T _prevVal
Definition: callback_caller.h:250
The disti::DisplayObject class and global enumerations.
AttributeChangedNotifier * _container
Definition: callback_caller.h:249
The CallbackMethodCallerBase class.
The standard Mouse and keyboard events and event structures.
const AttributeName & _attribName
Definition: callback_caller.h:252
Definition: callback_caller.h:221
T & _curVal
Definition: callback_caller.h:251
Definition: callback_caller_base.h:55
The disti::DisplayFrame class.
Definition: callback_caller.h:165
Definition: callback_caller.h:60
Definition: disti_metadata.h:443
virtual void NotifyAttributeChanged(const AttributeName &name)=0
Definition: disti_metadata.h:79
Definition: bmpimage.h:46