Mercurial > hg > wabletios
view uifunctor.h @ 15:d5758530a039 tip
oF0.84
Retina, and iPhone support
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Tue, 12 May 2015 15:48:52 +0100 |
parents | c667dfe12d47 |
children |
line wrap: on
line source
// // uifunctor.h // Wablet // // Created by Robert Tubb on 22/03/2012. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #ifndef Wablet_uifunctor_h #define Wablet_uifunctor_h //------------------- callback functor // abstract base class class UIFunctor { public: // two possible functions to call member function. virtual cause derived // classes will use a pointer to an object and a pointer to a member function // to make the function call virtual void operator()(int buttID)=0; // call using operator virtual void Call(int buttID)=0; // call using function }; // derived template class - this one is for memeber of testApp class template <class testApp> class UISpecificFunctor : public UIFunctor { private: void (testApp::*fpt)(int); // pointer to member function testApp* pt2Object; // pointer to object public: // constructor - takes pointer to an object and pointer to a member and stores // them in two private variables UISpecificFunctor( testApp* _pt2Object, void(testApp::*_fpt)(int)) { pt2Object = _pt2Object; fpt=_fpt; }; // override operator "()" virtual void operator()(int buttID) { (*pt2Object.*fpt)(buttID);}; // execute member function // override function "Call" virtual void Call(int buttID) { (*pt2Object.*fpt)(buttID);}; // execute member function }; #endif