xuiaddparams.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <precomp.h>
  2. #include "xuiaddparams.h"
  3. #include <api/script/scriptguid.h>
  4. // -----------------------------------------------------------------------
  5. const wchar_t AddParamsXuiObjectStr[] = L"AddParams"; // This is the xml tag
  6. char AddParamsXuiSvcName[] = "AddParams xui object";
  7. // -----------------------------------------------------------------------
  8. AddParams::AddParams():myxuihandle(0) {
  9. }
  10. // -----------------------------------------------------------------------
  11. AddParams::~AddParams() {
  12. pastlist.deleteAll();
  13. }
  14. // -----------------------------------------------------------------------
  15. int AddParams::setXmlParam(const wchar_t *param, const wchar_t *value)
  16. {
  17. int r = ADDPARAMS_PARENT::setXmlParam(param, value);
  18. if (!WCSCASEEQLSAFE(param, L"group") && !WCSCASEEQLSAFE(param, L"target")) {
  19. Pair<StringW, StringW> *pair = new Pair<StringW, StringW>(param, value);
  20. pastlist.addItem(pair);
  21. }
  22. return r;
  23. }
  24. // -----------------------------------------------------------------------
  25. void AddParams::actuator_onPerform(GuiObject *target) { // guaranteed non NULL
  26. ADDPARAMS_PARENT::actuator_onPerform(target);
  27. XmlObject *xtarget = static_cast<XmlObject *>(target->guiobject_getScriptObject()->vcpu_getInterface(xmlObjectGuid));
  28. foreach(pastlist)
  29. const wchar_t *a = pastlist.getfor()->a;
  30. int xp = xtarget->getXmlParam(a);
  31. StringW newval((xp == -1) ? L"" : xtarget->getXmlParamValue(xp));
  32. newval.cat(pastlist.getfor()->b);
  33. xtarget->setXmlParam(a, newval);
  34. endfor;
  35. }