1
0

standardframe.m 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #include <lib/std.mi>
  2. Global Group frameGroup, content, titlebar;
  3. Global String x, y, w, h, rx, ry, rw, rh;
  4. Global Layer mouselayer;
  5. Global Button Sysmenu;
  6. Function setNewGroup(String groupid);
  7. System.onScriptLoaded() {
  8. frameGroup = getScriptGroup();
  9. String param = getParam();
  10. x = getToken(param, ",", 0);
  11. y = getToken(param, ",", 1);
  12. w = getToken(param, ",", 2);
  13. h = getToken(param, ",", 3);
  14. rx = getToken(param, ",", 4);
  15. ry = getToken(param, ",", 5);
  16. rw = getToken(param, ",", 6);
  17. rh = getToken(param, ",", 7);
  18. sysmenu = frameGroup.findObject("sysmenu");
  19. }
  20. System.onSetXuiParam(String param, String value) {
  21. if (param == "content") {
  22. setNewGroup(value);
  23. titlebar = frameGroup.findObject("wasabi.titlebar");
  24. mouselayer = titlebar.findObject("mousetrap");
  25. }
  26. if (param == "padtitleright" || param == "padtitleleft") {
  27. if (titlebar != NULL) titlebar.setXmlParam(param, value);
  28. }
  29. if (param == "shade") {
  30. if (mouselayer != NULL) mouselayer.setXmlParam("dblclickaction", "switch;"+value);
  31. else messagebox("Cannot set shade parameter for StandardFrame object, no mousetrap found", "Skin Error", 0, "");
  32. }
  33. }
  34. // backward compatibility for prerelease notify trick
  35. frameGroup.onNotify(String cmd, String param, int a, int b) {
  36. String _command = getToken(cmd, ",", 0);
  37. String _param = getToken(cmd, ",", 1);
  38. if (_command == "content" || _command == "padtitleright" || _command == "padtitleleft" || _command == "shade") {
  39. onSetXuiParam(_command, _param);
  40. }
  41. }
  42. setNewGroup(String groupid) {
  43. content = newGroup(groupid);
  44. if (content == NULL) {
  45. messagebox("group \"" + groupid + "\" not found", "ButtonGroup", 0, "");
  46. return;
  47. }
  48. content.setXmlParam("x", x);
  49. content.setXmlParam("y", y);
  50. content.setXmlParam("w", w);
  51. content.setXmlParam("h", h);
  52. content.setXmlParam("relatx", rx);
  53. content.setXmlParam("relaty", ry);
  54. content.setXmlParam("relatw", rw);
  55. content.setXmlParam("relath", rh);
  56. content.init(frameGroup);
  57. }
  58. Sysmenu.onLeftClick() {
  59. LayoutStatus _status = frameGroup.findObject("sysmenu.status");
  60. _status.callme("{system}");
  61. }