57 lines
1.1 KiB
Plaintext
57 lines
1.1 KiB
Plaintext
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
|
// See the file tools.license for terms.
|
|
|
|
#ifndef tools_X11_dispatcher
|
|
#define tools_X11_dispatcher
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#ifdef TOOLS_MEM
|
|
#include <tools/mem>
|
|
#endif
|
|
|
|
namespace tools {
|
|
namespace X11 {
|
|
|
|
class dispatcher {
|
|
protected:
|
|
#ifdef TOOLS_MEM
|
|
static const std::string& s_class() {
|
|
static const std::string s_v("tools::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
|