Documentation ¶
Overview ¶
Copyright (c) 2016, redstarcoder
Copyright (c) 2016, redstarcoder ¶
Copyright (c) 2016, redstarcoder
Index ¶
- type Button
- func (btn *Button) CharPress(char rune) draw2dui.Event
- func (btn *Button) Draw(selected, forceRedraw bool)
- func (btn *Button) GetData() interface{}
- func (btn *Button) GetDimensions() (float64, float64)
- func (btn *Button) GetEnabled() bool
- func (btn *Button) GetInt() int
- func (btn *Button) GetPos() (float64, float64)
- func (btn *Button) GetString() string
- func (btn *Button) Handle(selected bool) bool
- func (btn *Button) IsInside(x, y float64) bool
- func (btn *Button) KeyPress(key glfw.Key, action glfw.Action, mods glfw.ModifierKey) draw2dui.Event
- func (btn *Button) MClick(xpos, ypos float64, button glfw.MouseButton, action glfw.Action, ...) draw2dui.Event
- func (btn *Button) MMove(xpos, ypos float64) draw2dui.Event
- func (btn *Button) Name() string
- func (btn *Button) SetData(d interface{})
- func (btn *Button) SetDimensions(w, h float64)
- func (btn *Button) SetEnabled(enabled bool)
- func (btn *Button) SetInt(i int)
- func (btn *Button) SetPos(x, y float64)
- func (btn *Button) SetString(s string)
- type Cursor
- func (c *Cursor) Backspace() bool
- func (c *Cursor) Blink() (redraw bool)
- func (c *Cursor) GenLines(_gc draw2d.GraphicContext, width float64)
- func (c *Cursor) Insert(s string)
- func (c *Cursor) InsertLine(s string)
- func (c *Cursor) MoveLeft() bool
- func (c *Cursor) MoveRight() bool
- func (c *Cursor) MoveTo(i int) bool
- func (c *Cursor) MoveToX(_gc draw2d.GraphicContext, x, mx, width float64)
- type Label
- func (lbl *Label) CharPress(char rune) draw2dui.Event
- func (lbl *Label) Draw(selected, forceRedraw bool)
- func (lbl *Label) GetData() interface{}
- func (lbl *Label) GetDimensions() (float64, float64)
- func (lbl *Label) GetEnabled() bool
- func (lbl *Label) GetInt() int
- func (lbl *Label) GetPos() (float64, float64)
- func (lbl *Label) GetString() string
- func (lbl *Label) Handle(selected bool) bool
- func (lbl *Label) IsInside(x, y float64) bool
- func (lbl *Label) KeyPress(key glfw.Key, action glfw.Action, mods glfw.ModifierKey) draw2dui.Event
- func (lbl *Label) MClick(xpos, ypos float64, button glfw.MouseButton, action glfw.Action, ...) draw2dui.Event
- func (lbl *Label) MMove(xpos, ypos float64) draw2dui.Event
- func (lbl *Label) Name() string
- func (lbl *Label) SetData(d interface{})
- func (lbl *Label) SetDimensions(w, h float64)
- func (lbl *Label) SetEnabled(enabled bool)
- func (lbl *Label) SetInt(i int)
- func (lbl *Label) SetPos(x, y float64)
- func (lbl *Label) SetString(s string)
- type TextBox
- func (tb *TextBox) CharPress(char rune) draw2dui.Event
- func (tb *TextBox) Draw(selected, forceRedraw bool)
- func (tb *TextBox) GetData() interface{}
- func (tb *TextBox) GetDimensions() (float64, float64)
- func (tb *TextBox) GetEnabled() bool
- func (tb *TextBox) GetInt() int
- func (tb *TextBox) GetPos() (float64, float64)
- func (tb *TextBox) GetString() string
- func (tb *TextBox) Handle(selected bool) bool
- func (tb *TextBox) InsertLine(s string)
- func (tb *TextBox) IsInside(x, y float64) bool
- func (tb *TextBox) KeyPress(key glfw.Key, action glfw.Action, mods glfw.ModifierKey) draw2dui.Event
- func (tb *TextBox) MClick(xpos, ypos float64, button glfw.MouseButton, action glfw.Action, ...) draw2dui.Event
- func (tb *TextBox) MMove(xpos, ypos float64) draw2dui.Event
- func (tb *TextBox) Name() string
- func (tb *TextBox) SetData(d interface{})
- func (tb *TextBox) SetDimensions(w, h float64)
- func (tb *TextBox) SetEnabled(enabled bool)
- func (tb *TextBox) SetInt(i int)
- func (tb *TextBox) SetPos(x, y float64)
- func (tb *TextBox) SetString(s string)
- type TextField
- func (tf *TextField) CharPress(char rune) draw2dui.Event
- func (tf *TextField) Draw(selected, forceRedraw bool)
- func (tf *TextField) GetData() interface{}
- func (tf *TextField) GetDimensions() (float64, float64)
- func (tf *TextField) GetEnabled() bool
- func (tf *TextField) GetInt() int
- func (tf *TextField) GetPos() (float64, float64)
- func (tf *TextField) GetString() string
- func (tf *TextField) Handle(selected bool) bool
- func (tf *TextField) IsInside(x, y float64) bool
- func (tf *TextField) KeyPress(key glfw.Key, action glfw.Action, mods glfw.ModifierKey) draw2dui.Event
- func (tf *TextField) MClick(xpos, ypos float64, button glfw.MouseButton, action glfw.Action, ...) draw2dui.Event
- func (tf *TextField) MMove(xpos, ypos float64) draw2dui.Event
- func (tf *TextField) Name() string
- func (tf *TextField) SetData(d interface{})
- func (tf *TextField) SetDimensions(w, h float64)
- func (tf *TextField) SetEnabled(enabled bool)
- func (tf *TextField) SetInt(i int)
- func (tf *TextField) SetPos(x, y float64)
- func (tf *TextField) SetString(s string)
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Button ¶
type Button struct {
// contains filtered or unexported fields
}
func (*Button) Draw ¶
Draw draws the widget, selected determines if the widget displays as selected or not, and forceRedraw forces a full redraw of the widget. TODO draw dotted border if selected
func (*Button) GetDimensions ¶
GetDimensions returns btn's drawn width and height
func (*Button) GetEnabled ¶
GetEnabled returns whether the widget is enabled or not
func (*Button) IsInside ¶
IsInside checks if point x, y is inside of the widget's boundaries. It uses btn.offscreen as a pallet
func (*Button) MClick ¶
func (btn *Button) MClick(xpos, ypos float64, button glfw.MouseButton, action glfw.Action, mods glfw.ModifierKey) draw2dui.Event
MClick has the widget process a MouseClick event
func (*Button) SetDimensions ¶
SetDimensions sets btn's drawn width and height
func (*Button) SetEnabled ¶
SetEnabled enables or disables the widget
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
TODO calculate iEdge & iOffset using something like MoveToX
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
func (*Label) Draw ¶
Draw draws the widget, selected determines if the widget displays as selected or not, and forceRedraw forces a full redraw of the widget.
func (*Label) GetDimensions ¶
GetDimensions returns lbl's drawn width and height
func (*Label) IsInside ¶
IsInside checks if point x, y is inside of the widget's boundaries. It uses lbl.offscreen as a pallet
func (*Label) MClick ¶
func (lbl *Label) MClick(xpos, ypos float64, button glfw.MouseButton, action glfw.Action, mods glfw.ModifierKey) draw2dui.Event
MClick returns draw2dui.EventNone
func (*Label) SetDimensions ¶
SetDimensions sets lbl's drawn width and height
type TextBox ¶
type TextBox struct {
// contains filtered or unexported fields
}
TODO text highlighting
func NewTextBox ¶
func NewTextBox(gc *draw2d.GraphicContext, window, offscreen *glfw.Window, x, y, width, height float64, text string) *TextBox
NewTextBox creates a new TextBox widget BUG(x) TextBox does not support enabled state BUG(x) TextBox default is disabled, should be enabled BUG(x) TextBox should have a scrollbar BUG(x) TextBox text wrapping should be optional
func (*TextBox) Draw ¶
Draw draws the widget, selected determines if the widget displays as selected or not, and forceRedraw forces a full redraw of the widget.
func (*TextBox) GetDimensions ¶
GetDimensions returns tf's drawn width and height
func (*TextBox) GetEnabled ¶
GetEnabled returns whether the widget is enabled or not
func (*TextBox) GetString ¶
GetString returns tf's text BUG(x) needs to rebuild cursor.text from cursor.textLines
func (*TextBox) InsertLine ¶
func (*TextBox) IsInside ¶
IsInside checks if point x, y is inside of the widget's boundaries. It uses tb.offscreen as a pallet
func (*TextBox) MClick ¶
func (tb *TextBox) MClick(xpos, ypos float64, button glfw.MouseButton, action glfw.Action, mods glfw.ModifierKey) draw2dui.Event
MClick has the widget process a MouseClick event
func (*TextBox) SetDimensions ¶
SetDimensions sets tf's drawn width and height
func (*TextBox) SetEnabled ¶
SetEnabled enables or disables the widget
type TextField ¶
type TextField struct {
// contains filtered or unexported fields
}
TODO text highlighting
func NewTextField ¶
func NewTextField(gc *draw2d.GraphicContext, window, offscreen *glfw.Window, x, y, width float64, text string, maxlen int) *TextField
NewTextField creates a new TextField widget
func (*TextField) Draw ¶
Draw draws the widget, selected determines if the widget displays as selected or not, and forceRedraw forces a full redraw of the widget.
func (*TextField) GetDimensions ¶
GetDimensions returns tf's drawn width and height
func (*TextField) GetEnabled ¶
GetEnabled returns whether the widget is enabled or not
func (*TextField) IsInside ¶
IsInside checks if point x, y is inside of the widget's boundaries. It uses tf.offscreen as a pallet
func (*TextField) KeyPress ¶
func (tf *TextField) KeyPress(key glfw.Key, action glfw.Action, mods glfw.ModifierKey) draw2dui.Event
KeyPress has the widget process a KeyPress event
func (*TextField) MClick ¶
func (tf *TextField) MClick(xpos, ypos float64, button glfw.MouseButton, action glfw.Action, mods glfw.ModifierKey) draw2dui.Event
MClick has the widget process a MouseClick event
func (*TextField) SetDimensions ¶
SetDimensions sets tf's drawn width and height
func (*TextField) SetEnabled ¶
SetEnabled enables or disables the widget
Notes ¶
Bugs ¶
loadCurrentFont should take a GraphicContext interface
TextBox does not support enabled state
TextBox default is disabled, should be enabled
TextBox should have a scrollbar
TextBox text wrapping should be optional
needs to rebuild cursor.text from cursor.textLines
shortening strings can end up with bad iOffset / iEdge