gxui: github.com/google/gxui Index | Files | Directories

package gxui

import "github.com/google/gxui"

Index

Package Files

adapter_base.go adapter_item.go alignment.go brush.go bubble_overlay.go button.go canvas.go channeled_event.go code_editor.go code_syntax_layer.go color.go container.go control.go control_list.go debug.go default_adapter.go direction.go driver.go drop_down_list.go event.go event_base.go filtered_list_adapter.go focus_controller.go focusable.go font.go image.go keyboard_controller.go keyboard_event.go keyboard_key.go keyboard_modifier.go keystroke_event.go label.go linear_layout.go list.go mouse_button.go mouse_controller.go mouse_event.go mouse_state.go orientation.go panel_holder.go pen.go polygon.go progress_bar.go scroll_bar.go scroll_layout.go simple_event.go size_mode.go splitter_layout.go table_layout.go text_selection.go text_selection_list.go textbox.go textbox_controller.go texture.go theme.go tooltip_controller.go tree.go utils.go viewport.go while_attached.go window.go

Constants

const (
    AspectStretch = iota
    AspectCorrectLetterbox
    AspectCorrectCrop
)

Variables

var Black = Color{0.0, 0.0, 0.0, 1.0}
var BlackBrush = CreateBrush(Black)
var Blue = Color{0.0, 0.0, 1.0, 1.0}
var Blue10 = Color{0.0, 0.0, 0.1, 1.0}
var Blue20 = Color{0.0, 0.0, 0.2, 1.0}
var Blue30 = Color{0.0, 0.0, 0.3, 1.0}
var Blue40 = Color{0.0, 0.0, 0.4, 1.0}
var Blue50 = Color{0.0, 0.0, 0.5, 1.0}
var Blue60 = Color{0.0, 0.0, 0.6, 1.0}
var Blue70 = Color{0.0, 0.0, 0.7, 1.0}
var Blue80 = Color{0.0, 0.0, 0.8, 1.0}
var Blue90 = Color{0.0, 0.0, 0.9, 1.0}
var DefaultBrush = WhiteBrush
var Gray10 = Color{0.1, 0.1, 0.1, 1.0}
var Gray15 = Color{0.15, 0.15, 0.15, 1.0}
var Gray20 = Color{0.2, 0.2, 0.2, 1.0}
var Gray30 = Color{0.3, 0.3, 0.3, 1.0}
var Gray40 = Color{0.4, 0.4, 0.4, 1.0}
var Gray50 = Color{0.5, 0.5, 0.5, 1.0}
var Gray60 = Color{0.6, 0.6, 0.6, 1.0}
var Gray70 = Color{0.7, 0.7, 0.7, 1.0}
var Gray80 = Color{0.8, 0.8, 0.8, 1.0}
var Gray90 = Color{0.9, 0.9, 0.9, 1.0}
var Green = Color{0.0, 1.0, 0.0, 1.0}
var Green10 = Color{0.0, 0.1, 0.0, 1.0}
var Green20 = Color{0.0, 0.2, 0.0, 1.0}
var Green30 = Color{0.0, 0.3, 0.0, 1.0}
var Green40 = Color{0.0, 0.4, 0.0, 1.0}
var Green50 = Color{0.0, 0.5, 0.0, 1.0}
var Green60 = Color{0.0, 0.6, 0.0, 1.0}
var Green70 = Color{0.0, 0.7, 0.0, 1.0}
var Green80 = Color{0.0, 0.8, 0.0, 1.0}
var Green90 = Color{0.0, 0.9, 0.0, 1.0}
var Red = Color{1.0, 0.0, 0.0, 1.0}
var Red10 = Color{0.1, 0.0, 0.0, 1.0}
var Red20 = Color{0.2, 0.0, 0.0, 1.0}
var Red30 = Color{0.3, 0.0, 0.0, 1.0}
var Red40 = Color{0.4, 0.0, 0.0, 1.0}
var Red50 = Color{0.5, 0.0, 0.0, 1.0}
var Red60 = Color{0.6, 0.0, 0.0, 1.0}
var Red70 = Color{0.7, 0.0, 0.0, 1.0}
var Red80 = Color{0.8, 0.0, 0.0, 1.0}
var Red90 = Color{0.9, 0.0, 0.0, 1.0}
var Transparent = Color{0.0, 0.0, 0.0, 0.0}
var TransparentBrush = CreateBrush(Transparent)
var White = Color{1.0, 1.0, 1.0, 1.0}
var WhiteBrush = CreateBrush(White)
var Yellow = Color{1.0, 1.0, 0.0, 1.0}
func BreadcrumbsAt(p Container, pnt math.Point) string

func ChildToParent Uses

func ChildToParent(coord math.Point, from Control, to Parent) math.Point

func Dump Uses

func Dump(c interface{})

func FunctionName Uses

func FunctionName(i interface{}) string

func ParentToChild Uses

func ParentToChild(coord math.Point, from Parent, to Control) math.Point

func Path Uses

func Path(p interface{}) string

func RuneArrayToString Uses

func RuneArrayToString(arr []rune) string

func SetFocus Uses

func SetFocus(focusable Focusable)

func StringToRuneArray Uses

func StringToRuneArray(str string) []rune

func TransformCoordinate Uses

func TransformCoordinate(coord math.Point, from, to Control) math.Point

func ValidateHierarchy Uses

func ValidateHierarchy(p Parent)

func WhileAttached Uses

func WhileAttached(c Control, event, callback interface{})

WhileAttached binds the function callback to event for the duration of c being attached. event can either be:

• A event of the signature:    event(callback)
• A function of the signature: func(callback) EventSubscription

func WindowToChild Uses

func WindowToChild(coord math.Point, to Control) math.Point

type AdapterBase Uses

type AdapterBase struct {
    // contains filtered or unexported fields
}

func (*AdapterBase) DataChanged Uses

func (a *AdapterBase) DataChanged(recreateControls bool)

func (*AdapterBase) DataReplaced Uses

func (a *AdapterBase) DataReplaced()

func (*AdapterBase) OnDataChanged Uses

func (a *AdapterBase) OnDataChanged(f func(recreateControls bool)) EventSubscription

func (*AdapterBase) OnDataReplaced Uses

func (a *AdapterBase) OnDataReplaced(f func()) EventSubscription

type AdapterItem Uses

type AdapterItem interface{}

AdapterItem is a user defined type that can be used to uniquely identify a single item in an adapter. The type must support equality and be hashable.

type AspectMode Uses

type AspectMode int

type Brush Uses

type Brush struct {
    Color Color
}

func CreateBrush Uses

func CreateBrush(color Color) Brush

type BubbleOverlay Uses

type BubbleOverlay interface {
    Control
    Show(control Control, target math.Point)
    Hide()
}

type Button Uses

type Button interface {
    LinearLayout
    Text() string
    SetText(string)
    Type() ButtonType
    SetType(ButtonType)
    IsChecked() bool
    SetChecked(bool)
}

type ButtonType Uses

type ButtonType int
const (
    PushButton ButtonType = iota
    ToggleButton
)

type Canvas Uses

type Canvas interface {
    Size() math.Size
    IsComplete() bool
    Complete()
    Push()
    Pop()
    AddClip(math.Rect)
    Clear(Color)
    DrawCanvas(c Canvas, position math.Point)
    DrawTexture(t Texture, bounds math.Rect)
    DrawRunes(font Font, runes []rune, points []math.Point, color Color)
    DrawLines(Polygon, Pen)
    DrawPolygon(Polygon, Pen, Brush)
    DrawRect(math.Rect, Brush)
    DrawRoundedRect(rect math.Rect, tl, tr, bl, br float32, p Pen, b Brush)
}

type ChanneledEvent Uses

type ChanneledEvent struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

func (*ChanneledEvent) Fire Uses

func (e *ChanneledEvent) Fire(args ...interface{})

func (*ChanneledEvent) Listen Uses

func (e *ChanneledEvent) Listen(listener interface{}) EventSubscription

func (*ChanneledEvent) ParameterTypes Uses

func (e *ChanneledEvent) ParameterTypes() []reflect.Type

type Child Uses

type Child struct {
    Control Control
    Offset  math.Point
}

func (*Child) Bounds Uses

func (c *Child) Bounds() math.Rect

Bounds returns the Child bounds relative to the parent.

func (*Child) Layout Uses

func (c *Child) Layout(rect math.Rect)

Layout sets the Child size and offset relative to the parent. Layout should only be called by the Child's parent.

func (*Child) String Uses

func (c *Child) String() string

String returns a string describing the child type and bounds.

type Children Uses

type Children []*Child

Children is a list of Child pointers.

func (Children) Find Uses

func (c Children) Find(control Control) *Child

Find returns and returns the Child pointer for the given Control, or nil if the child is not in this Children list.

func (Children) IndexOf Uses

func (c Children) IndexOf(control Control) int

IndexOf returns and returns the index of the child control, or -1 if the child is not in this Children list.

func (Children) String Uses

func (c Children) String() string

String returns a string describing the child type and bounds.

type CodeEditor Uses

type CodeEditor interface {
    TextBox
    SyntaxLayers() CodeSyntaxLayers
    SetSyntaxLayers(CodeSyntaxLayers)
    TabWidth() int
    SetTabWidth(int)
    SuggestionProvider() CodeSuggestionProvider
    SetSuggestionProvider(CodeSuggestionProvider)
    ShowSuggestionList()
    HideSuggestionList()
}

type CodeSuggestion Uses

type CodeSuggestion interface {
    Name() string
    Code() string
}

type CodeSuggestionProvider Uses

type CodeSuggestionProvider interface {
    SuggestionsAt(runeIndex int) []CodeSuggestion
}

type CodeSyntaxLayer Uses

type CodeSyntaxLayer struct {
    // contains filtered or unexported fields
}

func CreateCodeSyntaxLayer Uses

func CreateCodeSyntaxLayer() *CodeSyntaxLayer

func (*CodeSyntaxLayer) Add Uses

func (l *CodeSyntaxLayer) Add(start, count int)

func (*CodeSyntaxLayer) AddData Uses

func (l *CodeSyntaxLayer) AddData(start, count int, data interface{})

func (*CodeSyntaxLayer) AddSpan Uses

func (l *CodeSyntaxLayer) AddSpan(span interval.IntData)

func (*CodeSyntaxLayer) BackgroundColor Uses

func (l *CodeSyntaxLayer) BackgroundColor() *Color

func (*CodeSyntaxLayer) BorderColor Uses

func (l *CodeSyntaxLayer) BorderColor() *Color

func (*CodeSyntaxLayer) Clear Uses

func (l *CodeSyntaxLayer) Clear()

func (*CodeSyntaxLayer) ClearBackgroundColor Uses

func (l *CodeSyntaxLayer) ClearBackgroundColor()

func (*CodeSyntaxLayer) ClearBorderColor Uses

func (l *CodeSyntaxLayer) ClearBorderColor()

func (*CodeSyntaxLayer) ClearColor Uses

func (l *CodeSyntaxLayer) ClearColor()

func (*CodeSyntaxLayer) Color Uses

func (l *CodeSyntaxLayer) Color() *Color

func (*CodeSyntaxLayer) Data Uses

func (l *CodeSyntaxLayer) Data() interface{}

func (*CodeSyntaxLayer) SetBackgroundColor Uses

func (l *CodeSyntaxLayer) SetBackgroundColor(color Color)

func (*CodeSyntaxLayer) SetBorderColor Uses

func (l *CodeSyntaxLayer) SetBorderColor(color Color)

func (*CodeSyntaxLayer) SetColor Uses

func (l *CodeSyntaxLayer) SetColor(color Color)

func (*CodeSyntaxLayer) SetData Uses

func (l *CodeSyntaxLayer) SetData(data interface{})

func (*CodeSyntaxLayer) SpanAt Uses

func (l *CodeSyntaxLayer) SpanAt(runeIndex int) *interval.IntData

func (*CodeSyntaxLayer) Spans Uses

func (l *CodeSyntaxLayer) Spans() interval.IntDataList

func (*CodeSyntaxLayer) UpdateSpans Uses

func (l *CodeSyntaxLayer) UpdateSpans(runeCount int, edits []TextBoxEdit)

type CodeSyntaxLayers Uses

type CodeSyntaxLayers []*CodeSyntaxLayer

func (*CodeSyntaxLayers) Clear Uses

func (l *CodeSyntaxLayers) Clear()

func (*CodeSyntaxLayers) Get Uses

func (l *CodeSyntaxLayers) Get(idx int) *CodeSyntaxLayer

type Color Uses

type Color struct {
    R, G, B, A float32
}

func ColorFromHex Uses

func ColorFromHex(hex uint32) Color

func (Color) MulRGB Uses

func (c Color) MulRGB(s float32) Color

func (Color) Saturate Uses

func (c Color) Saturate() Color

type Container Uses

type Container interface {
    Parent
    AddChild(child Control) *Child
    AddChildAt(index int, child Control) *Child
    RemoveChild(child Control)
    RemoveChildAt(index int)
    RemoveAll()
    Padding() math.Spacing
    SetPadding(math.Spacing)
}

type Control Uses

type Control interface {
    // Size returns the size of the control. If the control is not attached, then
    // the returned size is undefined.
    Size() math.Size

    // SetSize sets the size of the control to the specified value.
    // SetSize should only be called by the parent of the control during layout.
    SetSize(math.Size)

    // Draw draws the control's visual apperance into the returned, new canvas.
    // Draw is typically called by the parent of the control - calling Draw will
    // not issue a re-draw of an attached control.
    Draw() Canvas

    // Parent returns the parent of the control.
    Parent() Parent

    // SetParent sets the parent of the control.
    // SetParent should only be called by the new parent of the control.
    SetParent(Parent)

    // Attached returns true if the control is directly or indirectly attached
    // to a window.
    Attached() bool

    // Attach is called when the control is directly or indirectly attached to a
    // window.
    // Attach should only be called by the parent of the control.
    Attach()

    // Detach is called when the control is directly or indirectly detached from a
    // window.
    // Detach should only be called by the parent of the control.
    Detach()

    // DesiredSize returns the desired size of the control based on the min and
    // max size limits. The parent control may ignore the desired size.
    DesiredSize(min, max math.Size) math.Size

    // Margin returns the desired spacing between sibling controls.
    Margin() math.Spacing

    // SetMargin set the desired spacing between sibling controls, issuing a
    // relayout if the margin has changed.
    SetMargin(math.Spacing)

    // IsVisible returns true if the control is visible.
    IsVisible() bool

    // SetVisible sets the visibility of the control.
    SetVisible(bool)

    // ContainsPoint returns true if the specified local-space point is considered
    // within the control.
    ContainsPoint(math.Point) bool

    // IsMouseOver returns true if the mouse cursor was last reported within the
    // control.
    IsMouseOver() bool

    // IsMouseDown returns true if button was last reported pressed on the
    // control.
    IsMouseDown(button MouseButton) bool

    // Click is called when the mouse is pressed and released on the control.
    // If Click returns true, then the click event is consumed by the control,
    // otherwise the next control below the should be considered for the click
    // event.
    Click(MouseEvent) (consume bool)

    // DoubleClick is called when the mouse is double-clicked on the control.
    // If DoubleClick returns true, then the double-click event is consumed by the
    // control, otherwise the next control below the should be considered for the
    // double-click event.
    DoubleClick(MouseEvent) (consume bool)

    // KeyPress is called when a keyboard key is pressed while the control (or
    // non-consuming child) has focus. If KeyPress returns true, then the
    // key-press event is consumed by the control, otherwise the parent control
    // should be considered for the key-press event.
    KeyPress(KeyboardEvent) (consume bool)

    // KeyStroke is called when a key-storke is made while the control (or
    // non-consuming child) has focus. If KeyStroke returns true, then the
    // key-stroke event is consumed by the control, otherwise the parent control
    // should be considered for the key-stroke event.
    KeyStroke(KeyStrokeEvent) (consume bool)

    // MouseScroll is called when a mouse scroll is made while the control (or
    // non-consuming child) has focus. If MouseScroll returns true, then the
    // mouse-scroll event is consumed by the control, otherwise the parent control
    // should be considered for the key-stroke event.
    MouseScroll(MouseEvent) (consume bool)

    // MouseMove is called when the mouse cursor moves over the control.
    MouseMove(MouseEvent)

    // MouseEnter is called when the mouse cursor transitions from outside to
    // inside the bounds of the control.
    MouseEnter(MouseEvent)

    // MouseExit is called when the mouse cursor transitions from inside to
    // outside the bounds of the control.
    MouseExit(MouseEvent)

    // MouseDown is called when a mouse button is pressed while the mouse cursor
    // is over the control.
    MouseDown(MouseEvent)

    // MouseUp is called when a mouse button is released while the mouse cursor
    // is over the control.
    MouseUp(MouseEvent)

    // KeyDown is called when a keyboard button is pressed while the control (or
    // child control) has focus.
    KeyDown(KeyboardEvent)

    // KeyUp is called when a keyboard button is released while the control (or
    // child control) has focus.
    KeyUp(KeyboardEvent)

    // KeyRepeat is called when a keyboard button held long enough for a
    // repeat-key event while the control (or child control) has focus.
    KeyRepeat(KeyboardEvent)

    // OnAttach subscribes f to be called whenever the control is attached.
    OnAttach(f func()) EventSubscription

    // OnDetach subscribes f to be called whenever the control is detached.
    OnDetach(f func()) EventSubscription

    // OnKeyPress subscribes f to be called whenever the control receives a
    // key-press event.
    OnKeyPress(f func(KeyboardEvent)) EventSubscription

    // OnKeyStroke subscribes f to be called whenever the control receives a
    // key-stroke event.
    OnKeyStroke(f func(KeyStrokeEvent)) EventSubscription

    // OnClick subscribes f to be called whenever the control receives a click
    // event.
    OnClick(f func(MouseEvent)) EventSubscription

    // OnDoubleClick subscribes f to be called whenever the control receives a
    // double-click event.
    OnDoubleClick(f func(MouseEvent)) EventSubscription

    // OnMouseMove subscribes f to be called whenever the control receives a
    // mouse-move event.
    OnMouseMove(f func(MouseEvent)) EventSubscription

    // OnMouseEnter subscribes f to be called whenever the control receives a
    // mouse-enter event.
    OnMouseEnter(f func(MouseEvent)) EventSubscription

    // OnMouseExit subscribes f to be called whenever the control receives a
    // mouse-exit event.
    OnMouseExit(f func(MouseEvent)) EventSubscription

    // OnMouseDown subscribes f to be called whenever the control receives a
    // mouse-down event.
    OnMouseDown(f func(MouseEvent)) EventSubscription

    // OnMouseUp subscribes f to be called whenever the control receives a
    // mouse-up event.
    OnMouseUp(f func(MouseEvent)) EventSubscription

    // OnMouseScroll subscribes f to be called whenever the control receives a
    // mouse-scroll event.
    OnMouseScroll(f func(MouseEvent)) EventSubscription

    // OnKeyDown subscribes f to be called whenever the control receives a
    // key-down event.
    OnKeyDown(f func(KeyboardEvent)) EventSubscription

    // OnKeyUp subscribes f to be called whenever the control receives a
    // key-up event.
    OnKeyUp(f func(KeyboardEvent)) EventSubscription

    // OnKeyRepeat subscribes f to be called whenever the control receives a
    // key-repeat event.
    OnKeyRepeat(f func(KeyboardEvent)) EventSubscription
}

Control is the interface exposed by all UI control elements.

func FindControl Uses

func FindControl(root Parent, test func(Control) (found bool)) Control

FindControl performs a depth-first search of the controls starting from root, calling test with each visited control. If test returns true then the search is stopped and FindControl returns the Control passed to test. If no call to test returns true then FindControl returns nil.

type ControlList Uses

type ControlList []Control

func (ControlList) Contains Uses

func (l ControlList) Contains(c Control) bool

type ControlPoint Uses

type ControlPoint struct {
    C   Control
    P   math.Point
}

type ControlPointList Uses

type ControlPointList []ControlPoint

func ControlsUnder Uses

func ControlsUnder(p math.Point, c Parent) ControlPointList

func TopControlsUnder Uses

func TopControlsUnder(p math.Point, c Parent) ControlPointList

func (ControlPointList) Contains Uses

func (l ControlPointList) Contains(c Control) bool

func (ControlPointList) Find Uses

func (l ControlPointList) Find(c Control) (math.Point, bool)

type DefaultAdapter Uses

type DefaultAdapter struct {
    AdapterBase
    // contains filtered or unexported fields
}

func CreateDefaultAdapter Uses

func CreateDefaultAdapter() *DefaultAdapter

func (*DefaultAdapter) Count Uses

func (a *DefaultAdapter) Count() int

func (*DefaultAdapter) Create Uses

func (a *DefaultAdapter) Create(theme Theme, index int) Control

func (*DefaultAdapter) ItemAt Uses

func (a *DefaultAdapter) ItemAt(index int) AdapterItem

func (*DefaultAdapter) ItemIndex Uses

func (a *DefaultAdapter) ItemIndex(item AdapterItem) int

func (*DefaultAdapter) Items Uses

func (a *DefaultAdapter) Items() interface{}

func (*DefaultAdapter) SetItems Uses

func (a *DefaultAdapter) SetItems(items interface{})

func (*DefaultAdapter) SetSize Uses

func (a *DefaultAdapter) SetSize(s math.Size)

func (*DefaultAdapter) SetSizeAsLargest Uses

func (a *DefaultAdapter) SetSizeAsLargest(theme Theme)

func (*DefaultAdapter) SetStyleLabel Uses

func (a *DefaultAdapter) SetStyleLabel(f func(Theme, Label))

func (*DefaultAdapter) Size Uses

func (a *DefaultAdapter) Size(theme Theme) math.Size

type Direction Uses

type Direction int
const (
    TopToBottom Direction = iota
    LeftToRight
    BottomToTop
    RightToLeft
)

func (Direction) BottomToTop Uses

func (d Direction) BottomToTop() bool

func (Direction) Flip Uses

func (d Direction) Flip() Direction

func (Direction) LeftToRight Uses

func (d Direction) LeftToRight() bool

func (Direction) Orientation Uses

func (d Direction) Orientation() Orientation

func (Direction) RightToLeft Uses

func (d Direction) RightToLeft() bool

func (Direction) TopToBottom Uses

func (d Direction) TopToBottom() bool

type Driver Uses

type Driver interface {
    // Call queues f to be run on the UI go-routine, returning before f may have
    // been called. Call returns false if the driver has been terminated, in which
    // case f may not be called.
    Call(f func()) bool

    // CallSync queues and then blocks for f to be run on the UI go-routine.
    // Call returns false if the driver has been terminated, in which case f may
    // not be called.
    CallSync(f func()) bool

    Terminate()
    SetClipboard(str string)
    GetClipboard() (string, error)

    // CreateFont loads a font from the provided TrueType bytes.
    CreateFont(data []byte, size int) (Font, error)

    // CreateWindowedViewport creates a new windowed Viewport with the specified
    // width and height in device independent pixels.
    CreateWindowedViewport(width, height int, name string) Viewport

    // CreateFullscreenViewport creates a new fullscreen Viewport with the
    // specified width and height in device independent pixels. If width or
    // height is 0, then the viewport adopts the current screen resolution.
    CreateFullscreenViewport(width, height int, name string) Viewport

    CreateCanvas(math.Size) Canvas
    CreateTexture(img image.Image, pixelsPerDip float32) Texture

    // Debug function used to verify that the caller is executing on the UI
    // go-routine. If the caller is not on the UI go-routine then the function
    // panics.
    AssertUIGoroutine()
}
type DropDownList interface {
    Focusable
    Container
    SetBubbleOverlay(BubbleOverlay)
    BubbleOverlay() BubbleOverlay
    Adapter() ListAdapter
    SetAdapter(ListAdapter)
    BorderPen() Pen
    SetBorderPen(Pen)
    BackgroundBrush() Brush
    SetBackgroundBrush(Brush)
    Selected() AdapterItem
    Select(AdapterItem)
    OnSelectionChanged(func(AdapterItem)) EventSubscription
    OnShowList(func()) EventSubscription
    OnHideList(func()) EventSubscription
}

type Event Uses

type Event interface {
    Fire(args ...interface{})
    Listen(interface{}) EventSubscription
    ParameterTypes() []reflect.Type
}

func CreateChanneledEvent Uses

func CreateChanneledEvent(signature interface{}, channel chan func()) Event

func CreateEvent Uses

func CreateEvent(signature interface{}) Event

type EventBase Uses

type EventBase struct {
    // contains filtered or unexported fields
}

func (*EventBase) Fire Uses

func (e *EventBase) Fire(args ...interface{})

func (*EventBase) InvokeListeners Uses

func (e *EventBase) InvokeListeners(args []interface{})

func (*EventBase) Listen Uses

func (e *EventBase) Listen(listener interface{}) EventSubscription

Event compliance

func (*EventBase) ParameterTypes Uses

func (e *EventBase) ParameterTypes() []reflect.Type

func (*EventBase) String Uses

func (e *EventBase) String() string

func (*EventBase) VerifyArguments Uses

func (e *EventBase) VerifyArguments(args []interface{})

func (*EventBase) VerifySignature Uses

func (e *EventBase) VerifySignature(argTys []reflect.Type, isVariadic bool)

type EventListener Uses

type EventListener struct {
    Id       int
    Function reflect.Value
}

type EventSubscription Uses

type EventSubscription interface {
    Unlisten()
}

type FilteredListAdapter Uses

type FilteredListAdapter struct {
    DefaultAdapter
    // contains filtered or unexported fields
}

func (*FilteredListAdapter) SetItems Uses

func (a *FilteredListAdapter) SetItems(items []FilteredListItem)

func (*FilteredListAdapter) Sort Uses

func (a *FilteredListAdapter) Sort(partial string)

type FilteredListItem Uses

type FilteredListItem struct {
    Name string
    Data interface{}
}

type FocusController Uses

type FocusController struct {
    // contains filtered or unexported fields
}

func CreateFocusController Uses

func CreateFocusController(window Window) *FocusController

func (*FocusController) Focus Uses

func (c *FocusController) Focus() Focusable

func (*FocusController) FocusNext Uses

func (c *FocusController) FocusNext()

func (*FocusController) FocusPrev Uses

func (c *FocusController) FocusPrev()

func (*FocusController) Focusable Uses

func (c *FocusController) Focusable(ctrl Control) Focusable

func (*FocusController) NextChildFocusable Uses

func (c *FocusController) NextChildFocusable(p Parent, after Control, forwards bool) Focusable

func (*FocusController) NextFocusable Uses

func (c *FocusController) NextFocusable(after Control, forwards bool) Focusable

func (*FocusController) SetFocus Uses

func (c *FocusController) SetFocus(f Focusable)

func (*FocusController) SetFocusCount Uses

func (c *FocusController) SetFocusCount() int

type Focusable Uses

type Focusable interface {
    Control

    // IsFocusable returns true if the control is currently in a state where it
    // can acquire focus.
    IsFocusable() bool

    // HasFocus returns true when the control has focus.
    HasFocus() bool

    // GainedFocus is called when the Focusable gains focus.
    // This method is called by the FocusManager should not be called by the user.
    GainedFocus()

    // LostFocus is called when the Focusable loses focus.
    // This method is called by the FocusManager should not be called by the user.
    LostFocus()

    // OnGainedFocus subscribes f to be called whenever the control gains focus.
    OnGainedFocus(f func()) EventSubscription

    // OnLostFocus subscribes f to be called whenever the control loses focus.
    OnLostFocus(f func()) EventSubscription
}

Focusable is the optional interface implmented by controls that have the ability to acquire focus. A control with focus will receive keyboard input first.

type Font Uses

type Font interface {
    LoadGlyphs(first, last rune)
    Size() int
    GlyphMaxSize() math.Size
    Measure(*TextBlock) math.Size
    Layout(*TextBlock) (offsets []math.Point)
}

A Font represents a TrueType font loaded by the GXUI driver.

type HorizontalAlignment Uses

type HorizontalAlignment int
const (
    AlignLeft HorizontalAlignment = iota
    AlignCenter
    AlignRight
)

func (HorizontalAlignment) AlignCenter Uses

func (a HorizontalAlignment) AlignCenter() bool

func (HorizontalAlignment) AlignLeft Uses

func (a HorizontalAlignment) AlignLeft() bool

func (HorizontalAlignment) AlignRight Uses

func (a HorizontalAlignment) AlignRight() bool

type Image Uses

type Image interface {
    Control
    Texture() Texture
    SetTexture(Texture)
    Canvas() Canvas
    SetCanvas(Canvas)
    BorderPen() Pen
    SetBorderPen(Pen)
    BackgroundBrush() Brush
    SetBackgroundBrush(Brush)
    ScalingMode() ScalingMode
    SetScalingMode(ScalingMode)
    SetExplicitSize(math.Size)
    AspectMode() AspectMode
    SetAspectMode(AspectMode)
    PixelAt(math.Point) (math.Point, bool) // TODO: Remove
}

type KeyStrokeEvent Uses

type KeyStrokeEvent struct {
    Character rune
    Modifier  KeyboardModifier
}

type KeyboardController Uses

type KeyboardController struct {
    // contains filtered or unexported fields
}

func CreateKeyboardController Uses

func CreateKeyboardController(w Window) *KeyboardController

type KeyboardEvent Uses

type KeyboardEvent struct {
    Key      KeyboardKey
    Modifier KeyboardModifier
}

type KeyboardKey Uses

type KeyboardKey int
const (
    KeyUnknown KeyboardKey = iota
    KeySpace
    KeyApostrophe
    KeyComma
    KeyMinus
    KeyPeriod
    KeySlash
    Key0
    Key1
    Key2
    Key3
    Key4
    Key5
    Key6
    Key7
    Key8
    Key9
    KeySemicolon
    KeyEqual
    KeyA
    KeyB
    KeyC
    KeyD
    KeyE
    KeyF
    KeyG
    KeyH
    KeyI
    KeyJ
    KeyK
    KeyL
    KeyM
    KeyN
    KeyO
    KeyP
    KeyQ
    KeyR
    KeyS
    KeyT
    KeyU
    KeyV
    KeyW
    KeyX
    KeyY
    KeyZ
    KeyLeftBracket
    KeyBackslash
    KeyRightBracket
    KeyGraveAccent
    KeyWorld1
    KeyWorld2
    KeyEscape
    KeyEnter
    KeyTab
    KeyBackspace
    KeyInsert
    KeyDelete
    KeyRight
    KeyLeft
    KeyDown
    KeyUp
    KeyPageUp
    KeyPageDown
    KeyHome
    KeyEnd
    KeyCapsLock
    KeyScrollLock
    KeyNumLock
    KeyPrintScreen
    KeyPause
    KeyF1
    KeyF2
    KeyF3
    KeyF4
    KeyF5
    KeyF6
    KeyF7
    KeyF8
    KeyF9
    KeyF10
    KeyF11
    KeyF12
    KeyKp0
    KeyKp1
    KeyKp2
    KeyKp3
    KeyKp4
    KeyKp5
    KeyKp6
    KeyKp7
    KeyKp8
    KeyKp9
    KeyKpDecimal
    KeyKpDivide
    KeyKpMultiply
    KeyKpSubtract
    KeyKpAdd
    KeyKpEnter
    KeyKpEqual
    KeyLeftShift
    KeyLeftControl
    KeyLeftAlt
    KeyLeftSuper
    KeyRightShift
    KeyRightControl
    KeyRightAlt
    KeyRightSuper
    KeyMenu
    KeyLast
)

type KeyboardModifier Uses

type KeyboardModifier int
const (
    ModNone    KeyboardModifier = 0
    ModShift   KeyboardModifier = 1
    ModControl KeyboardModifier = 2
    ModAlt     KeyboardModifier = 4
    ModSuper   KeyboardModifier = 8
)

func (KeyboardModifier) Alt Uses

func (m KeyboardModifier) Alt() bool

func (KeyboardModifier) Control Uses

func (m KeyboardModifier) Control() bool

func (KeyboardModifier) Shift Uses

func (m KeyboardModifier) Shift() bool

func (KeyboardModifier) Super Uses

func (m KeyboardModifier) Super() bool

type Label Uses

type Label interface {
    Control
    Text() string
    SetText(string)
    Font() Font
    SetFont(Font)
    Color() Color
    SetColor(Color)
    Multiline() bool
    SetMultiline(bool)
    SetHorizontalAlignment(HorizontalAlignment)
    HorizontalAlignment() HorizontalAlignment
    SetVerticalAlignment(VerticalAlignment)
    VerticalAlignment() VerticalAlignment
}

type LinearLayout Uses

type LinearLayout interface {
    // LinearLayout extends the Control interface.
    Control

    // LinearLayout extends the Container interface.
    Container

    // Direction returns the direction of layout for this LinearLayout.
    Direction() Direction

    // Direction sets the direction of layout for this LinearLayout.
    SetDirection(Direction)

    // SizeMode returns the desired size behaviour for this LinearLayout.
    SizeMode() SizeMode

    // SetSizeMode sets the desired size behaviour for this LinearLayout.
    SetSizeMode(SizeMode)

    // HorizontalAlignment returns the alignment of the child Controls when laying
    // out TopToBottom or BottomToTop. It has no effect when the layout direction
    // is LeftToRight or RightToLeft.
    HorizontalAlignment() HorizontalAlignment

    // SetHorizontalAlignment sets the alignment of the child Controls when laying
    // out TopToBottom or BottomToTop. It has no effect when the layout direction
    // is LeftToRight or RightToLeft.
    SetHorizontalAlignment(HorizontalAlignment)

    // VerticalAlignment returns the alignment of the child Controls when laying
    // out LeftToRight or RightToLeft. It has no effect when the layout direction
    // is TopToBottom or BottomToTop.
    VerticalAlignment() VerticalAlignment

    // SetVerticalAlignment returns the alignment of the child Controls when
    // laying out LeftToRight or RightToLeft. It has no effect when the layout
    // direction is TopToBottom or BottomToTop.
    SetVerticalAlignment(VerticalAlignment)

    // BorderPen returns the Pen used to draw the LinearLayout's border.
    BorderPen() Pen

    // SetBorderPen sets the Pen used to draw the LinearLayout's border.
    SetBorderPen(Pen)

    // BackgroundBrush returns the Brush used to fill the LinearLayout's
    // background.
    BackgroundBrush() Brush

    // SetBackgroundBrush sets the Brush used to fill the LinearLayout's
    // background.
    SetBackgroundBrush(Brush)
}

LinearLayout is a Container that lays out its child Controls into a column or row. The layout will always start by positioning the first (0'th) child, and then depending on the direction, will position each successive child either to the left, top, right or bottom of the preceding child Control. LinearLayout makes no effort to distribute remaining space evenly between the children - an child control that is laid out before others will reduce the remaining space given to the later children, even to the point that there is zero space remaining.

type List Uses

type List interface {
    Focusable
    Parent
    Adapter() ListAdapter
    SetAdapter(ListAdapter)
    SetOrientation(Orientation)
    Orientation() Orientation
    BorderPen() Pen
    SetBorderPen(Pen)
    BackgroundBrush() Brush
    SetBackgroundBrush(Brush)
    ScrollTo(AdapterItem)
    IsItemVisible(AdapterItem) bool
    ItemControl(AdapterItem) Control
    Selected() AdapterItem
    Select(AdapterItem) bool
    OnSelectionChanged(func(AdapterItem)) EventSubscription
    OnItemClicked(func(MouseEvent, AdapterItem)) EventSubscription
}

type ListAdapter Uses

type ListAdapter interface {
    // Count returns the total number of items.
    Count() int

    // ItemAt returns the AdapterItem for the item at index i. It is important
    // for the Adapter to return consistent AdapterItems for the same data, so
    // that selections can be persisted, or re-ordering animations can be played
    // when the dataset changes.
    // The AdapterItem returned must be equality-unique across all indices.
    ItemAt(index int) AdapterItem

    // ItemIndex returns the index of item, or -1 if the adapter does not contain
    // item.
    ItemIndex(item AdapterItem) int

    // Create returns a Control visualizing the item at the specified index.
    Create(theme Theme, index int) Control

    // Size returns the size that each of the item's controls will be displayed
    // at for the given theme.
    Size(Theme) math.Size

    // OnDataChanged registers f to be called when there is a partial change in
    // the items of the adapter. Scroll positions and selections should be
    // preserved if possible.
    // If recreateControls is true then each of the visible controls should be
    // recreated by re-calling Create().
    OnDataChanged(f func(recreateControls bool)) EventSubscription

    // OnDataReplaced registers f to be called when there is a complete
    // replacement of items in the adapter.
    OnDataReplaced(f func()) EventSubscription
}

ListAdapter is an interface used to visualize a flat set of items. Users of the ListAdapter should presume the data is unchanged until the OnDataChanged or OnDataReplaced events are fired.

type MouseButton Uses

type MouseButton int
const (
    MouseButtonLeft MouseButton = iota
    MouseButtonMiddle
    MouseButtonRight
)

type MouseController Uses

type MouseController struct {
    // contains filtered or unexported fields
}

func CreateMouseController Uses

func CreateMouseController(w Window, focusController *FocusController) *MouseController

type MouseEvent Uses

type MouseEvent struct {
    Button           MouseButton
    State            MouseState
    Point            math.Point // Local to the event receiver
    WindowPoint      math.Point
    Window           Window
    ScrollX, ScrollY int
    Modifier         KeyboardModifier
}

type MouseState Uses

type MouseState int

func (MouseState) IsDown Uses

func (s MouseState) IsDown(b MouseButton) bool

type Orientation Uses

type Orientation int
const (
    Vertical Orientation = iota
    Horizontal
)

func (Orientation) Flip Uses

func (o Orientation) Flip() Orientation

func (Orientation) Horizontal Uses

func (o Orientation) Horizontal() bool

func (Orientation) Major Uses

func (o Orientation) Major(x, y int) int

func (Orientation) Minor Uses

func (o Orientation) Minor(x, y int) int

func (Orientation) Vertical Uses

func (o Orientation) Vertical() bool

type PanelHolder Uses

type PanelHolder interface {
    Control
    AddPanel(panel Control, name string)
    AddPanelAt(panel Control, name string, index int)
    RemovePanel(panel Control)
    Select(int)
    PanelCount() int
    PanelIndex(Control) int
    Panel(int) Control
    Tab(int) Control
}

type Parent Uses

type Parent interface {
    Children() Children
    Relayout()
    Redraw()
}

func CommonAncestor Uses

func CommonAncestor(a, b Control) Parent

type ParentPoint Uses

type ParentPoint struct {
    C   Parent
    P   math.Point
}

type Pen Uses

type Pen struct {
    Width float32
    Color Color
}
var DefaultPen Pen = CreatePen(1.0, Black)
var TransparentPen Pen = CreatePen(0.0, Transparent)
var WhitePen Pen = CreatePen(1.0, White)

func CreatePen Uses

func CreatePen(width float32, color Color) Pen

type Polygon Uses

type Polygon []PolygonVertex

type PolygonVertex Uses

type PolygonVertex struct {
    Position      math.Point
    RoundedRadius float32
}

type ProgressBar Uses

type ProgressBar interface {
    Control
    SetDesiredSize(math.Size)
    SetProgress(int)
    Progress() int
    SetTarget(int)
    Target() int
}

type ScalingMode Uses

type ScalingMode int
const (
    Scaling1to1 ScalingMode = iota
    ScalingExpandGreedy
    ScalingExplicitSize
)

type ScrollBar Uses

type ScrollBar interface {
    Control

    OnScroll(func(from, to int)) EventSubscription
    ScrollPosition() (from, to int)
    SetScrollPosition(from, to int)
    ScrollLimit() int
    SetScrollLimit(l int)
    AutoHide() bool
    SetAutoHide(l bool)
    Orientation() Orientation
    SetOrientation(Orientation)
}

type ScrollLayout Uses

type ScrollLayout interface {
    Control
    Parent
    SetChild(Control)
    Child() Control
    SetScrollAxis(horizontal, vertical bool)
    ScrollAxis() (horizontal, vertical bool)
    BorderPen() Pen
    SetBorderPen(Pen)
    BackgroundBrush() Brush
    SetBackgroundBrush(Brush)
}

type SelectionTransform Uses

type SelectionTransform func(int) int

type SimpleEvent Uses

type SimpleEvent struct {
    EventBase
}

type SizeMode Uses

type SizeMode int
const (
    ExpandToContent SizeMode = iota
    Fill
)

func (SizeMode) ExpandToContent Uses

func (s SizeMode) ExpandToContent() bool

func (SizeMode) Fill Uses

func (s SizeMode) Fill() bool

type SplitterLayout Uses

type SplitterLayout interface {
    Control
    Container
    ChildWeight(Control) float32
    SetChildWeight(Control, float32)
    Orientation() Orientation
    SetOrientation(Orientation)
}

type Stringer Uses

type Stringer interface {
    String() string
}

type TableLayout Uses

type TableLayout interface {
    Control

    Parent

    SetGrid(rows, columns int)
    // Add child at cell {x, y} with size of {w, h}
    SetChildAt(x, y, w, h int, child Control) *Child
    RemoveChild(child Control)
}

type TextBlock Uses

type TextBlock struct {
    Runes     []rune
    AlignRect math.Rect
    H         HorizontalAlignment
    V         VerticalAlignment
}

TextBlock is a sequence of runes to be laid out.

type TextBox Uses

type TextBox interface {
    Focusable
    OnSelectionChanged(func()) EventSubscription
    OnTextChanged(func([]TextBoxEdit)) EventSubscription
    Padding() math.Spacing
    SetPadding(math.Spacing)
    Runes() []rune
    Text() string
    SetText(string)
    Font() Font
    SetFont(Font)
    Multiline() bool
    SetMultiline(bool)
    DesiredWidth() int
    SetDesiredWidth(desiredWidth int)
    TextColor() Color
    SetTextColor(Color)
    Select(TextSelectionList)
    SelectAll()
    Carets() []int
    RuneIndexAt(p math.Point) (idx int, found bool)
    TextAt(s, e int) string
    WordAt(runeIndex int) string
    ScrollToLine(int)
    ScrollToRune(int)
    LineIndex(runeIndex int) int
    LineStart(line int) int
    LineEnd(line int) int
}

type TextBoxController Uses

type TextBoxController struct {
    // contains filtered or unexported fields
}

func CreateTextBoxController Uses

func CreateTextBoxController() *TextBoxController

func (*TextBoxController) AddCaret Uses

func (t *TextBoxController) AddCaret(c int)

func (*TextBoxController) AddCarets Uses

func (t *TextBoxController) AddCarets(transform SelectionTransform)

func (*TextBoxController) AddCaretsDown Uses

func (t *TextBoxController) AddCaretsDown()

func (*TextBoxController) AddCaretsUp Uses

func (t *TextBoxController) AddCaretsUp()

func (*TextBoxController) AddSelection Uses

func (t *TextBoxController) AddSelection(s TextSelection)

func (*TextBoxController) Backspace Uses

func (t *TextBoxController) Backspace()

func (*TextBoxController) Caret Uses

func (t *TextBoxController) Caret(i int) int

func (*TextBoxController) Carets Uses

func (t *TextBoxController) Carets() []int

func (*TextBoxController) ClearSelections Uses

func (t *TextBoxController) ClearSelections()

func (*TextBoxController) Delete Uses

func (t *TextBoxController) Delete()

func (*TextBoxController) Deselect Uses

func (t *TextBoxController) Deselect(moveCaretToStart bool) (deselected bool)

func (*TextBoxController) FirstCaret Uses

func (t *TextBoxController) FirstCaret() int

func (*TextBoxController) FirstSelection Uses

func (t *TextBoxController) FirstSelection() TextSelection

func (*TextBoxController) GrowSelections Uses

func (t *TextBoxController) GrowSelections(transform SelectionTransform)

func (*TextBoxController) IndentSelection Uses

func (t *TextBoxController) IndentSelection(tabWidth int)

func (*TextBoxController) IndexDown Uses

func (t *TextBoxController) IndexDown(i int) int

func (*TextBoxController) IndexEnd Uses

func (t *TextBoxController) IndexEnd(i int) int

func (*TextBoxController) IndexFirst Uses

func (t *TextBoxController) IndexFirst(i int) int

func (*TextBoxController) IndexHome Uses

func (t *TextBoxController) IndexHome(i int) int

func (*TextBoxController) IndexLast Uses

func (t *TextBoxController) IndexLast(i int) int

func (*TextBoxController) IndexLeft Uses

func (t *TextBoxController) IndexLeft(i int) int

func (*TextBoxController) IndexRight Uses

func (t *TextBoxController) IndexRight(i int) int

func (*TextBoxController) IndexUp Uses

func (t *TextBoxController) IndexUp(i int) int

func (*TextBoxController) IndexWordLeft Uses

func (t *TextBoxController) IndexWordLeft(i int) int

func (*TextBoxController) IndexWordRight Uses

func (t *TextBoxController) IndexWordRight(i int) int

func (*TextBoxController) LastCaret Uses

func (t *TextBoxController) LastCaret() int

func (*TextBoxController) LastSelection Uses

func (t *TextBoxController) LastSelection() TextSelection

func (*TextBoxController) Line Uses

func (t *TextBoxController) Line(i int) string

func (*TextBoxController) LineAndRow Uses

func (t *TextBoxController) LineAndRow(index int) (line, row int)

func (*TextBoxController) LineCount Uses

func (t *TextBoxController) LineCount() int

func (*TextBoxController) LineEnd Uses

func (t *TextBoxController) LineEnd(i int) int

func (*TextBoxController) LineIndent Uses

func (t *TextBoxController) LineIndent(i int) int

func (*TextBoxController) LineIndex Uses

func (t *TextBoxController) LineIndex(p int) int

func (*TextBoxController) LineRunes Uses

func (t *TextBoxController) LineRunes(i int) []rune

func (*TextBoxController) LineStart Uses

func (t *TextBoxController) LineStart(i int) int

func (*TextBoxController) MoveDown Uses

func (t *TextBoxController) MoveDown()

func (*TextBoxController) MoveEnd Uses

func (t *TextBoxController) MoveEnd()

func (*TextBoxController) MoveFirst Uses

func (t *TextBoxController) MoveFirst()

func (*TextBoxController) MoveHome Uses

func (t *TextBoxController) MoveHome()

func (*TextBoxController) MoveLast Uses

func (t *TextBoxController) MoveLast()

func (*TextBoxController) MoveLeft Uses

func (t *TextBoxController) MoveLeft()

func (*TextBoxController) MoveLeftByWord Uses

func (t *TextBoxController) MoveLeftByWord()

func (*TextBoxController) MoveRight Uses

func (t *TextBoxController) MoveRight()

func (*TextBoxController) MoveRightByWord Uses

func (t *TextBoxController) MoveRightByWord()

func (*TextBoxController) MoveSelections Uses

func (t *TextBoxController) MoveSelections(transform SelectionTransform)

func (*TextBoxController) MoveUp Uses

func (t *TextBoxController) MoveUp()

func (*TextBoxController) OnSelectionChanged Uses

func (t *TextBoxController) OnSelectionChanged(f func()) EventSubscription

func (*TextBoxController) OnTextChanged Uses

func (t *TextBoxController) OnTextChanged(f func([]TextBoxEdit)) EventSubscription

func (*TextBoxController) Replace Uses

func (t *TextBoxController) Replace(f func(sel TextSelection) string)

func (*TextBoxController) ReplaceAll Uses

func (t *TextBoxController) ReplaceAll(str string)

func (*TextBoxController) ReplaceAllRunes Uses

func (t *TextBoxController) ReplaceAllRunes(str []rune)

func (*TextBoxController) ReplaceAt Uses

func (t *TextBoxController) ReplaceAt(text []rune, s, e int, replacement []rune) ([]rune, TextBoxEdit)

func (*TextBoxController) ReplaceRunes Uses

func (t *TextBoxController) ReplaceRunes(f func(sel TextSelection) []rune)

func (*TextBoxController) ReplaceWithNewline Uses

func (t *TextBoxController) ReplaceWithNewline()

func (*TextBoxController) ReplaceWithNewlineKeepIndent Uses

func (t *TextBoxController) ReplaceWithNewlineKeepIndent()

func (*TextBoxController) RestoreNextSelections Uses

func (t *TextBoxController) RestoreNextSelections()

func (*TextBoxController) RestorePreviousSelections Uses

func (t *TextBoxController) RestorePreviousSelections()

func (*TextBoxController) RuneInWord Uses

func (t *TextBoxController) RuneInWord(r rune) bool

func (*TextBoxController) SelectAll Uses

func (t *TextBoxController) SelectAll()

func (*TextBoxController) SelectDown Uses

func (t *TextBoxController) SelectDown()

func (*TextBoxController) SelectEnd Uses

func (t *TextBoxController) SelectEnd()

func (*TextBoxController) SelectFirst Uses

func (t *TextBoxController) SelectFirst()

func (*TextBoxController) SelectHome Uses

func (t *TextBoxController) SelectHome()

func (*TextBoxController) SelectLast Uses

func (t *TextBoxController) SelectLast()

func (*TextBoxController) SelectLeft Uses

func (t *TextBoxController) SelectLeft()

func (*TextBoxController) SelectLeftByWord Uses

func (t *TextBoxController) SelectLeftByWord()

func (*TextBoxController) SelectRight Uses

func (t *TextBoxController) SelectRight()

func (*TextBoxController) SelectRightByWord Uses

func (t *TextBoxController) SelectRightByWord()

func (*TextBoxController) SelectUp Uses

func (t *TextBoxController) SelectUp()

func (*TextBoxController) Selection Uses

func (t *TextBoxController) Selection(i int) TextSelection

func (*TextBoxController) SelectionCount Uses

func (t *TextBoxController) SelectionCount() int

func (*TextBoxController) SelectionLineText Uses

func (t *TextBoxController) SelectionLineText(i int) string

func (*TextBoxController) SelectionText Uses

func (t *TextBoxController) SelectionText(i int) string

func (*TextBoxController) Selections Uses

func (t *TextBoxController) Selections() TextSelectionList

func (*TextBoxController) SetCaret Uses

func (t *TextBoxController) SetCaret(c int)

func (*TextBoxController) SetSelection Uses

func (t *TextBoxController) SetSelection(s TextSelection)

func (*TextBoxController) SetSelections Uses

func (t *TextBoxController) SetSelections(s TextSelectionList)

func (*TextBoxController) SetText Uses

func (t *TextBoxController) SetText(str string)

func (*TextBoxController) SetTextEdits Uses

func (t *TextBoxController) SetTextEdits(text []rune, edits []TextBoxEdit)

func (*TextBoxController) SetTextRunes Uses

func (t *TextBoxController) SetTextRunes(text []rune)

func (*TextBoxController) StoreCaretLocations Uses

func (t *TextBoxController) StoreCaretLocations()

func (*TextBoxController) Text Uses

func (t *TextBoxController) Text() string

func (*TextBoxController) TextRange Uses

func (t *TextBoxController) TextRange(s, e int) string

func (*TextBoxController) TextRunes Uses

func (t *TextBoxController) TextRunes() []rune

func (*TextBoxController) UnindentSelection Uses

func (t *TextBoxController) UnindentSelection(tabWidth int)

func (*TextBoxController) WordAt Uses

func (t *TextBoxController) WordAt(runeIdx int) (s, e int)

type TextBoxEdit Uses

type TextBoxEdit struct {
    At    int
    Delta int
}

type TextSelection Uses

type TextSelection struct {
    // contains filtered or unexported fields
}

func CreateTextSelection Uses

func CreateTextSelection(start, end int, caretAtStart bool) TextSelection

func (TextSelection) Caret Uses

func (i TextSelection) Caret() int

func (TextSelection) CaretAtStart Uses

func (i TextSelection) CaretAtStart() bool

func (TextSelection) End Uses

func (i TextSelection) End() int

func (TextSelection) First Uses

func (i TextSelection) First() int

func (TextSelection) From Uses

func (i TextSelection) From() int

func (TextSelection) Last Uses

func (i TextSelection) Last() int

func (TextSelection) Length Uses

func (i TextSelection) Length() int

func (TextSelection) Offset Uses

func (t TextSelection) Offset(i int) TextSelection

func (TextSelection) Range Uses

func (i TextSelection) Range() (start, end int)

func (TextSelection) Span Uses

func (i TextSelection) Span() (start, end uint64)

func (TextSelection) Start Uses

func (i TextSelection) Start() int

type TextSelectionList Uses

type TextSelectionList []TextSelection

func (TextSelectionList) Cap Uses

func (l TextSelectionList) Cap() int

func (TextSelectionList) Copy Uses

func (l TextSelectionList) Copy(to, from, count int)

func (TextSelectionList) GetInterval Uses

func (l TextSelectionList) GetInterval(index int) (start, end uint64)

func (*TextSelectionList) GrowTo Uses

func (l *TextSelectionList) GrowTo(length, capacity int)

func (TextSelectionList) Len Uses

func (l TextSelectionList) Len() int

func (TextSelectionList) MergeData Uses

func (l TextSelectionList) MergeData(index int, i interval.Node)

func (TextSelectionList) SetInterval Uses

func (l TextSelectionList) SetInterval(index int, start, end uint64)

func (*TextSelectionList) SetLen Uses

func (l *TextSelectionList) SetLen(len int)

func (TextSelectionList) Transform Uses

func (l TextSelectionList) Transform(from int, transform func(i int) int) TextSelectionList

func (TextSelectionList) TransformCarets Uses

func (l TextSelectionList) TransformCarets(from int, transform func(i int) int) TextSelectionList

type Texture Uses

type Texture interface {
    Image() image.Image
    Size() math.Size
    SizePixels() math.Size
    FlipY() bool
    SetFlipY(bool)
}

type Theme Uses

type Theme interface {
    Driver() Driver
    DefaultFont() Font
    SetDefaultFont(Font)
    DefaultMonospaceFont() Font
    SetDefaultMonospaceFont(Font)
    CreateBubbleOverlay() BubbleOverlay
    CreateButton() Button
    CreateCodeEditor() CodeEditor
    CreateDropDownList() DropDownList
    CreateImage() Image
    CreateLabel() Label
    CreateLinearLayout() LinearLayout
    CreateList() List
    CreatePanelHolder() PanelHolder
    CreateProgressBar() ProgressBar
    CreateScrollBar() ScrollBar
    CreateScrollLayout() ScrollLayout
    CreateSplitterLayout() SplitterLayout
    CreateTableLayout() TableLayout
    CreateTextBox() TextBox
    CreateTree() Tree
    CreateWindow(width, height int, title string) Window
}

type ToolTipController Uses

type ToolTipController struct {
    // contains filtered or unexported fields
}

func CreateToolTipController Uses

func CreateToolTipController(bubbleOverlay BubbleOverlay, driver Driver) *ToolTipController

func (*ToolTipController) AddToolTip Uses

func (c *ToolTipController) AddToolTip(control Control, delaySeconds float32, creator ToolTipCreator)

func (*ToolTipController) ShowToolTip Uses

func (c *ToolTipController) ShowToolTip(toolTip Control, at math.Point)

type ToolTipCreator Uses

type ToolTipCreator func(math.Point) Control

type Tree Uses

type Tree interface {
    Focusable

    // SetAdapter binds the specified TreeAdapter to this Tree control, replacing
    // any previously bound adapter.
    SetAdapter(TreeAdapter)

    // TreeAdapter returns the currently bound adapter.
    Adapter() TreeAdapter

    // Show makes the specified item visible, expanding the tree if necessary.
    Show(AdapterItem)

    // ExpandAll expands all tree nodes.
    ExpandAll()

    // CollapseAll collapses all tree nodes.
    CollapseAll()

    // Selected returns the currently selected item.
    Selected() AdapterItem

    // Select makes the specified item selected. The tree will not automatically
    // expand to the newly selected item. If the Tree does not contain the
    // specified item, then Select returns false and the previous selection
    // remains unaltered.
    Select(AdapterItem) bool

    // OnSelectionChanged registers the function f to be called when the selection
    // changes.
    OnSelectionChanged(f func(AdapterItem)) EventSubscription
}

Tree is the interface of all controls that visualize a hierarchical tree structure of items.

type TreeAdapter Uses

type TreeAdapter interface {
    TreeNodeContainer

    // Size returns the size that each of the item's controls will be displayed
    // at for the given theme.
    Size(Theme) math.Size

    // OnDataChanged registers f to be called when there is a partial change in
    // the items of the adapter. Scroll positions and selections should be
    // preserved if possible.
    // If recreateControls is true then each of the visible controls should be
    // recreated by re-calling Create().
    OnDataChanged(f func(recreateControls bool)) EventSubscription

    // OnDataReplaced registers f to be called when there is a complete
    // replacement of items in the adapter.
    OnDataReplaced(f func()) EventSubscription
}

TreeAdapter is an interface used to visualize a set of hierarchical items. Users of the TreeAdapter should presume the data is unchanged until the OnDataChanged or OnDataReplaced events are fired.

type TreeNode Uses

type TreeNode interface {
    TreeNodeContainer

    // Item returns the AdapterItem this node.
    // It is important for the TreeNode to return consistent AdapterItems for
    // the same data, so that selections can be persisted, or re-ordering
    // animations can be played when the dataset changes.
    // The AdapterItem returned must be equality-unique across the entire Adapter.
    Item() AdapterItem

    // Create returns a Control visualizing this node.
    Create(theme Theme) Control
}

TreeNode is the interface used by nodes in the tree.

type TreeNodeContainer Uses

type TreeNodeContainer interface {
    // Count returns the number of immediate child nodes.
    Count() int

    // Node returns the i'th child TreeNode.
    NodeAt(i int) TreeNode

    // ItemIndex returns the index of the child equal to item, or the index of the
    // child that indirectly contains item, or if the item is not found under this
    // node, -1.
    ItemIndex(item AdapterItem) int
}

TreeNodeContainer is the interface used by nodes that can hold sub-nodes in the tree.

type VerticalAlignment Uses

type VerticalAlignment int
const (
    AlignTop VerticalAlignment = iota
    AlignMiddle
    AlignBottom
)

func (VerticalAlignment) AlignBottom Uses

func (a VerticalAlignment) AlignBottom() bool

func (VerticalAlignment) AlignMiddle Uses

func (a VerticalAlignment) AlignMiddle() bool

func (VerticalAlignment) AlignTop Uses

func (a VerticalAlignment) AlignTop() bool

type Viewer Uses

type Viewer interface {
    View(t Theme) Control
}

type Viewport Uses

type Viewport interface {
    // SizeDips returns the size of the viewport in device-independent pixels.
    // The ratio of pixels to DIPs is based on the screen density and scale
    // adjustments made with the SetScale method.
    SizeDips() math.Size

    // SetSizeDips sets the size of the viewport in device-independent pixels.
    // The ratio of pixels to DIPs is based on the screen density and scale
    // adjustments made with the SetScale method.
    SetSizeDips(math.Size)

    // SizePixels returns the size of the viewport in pixels.
    SizePixels() math.Size

    // Scale returns the display scaling for this viewport.
    // A scale of 1 is unscaled, 2 is twice the regular scaling.
    Scale() float32

    // SetScale alters the display scaling for this viewport.
    // A scale of 1 is unscaled, 2 is twice the regular scaling.
    SetScale(float32)

    // Fullscreen returns true if the viewport was created full-screen.
    Fullscreen() bool

    // Title returns the title of the window.
    // This is usually the text displayed at the top of the window.
    Title() string

    // SetTitle changes the title of the window.
    SetTitle(string)

    // Position returns position of the window.
    Position() math.Point

    // SetPosition changes position of the window.
    SetPosition(math.Point)

    // Show makes the window visible.
    Show()

    // Hide makes the window invisible.
    Hide()

    // Close destroys the window.
    // Once the window is closed, no further calls should be made to it.
    Close()

    // SetCanvas changes the displayed content of the viewport to the specified
    // Canvas. As canvases are immutable once completed, every visual update of a
    // viewport will require a call to SetCanvas.
    SetCanvas(Canvas)

    // OnClose subscribes f to be called when the viewport closes.
    OnClose(f func()) EventSubscription

    // OnResize subscribes f to be called whenever the viewport changes size.
    OnResize(f func()) EventSubscription

    // OnMouseMove subscribes f to be called whenever the mouse cursor moves over
    // the viewport.
    OnMouseMove(f func(MouseEvent)) EventSubscription

    // OnMouseEnter subscribes f to be called whenever the mouse cursor enters the
    // viewport.
    OnMouseEnter(f func(MouseEvent)) EventSubscription

    // OnMouseEnter subscribes f to be called whenever the mouse cursor leaves the
    // viewport.
    OnMouseExit(f func(MouseEvent)) EventSubscription

    // OnMouseDown subscribes f to be called whenever a mouse button is pressed
    // while the cursor is inside the viewport.
    OnMouseDown(f func(MouseEvent)) EventSubscription

    // OnMouseUp subscribes f to be called whenever a mouse button is released
    // while the cursor is inside the viewport.
    OnMouseUp(f func(MouseEvent)) EventSubscription

    // OnMouseScroll subscribes f to be called whenever the mouse scroll wheel
    // turns while the cursor is inside the viewport.
    OnMouseScroll(f func(MouseEvent)) EventSubscription

    // OnKeyDown subscribes f to be called whenever a keyboard key is pressed
    // while the viewport has focus.
    OnKeyDown(f func(KeyboardEvent)) EventSubscription

    // OnKeyUp subscribes f to be called whenever a keyboard key is released
    // while the viewport has focus.
    OnKeyUp(f func(KeyboardEvent)) EventSubscription

    // OnKeyRepeat subscribes f to be called whenever a keyboard key-repeat event
    // is raised while the viewport has focus.
    OnKeyRepeat(f func(KeyboardEvent)) EventSubscription

    // OnKeyStroke subscribes f to be called whenever a keyboard key-stroke event
    // is raised while the viewport has focus.
    OnKeyStroke(f func(KeyStrokeEvent)) EventSubscription
}

type Window Uses

type Window interface {
    Container

    // Title returns the title of the window.
    // This is usually the text displayed at the top of the window.
    Title() string

    // SetTitle changes the title of the window.
    SetTitle(string)

    // Scale returns the display scaling for this window.
    // A scale of 1 is unscaled, 2 is twice the regular scaling.
    Scale() float32

    // SetScale alters the display scaling for this window.
    // A scale of 1 is unscaled, 2 is twice the regular scaling.
    SetScale(float32)

    // Position returns position of the window.
    Position() math.Point

    // SetPosition changes position of the window.
    SetPosition(math.Point)

    // Fullscreen returns true if the window is currently full-screen.
    Fullscreen() bool

    // SetFullscreen makes the window either full-screen or windowed.
    SetFullscreen(bool)

    // Show makes the window visible.
    Show()

    // Hide makes the window invisible.
    Hide()

    // Close destroys the window.
    // Once the window is closed, no further calls should be made to it.
    Close()

    // Focus returns the control currently with focus.
    Focus() Focusable

    // SetFocus gives the specified control Focus, returning true on success or
    // false if the control cannot be given focus.
    SetFocus(Control) bool

    // BackgroundBrush returns the brush used to draw the window background.
    BackgroundBrush() Brush

    // SetBackgroundBrush sets the brush used to draw the window background.
    SetBackgroundBrush(Brush)

    // BorderPen returns the pen used to draw the window border.
    BorderPen() Pen

    // SetBorderPen sets the pen used to draw the window border.
    SetBorderPen(Pen)

    Click(MouseEvent)
    DoubleClick(MouseEvent)
    KeyPress(KeyboardEvent)
    KeyStroke(KeyStrokeEvent)

    // Events
    OnClose(func()) EventSubscription
    OnResize(func()) EventSubscription
    OnClick(func(MouseEvent)) EventSubscription
    OnDoubleClick(func(MouseEvent)) EventSubscription
    OnMouseMove(func(MouseEvent)) EventSubscription
    OnMouseEnter(func(MouseEvent)) EventSubscription
    OnMouseExit(func(MouseEvent)) EventSubscription
    OnMouseDown(func(MouseEvent)) EventSubscription
    OnMouseUp(func(MouseEvent)) EventSubscription
    OnMouseScroll(func(MouseEvent)) EventSubscription
    OnKeyDown(func(KeyboardEvent)) EventSubscription
    OnKeyUp(func(KeyboardEvent)) EventSubscription
    OnKeyRepeat(func(KeyboardEvent)) EventSubscription
    OnKeyStroke(func(KeyStrokeEvent)) EventSubscription
}

func WindowContaining Uses

func WindowContaining(c Control) Window

Directories

PathSynopsis
drivers/glPackage gl contains an OpenGL implementation of the gxui.Driver interface.
drivers/gl/platform
gxfontPackage gxfont provides default fonts.
interval
math
mixins
mixins/base
mixins/outer
mixins/parts
samples/file_dlg
samples/file_dlg/roots
samples/flagsPackage flags holds command line options common to all GXUI samples.
samples/fullscreen
samples/hello_world
samples/image_viewer
samples/linear_layout
samples/lists
samples/panels
samples/polygon
samples/progress_bar
samples/table
samples/tree
testing
themes/basic
themes/dark
themes/light

Package gxui imports 13 packages (graph) and is imported by 266 packages. Updated 2018-08-14. Refresh now. Tools for package owners.