xuihideobject.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include <precomp.h>
  2. #include "xuihideobject.h"
  3. // -----------------------------------------------------------------------
  4. const wchar_t HideObjectXuiObjectStr[] = L"HideObject"; // This is the xml tag
  5. char HideObjectXuiSvcName[] = "HideObject xui object";
  6. XMLParamPair HideObject::params[] = {
  7. { HIDEOBJECT_HIDE, L"HIDE"},
  8. };
  9. // -----------------------------------------------------------------------
  10. HideObject::HideObject() : HIDEOBJECT_PARENT()
  11. {
  12. myxuihandle = newXuiHandle();
  13. CreateXMLParameters(myxuihandle);
  14. }
  15. void HideObject::CreateXMLParameters(int master_handle)
  16. {
  17. //HIDEOBJECT_PARENT::CreateXMLParameters(master_handle);
  18. int numParams = sizeof(params) / sizeof(params[0]);
  19. hintNumberOfParams(myxuihandle, numParams);
  20. for (int i = 0;i < numParams;i++)
  21. addParam(myxuihandle, params[i], XUI_ATTRIBUTE_IMPLIED);
  22. }
  23. // -----------------------------------------------------------------------
  24. int HideObject::setXuiParam(int xuihandle, int xmlattributeid, const wchar_t *xmlattributename, const wchar_t *value) {
  25. if (xuihandle != myxuihandle)
  26. return HIDEOBJECT_PARENT::setXuiParam(xuihandle, xmlattributeid, xmlattributename, value);
  27. switch (xmlattributeid) {
  28. case HIDEOBJECT_HIDE:
  29. actuator_setTarget(value);
  30. break;
  31. default:
  32. return 0;
  33. }
  34. return 1;
  35. }
  36. // -----------------------------------------------------------------------
  37. void HideObject::actuator_onPerform(GuiObject *target) { // guaranteed non NULL
  38. ifc_window *w = target->guiobject_getRootWnd();
  39. if (w != NULL) {
  40. w->setVisible(0);
  41. }
  42. }