| GL Studio C++ Runtime API

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AttributeChangedEventEmitter< T > Class Template Reference

`#include <callback_caller.h>`

## Public Member Functions
| AttributeChangedEventEmitter (AttributeChangedNotifier *container, T &val, const AttributeName &attribName, bool emitEvent=false)
| ~AttributeChangedEventEmitter ()

## Protected Member Functions
void | EmitAttributeChangedEventProperty ()
| Emits an "AttributeChanged" ObjectEvent, and calls NotifyAttributeChanged to tell subscribers that this property changed.

## Protected Attributes
AttributeChangedNotifier * | _container
T | _prevVal
T & | _curVal
const AttributeName & | _attribName
bool | _emitEvent
| whether or not to emit an event

## Detailed Description

template<class T>
class disti::AttributeChangedEventEmitter< T >

helper for class for emitting attribute changed events in generated code this class does two things:
1) It calls NotifyAttributeChanged if the attribute changed 2) It emits an event if EmitEvent() was set to true and if the Container type is DisplayObject. It can't emit events for top level display frames since they don't have a handle() method.

## Constructor & Destructor Documentation

## ◆ AttributeChangedEventEmitter()

AttributeChangedEventEmitter | ( | AttributeChangedNotifier * | container,
|  | T & | val,
|  | const AttributeName & | attribName,
|  | bool | emitEvent = `false`
| ) |  |
| inline

ctor

Parameters

  container | container that has attribute
  val | current value of attribute. Lifetime must extend pass the life of this class
  attribName | name of attribute. Lifetime must extend pass the life of this class
  emitEvent | whether or not to emit an event. The container must be a DisplayObject, and the event will be passed to the object's handle() method.

## ◆ ~AttributeChangedEventEmitter()

~AttributeChangedEventEmitter | ( |  | ) |
| inline

dtor - emit attribute changed event if container is a DisplayObject and the value has changed

## Member Data Documentation

## ◆ _attribName

const AttributeName& _attribName
| protected

attribute name

## ◆ _container

AttributeChangedNotifier* _container
| protected

container

## ◆ _curVal

T& _curVal
| protected

ref to current value for attribute

## ◆ _prevVal

T _prevVal
| protected

previous value for attribute

The documentation for this class was generated from the following file:

- callback_caller.h