1
0

xuigradientwnd.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #include <precomp.h>
  2. #include "xuigradientwnd.h"
  3. #ifndef _WASABIRUNTIME
  4. BEGIN_SERVICES(XuiGradient_Svc);
  5. DECLARE_SERVICE(XuiObjectCreator<GradientWndXuiSvc>);
  6. END_SERVICES(XuiGradient_Svc, _XuiGradient_Svc);
  7. #ifdef _X86_
  8. extern "C" { int _link_GradientXuiSvc; }
  9. #else
  10. extern "C" { int __link_GradientXuiSvc; }
  11. #endif
  12. #endif
  13. enum { P_X1, P_Y1, P_X2, P_Y2, P_POINTS, P_GG };
  14. XMLParamPair XuiGradientWnd::params[] = {
  15. {P_X1, L"GRADIENT_X1"},
  16. {P_Y1, L"GRADIENT_Y1"},
  17. {P_X2, L"GRADIENT_X2"},
  18. {P_Y2, L"GRADIENT_Y2"},
  19. {P_POINTS, L"POINTS"},
  20. {P_GG, L"GAMMAGROUP"},
  21. };
  22. XuiGradientWnd::XuiGradientWnd()
  23. {
  24. myxuihandle = newXuiHandle();
  25. CreateXMLParameters(myxuihandle);
  26. }
  27. void XuiGradientWnd::CreateXMLParameters(int master_handle)
  28. {
  29. //XUIGRADIENTWND_PARENT::CreateXMLParameters(master_handle);
  30. int numParams = sizeof(params) / sizeof(params[0]);
  31. hintNumberOfParams(myxuihandle, numParams);
  32. for (int i = 0;i < numParams;i++)
  33. {
  34. if (params[i].id == P_GG)
  35. addParam(myxuihandle, params[i], XUI_ATTRIBUTE_IMPLIED);
  36. else
  37. addParam(myxuihandle, params[i], XUI_ATTRIBUTE_REQUIRED);
  38. }
  39. }
  40. int XuiGradientWnd::setXuiParam(int xuihandle, int xmlattributeid, const wchar_t *xmlattributename, const wchar_t *value)
  41. {
  42. if (xuihandle != myxuihandle)
  43. return XUIGRADIENTWND_PARENT::setXuiParam(xuihandle, xmlattributeid, xmlattributename, value);
  44. switch (xmlattributeid)
  45. {
  46. case P_X1: setX1((float)WTOF(value)); break;
  47. case P_Y1: setY1((float)WTOF(value)); break;
  48. case P_X2: setX2((float)WTOF(value)); break;
  49. case P_Y2: setY2((float)WTOF(value)); break;
  50. case P_POINTS: setPoints(value); break;
  51. case P_GG: setGammaGroup(value); break;
  52. default:
  53. return 0;
  54. }
  55. invalidate(); // what the hell
  56. return 1;
  57. }