clipboard #14
@ -1,13 +1,13 @@
|
|||||||
package elements
|
package elements
|
||||||
|
|
||||||
|
import "io"
|
||||||
import "image"
|
import "image"
|
||||||
|
import "git.tebibyte.media/sashakoshka/tomo/data"
|
||||||
|
|
||||||
// Window represents a top-level container generated by the currently running
|
// Window represents a top-level container generated by the currently running
|
||||||
// backend. It can contain a single element. It is hidden by default, and must
|
// backend. It can contain a single element. It is hidden by default, and must
|
||||||
// be explicitly shown with the Show() method.
|
// be explicitly shown with the Show() method.
|
||||||
type Window interface {
|
type Window interface {
|
||||||
Parent
|
|
||||||
|
|
||||||
// Adopt sets the root element of the window. There can only be one of
|
// Adopt sets the root element of the window. There can only be one of
|
||||||
// these at one time.
|
// these at one time.
|
||||||
Adopt (Element)
|
Adopt (Element)
|
||||||
@ -28,6 +28,15 @@ type Window interface {
|
|||||||
// NewModal creates a new modal dialog window.
|
// NewModal creates a new modal dialog window.
|
||||||
NewModal (width, height int) (window Window, err error)
|
NewModal (width, height int) (window Window, err error)
|
||||||
|
|
||||||
|
// Copy puts data into the clipboard.
|
||||||
|
Copy (data.Data)
|
||||||
|
|
||||||
|
// Paste requests the data currently in the clipboard. When the data is
|
||||||
|
// available, it is sent on the returned channel. If there is no data on
|
||||||
|
// the clipboard matching the requested mime type, the channel will be
|
||||||
|
// sent nil.
|
||||||
|
Paste (accept data.Mime) <- chan io.Reader
|
||||||
|
|
||||||
// Show shows the window. The window starts off hidden, so this must be
|
// Show shows the window. The window starts off hidden, so this must be
|
||||||
// called after initial setup to make sure it is visible.
|
// called after initial setup to make sure it is visible.
|
||||||
Show ()
|
Show ()
|
||||||
|
14
tomo.go
14
tomo.go
@ -4,7 +4,6 @@ import "os"
|
|||||||
import "io"
|
import "io"
|
||||||
import "path/filepath"
|
import "path/filepath"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/dirs"
|
import "git.tebibyte.media/sashakoshka/tomo/dirs"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/data"
|
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/theme"
|
import "git.tebibyte.media/sashakoshka/tomo/theme"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/config"
|
import "git.tebibyte.media/sashakoshka/tomo/config"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
||||||
@ -47,19 +46,6 @@ func NewWindow (width, height int) (window elements.MainWindow, err error) {
|
|||||||
return backend.NewWindow(width, height)
|
return backend.NewWindow(width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy puts data into the clipboard.
|
|
||||||
func Copy (data data.Data) {
|
|
||||||
assertBackend()
|
|
||||||
backend.Copy(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Paste returns the data currently in the clipboard. This method may
|
|
||||||
// return nil.
|
|
||||||
func Paste (accept []data.Mime) (data.Data) {
|
|
||||||
assertBackend()
|
|
||||||
return backend.Paste(accept)
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTheme sets the theme of all open windows.
|
// SetTheme sets the theme of all open windows.
|
||||||
func SetTheme (theme theme.Theme) {
|
func SetTheme (theme theme.Theme) {
|
||||||
backend.SetTheme(theme)
|
backend.SetTheme(theme)
|
||||||
|
Reference in New Issue
Block a user