clipboard.go 528 B

123456789101112131415161718192021222324
  1. // clipboard support
  2. package al
  3. /*
  4. #include <stdlib.h>
  5. #include <allegro5/allegro.h>
  6. #include "helpers.h"
  7. #include "callbacks.h"
  8. */
  9. import "C"
  10. func (disp * Display) ClipboardText() string {
  11. return C.GoString(C.al_get_clipboard_text(disp.toC()))
  12. }
  13. func (disp * Display) ClipboardHasText() bool {
  14. return bool(C.al_clipboard_has_text(disp.toC()))
  15. }
  16. func (disp * Display) SetClipboardText(text string) bool {
  17. ctext := cstr(text) ; defer cstrFree(ctext)
  18. return bool(C.al_set_clipboard_text(disp.toC(), ctext))
  19. }