utils.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // code viewer utility
  2. exports.viewCode = function(codeFile, mylayout) {
  3. var window = new Atomic.UIWindow();
  4. window.setSettings ( Atomic.UI_WINDOW_SETTINGS_DEFAULT );
  5. window.text = "Code Viewer";
  6. window.load("Scenes/view_code.ui.txt");
  7. var filex = Atomic.cache.getFile(codeFile);
  8. var textx = filex.readText();
  9. filex.close();
  10. window.getWidget("viewCodeText").text = textx;
  11. window.resizeToFitContent();
  12. mylayout.view.addChild(window);
  13. window.center();
  14. window.getWidget("viewCodeOK").onClick = function () {
  15. window.die();
  16. window = null;
  17. };
  18. };
  19. exports.eventReport = function(eventNumber) {
  20. switch ( eventNumber ) {
  21. case 0: return "UI_EVENT_TYPE_CLICK";
  22. case 1: return "UI_EVENT_TYPE_LONG_CLICK";
  23. case 2: return "UI_EVENT_TYPE_POINTER_DOWN";
  24. case 3: return "UI_EVENT_TYPE_POINTER_UP";
  25. case 4: return "UI_EVENT_TYPE_POINTER_MOVE";
  26. case 5: return "UI_EVENT_TYPE_RIGHT_POINTER_DOWN";
  27. case 6: return "UI_EVENT_TYPE_RIGHT_POINTER_UP";
  28. case 7: return "UI_EVENT_TYPE_WHEEL";
  29. case 8: return "UI_EVENT_TYPE_CHANGED";
  30. case 9: return "UI_EVENT_TYPE_KEY_DOWN";
  31. case 10: return "UI_EVENT_TYPE_KEY_UP";
  32. case 11: return "UI_EVENT_TYPE_SHORTCUT";
  33. case 12: return "UI_EVENT_TYPE_CONTEXT_MENU";
  34. case 13: return "UI_EVENT_TYPE_FILE_DROP";
  35. case 14: return "UI_EVENT_TYPE_TAB_CHANGED";
  36. case 15: return "UI_EVENT_TYPE_CUSTOM";
  37. }
  38. return "Unknown";
  39. };