system.macos.bmx 3.2 KB

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