1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/clipboard/clipboard.v

37 lines
695 B
V
Raw Normal View History

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 {
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 {
return cb.get_text()
}
// clear the clipboard
2020-05-17 14:51:18 +03:00
pub fn (mut cb Clipboard) clear_all() {
cb.clear()
}
// destroy the clipboard
2020-05-17 14:51:18 +03:00
pub fn (mut cb Clipboard) destroy() {
cb.free()
}
// check if we own the clipboard
2019-12-06 23:02:09 +03:00
pub fn (cb Clipboard) check_ownership() bool {
return cb.has_ownership()
}
// check if clipboard can be used
pub fn (cb &Clipboard) is_available() bool {
return cb.check_availability()
}