2019-11-17 05:40:03 +03:00
|
|
|
module clipboard
|
|
|
|
|
|
|
|
// create a new clipboard
|
|
|
|
pub fn new() &Clipboard {
|
|
|
|
return new_clipboard()
|
|
|
|
}
|
|
|
|
|
|
|
|
// copy some text into the clipboard
|
2020-05-17 14:51:18 +03:00
|
|
|
pub fn (mut cb Clipboard) copy(text string) bool {
|
2019-11-17 05:40:03 +03:00
|
|
|
return cb.set_text(text)
|
|
|
|
}
|
|
|
|
|
|
|
|
// get the text from the clipboard
|
2020-05-17 14:51:18 +03:00
|
|
|
pub fn (mut cb Clipboard) paste() string {
|
2019-11-17 05:40:03 +03:00
|
|
|
return cb.get_text()
|
|
|
|
}
|
|
|
|
|
|
|
|
// clear the clipboard
|
2020-05-17 14:51:18 +03:00
|
|
|
pub fn (mut cb Clipboard) clear_all() {
|
2019-11-17 05:40:03 +03:00
|
|
|
cb.clear()
|
2019-12-07 15:22:28 +03:00
|
|
|
}
|
2019-11-17 05:40:03 +03:00
|
|
|
|
|
|
|
// destroy the clipboard
|
2020-05-17 14:51:18 +03:00
|
|
|
pub fn (mut cb Clipboard) destroy() {
|
2019-11-17 05:40:03 +03:00
|
|
|
cb.free()
|
|
|
|
}
|
|
|
|
|
|
|
|
// check if we own the clipboard
|
2019-12-06 23:02:09 +03:00
|
|
|
pub fn (cb Clipboard) check_ownership() bool {
|
2019-11-17 05:40:03 +03:00
|
|
|
return cb.has_ownership()
|
|
|
|
}
|
|
|
|
|
|
|
|
// check if clipboard can be used
|
|
|
|
pub fn (cb &Clipboard) is_available() bool {
|
|
|
|
return cb.check_availability()
|
|
|
|
}
|