PIThread cxx11 support

git-svn-id: svn://db.shs.com.ru/pip@883 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2020-02-25 15:38:35 +00:00
parent ddd06de776
commit f8f627360a
5 changed files with 65 additions and 12 deletions

View File

@@ -133,8 +133,11 @@ public:
bool direction;
};
#ifdef PIP_CXX11_SUPPORT
typedef std::function<void(KeyEvent, void *)> KBFunc;
#else
typedef void (*KBFunc)(KeyEvent, void * );
#endif
//! Constructs keyboard listener with external function "slot" and custom data "data"
explicit PIKbdListener(KBFunc slot = 0, void * data = 0, bool startNow = true);
@@ -151,6 +154,11 @@ public:
//! Set external function to "slot"
void setSlot(KBFunc slot) {ret_func = slot;}
#ifdef PIP_CXX11_SUPPORT
//! Set external function to "slot"
void setSlot(std::function<void(KeyEvent)> slot) {ret_func = [slot](KeyEvent e, void *){slot(e);};}
#endif
//! Returns if exit key if awaiting
bool exitCaptured() const {return exit_enabled;}