thanks to powerful generic ZFCallback, we are able to implement lambda feature with pure C++03
example:
) {
valueCapture.
width = 999;
btn->observerAdd(
ZFUIButton::EventButtonOnClick(), onClick);
zfLogTrim() << "before invoke: " << refCapture << valueCapture;
btn->simulateClick();
zfLogTrim() << "after invoke: " << refCapture << valueCapture;
#define ZFLISTENER_2(name, CaptureParam0, capture0, CaptureParam1, capture1)
see ZFLISTENER
Definition ZFListenerDeclare.h:79
#define ZFLISTENER_END()
see ZFLISTENER
Definition ZFListenerDeclare.h:17
#define zfLogTrim(...)
see zfLog
Definition ZFLog.h:66
ZFUIRect const & ZFUIRectZero()
(0, 0, 0, 0)
Definition ZFUITypeDef.h:639
2D rectangle
Definition ZFUITypeDef.h:612
zffloat width
width
Definition ZFUITypeDef.h:616
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:163
as you may noticed, we can capture vars outside of the lambda function
you should take care of the life circle of the captured vars, though