3 May
2012
3 May
'12
8:55 a.m.
No, you don't have to make a signleton. The function XtAppAddTimeOut accepts "XtPointer client_data" argument, where you can pass "this". Then you get it back in the callback function, and type-cast it to its original type.
Ok this is another solution. But I don't like such pointer casts. I have done it the following way: class AnimationController { private: static boost::optional<AnimationController&> cInstance; public: static AnimationController& instance() { return cInstance.get(); } AnimationController() { cInstance = *this; } static void timerCB() { instance().animate(); } private: void animate(); }; Just as praise for boost::optional :-) Sven