Documentation ¶
Index ¶
- Constants
- func Do(v View, f func())
- func DoChan(v View) chan<- func()
- func DrawBezier(ctrlPts ...Point)
- func DrawLine(p1, p2 Point)
- func DrawPoint(p Point)
- func DrawPolygon(pts ...Point)
- func DrawRect(r Rectangle)
- func FillPolygon(pts ...Point)
- func FillRect(r Rectangle)
- func Height(v View) float64
- func Hide(v View)
- func Lower(v View)
- func MouseParent(v View, m MouseEvent)
- func MoveCenter(v View, p Point)
- func MoveOrigin(v View, p Point)
- func NewWindow(self View, title string, init func(w *Window))
- func NumChildren(v View) int
- func Pan(v View, p Point)
- func Quit()
- func Raise(v View)
- func Repaint(v View)
- func Resize(v View, s Point)
- func ResizeToFit(v View, margin float64)
- func Rotate(rot float64)
- func Run(init func()) error
- func SetColor(c Color)
- func SetKeyFocus(v View)
- func SetLineWidth(x float64)
- func SetMouser(m MouserView, button int)
- func SetPointSize(x float64)
- func Show(v View)
- func Width(v View) float64
- type AggregateMouser
- type Clicker
- type Color
- type KeyEvent
- type MouseEvent
- type Mouser
- type MouserView
- type Mover
- type Panner
- type Point
- func Center(v View) Point
- func CenterInParent(v View) Point
- func LineToLine(p, p2, q, q2 Point) (z, z2 Point)
- func Map(p Point, from, to View) Point
- func MapFromParent(p Point, v View) Point
- func MapToParent(p Point, v View) Point
- func PointToLine(p, x, y Point) Point
- func Pos(v View) Point
- func Pt(X, Y float64) Point
- func Size(v View) Point
- func (p Point) Add(q Point) Point
- func (p Point) Angle() float64
- func (p Point) Cross(q Point) float64
- func (p Point) Div(k float64) Point
- func (p Point) Dot(q Point) float64
- func (p Point) Eq(q Point) bool
- func (p Point) In(r Rectangle) bool
- func (p Point) Len() float64
- func (p Point) Mod(r Rectangle) Point
- func (p Point) Mul(k float64) Point
- func (p Point) String() string
- func (p Point) Sub(q Point) Point
- func (p Point) XY() (float64, float64)
- type Rectangle
- func (r Rectangle) Add(p Point) Rectangle
- func (r Rectangle) Canon() Rectangle
- func (r Rectangle) Center() Point
- func (r Rectangle) Dx() float64
- func (r Rectangle) Dy() float64
- func (r Rectangle) Empty() bool
- func (r Rectangle) Eq(s Rectangle) bool
- func (r Rectangle) In(s Rectangle) bool
- func (r Rectangle) Inset(n float64) Rectangle
- func (r Rectangle) Intersect(s Rectangle) Rectangle
- func (r Rectangle) Overlaps(s Rectangle) bool
- func (r Rectangle) Size() Point
- func (r Rectangle) String() string
- func (r Rectangle) Sub(p Point) Rectangle
- func (r Rectangle) Union(s Rectangle) Rectangle
- type ScrollEvent
- type Scroller
- type ScrollerView
- type Text
- func (t *Text) KeyPress(event KeyEvent)
- func (t *Text) LostKeyFocus()
- func (t *Text) Paint()
- func (t *Text) SetBackgroundColor(c Color)
- func (t *Text) SetFrameColor(c Color)
- func (t *Text) SetFrameSize(size float64)
- func (t *Text) SetText(text string)
- func (t *Text) SetTextColor(c Color)
- func (t Text) Text() string
- func (t *Text) TookKeyFocus()
- type View
- type ViewBase
- func (v *ViewBase) Add(u View)
- func (v *ViewBase) Close()
- func (v *ViewBase) KeyPress(event KeyEvent)
- func (v *ViewBase) KeyRelease(event KeyEvent)
- func (v *ViewBase) LostKeyFocus()
- func (v *ViewBase) Move(p Point)
- func (v ViewBase) Paint()
- func (v *ViewBase) Remove(u View)
- func (v *ViewBase) SetRect(r Rectangle)
- func (v *ViewBase) TookKeyFocus()
- type Window
Constants ¶
const ( KeySpace = 32 KeyApostrophe = 39 KeyComma = 44 KeyMinus = 45 KeyPeriod = 46 KeySlash = 47 Key0 = 48 Key1 = 49 Key2 = 50 Key3 = 51 Key4 = 52 Key5 = 53 Key6 = 54 Key7 = 55 Key8 = 56 Key9 = 57 KeySemicolon = 59 KeyEqual = 61 KeyA = 65 KeyB = 66 KeyC = 67 KeyD = 68 KeyE = 69 KeyF = 70 KeyG = 71 KeyH = 72 KeyI = 73 KeyJ = 74 KeyK = 75 KeyL = 76 KeyM = 77 KeyN = 78 KeyO = 79 KeyP = 80 KeyQ = 81 KeyR = 82 KeyS = 83 KeyT = 84 KeyU = 85 KeyV = 86 KeyW = 87 KeyX = 88 KeyY = 89 KeyZ = 90 KeyLeftBracket = 91 KeyBackslash = 92 KeyRightBracket = 93 KeyGraveAccent = 96 KeyEscape = 256 KeyEnter = 257 KeyTab = 258 KeyBackspace = 259 KeyInsert = 260 KeyDelete = 261 KeyRight = 262 KeyLeft = 263 KeyDown = 264 KeyUp = 265 KeyPageUp = 266 KeyPageDown = 267 KeyHome = 268 KeyEnd = 269 KeyCapsLock = 280 KeyScrollLock = 281 KeyNumLock = 282 KeyPrintScreen = 283 KeyPause = 284 KeyF1 = 290 KeyF2 = 291 KeyF3 = 292 KeyF4 = 293 KeyF5 = 294 KeyF6 = 295 KeyF7 = 296 KeyF8 = 297 KeyF9 = 298 KeyF10 = 299 KeyF11 = 300 KeyF12 = 301 KeyF13 = 302 KeyF14 = 303 KeyF15 = 304 KeyF16 = 305 KeyF17 = 306 KeyF18 = 307 KeyF19 = 308 KeyF20 = 309 KeyF21 = 310 KeyF22 = 311 KeyF23 = 312 KeyF24 = 313 KeyF25 = 314 KeyKP0 = 320 KeyKP1 = 321 KeyKP2 = 322 KeyKP3 = 323 KeyKP4 = 324 KeyKP5 = 325 KeyKP6 = 326 KeyKP7 = 327 KeyKP8 = 328 KeyKP9 = 329 KeyKPDecimal = 330 KeyKPDivide = 331 KeyKPMultiply = 332 KeyKPSubtract = 333 KeyKPAdd = 334 KeyKPEnter = 335 KeyKPEqual = 336 KeyLeftShift = 340 KeyLeftControl = 341 KeyLeftAlt = 342 KeyLeftSuper = 343 KeyRightShift = 344 KeyRightControl = 345 KeyRightAlt = 346 KeyRightSuper = 347 KeyMenu = 348 KeyLast = KeyMenu )
Variables ¶
This section is empty.
Functions ¶
func DrawBezier ¶
func DrawBezier(ctrlPts ...Point)
func DrawPolygon ¶
func DrawPolygon(pts ...Point)
func FillPolygon ¶
func FillPolygon(pts ...Point)
func MouseParent ¶
func MouseParent(v View, m MouseEvent)
func MoveCenter ¶
func MoveOrigin ¶
func NumChildren ¶
func ResizeToFit ¶
func Run ¶
func Run(init func()) error
must be called on the main goroutine, which will run on the main thread because glfw calls runtime.LockOSThread()
func SetKeyFocus ¶
func SetKeyFocus(v View)
func SetLineWidth ¶
func SetLineWidth(x float64)
func SetMouser ¶
func SetMouser(m MouserView, button int)
func SetPointSize ¶
func SetPointSize(x float64)
Types ¶
type AggregateMouser ¶
type AggregateMouser []Mouser
func (AggregateMouser) Mouse ¶
func (a AggregateMouser) Mouse(m MouseEvent)
type Clicker ¶
type Clicker func(MouseEvent)
func NewClickFocuser ¶
func (Clicker) Mouse ¶
func (c Clicker) Mouse(m MouseEvent)
type MouseEvent ¶
type Mouser ¶
type Mouser interface {
Mouse(MouseEvent)
}
type MouserView ¶
type Mover ¶
type Mover struct {
// contains filtered or unexported fields
}
func (*Mover) Mouse ¶
func (d *Mover) Mouse(m MouseEvent)
type Panner ¶
type Panner struct {
// contains filtered or unexported fields
}
func (*Panner) Mouse ¶
func (p *Panner) Mouse(m MouseEvent)
type Point ¶
type Point struct {
X, Y float64
}
A Point is an X, Y coordinate pair. The axes increase right and down.
var ZP Point
ZP is the zero Point.
func CenterInParent ¶
func LineToLine ¶
LineToLine returns the Points z and z2 on line segments (p, p2) and (q, q2), respectively, such that the distance from z to z2 is minimized.
func MapFromParent ¶
func MapToParent ¶
func PointToLine ¶
PointToLine returns the Point on line segment (x, y) that is nearest to p.
func (Point) Mod ¶
Mod returns the point q in r such that p.X-q.X is a multiple of r's width and p.Y-q.Y is a multiple of r's height.
type Rectangle ¶
type Rectangle struct {
Min, Max Point
}
A Rectangle contains the points with Min.X <= X < Max.X, Min.Y <= Y < Max.Y. It is well-formed if Min.X <= Max.X and likewise for Y. Points are always well-formed. A rectangle's methods always return well-formed outputs for well-formed inputs.
var ZR Rectangle
ZR is the zero Rectangle.
func RectInParent ¶
func (Rectangle) Canon ¶
Canon returns the canonical version of r. The returned rectangle has minimum and maximum coordinates swapped if necessary so that it is well-formed.
func (Rectangle) Inset ¶
Inset returns the rectangle r inset by n, which may be negative. If either of r's dimensions is less than 2*n then an empty rectangle near the center of r will be returned.
func (Rectangle) Intersect ¶
Intersect returns the largest rectangle contained by both r and s. If the two rectangles do not overlap then the zero rectangle will be returned.
type ScrollEvent ¶
type ScrollEvent struct {
Pos, Delta Point
}
type Scroller ¶
type Scroller interface {
Scroll(ScrollEvent)
}
type ScrollerView ¶
type Text ¶
type Text struct { *ViewBase Validate func(*string) bool Accept, TextChanged func(string) Reject func() // contains filtered or unexported fields }
func (*Text) LostKeyFocus ¶
func (t *Text) LostKeyFocus()
func (*Text) SetBackgroundColor ¶
func (*Text) SetFrameColor ¶
func (*Text) SetFrameSize ¶
func (*Text) SetTextColor ¶
func (*Text) TookKeyFocus ¶
func (t *Text) TookKeyFocus()
type View ¶
type ViewBase ¶
type ViewBase struct { Self View // contains filtered or unexported fields }
func (*ViewBase) KeyRelease ¶
func (*ViewBase) LostKeyFocus ¶
func (v *ViewBase) LostKeyFocus()
func (*ViewBase) TookKeyFocus ¶
func (v *ViewBase) TookKeyFocus()
type Window ¶
type Window struct { *ViewBase // contains filtered or unexported fields }