DummyCore.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. require "Polycode/Core"
  2. class "DummyCore" (Core)
  3. function DummyCore:DummyCore(...)
  4. local arg = {...}
  5. if type(arg[1]) == "table" and count(arg) == 1 then
  6. if ""..arg[1].__classname == "Core" then
  7. self.__ptr = arg[1].__ptr
  8. return
  9. end
  10. end
  11. for k,v in pairs(arg) do
  12. if type(v) == "table" then
  13. if v.__ptr ~= nil then
  14. arg[k] = v.__ptr
  15. end
  16. end
  17. end
  18. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  19. self.__ptr = Polycode.DummyCore(unpack(arg))
  20. end
  21. end
  22. function DummyCore:systemUpdate()
  23. local retVal = Polycode.DummyCore_systemUpdate(self.__ptr)
  24. return retVal
  25. end
  26. function DummyCore:setCursor(cursorType)
  27. local retVal = Polycode.DummyCore_setCursor(self.__ptr, cursorType)
  28. end
  29. function DummyCore:copyStringToClipboard(str)
  30. local retVal = Polycode.DummyCore_copyStringToClipboard(self.__ptr, str)
  31. end
  32. function DummyCore:getClipboardString()
  33. local retVal = Polycode.DummyCore_getClipboardString(self.__ptr)
  34. return retVal
  35. end
  36. function DummyCore:createFolder(folderPath)
  37. local retVal = Polycode.DummyCore_createFolder(self.__ptr, folderPath)
  38. end
  39. function DummyCore:copyDiskItem(itemPath, destItemPath)
  40. local retVal = Polycode.DummyCore_copyDiskItem(self.__ptr, itemPath, destItemPath)
  41. end
  42. function DummyCore:moveDiskItem(itemPath, destItemPath)
  43. local retVal = Polycode.DummyCore_moveDiskItem(self.__ptr, itemPath, destItemPath)
  44. end
  45. function DummyCore:removeDiskItem(itemPath)
  46. local retVal = Polycode.DummyCore_removeDiskItem(self.__ptr, itemPath)
  47. end
  48. function DummyCore:openFolderPicker()
  49. local retVal = Polycode.DummyCore_openFolderPicker(self.__ptr)
  50. return retVal
  51. end
  52. function DummyCore:openFilePicker(extensions, allowMultiple)
  53. local retVal = Polycode.DummyCore_openFilePicker(self.__ptr, extensions.__ptr, allowMultiple)
  54. if retVal == nil then return nil end
  55. for i=1,count(retVal) do
  56. local __c = _G["String"]("__skip_ptr__")
  57. __c.__ptr = retVal[i]
  58. retVal[i] = __c
  59. end
  60. return retVal
  61. end
  62. function DummyCore:saveFilePicker(extensions)
  63. local retVal = Polycode.DummyCore_saveFilePicker(self.__ptr, extensions.__ptr)
  64. return retVal
  65. end
  66. function DummyCore:flushRenderContext()
  67. local retVal = Polycode.DummyCore_flushRenderContext(self.__ptr)
  68. end
  69. function DummyCore:openURL(url)
  70. local retVal = Polycode.DummyCore_openURL(self.__ptr, url)
  71. end
  72. function DummyCore:getTicks()
  73. local retVal = Polycode.DummyCore_getTicks(self.__ptr)
  74. return retVal
  75. end
  76. function DummyCore:executeExternalCommand(command, args, inDirectory)
  77. local retVal = Polycode.DummyCore_executeExternalCommand(self.__ptr, command, args, inDirectory)
  78. return retVal
  79. end
  80. function DummyCore:systemParseFolder(pathString, showHidden, targetVector)
  81. local retVal = Polycode.DummyCore_systemParseFolder(self.__ptr, pathString, showHidden, targetVector.__ptr)
  82. return retVal
  83. end
  84. function DummyCore:__delete()
  85. if self then Polycode.delete_DummyCore(self.__ptr) end
  86. end