requesters.monkey2 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. Namespace std.requesters
  2. #If __DESKTOP_TARGET__
  3. #Import "native/requesters.h"
  4. #If __TARGET__="macos"
  5. #Import "native/requesters.mm"
  6. #Else
  7. #Import "native/requesters.cpp"
  8. #if __TARGET__="windows"
  9. #Import "<libole32.a>"
  10. #Import "<libComdlg32.a>"
  11. #endif
  12. #endif
  13. Extern
  14. #rem monkeydoc Activates a modal notification dialog.
  15. Notify activates a simple modal dialog informing the user of an event. The optional `serious` flag can be used to indicate a 'critical' event.
  16. #end
  17. Function Notify:Void( title:String,text:String,serious:Bool=False )="bbRequesters::Notify"
  18. #rem monkeydoc Activates a simple modal Yes/No dialog.
  19. Confirm activates a simple modal dialog requesting the user to select between Yes and No options. If the user selects Yes, then Confirm returns true. Otherwise, false is returned.
  20. #end
  21. Function Confirm:Bool( title:String,text:String,serious:Bool=False )="bbRequesters::Confirm"
  22. #rem monkeydoc Activates a modal Yes/No/Cancel dialog.
  23. Proceed activates a simple modal dialog requesting the user to select between Yes, No and Cancel options. If the user selects Yes, then Proceed return 1. If the user selects No, then Proceed returns 0. Otherwise, Proceed returns -1.
  24. #end
  25. Function Proceed:Int( title:String,text:String,serious:Bool=False )="bbRequesters::Proceed"
  26. #rem monkeydoc Activate a modal file requester dialog.
  27. RequestFile activates a modal file requester dialog.
  28. The optional filters string can either be a comma separated list of file extensions or, as in the following example, groups of extensions that begin with a "group:" label and are separated by a semicolon. For example:
  29. "Image files:png,jpg;Audio files:was,ogg;All files:*"
  30. The save parameter should be true to create a save-style requester, false to create a load-style requester.
  31. The `path` parameter can be used to specify an initial file path.
  32. Returns selected file path, or an empty string if dialog was cancelled.
  33. #end
  34. Function RequestFile:String( title:String,filter:String="",save:Bool=False,file:String="" )="bbRequesters::RequestFile"
  35. #rem monkeydoc Activates a modal directory path dialog.
  36. RequestDir activates a modal directory path dialog.
  37. The `dir` parameter can be used to specify an initial directory path.
  38. Returns selected directory path, or an empty string if dialog was cancelled.
  39. #end
  40. Function RequestDir:String( title:String,dir:String="" )="bbRequesters::RequestDir"
  41. #rem monkeydoc Opens a URL using the desktop manager.
  42. Opens a URL using the desktop manager.
  43. The behavior of OpenURL is highly target dependent, but in general it should at least be able to open web pages for you!
  44. #end
  45. Function OpenUrl( url:String )="bbRequesters::OpenUrl"
  46. #else
  47. #rem
  48. #rem monkeydoc @hidden
  49. #end
  50. Function Notify:Void( title:String,text:String,serious:Bool=False )
  51. End
  52. #rem monkeydoc @hidden
  53. #end
  54. Function Confirm:Bool( title:String,text:String,serious:Bool=False )
  55. Return False
  56. End
  57. #rem monkeydoc @hidden
  58. #end
  59. Function RequestFile:String( title:String,filter:String="",save:Bool=False,file:String="" )
  60. Return ""
  61. End
  62. #rem monkeydoc @hidden
  63. #end
  64. Function RequestDir:String( title:String,dir:String="" )
  65. Return ""
  66. End
  67. #rem monkeydoc @hidden
  68. #end
  69. Function OpenUrl( url:String )
  70. End
  71. #end
  72. #Endif