Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b00a7302b4 | |||
| 48fe7ef5e1 | |||
| bb07363c89 | |||
| 41d3cd8729 | |||
| c7c6fd2894 | |||
| a5ba4cd855 |
@@ -5,7 +5,7 @@ import "image"
|
||||
import "errors"
|
||||
|
||||
type Backend interface {
|
||||
NewWindow (image.Rectangle) MainWindow
|
||||
NewWindow (image.Rectangle) (MainWindow, error)
|
||||
NewBox () Box
|
||||
NewTextBox () TextBox
|
||||
NewCanvasBox () CanvasBox
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Canvas defines a standard interface for images that support drawing
|
||||
// primitives.
|
||||
package canvas
|
||||
|
||||
import "image"
|
||||
@@ -30,8 +32,11 @@ type StrokeAlign int; const (
|
||||
// have multiple pens associated with it, each maintaining their own drawing
|
||||
// context.
|
||||
type Pen interface {
|
||||
// Draw draws a path
|
||||
Draw (points ...image.Point)
|
||||
// Rectangle draws a rectangle
|
||||
Rectangle (image.Rectangle)
|
||||
|
||||
// Path draws a path
|
||||
Path (points ...image.Point)
|
||||
|
||||
Closed (bool) // if the path is closed
|
||||
Cap (Cap) // line cap stype
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Package event provides a system for broadcasting events to multiple event
|
||||
// handlers.
|
||||
package event
|
||||
|
||||
// A cookie is returned when you add an event handler so you can remove it
|
||||
|
||||
@@ -93,15 +93,16 @@ type ContainerBox interface {
|
||||
|
||||
type Window interface {
|
||||
SetRoot (Object)
|
||||
SetTitle (string)
|
||||
SetIcon (sizes []image.Image)
|
||||
NewMenu (image.Rectangle) (Window, error)
|
||||
NewModal (image.Rectangle) (Window, error)
|
||||
Widget () (Window, error)
|
||||
Copy (data.Data)
|
||||
Paste (callback func (data.Data, error), accept ...data.Mime)
|
||||
Close ()
|
||||
Show ()
|
||||
Hide ()
|
||||
Close ()
|
||||
OnClose (func ()) event.Cookie
|
||||
}
|
||||
|
||||
|
||||
4
tomo.go
4
tomo.go
@@ -9,6 +9,8 @@ var backend Backend
|
||||
// event loop in that order. This function blocks until Stop is called, or the
|
||||
// backend experiences a fatal error.
|
||||
func Run (callback func ()) error {
|
||||
loadPlugins()
|
||||
|
||||
if backend != nil {
|
||||
return errors.New("there is already a backend running")
|
||||
}
|
||||
@@ -33,7 +35,7 @@ func Stop () {
|
||||
backend = nil
|
||||
}
|
||||
|
||||
func NewWindow (bounds image.Rectangle) MainWindow {
|
||||
func NewWindow (bounds image.Rectangle) (MainWindow, error) {
|
||||
assertBackend()
|
||||
return backend.NewWindow(bounds)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user