svc_xuiobject.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef _SVC_XUIOBJECT_H
  2. #define _SVC_XUIOBJECT_H
  3. #include <bfc/dispatch.h>
  4. #include <api/service/services.h>
  5. #include <bfc/platform/platform.h>
  6. #include <bfc/string/StringW.h>
  7. class GuiObject;
  8. class skin_xmlreaderparams;
  9. class NOVTABLE svc_xuiObject : public Dispatchable
  10. {
  11. public:
  12. static FOURCC getServiceType()
  13. {
  14. return WaSvc::XUIOBJECT;
  15. }
  16. int testTag( const wchar_t *xmltag );
  17. GuiObject *instantiate( const wchar_t *xmltag, ifc_xmlreaderparams *params = NULL );
  18. void destroy( GuiObject *g );
  19. enum
  20. {
  21. XUI_TESTTAG = 10,
  22. //XUI_INSTANTIATE=20, // RETIRED
  23. XUI_INSTANTIATEWITHPARAMS = 25,
  24. XUI_DESTROY = 30,
  25. };
  26. };
  27. inline int svc_xuiObject::testTag(const wchar_t *xmltag) {
  28. return _call(XUI_TESTTAG, 0, xmltag);
  29. }
  30. inline GuiObject *svc_xuiObject::instantiate(const wchar_t *xmltag, ifc_xmlreaderparams *params) {
  31. return _call(XUI_INSTANTIATEWITHPARAMS, (GuiObject *)NULL, xmltag, params);
  32. }
  33. inline void svc_xuiObject::destroy(GuiObject *o) {
  34. _voidcall(XUI_DESTROY, o);
  35. }
  36. // derive from this one
  37. class svc_xuiObjectI : public svc_xuiObject
  38. {
  39. public:
  40. virtual int testTag(const wchar_t *xmltag)=0;
  41. virtual GuiObject *instantiate(const wchar_t *xmltag, ifc_xmlreaderparams *params=NULL)=0;
  42. virtual void destroy(GuiObject *o)=0;
  43. protected:
  44. RECVS_DISPATCH;
  45. };
  46. #include <api/service/servicei.h>
  47. template <class T>
  48. class XuiObjectCreator : public waServiceFactoryTSingle<svc_xuiObject, T> {
  49. public:
  50. virtual const wchar_t *svc_getTestString() { return T::xuisvc_getXmlTag(); }
  51. };
  52. #include <api/service/svc_enum.h>
  53. #include <bfc/string/StringW.h>
  54. class XuiObjectSvcEnum : public SvcEnumT<svc_xuiObject> {
  55. public:
  56. XuiObjectSvcEnum(const wchar_t *xmltag) : tag(xmltag) {}
  57. protected:
  58. virtual int testService(svc_xuiObject *svc) {
  59. return (svc->testTag(tag));
  60. }
  61. private:
  62. StringW tag;
  63. };
  64. #endif