Import Geant4 11.4.0 source tree
This commit is contained in:
-97
@@ -8,44 +8,22 @@
|
||||
#include "../S_STRING"
|
||||
#include "../typedefs"
|
||||
|
||||
#ifdef TOOLS_MEM
|
||||
#include "../mem"
|
||||
#endif
|
||||
|
||||
#define TOOLS_SG_EVENT_ID_CAST
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
|
||||
class event {
|
||||
public:
|
||||
#ifdef TOOLS_SG_EVENT_ID_CAST
|
||||
static cid id_class() {return 0;}
|
||||
virtual void* cast(cid) const = 0;
|
||||
#else
|
||||
virtual void* cast(const std::string&) const = 0;
|
||||
#endif
|
||||
virtual event* copy() const = 0;
|
||||
public:
|
||||
#ifdef TOOLS_MEM
|
||||
TOOLS_SCLASS(tools::sg::event)
|
||||
#endif
|
||||
public:
|
||||
event(){
|
||||
#ifdef TOOLS_MEM
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
virtual ~event(){
|
||||
#ifdef TOOLS_MEM
|
||||
mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
event(const event&){
|
||||
#ifdef TOOLS_MEM
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
event& operator=(const event&){return *this;}
|
||||
};
|
||||
@@ -53,19 +31,11 @@ public:
|
||||
class size_event : public event {
|
||||
typedef event parent;
|
||||
public:
|
||||
#ifdef TOOLS_SG_EVENT_ID_CAST
|
||||
static cid id_class() {return parent::id_class()+1;}
|
||||
virtual void* cast(cid a_class) const {
|
||||
if(void* p = cmp_cast<size_event>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
TOOLS_SCLASS(tools::sg::size_event)
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<size_event>(this,a_class)) {return p;}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
virtual event* copy() const {return new size_event(*this);}
|
||||
public:
|
||||
size_event(unsigned int a_ow,unsigned int a_oh,
|
||||
@@ -143,19 +113,11 @@ class mouse_down_event : public event, public position_modifiers {
|
||||
typedef event parent;
|
||||
typedef position_modifiers parent_pos_mod;
|
||||
public:
|
||||
#ifdef TOOLS_SG_EVENT_ID_CAST
|
||||
static cid id_class() {return parent::id_class()+2;}
|
||||
virtual void* cast(cid a_class) const {
|
||||
if(void* p = cmp_cast<mouse_down_event>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
TOOLS_SCLASS(tools::sg::mouse_down_event)
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<mouse_down_event>(this,a_class)) {return p;}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
virtual event* copy() const {return new mouse_down_event(*this);}
|
||||
public:
|
||||
mouse_down_event(int a_x,int a_y,bool a_shift_modifier,bool a_control_modifier)
|
||||
@@ -178,19 +140,11 @@ class mouse_up_event : public event, public position_modifiers {
|
||||
typedef event parent;
|
||||
typedef position_modifiers parent_pos_mod;
|
||||
public:
|
||||
#ifdef TOOLS_SG_EVENT_ID_CAST
|
||||
static cid id_class() {return parent::id_class()+3;}
|
||||
virtual void* cast(cid a_class) const {
|
||||
if(void* p = cmp_cast<mouse_up_event>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
TOOLS_SCLASS(tools::sg::mouse_up_event)
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<mouse_up_event>(this,a_class)) {return p;}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
virtual event* copy() const {return new mouse_up_event(*this);}
|
||||
public:
|
||||
mouse_up_event(int a_x,int a_y,bool a_shift_modifier,bool a_control_modifier)
|
||||
@@ -213,19 +167,11 @@ class mouse_move_event : public event, public position_modifiers {
|
||||
typedef event parent;
|
||||
typedef position_modifiers parent_pos_mod;
|
||||
public:
|
||||
#ifdef TOOLS_SG_EVENT_ID_CAST
|
||||
static cid id_class() {return parent::id_class()+4;}
|
||||
virtual void* cast(cid a_class) const {
|
||||
if(void* p = cmp_cast<mouse_move_event>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
TOOLS_SCLASS(tools::sg::mouse_move_event)
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<mouse_move_event>(this,a_class)) {return p;}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
virtual event* copy() const {return new mouse_move_event(*this);}
|
||||
public:
|
||||
mouse_move_event(int a_x,int a_y,bool a_shift_modifier,bool a_control_modifier,
|
||||
@@ -269,19 +215,11 @@ protected:
|
||||
class anim_event : public event {
|
||||
typedef event parent;
|
||||
public:
|
||||
#ifdef TOOLS_SG_EVENT_ID_CAST
|
||||
static cid id_class() {return parent::id_class()+5;}
|
||||
virtual void* cast(cid a_class) const {
|
||||
if(void* p = cmp_cast<anim_event>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
TOOLS_SCLASS(tools::sg::anim_event)
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<anim_event>(this,a_class)) {return p;}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
virtual event* copy() const {return new anim_event(*this);}
|
||||
public:
|
||||
typedef uint64 num_t;
|
||||
@@ -305,12 +243,6 @@ public:
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
/*
|
||||
void set_time(num_t a_secs,num_t a_micro_secs) {
|
||||
m_secs = a_secs;
|
||||
m_micro_secs = a_micro_secs;
|
||||
}
|
||||
*/
|
||||
num_t seconds() const {return m_secs;}
|
||||
num_t micro_seconds() const {return m_micro_secs;}
|
||||
|
||||
@@ -325,19 +257,11 @@ protected:
|
||||
class key_down_event : public event {
|
||||
typedef event parent;
|
||||
public:
|
||||
#ifdef TOOLS_SG_EVENT_ID_CAST
|
||||
static cid id_class() {return parent::id_class()+6;}
|
||||
virtual void* cast(cid a_class) const {
|
||||
if(void* p = cmp_cast<key_down_event>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
TOOLS_SCLASS(tools::sg::key_down_event)
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<key_down_event>(this,a_class)) {return p;}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
virtual event* copy() const {return new key_down_event(*this);}
|
||||
public:
|
||||
key_down_event(key_code a_key)
|
||||
@@ -363,19 +287,11 @@ protected:
|
||||
class key_up_event : public event {
|
||||
typedef event parent;
|
||||
public:
|
||||
#ifdef TOOLS_SG_EVENT_ID_CAST
|
||||
static cid id_class() {return parent::id_class()+7;}
|
||||
virtual void* cast(cid a_class) const {
|
||||
if(void* p = cmp_cast<key_up_event>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
TOOLS_SCLASS(tools::sg::key_up_event)
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<key_up_event>(this,a_class)) {return p;}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
virtual event* copy() const {return new key_up_event(*this);}
|
||||
public:
|
||||
key_up_event(key_code a_key)
|
||||
@@ -402,19 +318,11 @@ class wheel_rotate_event : public event, public position_modifiers {
|
||||
typedef event parent;
|
||||
typedef position_modifiers parent_pos_mod;
|
||||
public:
|
||||
#ifdef TOOLS_SG_EVENT_ID_CAST
|
||||
static cid id_class() {return parent::id_class()+8;}
|
||||
virtual void* cast(cid a_class) const {
|
||||
if(void* p = cmp_cast<wheel_rotate_event>(this,a_class)) return p;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
TOOLS_SCLASS(tools::sg::wheel_rotate_event)
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = cmp_cast<wheel_rotate_event>(this,a_class)) {return p;}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
virtual event* copy() const {return new wheel_rotate_event(*this);}
|
||||
public:
|
||||
wheel_rotate_event(int a_angle,int a_x,int a_y,bool a_shift_modifier,bool a_control_modifier)
|
||||
@@ -440,13 +348,8 @@ protected:
|
||||
int m_angle;
|
||||
};
|
||||
|
||||
#ifdef TOOLS_SG_EVENT_ID_CAST
|
||||
template <class FROM,class TO> inline TO* event_cast(FROM& a_o) {return id_cast<FROM,TO>(a_o);}
|
||||
template <class FROM,class TO> inline const TO* event_cast(const FROM& a_o) {return id_cast<FROM,TO>(a_o);}
|
||||
#else
|
||||
template <class FROM,class TO> inline TO* event_cast(FROM& a_o) {return safe_cast<FROM,TO>(a_o);}
|
||||
template <class FROM,class TO> inline const TO* event_cast(const FROM& a_o) {return safe_cast<FROM,TO>(a_o);}
|
||||
#endif
|
||||
|
||||
inline bool get_event_xy(const sg::event& a_event,int& a_x,int& a_y) {
|
||||
typedef sg::event evt_t;
|
||||
|
||||
Reference in New Issue
Block a user