Documentation ¶
Index ¶
- Constants
- Variables
- func ClearPaint(gc draw2d.GraphicContext)
- func GetFontHeight(fd draw2d.FontData, size float64) (height float64)
- func RectangleForRect(b geom.Rect) (r image.Rectangle)
- func RegisterPaint(path string, dg PaintGen)
- func RenderString(text string, fd draw2d.FontData, size float64, color color.Color) (buffer image.Image)
- func Report(args ...interface{})
- func SubscriptionQueue(cap int) (in chan<- interface{}, out <-chan interface{}, sub chan<- Subscription)
- func TimeSinceStart() (dur time.Duration)
- func ZeroRGBA(rgba *image.RGBA)
- type Block
- func (b *Block) Bounds() geom.Rect
- func (b *Block) DoPaint(gc draw2d.GraphicContext)
- func (b *Block) DoResizeEvent(e ResizeEvent)
- func (b *Block) Draw(buffer draw.Image, invalidRects RectSet)
- func (b *Block) HandleEvent(e interface{})
- func (b *Block) Initialize()
- func (b *Block) Invalidate(areas ...geom.Rect)
- func (b *Block) SetSizeHint(sh SizeHint)
- type BlockID
- type BlockInvalidation
- type BlockSizeHint
- type CloseEvent
- type Drawer
- type DropChan
- type Event
- type Filter
- type Foundation
- func (f *Foundation) AddBlock(b *Block)
- func (f *Foundation) BlocksForCoord(p geom.Coord) (bs []*Block)
- func (f *Foundation) DoBlockInvalidation(e BlockInvalidation)
- func (f *Foundation) DoCloseEvent(e CloseEvent)
- func (f *Foundation) DoKeyEvent(e interface{})
- func (f *Foundation) DoKeyFocusEvent(e KeyFocusEvent)
- func (f *Foundation) DoMouseDownEvent(e MouseDownEvent)
- func (f *Foundation) DoMouseDraggedEvent(e MouseDraggedEvent)
- func (f *Foundation) DoMouseMovedEvent(e MouseMovedEvent)
- func (f *Foundation) DoMouseUpEvent(e MouseUpEvent)
- func (f *Foundation) Draw(buffer draw.Image, invalidRects RectSet)
- func (f *Foundation) HandleEvent(e interface{})
- func (f *Foundation) HandleEvents()
- func (f *Foundation) Initialize()
- func (f *Foundation) InvokeOnBlocksUnder(p geom.Coord, foo func(*Block))
- func (f *Foundation) KeyFocusRequest(e KeyFocusRequest)
- func (f *Foundation) PlaceBlock(b *Block, bounds geom.Rect)
- func (f *Foundation) RemoveBlock(b *Block)
- type Invalidation
- type InvalidationChan
- type KeyDownEvent
- type KeyFocusChan
- type KeyFocusEvent
- type KeyFocusRequest
- type KeyTypedEvent
- type KeyUpEvent
- type MouseDownEvent
- type MouseDraggedEvent
- type MouseEnteredEvent
- type MouseEvent
- type MouseExitedEvent
- type MouseLocator
- type MouseMovedEvent
- type MouseUpEvent
- type PaintFunc
- type PaintGen
- type RectSet
- type ResizeChan
- type ResizeEvent
- type SizeHint
- type SizeHintChan
- type Subscription
- type WindowFoundation
Constants ¶
View Source
const FrameDelay = 16 * time.Millisecond
FrameDelay is how long the window will wait, after receiving an invalidation, to redraw the window. This gives related updates a chance to get ready. If they take too long, they'll just have to wait for the next frame.
View Source
const ReportIDs = false
Variables ¶
View Source
var DefaultFontData = draw2d.FontData{ Name: "Fira Sans Light", Family: draw2d.FontFamilySans, Style: draw2d.FontStyleNormal, }
View Source
var StartTime = time.Now()
View Source
var WindowGenerator func(parent wde.Window, width, height int) (window wde.Window, err error)
Functions ¶
func ClearPaint ¶
func ClearPaint(gc draw2d.GraphicContext)
func RegisterPaint ¶
func RenderString ¶
func SubscriptionQueue ¶
func SubscriptionQueue(cap int) (in chan<- interface{}, out <-chan interface{}, sub chan<- Subscription)
func TimeSinceStart ¶
Types ¶
type Block ¶
type Block struct { ID BlockID Parent *Foundation UserEventsIn DropChan UserEvents <-chan interface{} ResizeEvents ResizeChan Subscribe chan<- Subscription Drawer Paint func(gc draw2d.GraphicContext) Invalidations InvalidationChan SizeHints SizeHintChan HasKeyFocus bool // size of block Size geom.Coord // contains filtered or unexported fields }
The Block type is a basic unit that can receive events and draw itself.
This struct essentially defines an interface, except a synchronous interface based on channels rather than an asynchronous interface based on method calls.
func (*Block) DoPaint ¶
func (b *Block) DoPaint(gc draw2d.GraphicContext)
func (*Block) DoResizeEvent ¶
func (b *Block) DoResizeEvent(e ResizeEvent)
func (*Block) HandleEvent ¶
func (b *Block) HandleEvent(e interface{})
func (*Block) Initialize ¶
func (b *Block) Initialize()
func (*Block) Invalidate ¶
func (*Block) SetSizeHint ¶
type BlockInvalidation ¶
type BlockInvalidation struct { Invalidation Block *Block }
type BlockSizeHint ¶
type CloseEvent ¶
type CloseEvent struct { Event wde.CloseEvent }
type DropChan ¶
type DropChan chan<- interface{}
func (DropChan) SendOrDrop ¶
func (ch DropChan) SendOrDrop(e interface{})
type Foundation ¶
type Foundation struct { Block DrawOp draw.Op Children map[*Block]bool ChildrenHints map[*Block]SizeHint BlockSizeHints chan BlockSizeHint BlockInvalidations chan BlockInvalidation DragOriginBlocks map[wde.Button][]*Block // this block currently has keyboard priority KeyFocus *Block // contains filtered or unexported fields }
The foundation type is for channeling events to children, and passing along draw calls.
func (*Foundation) AddBlock ¶
func (f *Foundation) AddBlock(b *Block)
func (*Foundation) BlocksForCoord ¶
func (f *Foundation) BlocksForCoord(p geom.Coord) (bs []*Block)
func (*Foundation) DoBlockInvalidation ¶
func (f *Foundation) DoBlockInvalidation(e BlockInvalidation)
func (*Foundation) DoCloseEvent ¶
func (f *Foundation) DoCloseEvent(e CloseEvent)
func (*Foundation) DoKeyEvent ¶
func (f *Foundation) DoKeyEvent(e interface{})
func (*Foundation) DoKeyFocusEvent ¶
func (f *Foundation) DoKeyFocusEvent(e KeyFocusEvent)
func (*Foundation) DoMouseDownEvent ¶
func (f *Foundation) DoMouseDownEvent(e MouseDownEvent)
func (*Foundation) DoMouseDraggedEvent ¶
func (f *Foundation) DoMouseDraggedEvent(e MouseDraggedEvent)
func (*Foundation) DoMouseMovedEvent ¶
func (f *Foundation) DoMouseMovedEvent(e MouseMovedEvent)
func (*Foundation) DoMouseUpEvent ¶
func (f *Foundation) DoMouseUpEvent(e MouseUpEvent)
func (*Foundation) HandleEvent ¶
func (f *Foundation) HandleEvent(e interface{})
func (*Foundation) HandleEvents ¶
func (f *Foundation) HandleEvents()
dispense events to children, as appropriate
func (*Foundation) Initialize ¶
func (f *Foundation) Initialize()
func (*Foundation) InvokeOnBlocksUnder ¶
func (f *Foundation) InvokeOnBlocksUnder(p geom.Coord, foo func(*Block))
func (*Foundation) KeyFocusRequest ¶
func (f *Foundation) KeyFocusRequest(e KeyFocusRequest)
func (*Foundation) PlaceBlock ¶
func (f *Foundation) PlaceBlock(b *Block, bounds geom.Rect)
func (*Foundation) RemoveBlock ¶
func (f *Foundation) RemoveBlock(b *Block)
type Invalidation ¶
type InvalidationChan ¶
type InvalidationChan chan Invalidation
func (InvalidationChan) Stack ¶
func (ch InvalidationChan) Stack(e Invalidation)
type KeyDownEvent ¶
type KeyDownEvent struct { Event wde.KeyDownEvent }
type KeyFocusChan ¶
type KeyFocusChan chan *Block
func (KeyFocusChan) Stack ¶
func (ch KeyFocusChan) Stack(b *Block)
type KeyFocusEvent ¶
type KeyFocusEvent struct {
Focus bool
}
type KeyFocusRequest ¶
type KeyFocusRequest struct {
Block *Block
}
type KeyTypedEvent ¶
type KeyTypedEvent struct { Event wde.KeyTypedEvent }
type KeyUpEvent ¶
type KeyUpEvent struct { Event wde.KeyUpEvent }
type MouseDownEvent ¶
type MouseDownEvent struct { Event wde.MouseDownEvent MouseLocator }
type MouseDraggedEvent ¶
type MouseDraggedEvent struct { Event wde.MouseDraggedEvent MouseLocator From geom.Coord }
type MouseEnteredEvent ¶
type MouseEnteredEvent struct { Event wde.MouseEnteredEvent MouseLocator From geom.Coord }
type MouseEvent ¶
type MouseExitedEvent ¶
type MouseExitedEvent struct { Event wde.MouseExitedEvent MouseLocator From geom.Coord }
type MouseLocator ¶
func (*MouseLocator) Translate ¶
func (e *MouseLocator) Translate(offset geom.Coord)
func (*MouseLocator) Where ¶
func (e *MouseLocator) Where() geom.Coord
type MouseMovedEvent ¶
type MouseMovedEvent struct { Event wde.MouseMovedEvent MouseLocator From geom.Coord }
type MouseUpEvent ¶
type MouseUpEvent struct { Event wde.MouseUpEvent MouseLocator }
type ResizeChan ¶
type ResizeChan chan ResizeEvent
func (ResizeChan) Stack ¶
func (ch ResizeChan) Stack(e ResizeEvent)
type ResizeEvent ¶
type SizeHintChan ¶
type SizeHintChan chan SizeHint
func (SizeHintChan) Stack ¶
func (ch SizeHintChan) Stack(sh SizeHint)
type Subscription ¶
type Subscription struct { Filter Filter Ch chan<- interface{} }
type WindowFoundation ¶
type WindowFoundation struct { Foundation W wde.Window // contains filtered or unexported fields }
A foundation that wraps a wde.Window
func NewWindow ¶
func NewWindow(parent wde.Window, width, height int) (wf *WindowFoundation, err error)
func (*WindowFoundation) HandleEvents ¶
func (wf *WindowFoundation) HandleEvents()
func (*WindowFoundation) Initialize ¶
func (wf *WindowFoundation) Initialize()
func (*WindowFoundation) SetPane ¶
func (wf *WindowFoundation) SetPane(b *Block)
func (*WindowFoundation) Show ¶
func (wf *WindowFoundation) Show()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.