Sander Schobers
71cdc234ee
- Default implementation only copies to application memory. Is open for using external implementation.
24 lines
390 B
Go
24 lines
390 B
Go
package ui
|
|
|
|
type Clipboard interface {
|
|
WriteText(t string) error
|
|
ReadText() (string, error)
|
|
}
|
|
|
|
var DefaultClipboard Clipboard = &clipboard{}
|
|
|
|
func SetClipboard(c Clipboard) { DefaultClipboard = c }
|
|
|
|
type clipboard struct {
|
|
value string
|
|
}
|
|
|
|
func (c *clipboard) WriteText(t string) error {
|
|
c.value = t
|
|
return nil
|
|
}
|
|
|
|
func (c *clipboard) ReadText() (string, error) {
|
|
return c.value, nil
|
|
}
|