Documentation
¶
Index ¶
- Constants
- Variables
- func Register(d Driver)
- type Actor
- type Application
- type ButtonEvent
- type Color
- type ConfigureEvent
- type Driver
- type Eventer
- type Font
- type Fonter
- type GeneralEvent
- type Image
- type Imager
- type KeyboardEvent
- type Menu
- type MenuEvent
- type Menuer
- type MotionEvent
- type Painter
- type Point
- type Rect
- type Size
- type Window
- func (w *Window) Clear()
- func (w *Window) Drop()
- func (w *Window) Fill(rect Rect, color Color)
- func (w *Window) Image(from Point, img *Image)
- func (w *Window) Line(from Point, to Point, color Color)
- func (w *Window) Raise()
- func (w *Window) Show()
- func (w *Window) Size(rect Rect)
- func (w *Window) Text(text string, font *Font, from Point, color Color)
Constants ¶
const ( GeneralEventType int KeyboardEventType ButtonEventType MotionEventType MenuEventType ConfigureEventType )
Event types
const ( ButtonActionPress = 4 ButtonActionDouble = 5 ButtonActionTriple = 6 ButtonActionRelease = 7 )
Button action type
const ( ButtonLeft = 1 ButtonMiddle = 2 ButtonRight = 3 )
Button number
Variables ¶
var ( UnknownEvent = GeneralEvent{Event: 0} DestroyEvent = GeneralEvent{Event: 1} )
Signal events
var ( KeyLeft = KeyboardEvent{Name: "Left"} KeyRight = KeyboardEvent{Name: "Right"} KeyUp = KeyboardEvent{Name: "Up"} KeyDown = KeyboardEvent{Name: "Down"} KeyBackSpace = KeyboardEvent{Rune: 8, Name: "BackSpace"} KeyTab = KeyboardEvent{Rune: 9, Name: "Tab"} KeyEnter = KeyboardEvent{Rune: 13, Name: "Return"} KeyDelete = KeyboardEvent{Rune: 127, Name: "Delete"} )
Keyboard events
var ( KeySave = KeyboardEvent{Rune: 115, Name: "s", Control: true} KeyExit = KeyboardEvent{Rune: 119, Name: "w", Control: true} )
Platform specified keyboard events
Functions ¶
Types ¶
type Application ¶
type Application struct{}
Application represents application top level window
func NewApplication ¶
func NewApplication(rect Rect, title string) *Application
NewApplication creates main application window
func (*Application) Chan ¶ added in v0.1.10
func (app *Application) Chan() <-chan Eventer
func (*Application) Close ¶
func (app *Application) Close()
Close makes invocation of the main loop return
func (*Application) NewMenu ¶ added in v0.1.7
func (app *Application) NewMenu(label string) *Menu
NewMenu returns a new top-level menu node
func (*Application) NewWindow ¶
func (app *Application) NewWindow(rect Rect, color Color) *Window
NewWindow creates new inner window with a specified size and background color
func (*Application) Size ¶
func (app *Application) Size(rect Rect)
Size sets application window size
func (*Application) Title ¶
func (app *Application) Title(title string)
Title sets application window title
type ButtonEvent ¶
ButtonEvent is mouse button event
type Color ¶
type Color struct {
R, G, B int
}
Color represents a 24-bit color, having 8 bits for each of red, green, blue.
type ConfigureEvent ¶ added in v0.1.8
type ConfigureEvent struct {
Size Size
}
Configure event
func (ConfigureEvent) Type ¶ added in v0.1.8
func (e ConfigureEvent) Type() int
Type returns event type
type Driver ¶
type Driver interface {
Init()
Done()
Title(title string)
Size(rect Rect)
NewWindow(rect Rect, color Color) Painter
NewFont(font *Font) (Fonter, error)
NewImage(img *Image) (Imager, error)
NewMenu(label string) Menuer
Chan() <-chan Eventer
}
Driver is the interface to a application level functions
type Eventer ¶
type Eventer interface {
Type() int
}
Eventer is the interface that groups GUI events
type Font ¶
type Font struct {
Fonter Fonter
Height int
Baseline int
Ascent int
Descent int
Attr map[string]string
}
Font represents a font selection
type GeneralEvent ¶
type GeneralEvent struct {
Event int
}
GeneralEvent is a general purpose notification
type Image ¶
Image represents a draw-ready image
type KeyboardEvent ¶
KeyboardEvent is a keyboard event
func (KeyboardEvent) IsGraphic ¶
func (e KeyboardEvent) IsGraphic() bool
IsGraphic tests printable rune
type Menu ¶ added in v0.1.7
type Menu struct {
// contains filtered or unexported fields
}
Menu represents any menu node
type MenuEvent ¶ added in v0.1.7
type MenuEvent struct {
Action string
}
MenuEvent is menu action event
func NewMenuEvent ¶ added in v0.1.7
NewMenuEvent returns a menu action event
type MotionEvent ¶
MotionEvent is mouse motion event
type Painter ¶
type Painter interface {
Drop()
Size(rect Rect)
Raise()
Clear()
Show()
Fill(rect Rect, color Color)
Line(from Point, to Point, color Color)
Image(from Point, img *Image)
Text(text string, font *Font, from Point, color Color)
}
Painter is the interface to a window functions
type Point ¶
type Point struct {
X, Y int
}
A Point is an X, Y coordinate pair. The axes increase right and down.
type Rect ¶
A Rect contains the upper left corner coordinates and rectangle size.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window represents inner window
func (*Window) Drop ¶
func (w *Window) Drop()
Drop deletes window Note that a dropped window can no longer be used
