// Copyright (C) 2010, Guy Barrand. All rights reserved. // See the file tools.license for terms. #ifndef toolx_X11_dispatcher #define toolx_X11_dispatcher #include #ifdef TOOLS_MEM #include #endif namespace toolx { namespace X11 { class dispatcher { protected: #ifdef TOOLS_MEM static const std::string& s_class() { static const std::string s_v("toolx::X11::dispatcher"); return s_v; } #endif public: virtual bool dispatch(XEvent&) = 0; virtual Window window() const = 0; virtual dispatcher* copy() const = 0; public: dispatcher():m_is_valid(true){ #ifdef TOOLS_MEM tools::mem::increment(s_class().c_str()); #endif } virtual ~dispatcher(){ #ifdef TOOLS_MEM tools::mem::decrement(s_class().c_str()); #endif } public: dispatcher(const dispatcher& a_from):m_is_valid(a_from.m_is_valid){ #ifdef TOOLS_MEM tools::mem::increment(s_class().c_str()); #endif } dispatcher& operator=(const dispatcher& a_from) { m_is_valid = a_from.m_is_valid;return *this;} public: bool is_valid() const {return m_is_valid;} void invalidate() {m_is_valid = false;} protected: bool m_is_valid; }; }} #endif