shadesizepos.m 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <lib/std.mi>
  2. #include "attribs.m"
  3. Function updateLinkage(int type);
  4. System.onScriptLoaded() {
  5. initAttribs();
  6. if (windowshade_linkall_attrib.getData() == "1") windowshade_linkall_attrib.onDataChanged();
  7. if (windowshade_linkposition_attrib.getData() == "1") windowshade_linkposition_attrib.onDataChanged();
  8. if (windowshade_linknone_attrib.getData() == "1") windowshade_linknone_attrib.onDataChanged();
  9. }
  10. windowshade_linkall_attrib.onDataChanged() {
  11. if (getData() == "1") updateLinkage(2);
  12. }
  13. windowshade_linkposition_attrib.onDataChanged() {
  14. if (getData() == "1") updateLinkage(1);
  15. }
  16. windowshade_linknone_attrib.onDataChanged() {
  17. if (getData() == "1") updateLinkage(0);
  18. }
  19. updateLinkage(int type) {
  20. Layout shade = getScriptGroup().getParentLayout();
  21. Layout normal = shade.getContainer().getLayout("normal");
  22. if (type == 0) {
  23. shade.setXmlParam("unlinked", "1");
  24. shade.setXmlParam("linkwidth", "");
  25. normal.setXmlParam("linkwidth", "");
  26. } else if (type == 1) {
  27. shade.setXmlParam("unlinked", "0");
  28. shade.setXmlParam("linkwidth", "");
  29. normal.setXmlParam("linkwidth", "");
  30. } else if (type == 2) {
  31. shade.setXmlParam("unlinked", "0");
  32. shade.setXmlParam("linkwidth", "normal");
  33. normal.setXmlParam("linkwidth", "shade");
  34. }
  35. }