Object.pkg 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. $#include "Object.h"
  2. class Object : public RefCounted
  3. {
  4. virtual ShortStringHash GetType() const;
  5. // virtual const String& GetTypeName() const;
  6. tolua_outside const char* ObjectGetTypeName @ GetTypeName() const;
  7. const String& GetCategory() const;
  8. tolua_outside const char* ObjectGetCategory @ GetCategory() const;
  9. // void SendEvent(StringHash eventType);
  10. tolua_outside void ObjectSendEvent @ SendEvent(const char* eventName);
  11. // void SendEvent(StringHash eventType, VariantMap& eventData);
  12. tolua_outside void ObjectSendEvent @ SendEvent(const char* eventName, VariantMap& eventData);
  13. tolua_readonly tolua_property__get_set ShortStringHash type;
  14. tolua_readonly tolua_property__get_set String& typeName;
  15. tolua_readonly tolua_property__get_set String& category;
  16. };
  17. ${
  18. static const char* ObjectGetTypeName(const Object* object)
  19. {
  20. return object->GetTypeName().CString();
  21. }
  22. static const char* ObjectGetCategory(const Object* object)
  23. {
  24. return object->GetCategory().CString();
  25. }
  26. static void ObjectSendEvent(Object* object, const char* eventName)
  27. {
  28. object->SendEvent(StringHash(eventName));
  29. }
  30. static void ObjectSendEvent(Object* object, const char* eventName, VariantMap& eventData)
  31. {
  32. object->SendEvent(StringHash(eventName), eventData);
  33. }
  34. $}