xuicustomobject.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include <precomp.h>
  2. #include "xuicustomobject.h"
  3. #include <api/wnd/notifmsg.h>
  4. // -----------------------------------------------------------------------
  5. const wchar_t CustomObjectXuiObjectStr[] = L"CustomObject"; // This is the xml tag
  6. char CustomObjectXuiSvcName[] = "CustomObject xui object";
  7. XMLParamPair XuiCustomObject::params[] = {
  8. {CUSTOMOBJECT_SETGROUP, L"GROUPID"},
  9. };
  10. // -----------------------------------------------------------------------
  11. XuiCustomObject::XuiCustomObject()
  12. {
  13. myxuihandle = newXuiHandle();
  14. CreateXMLParameters(myxuihandle);
  15. ScriptObject *o = getGuiObject()->guiobject_getScriptObject();
  16. o->vcpu_setInterface(customObjectGuid, static_cast<CustomObject *>(this));
  17. }
  18. void XuiCustomObject::CreateXMLParameters(int master_handle)
  19. {
  20. //CUSTOMOBJECT_PARENT::CreateXMLParameters(master_handle);
  21. int numParams = sizeof(params) / sizeof(params[0]);
  22. hintNumberOfParams(myxuihandle, numParams);
  23. for (int i = 0;i < numParams;i++)
  24. addParam(myxuihandle, params[i], XUI_ATTRIBUTE_IMPLIED);
  25. }
  26. // -----------------------------------------------------------------------
  27. XuiCustomObject::~XuiCustomObject() {
  28. }
  29. // -----------------------------------------------------------------------
  30. int XuiCustomObject::setXuiParam(int xuihandle, int xmlattributeid, const wchar_t *xmlattributename, const wchar_t *value) {
  31. if (xuihandle != myxuihandle)
  32. return CUSTOMOBJECT_PARENT::setXuiParam(xuihandle, xmlattributeid, xmlattributename, value);
  33. switch (xmlattributeid) {
  34. case CUSTOMOBJECT_SETGROUP:
  35. setContent(value);
  36. break;
  37. default:
  38. return 0;
  39. }
  40. return 1;
  41. }
  42. // -----------------------------------------------------------------------
  43. void XuiCustomObject::setGroup(const wchar_t *elementname) {
  44. setContent(elementname);
  45. }
  46. // -----------------------------------------------------------------------
  47. void XuiCustomObject::customobject_setRootWnd(ifc_window *w) {
  48. rootwndholder_setRootWnd(NULL);
  49. groupid = L"";
  50. setContent(groupid);
  51. if (w != NULL) rootwndholder_setRootWnd(w);
  52. notifyParent(ChildNotify::AUTOWHCHANGED);
  53. }