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