| 1 | module clipboard |
| 2 | |
| 3 | // new returns a new `Clipboard` instance allocated on the heap. |
| 4 | // The `Clipboard` resources can be released with `free()` |
| 5 | pub fn new() &Clipboard { |
| 6 | return new_clipboard() |
| 7 | } |
| 8 | |
| 9 | // copy copies `text` into the clipboard. |
| 10 | pub fn (mut cb Clipboard) copy(text string) bool { |
| 11 | return cb.set_text(text) |
| 12 | } |
| 13 | |
| 14 | // paste returns current entry as a `string` from the clipboard. |
| 15 | pub fn (mut cb Clipboard) paste() string { |
| 16 | return cb.get_text() |
| 17 | } |
| 18 | |
| 19 | // clear_all clears the clipboard. |
| 20 | pub fn (mut cb Clipboard) clear_all() { |
| 21 | cb.clear() |
| 22 | } |
| 23 | |
| 24 | // destroy destroys the clipboard and frees its resources. |
| 25 | pub fn (mut cb Clipboard) destroy() { |
| 26 | unsafe { |
| 27 | cb.free() |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | // check_ownership returns `true` if the `Clipboard` has the content ownership. |
| 32 | pub fn (cb Clipboard) check_ownership() bool { |
| 33 | return cb.has_ownership() |
| 34 | } |
| 35 | |
| 36 | // is_available returns `true` if the clipboard is available for use. |
| 37 | pub fn (cb &Clipboard) is_available() bool { |
| 38 | return cb.check_availability() |
| 39 | } |
| 40 | |