ui_stub.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #define HL_NAME(n) ui_##n
  2. #include <hl.h>
  3. #ifndef HL_WIN
  4. #include <unistd.h>
  5. #endif
  6. #define wref void
  7. #define vsentinel void
  8. HL_PRIM void HL_NAME(ui_init)() {
  9. }
  10. HL_PRIM int HL_NAME(ui_dialog)( const uchar *title, const uchar *message, int flags ) {
  11. uprintf(USTR("[DIALOG] [%s]"), title);
  12. uprintf(USTR(" %s\n"), title);
  13. return 0;
  14. }
  15. HL_PRIM wref *HL_NAME(ui_winlog_new)( const uchar *title, int width, int height ) {
  16. return NULL;
  17. }
  18. HL_PRIM wref *HL_NAME(ui_button_new)( wref *w, const uchar *txt, vclosure *callb ) {
  19. return NULL;
  20. }
  21. HL_PRIM void HL_NAME(ui_winlog_set_text)( wref *w, const uchar *txt, bool autoScroll ) {
  22. }
  23. HL_PRIM void HL_NAME(ui_win_set_text)( wref *w, const uchar *txt ) {
  24. }
  25. HL_PRIM void HL_NAME(ui_win_set_enable)( wref *w, bool enable ) {
  26. }
  27. HL_PRIM void HL_NAME(ui_win_destroy)( wref *w ) {
  28. }
  29. HL_PRIM int HL_NAME(ui_loop)( bool blocking ) {
  30. return 1;
  31. }
  32. HL_PRIM void HL_NAME(ui_stop_loop)() {
  33. // TODO ?
  34. }
  35. HL_PRIM vsentinel *HL_NAME(ui_start_sentinel)( double timeout, vclosure *c ) {
  36. return NULL;
  37. }
  38. HL_PRIM void HL_NAME(ui_sentinel_tick)( vsentinel *s ) {
  39. }
  40. HL_PRIM void HL_NAME(ui_sentinel_pause)( vsentinel *s, bool pause ) {
  41. }
  42. HL_PRIM bool HL_NAME(ui_sentinel_is_paused)( vsentinel *s ) {
  43. return false;
  44. }
  45. HL_PRIM void HL_NAME(ui_close_console)() {
  46. }
  47. HL_PRIM vbyte *HL_NAME(ui_choose_file)( bool forSave, vdynamic *options ) {
  48. return NULL;
  49. }
  50. HL_PRIM bool HL_NAME(ui_set_clipboard_text)(char* text) {
  51. return false;
  52. }
  53. HL_PRIM vbyte* HL_NAME(ui_get_clipboard_text)() {
  54. return NULL;
  55. }
  56. #define _WIN _ABSTRACT(ui_window)
  57. #define _SENTINEL _ABSTRACT(ui_sentinel)
  58. DEFINE_PRIM(_VOID, ui_init, _NO_ARG);
  59. DEFINE_PRIM(_I32, ui_dialog, _BYTES _BYTES _I32);
  60. DEFINE_PRIM(_WIN, ui_winlog_new, _BYTES _I32 _I32);
  61. DEFINE_PRIM(_WIN, ui_button_new, _WIN _BYTES _FUN(_VOID,_NO_ARG));
  62. DEFINE_PRIM(_VOID, ui_winlog_set_text, _WIN _BYTES _BOOL);
  63. DEFINE_PRIM(_VOID, ui_win_set_text, _WIN _BYTES);
  64. DEFINE_PRIM(_VOID, ui_win_set_enable, _WIN _BOOL);
  65. DEFINE_PRIM(_VOID, ui_win_destroy, _WIN);
  66. DEFINE_PRIM(_I32, ui_loop, _BOOL);
  67. DEFINE_PRIM(_VOID, ui_stop_loop, _NO_ARG);
  68. DEFINE_PRIM(_VOID, ui_close_console, _NO_ARG);
  69. DEFINE_PRIM(_SENTINEL, ui_start_sentinel, _F64 _FUN(_VOID,_NO_ARG));
  70. DEFINE_PRIM(_VOID, ui_sentinel_tick, _SENTINEL);
  71. DEFINE_PRIM(_VOID, ui_sentinel_pause, _SENTINEL _BOOL);
  72. DEFINE_PRIM(_BOOL, ui_sentinel_is_paused, _SENTINEL);
  73. DEFINE_PRIM(_BYTES, ui_choose_file, _BOOL _DYN);
  74. DEFINE_PRIM(_BOOL, ui_set_clipboard_text, _BYTES);
  75. DEFINE_PRIM(_BYTES, ui_get_clipboard_text, _NO_ARG);