system.macos.bmx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. Strict
  2. Import BRL.Event
  3. Import "driver.bmx"
  4. Import "system.macos.m"
  5. Extern
  6. Function bbSystemStartup()
  7. Function bbSystemPoll()
  8. Function bbSystemWait()
  9. Function bbSystemIntr()
  10. Function bbSystemMoveMouse( x,y )
  11. Function bbSystemSetMouseVisible( visible )
  12. Function bbSystemNotify( text$,serious )
  13. Function bbSystemConfirm( text$,serious )
  14. Function bbSystemProceed( text$,serious )
  15. Function bbSystemRequestFile$( text$,exts$,save,file$,dir$ )
  16. Function bbSystemRequestDir$( text$,dir$ )
  17. Function bbOpenURL( url$ )
  18. Function bbSystemPostSyncOp( syncOp( syncInfo:Object,asyncRet ),syncInfo:Object,asyncRet )
  19. Function bbSystemStartAsyncOp( asyncOp( asyncInfo ),asyncInfo,syncOp( syncInfo:Object,asyncRet ),syncInfo:Object )
  20. End Extern
  21. Private
  22. Function Hook:Object( id,data:Object,context:Object )
  23. bbSystemIntr
  24. Return data
  25. End Function
  26. AddHook EmitEventHook,Hook,Null,10000
  27. Public
  28. Type TMacOSSystemDriver Extends TSystemDriver
  29. Method New()
  30. bbSystemStartup
  31. End Method
  32. Method Poll()
  33. bbSystemPoll()
  34. End Method
  35. Method Wait()
  36. bbSystemWait()
  37. End Method
  38. Method MoveMouse( x,y )
  39. bbSystemMoveMouse x,y
  40. End Method
  41. Method SetMouseVisible( visible )
  42. bbSystemSetMouseVisible visible
  43. End Method
  44. Method Notify( text$,serious )
  45. bbSystemNotify text,serious
  46. End Method
  47. Method Confirm( text$,serious )
  48. Return bbSystemConfirm( text,serious )
  49. End Method
  50. Method Proceed( text$,serious )
  51. Return bbSystemProceed( text,serious )
  52. End Method
  53. Method RequestFile$( text$,exts$,save,path$ )
  54. Local file$,dir$,filter$
  55. path=path.Replace( "\","/" )
  56. Local i=path.FindLast( "/" )
  57. If i<>-1
  58. dir=path[..i]
  59. file=path[i+1..]
  60. Else
  61. file=path
  62. EndIf
  63. exts=exts.Replace( ";","," )
  64. While exts
  65. Local p=exts.Find(",")+1
  66. If p=0 p=exts.length
  67. Local q=exts.Find(":")+1
  68. If q=0 Or q>p q=0
  69. filter:+exts[q..p]
  70. exts=exts[p..]
  71. Wend
  72. If filter.find("*")>-1 filter=""
  73. Return bbSystemRequestFile( text,filter,save,file,dir )
  74. End Method
  75. Method RequestDir$( text$,dir$ )
  76. dir=dir.Replace( "\","/" )
  77. Return bbSystemRequestDir( text,dir )
  78. End Method
  79. Method OpenURL( url$ )
  80. ' Return system_( "open "" + url.Replace("~q","") + "~q" )
  81. bbOpenURL( url )
  82. End Method
  83. End Type