engine: github.com/g3n/engine/gui Index | Files | Directories

package gui

import "github.com/g3n/engine/gui"

Package gui implements the GUI infraestructure and several widgets.

Index

Package Files

align.go builder.go builder_layout.go builder_panel.go button.go chart.go checkradio.go control_folder.go doc.go docklayout.go dropdown.go edit.go events.go filllayout.go folder.go gridlayout.go hboxlayout.go ilayout.go image.go image_button.go imagelabel.go itemscroller.go label.go list.go logger.go menu.go panel.go root.go scrollbar.go scroller.go slider.go splitter.go style.go style_dark.go style_default.go style_light.go tabbar.go table.go tree.go util.go vboxlayout.go window.go

Constants

const (
    AlignNone   = Align(iota) // No alignment
    AlignLeft                 // Align horizontally at left
    AlignRight                // Align horizontally at right
    AlignWidth                // Align horizontally using all width
    AlignTop                  // Align vertically at the top
    AlignBottom               // Align vertically at the cnter
    AlignHeight               // Align vertically using all height
    AlignCenter               // Align horizontally/vertically at the center
)

The various types of alignment.

const (
    TypePanel       = "panel"
    TypeImagePanel  = "imagepanel"
    TypeLabel       = "label"
    TypeImageLabel  = "imagelabel"
    TypeButton      = "button"
    TypeCheckBox    = "checkbox"
    TypeRadioButton = "radiobutton"
    TypeEdit        = "edit"
    TypeVList       = "vlist"
    TypeHList       = "hlist"
    TypeDropDown    = "dropdown"
    TypeHSlider     = "hslider"
    TypeVSlider     = "vslider"
    TypeHSplitter   = "hsplitter"
    TypeVSplitter   = "vsplitter"
    TypeSeparator   = "separator"
    TypeTree        = "tree"
    TypeTreeNode    = "node"
    TypeMenuBar     = "menubar"
    TypeMenu        = "menu"
    TypeWindow      = "window"
    TypeChart       = "chart"
    TypeTable       = "table"
    TypeTabBar      = "tabbar"
    TypeHBoxLayout  = "hbox"
    TypeVBoxLayout  = "vbox"
    TypeGridLayout  = "grid"
    TypeDockLayout  = "dock"
)

Panel and layout types

const (
    AttribAlignv         = "alignv"        // Align
    AttribAlignh         = "alignh"        // Align
    AttribAspectHeight   = "aspectheight"  // float32
    AttribAspectWidth    = "aspectwidth"   // float32
    AttribBgColor        = "bgcolor"       // Color4
    AttribBorders        = "borders"       // RectBounds
    AttribBorderColor    = "bordercolor"   // Color4
    AttribChecked        = "checked"       // bool
    AttribColor          = "color"         // Color4
    AttribCols           = "cols"          // int GridLayout
    AttribColSpan        = "colspan"       // int GridLayout
    AttribColumns        = "columns"       // []map[string]interface{} Table
    AttribContent        = "content"       // map[string]interface{} Table
    AttribCountStepx     = "countstepx"    // float32
    AttribEdge           = "edge"          // int
    AttribEnabled        = "enabled"       // bool
    AttribExpand         = "expand"        // float32
    AttribExpandh        = "expandh"       // bool
    AttribExpandv        = "expandv"       // bool
    AttribFirstx         = "firstx"        // float32
    AttribFontColor      = "fontcolor"     // Color4
    AttribFontDPI        = "fontdpi"       // float32
    AttribFontSize       = "fontsize"      // float32
    AttribFormat         = "format"        // string
    AttribGroup          = "group"         // string
    AttribHeader         = "header"        // string
    AttribHeight         = "height"        // float32
    AttribHidden         = "hidden"        // bool Table
    AttribId             = "id"            // string
    AttribIcon           = "icon"          // string
    AttribImageFile      = "imagefile"     // string
    AttribImageLabel     = "imagelabel"    // []map[string]interface{}
    AttribItems          = "items"         // []map[string]interface{}
    AttribLayout         = "layout"        // map[string]interface{}
    AttribLayoutParams   = "layoutparams"  // map[string]interface{}
    AttribLineSpacing    = "linespacing"   // float32
    AttribLines          = "lines"         // int
    AttribMargin         = "margin"        // float32
    AttribMargins        = "margins"       // RectBounds
    AttribMinwidth       = "minwidth"      // float32 Table
    AttribAutoHeight     = "autoheight"    // bool
    AttribAutoWidth      = "autowidth"     // bool
    AttribName           = "name"          // string
    AttribPaddings       = "paddings"      // RectBounds
    AttribPanel0         = "panel0"        // map[string]interface{}
    AttribPanel1         = "panel1"        // map[string]interface{}
    AttribParentInternal = "parent_"       // string (internal attribute)
    AttribPinned         = "pinned"        // bool
    AttribPlaceHolder    = "placeholder"   // string
    AttribPosition       = "position"      // []float32
    AttribRangeAuto      = "rangeauto"     // bool
    AttribRangeMin       = "rangemin"      // float32
    AttribRangeMax       = "rangemax"      // float32
    AttribRender         = "render"        // bool
    AttribResizeBorders  = "resizeborders" // Resizable
    AttribResize         = "resize"        // bool Table
    AttribScaleFactor    = "scalefactor"   // float32
    AttribScalex         = "scalex"        // map[string]interface{}
    AttribScaley         = "scaley"        // map[string]interface{}
    AttribShortcut       = "shortcut"      // []int
    AttribShowHeader     = "showheader"    // bool
    AttribSortType       = "sorttype"      // TableSortType Table
    AttribSpacing        = "spacing"       // float32
    AttribSplit          = "split"         // float32
    AttribStepx          = "stepx"         // float32
    AttribText           = "text"          // string
    AttribTitle          = "title"         // string
    AttribType           = "type"          // string
    AttribUserData       = "userdata"      // interface{}
    AttribWidth          = "width"         // float32
    AttribValue          = "value"         // float32
    AttribVisible        = "visible"       // bool
)

Common attribute names

const (
    DockTop = iota + 1
    DockRight
    DockBottom
    DockLeft
    DockCenter
)

The different types of docking.

const (
    OnClick       = "gui.OnClick"       // Widget clicked by mouse left button or key
    OnCursor      = window.OnCursor     // cursor (mouse) position events
    OnCursorEnter = "gui.OnCursorEnter" // cursor enters the panel area
    OnCursorLeave = "gui.OnCursorLeave" // cursor leaves the panel area
    OnMouseDown   = window.OnMouseDown  // any mouse button is pressed
    OnMouseUp     = window.OnMouseUp    // any mouse button is released
    OnMouseOut    = "gui.OnMouseOut"    // mouse button pressed outside of the panel
    OnKeyDown     = window.OnKeyDown    // key is pressed
    OnKeyUp       = window.OnKeyUp      // key is released
    OnKeyRepeat   = window.OnKeyRepeat  // key is pressed again by automatic repeat
    OnChar        = window.OnChar       // key is pressed and has unicode
    OnResize      = "gui.OnResize"      // panel size changed (no parameters)
    OnEnable      = "gui.OnEnable"      // panel enabled state changed (no parameters)
    OnChange      = "gui.OnChange"      // onChange is emitted by List, DropDownList, CheckBox and Edit
    OnScroll      = window.OnScroll     // scroll event
    OnChild       = "gui.OnChild"       // child added to or removed from panel
    OnRadioGroup  = "gui.OnRadioGroup"  // radio button from a group changed state
    OnRightClick  = "gui.OnRightClick"  // Widget clicked by mouse right button
)

Consolidate window events plus GUI events

const (
    StopGUI = 0x01             // Stop event propagation to GUI
    Stop3D  = 0x02             // Stop event propagation to 3D
    StopAll = StopGUI | Stop3D // Stop event propagation
)

Types of event propagation stopping.

const (
    ScrollNone       = ScrollMode(0x00)                              // No scrolling allowed
    ScrollVertical   = ScrollMode(0x01)                              // Vertical scrolling allowed
    ScrollHorizontal = ScrollMode(0x02)                              // Horizontal scrolling allowed
    ScrollBoth       = ScrollMode(ScrollVertical | ScrollHorizontal) // Both vertical and horizontal scrolling allowed
)

The various scroll modes.

const (
    ScrollbarInterlockingNone       = ScrollbarInterlocking(iota) // No scrollbar interlocking
    ScrollbarInterlockingVertical                                 // Vertical scrollbar takes precedence
    ScrollbarInterlockingHorizontal                               // Horizontal scrollbar takes precedence
)

The three scrollbar interlocking types.

const (
    ScrollbarLeft   = ScrollbarPosition(iota) // Scrollbar is positioned on the left of the scroller
    ScrollbarRight                            // Scrollbar is positioned on the right of the scroller
    ScrollbarTop                              // Scrollbar is positioned on the top of the scroller
    ScrollbarBottom                           // Scrollbar is positioned on the bottom of the scroller
)

The four possible scrollbar positions.

const (
    StyleOver = iota + 1
    StyleFocus
    StyleDisabled
    StyleNormal
    StyleDef
)

States that a GUI element can be in

const (
    // OnTableClick is the event generated when the table is right or left clicked
    // Parameter is TableClickEvent
    OnTableClick = "onTableClick"
    // OnTableRowCount is the event generated when the table row count changes (no parameters)
    OnTableRowCount = "onTableRowCount"
)
const IgnoreSuffix = "_"

IgnoreSuffix specifies the suffix of ignored keys

const OnListItemResize = "gui.OnListItemResize"

OnListItemResize is the identifier of the event dispatched when a ListItem's child panel is resized

const ScrollModifierKey = window.KeyLeftShift

ScrollModifierKey is the Key that changes the scrolling direction from vertical to horizontal

func AttribCheckAlign Uses

func AttribCheckAlign(b *Builder, am map[string]interface{}, fname string) error

AttribCheckAlign checks and converts layout align* attribute

func AttribCheckBool Uses

func AttribCheckBool(b *Builder, am map[string]interface{}, fname string) error

AttribCheckBool checks and convert attribute to bool

func AttribCheckBorderSizes Uses

func AttribCheckBorderSizes(b *Builder, am map[string]interface{}, fname string) error

AttribCheckBorderSizes checks and convert attribute with border sizes

func AttribCheckColor Uses

func AttribCheckColor(b *Builder, am map[string]interface{}, fname string) error

AttribCheckColor checks and converts attribute with color name or color component values

func AttribCheckEdge Uses

func AttribCheckEdge(b *Builder, am map[string]interface{}, fname string) error

AttribCheckEdge checks and converts attribute with name of layout edge

func AttribCheckFloat Uses

func AttribCheckFloat(b *Builder, am map[string]interface{}, fname string) error

AttribCheckFloat checks and convert attribute to float32

func AttribCheckIcons Uses

func AttribCheckIcons(b *Builder, am map[string]interface{}, fname string) error

AttribCheckIcons checks and converts attribute with a list of icon names or codepoints

func AttribCheckInt Uses

func AttribCheckInt(b *Builder, am map[string]interface{}, fname string) error

AttribCheckInt checks and convert attribute to int

func AttribCheckInterface Uses

func AttribCheckInterface(b *Builder, am map[string]interface{}, fname string) error

AttribCheckInterface accepts any attribute value

func AttribCheckLayout Uses

func AttribCheckLayout(b *Builder, am map[string]interface{}, fname string) error

AttribCheckLayout checks and converts layout attribute

func AttribCheckListMap Uses

func AttribCheckListMap(b *Builder, am map[string]interface{}, fname string) error

AttribCheckListMap checks and converts attribute to []map[string]interface{}

func AttribCheckMap Uses

func AttribCheckMap(b *Builder, am map[string]interface{}, fname string) error

AttribCheckMap checks and converts attribute to map[string]interface{}

func AttribCheckMenuShortcut Uses

func AttribCheckMenuShortcut(b *Builder, am map[string]interface{}, fname string) error

AttribCheckMenuShortcut checks and converts attribute describing menu shortcut key

func AttribCheckPosition Uses

func AttribCheckPosition(b *Builder, am map[string]interface{}, fname string) error

AttribCheckPosition checks and convert attribute with x and y position

func AttribCheckResizeBorders Uses

func AttribCheckResizeBorders(b *Builder, am map[string]interface{}, fname string) error

AttribCheckResizeBorders checks and converts attribute with list of window resizable borders

func AttribCheckString Uses

func AttribCheckString(b *Builder, am map[string]interface{}, fname string) error

AttribCheckString checks and convert attribute to string

func AttribCheckStringLower Uses

func AttribCheckStringLower(b *Builder, am map[string]interface{}, fname string) error

AttribCheckStringLower checks and convert string attribute to lower case

func AttribCheckTableSortType Uses

func AttribCheckTableSortType(b *Builder, am map[string]interface{}, fname string) error

AttribCheckTableSortType checks and converts attribute table column sort type

func SetStyleDefault Uses

func SetStyleDefault(s *Style)

SetStyleDefault sets the default style

type Align Uses

type Align int

Align specifies the alignment of an object inside another.

type AttribCheckFunc Uses

type AttribCheckFunc func(b *Builder, am map[string]interface{}, fname string) error

AttribCheckFunc is the type for all attribute check functions

type BasicStyle Uses

type BasicStyle struct {
    PanelStyle
    FgColor math32.Color4
}

BasicStyle extends PanelStyle by adding a foreground color. Many GUI components can be styled using BasicStyle or redeclared versions thereof (e.g. ButtonStyle)

type Builder Uses

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

Builder builds GUI objects from a declarative description in YAML format

func NewBuilder Uses

func NewBuilder() *Builder

NewBuilder creates and returns a pointer to a new gui Builder object

func (*Builder) AddAttrib Uses

func (b *Builder) AddAttrib(typename string, acf AttribCheckFunc)

AddAttrib adds an attribute type and its checker/converte If the attribute type name already exists it is replaced.

func (*Builder) AddBuilderLayout Uses

func (b *Builder) AddBuilderLayout(typename string, bl IBuilderLayout)

AddBuilderLayout adds a layout builder object for the specified type name. If the type name already exists it is replaced.

func (*Builder) AddBuilderPanel Uses

func (b *Builder) AddBuilderPanel(typename string, bf BuilderFunc)

AddBuilderPanel adds a panel builder function for the specified type name. If the type name already exists it is replaced.

func (*Builder) Build Uses

func (b *Builder) Build(name string) (IPanel, error)

Build builds a gui object and all its children recursively. The specified name should be a top level name from a from a previously parsed description If the descriptions contains a single object with no name, It should be specified the empty string to build this object.

func (*Builder) Names Uses

func (b *Builder) Names() []string

Names returns a sorted list of names of top level previously parsed objects. Only objects with defined types are returned. If there is only a single object with no name, its name is returned as an empty string

func (*Builder) ParseFile Uses

func (b *Builder) ParseFile(filepath string) error

ParseFile parses a file with gui objects descriptions in YAML format It there was a previously parsed description, it is cleared.

func (*Builder) ParseString Uses

func (b *Builder) ParseString(desc string) error

ParseString parses a string with gui objects descriptions in YAML format It there was a previously parsed description, it is cleared.

func (*Builder) SetAttribs Uses

func (b *Builder) SetAttribs(am map[string]interface{}, ipan IPanel) error

SetAttribs sets common attributes from the description to the specified panel

func (*Builder) SetImagepath Uses

func (b *Builder) SetImagepath(path string)

SetImagepath Sets the path for image panels relative image files

type BuilderFunc Uses

type BuilderFunc func(*Builder, map[string]interface{}) (IPanel, error)

BuilderFunc is type for functions which build a gui object from an attribute map

type BuilderLayoutDock Uses

type BuilderLayoutDock struct{}

BuilderLayoutDock is builder for Dock layout

func (*BuilderLayoutDock) BuildLayout Uses

func (bl *BuilderLayoutDock) BuildLayout(b *Builder, am map[string]interface{}) (ILayout, error)

BuildLayout builds and returns a DockLayout with the specified attributes

func (*BuilderLayoutDock) BuildParams Uses

func (bl *BuilderLayoutDock) BuildParams(b *Builder, am map[string]interface{}) (interface{}, error)

BuildParams builds and returns a pointer to DockLayoutParams with the specified attributes

type BuilderLayoutGrid Uses

type BuilderLayoutGrid struct{}

BuilderLayoutGrid is builder for Grid layout

func (*BuilderLayoutGrid) BuildLayout Uses

func (bl *BuilderLayoutGrid) BuildLayout(b *Builder, am map[string]interface{}) (ILayout, error)

BuildLayout builds and returns a GridLayout with the specified attributes

func (*BuilderLayoutGrid) BuildParams Uses

func (bl *BuilderLayoutGrid) BuildParams(b *Builder, am map[string]interface{}) (interface{}, error)

BuildParams builds and returns a pointer to GridLayoutParams with the specified attributes

type BuilderLayoutHBox Uses

type BuilderLayoutHBox struct{}

BuilderLayoutHBox is builder for HBox layout

func (*BuilderLayoutHBox) BuildLayout Uses

func (bl *BuilderLayoutHBox) BuildLayout(b *Builder, am map[string]interface{}) (ILayout, error)

BuildLayout builds and returns an HBoxLayout with the specified attributes

func (*BuilderLayoutHBox) BuildParams Uses

func (bl *BuilderLayoutHBox) BuildParams(b *Builder, am map[string]interface{}) (interface{}, error)

BuildParams builds and returns a pointer to HBoxLayoutParams with the specified attributes

type BuilderLayoutVBox Uses

type BuilderLayoutVBox struct{}

BuilderLayoutVBox is builder for VBox layout

func (*BuilderLayoutVBox) BuildLayout Uses

func (bl *BuilderLayoutVBox) BuildLayout(b *Builder, am map[string]interface{}) (ILayout, error)

BuildLayout builds and returns an VBoxLayout with the specified attributes

func (*BuilderLayoutVBox) BuildParams Uses

func (bl *BuilderLayoutVBox) BuildParams(b *Builder, am map[string]interface{}) (interface{}, error)

BuildParams builds and returns a pointer to VBoxLayoutParams with the specified attributes

type Button Uses

type Button struct {
    *Panel        // Embedded Panel
    Label  *Label // Label panel
    // contains filtered or unexported fields
}

Button represents a button GUI element

func NewButton Uses

func NewButton(text string) *Button

NewButton creates and returns a pointer to a new button widget with the specified text for the button label.

func (*Button) SetIcon Uses

func (b *Button) SetIcon(icode string)

SetIcon sets the button icon from the default Icon font. If there is currently a selected image, it is removed

func (*Button) SetImage Uses

func (b *Button) SetImage(imgfile string) error

SetImage sets the button left image from the specified filename If there is currently a selected icon, it is removed

func (*Button) SetStyles Uses

func (b *Button) SetStyles(bs *ButtonStyles)

SetStyles set the button styles overriding the default style

type ButtonState Uses

type ButtonState int

ButtonState specifies a button state.

const (
    ButtonNormal ButtonState = iota
    ButtonOver
    ButtonPressed
    ButtonDisabled
)

The possible button states.

type ButtonStyle Uses

type ButtonStyle BasicStyle

ButtonStyle contains the styling of a Button

type ButtonStyles Uses

type ButtonStyles struct {
    Normal   ButtonStyle
    Over     ButtonStyle
    Focus    ButtonStyle
    Pressed  ButtonStyle
    Disabled ButtonStyle
}

ButtonStyles contains one ButtonStyle for each possible button state

type Chart Uses

type Chart struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

Chart implements a panel which can contain a title, an x scale, an y scale and several graphs

func NewChart Uses

func NewChart(width, height float32) *Chart

NewChart creates and returns a new chart panel with the specified dimensions in pixels.

func (*Chart) AddLineGraph Uses

func (ch *Chart) AddLineGraph(color *math32.Color, data []float32) *Graph

AddLineGraph adds a line graph to the chart

func (*Chart) ClearScaleX Uses

func (ch *Chart) ClearScaleX()

ClearScaleX removes the X scale if it was previously set

func (*Chart) ClearScaleY Uses

func (ch *Chart) ClearScaleY()

ClearScaleY removes the Y scale if it was previously set

func (*Chart) Init Uses

func (ch *Chart) Init(width float32, height float32)

Init initializes a new chart with the specified width and height It is normally used to initialize a Chart embedded in a struct

func (*Chart) RangeY Uses

func (ch *Chart) RangeY() (minY, maxY float32)

RangeY returns the current y range

func (*Chart) RemoveGraph Uses

func (ch *Chart) RemoveGraph(g *Graph)

RemoveGraph removes and disposes of the specified graph from the chart

func (*Chart) SetFontSizeX Uses

func (ch *Chart) SetFontSizeX(size float64)

SetFontSizeX sets the font size for the x scale labels

func (*Chart) SetFontSizeY Uses

func (ch *Chart) SetFontSizeY(size float64)

SetFontSizeY sets the font size for the y scale labels

func (*Chart) SetFormatX Uses

func (ch *Chart) SetFormatX(format string)

SetFormatX sets the string format of the X scale labels

func (*Chart) SetFormatY Uses

func (ch *Chart) SetFormatY(format string)

SetFormatY sets the string format of the Y scale labels

func (*Chart) SetMarginX Uses

func (ch *Chart) SetMarginX(bottom float32)

SetMarginX sets the x scale margin

func (*Chart) SetMarginY Uses

func (ch *Chart) SetMarginY(left float32)

SetMarginY sets the y scale margin

func (*Chart) SetRangeX Uses

func (ch *Chart) SetRangeX(firstX float32, stepX float32, countStepX float32)

SetRangeX sets the X scale labels and range per step firstX is the value of first label of the x scale stepX is the step to be added to get the next x scale label countStepX is the number of elements of the data buffer for each line step

func (*Chart) SetRangeY Uses

func (ch *Chart) SetRangeY(min float32, max float32)

SetRangeY sets the minimum and maximum values of the y scale

func (*Chart) SetRangeYauto Uses

func (ch *Chart) SetRangeYauto(auto bool)

SetRangeYauto sets the state of the auto

func (*Chart) SetScaleX Uses

func (ch *Chart) SetScaleX(lines int, color *math32.Color)

SetScaleX sets the X scale number of lines, lines color and label font size

func (*Chart) SetScaleY Uses

func (ch *Chart) SetScaleY(lines int, color *math32.Color)

SetScaleY sets the Y scale number of lines and color

func (*Chart) SetTitle Uses

func (ch *Chart) SetTitle(title string, size float64)

SetTitle sets the chart title text and font size. To remove the title pass an empty string

type CheckRadio Uses

type CheckRadio struct {
    Panel        // Embedded panel
    Label *Label // Text label
    // contains filtered or unexported fields
}

CheckRadio is a GUI element that can be either a checkbox or a radio button

func NewCheckBox Uses

func NewCheckBox(text string) *CheckRadio

NewCheckBox creates and returns a pointer to a new CheckBox widget with the specified text

func NewRadioButton Uses

func NewRadioButton(text string) *CheckRadio

NewRadioButton creates and returns a pointer to a new RadioButton widget with the specified text

func (*CheckRadio) Group Uses

func (cb *CheckRadio) Group() string

Group returns the name of the radio group

func (*CheckRadio) SetGroup Uses

func (cb *CheckRadio) SetGroup(group string) *CheckRadio

SetGroup sets the name of the radio group

func (*CheckRadio) SetStyles Uses

func (cb *CheckRadio) SetStyles(bs *CheckRadioStyles)

SetStyles set the button styles overriding the default style

func (*CheckRadio) SetValue Uses

func (cb *CheckRadio) SetValue(state bool) *CheckRadio

SetValue sets the current state of the checkbox

func (*CheckRadio) Value Uses

func (cb *CheckRadio) Value() bool

Value returns the current state of the checkbox

type CheckRadioStyle Uses

type CheckRadioStyle BasicStyle

CheckRadioStyle contains the styling of a CheckRadio

type CheckRadioStyles Uses

type CheckRadioStyles struct {
    Normal   CheckRadioStyle
    Over     CheckRadioStyle
    Focus    CheckRadioStyle
    Disabled CheckRadioStyle
}

CheckRadioStyles contains an CheckRadioStyle for each valid GUI state

type ColorStyle Uses

type ColorStyle struct {
    BgDark    math32.Color4
    BgMed     math32.Color4
    BgNormal  math32.Color4
    BgOver    math32.Color4
    Highlight math32.Color4
    Select    math32.Color4
    Text      math32.Color4
    TextDis   math32.Color4
}

ColorStyle defines the main colors used.

type ControlFolder Uses

type ControlFolder struct {
    Folder // Embedded folder
    // contains filtered or unexported fields
}

ControlFolder represents a folder with controls.

func NewControlFolder Uses

func NewControlFolder(text string, width float32) *ControlFolder

NewControlFolder creates and returns a pointer to a new control folder widget with the specified text and initial width

func (*ControlFolder) AddCheckBox Uses

func (f *ControlFolder) AddCheckBox(text string) *CheckRadio

AddCheckBox adds a checkbox to the control folder's tree

func (*ControlFolder) AddGroup Uses

func (f *ControlFolder) AddGroup(text string) *ControlFolderGroup

AddGroup adds a group to the control folder

func (*ControlFolder) AddPanel Uses

func (f *ControlFolder) AddPanel(pan IPanel)

AddPanel adds an IPanel to the control folder's tree

func (*ControlFolder) AddSlider Uses

func (f *ControlFolder) AddSlider(text string, sf, v float32) *Slider

AddSlider adds a slider to the control folder's tree

func (*ControlFolder) Clear Uses

func (f *ControlFolder) Clear()

Clear clears the control folder's tree

func (*ControlFolder) Initialize Uses

func (f *ControlFolder) Initialize(text string, width float32)

Initialize initializes the control folder with the specified text and initial width It is normally used when the control folder is embedded in another object

func (*ControlFolder) RemoveAt Uses

func (f *ControlFolder) RemoveAt(pos int) IPanel

RemoveAt removes the IPanel at the specified position from the control folder's tree

func (*ControlFolder) SetStyles Uses

func (f *ControlFolder) SetStyles(fs *ControlFolderStyles)

SetStyles set the folder styles overriding the default style

type ControlFolderGroup Uses

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

ControlFolderGroup represents a group of controls in the control folder.

func (*ControlFolderGroup) AddCheckBox Uses

func (g *ControlFolderGroup) AddCheckBox(text string) *CheckRadio

AddCheckBox adds a checkbox to the control folder group

func (*ControlFolderGroup) AddPanel Uses

func (g *ControlFolderGroup) AddPanel(pan IPanel)

AddPanel adds a panel to the control folder group

func (*ControlFolderGroup) AddSlider Uses

func (g *ControlFolderGroup) AddSlider(text string, sf, v float32) *Slider

AddSlider adds a slider to the control folder group

type ControlFolderStyles Uses

type ControlFolderStyles struct {
    Folder *FolderStyles
    Tree   *TreeStyles
}

ControlFolderStyles contains the styling for the valid GUI states of the components of a ControlFolder.

type DockLayout Uses

type DockLayout struct {
}

DockLayout is the layout for docking panels to the internal edges of their parent.

func NewDockLayout Uses

func NewDockLayout() *DockLayout

NewDockLayout returns a pointer to a new DockLayout.

func (*DockLayout) Recalc Uses

func (dl *DockLayout) Recalc(ipan IPanel)

Recalc (which satisfies the ILayout interface) recalculates the positions and sizes of the children panels.

type DockLayoutParams Uses

type DockLayoutParams struct {
    Edge int
}

DockLayoutParams specifies the edge to dock to.

type DropDown struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

DropDown represents a dropdown GUI element.

func NewDropDown Uses

func NewDropDown(width float32, item *ImageLabel) *DropDown

NewDropDown creates and returns a pointer to a new drop down widget with the specified width.

func (dd *DropDown) Add(item *ImageLabel)

Add adds a list item at the end of the list

func (dd *DropDown) InsertAt(pos int, item *ImageLabel)

InsertAt inserts a list item at the specified position Returs true if the item was successfully inserted

func (dd *DropDown) ItemAt(pos int) *ImageLabel

ItemAt returns the list item at the specified position

func (dd *DropDown) Len() int

Len returns the number of items in the dropdown's list.

func (dd *DropDown) RemoveAt(pos int)

RemoveAt removes the list item from the specified position Returs true if the item was successfully removed

func (dd *DropDown) SelectPos(pos int)

SelectPos selects the item at the specified position

func (dd *DropDown) Selected() *ImageLabel

Selected returns the currently selected item or nil if no item was selected

func (dd *DropDown) SelectedPos() int

SelectedPos returns the currently selected position or -1 if no item was selected

func (dd *DropDown) SetSelected(item *ImageLabel)

SetSelected sets the selected item

func (dd *DropDown) SetStyles(dds *DropDownStyles)

SetStyles sets the drop down styles overriding the default style

type DropDownStyle BasicStyle

DropDownStyle contains the styling of a DropDown.

type DropDownStyles struct {
    Normal   DropDownStyle
    Over     DropDownStyle
    Focus    DropDownStyle
    Disabled DropDownStyle
}

DropDownStyles contains a DropDownStyle for each valid GUI state.

type Edit Uses

type Edit struct {
    Label         // Embedded label
    MaxLength int // Maximum number of characters
    // contains filtered or unexported fields
}

Edit represents a text edit box GUI element

func NewEdit Uses

func NewEdit(width int, placeHolder string) *Edit

NewEdit creates and returns a pointer to a new edit widget

func (*Edit) CursorBack Uses

func (ed *Edit) CursorBack()

CursorBack deletes the character at left of the cursor if possible

func (*Edit) CursorDelete Uses

func (ed *Edit) CursorDelete()

CursorDelete deletes the character at the right of the cursor if possible

func (*Edit) CursorEnd Uses

func (ed *Edit) CursorEnd()

CursorEnd moves the edit cursor to the end of the text

func (*Edit) CursorHome Uses

func (ed *Edit) CursorHome()

CursorHome moves the edit cursor to the beginning of the text

func (*Edit) CursorInput Uses

func (ed *Edit) CursorInput(s string)

CursorInput inserts the specified string at the current cursor position

func (*Edit) CursorLeft Uses

func (ed *Edit) CursorLeft()

CursorLeft moves the edit cursor one character left if possible

func (*Edit) CursorPos Uses

func (ed *Edit) CursorPos(col int)

CursorPos sets the position of the cursor at the specified column if possible

func (*Edit) CursorRight Uses

func (ed *Edit) CursorRight()

CursorRight moves the edit cursor one character right if possible

func (*Edit) LostKeyFocus Uses

func (ed *Edit) LostKeyFocus()

LostKeyFocus satisfies the IPanel interface and is called by gui root container when the panel loses the key focus

func (*Edit) SetFontSize Uses

func (ed *Edit) SetFontSize(size float64) *Edit

SetFontSize sets label font size (overrides Label.SetFontSize)

func (*Edit) SetStyles Uses

func (ed *Edit) SetStyles(es *EditStyles)

SetStyles set the button styles overriding the default style

func (*Edit) SetText Uses

func (ed *Edit) SetText(text string) *Edit

SetText sets this edit text

func (*Edit) Text Uses

func (ed *Edit) Text() string

Text returns the current edited text

type EditStyle Uses

type EditStyle struct {
    Border      RectBounds
    Paddings    RectBounds
    BorderColor math32.Color4
    BgColor     math32.Color4
    BgAlpha     float32
    FgColor     math32.Color4
    HolderColor math32.Color4
}

EditStyle contains the styling of an Edit

type EditStyles Uses

type EditStyles struct {
    Normal   EditStyle
    Over     EditStyle
    Focus    EditStyle
    Disabled EditStyle
}

EditStyles contains an EditStyle for each valid GUI state

type FillLayout Uses

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

FillLayout is the simple layout where the assigned panel "fills" its parent in the specified dimension(s)

func NewFillLayout Uses

func NewFillLayout(width, height bool) *FillLayout

NewFillLayout creates and returns a pointer of a new fill layout

func (*FillLayout) Recalc Uses

func (f *FillLayout) Recalc(ipan IPanel)

Recalc is called by the panel which has this layout

type Folder Uses

type Folder struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

Folder represents a folder GUI element.

func NewFolder Uses

func NewFolder(text string, width float32, contentPanel IPanel) *Folder

NewFolder creates and returns a pointer to a new folder widget with the specified text and initial width.

func (*Folder) Initialize Uses

func (f *Folder) Initialize(text string, width float32, contentPanel IPanel)

Initialize initializes the Folder with the specified text and initial width It is normally used when the folder is embedded in another object.

func (*Folder) SetAlignRight Uses

func (f *Folder) SetAlignRight(state bool)

SetAlignRight sets the side of the alignment of the content panel in relation to the folder.

func (*Folder) SetStyles Uses

func (f *Folder) SetStyles(fs *FolderStyles)

SetStyles set the folder styles overriding the default style.

func (*Folder) TotalHeight Uses

func (f *Folder) TotalHeight() float32

TotalHeight returns this folder total height considering the contents panel, if visible.

type FolderStyle Uses

type FolderStyle struct {
    PanelStyle
    FgColor math32.Color4
    Icons   [2]string
}

FolderStyle contains the styling of a Folder.

type FolderStyles Uses

type FolderStyles struct {
    Normal   FolderStyle
    Over     FolderStyle
    Focus    FolderStyle
    Disabled FolderStyle
}

FolderStyles contains a FolderStyle for each valid GUI state.

type Graph Uses

type Graph struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

Graph is the GUI element that represents a single plotted function. A Chart has an array of Graph objects.

func (*Graph) RenderSetup Uses

func (lg *Graph) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo)

RenderSetup is called by the renderer before drawing this graphic It overrides the original panel RenderSetup Calculates the model matrix and transfer to OpenGL.

func (*Graph) SetColor Uses

func (lg *Graph) SetColor(color *math32.Color)

SetColor sets the color of the graph

func (*Graph) SetData Uses

func (lg *Graph) SetData(data []float32)

SetData sets the graph data

func (*Graph) SetLineWidth Uses

func (lg *Graph) SetLineWidth(width float32)

SetLineWidth sets the graph line width

type GridLayout Uses

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

GridLayout is a panel layout which arranges its children in a rectangular grid. It is necessary to set the number of columns of the grid when the layout is created. The panel's child elements are positioned in the grid cells accordingly to the order they were added to the panel. The height of each row is determined by the height of the heightest child in the row. The width of each column is determined by the width of the widest child in the column

func NewGridLayout Uses

func NewGridLayout(ncols int) *GridLayout

NewGridLayout creates and returns a pointer of a new grid layout

func (*GridLayout) Recalc Uses

func (g *GridLayout) Recalc(ipan IPanel)

Recalc sets the position and sizes of all of the panel's children. It is normally called by the parent panel when its size changes or a child is added or removed.

func (*GridLayout) SetAlignH Uses

func (g *GridLayout) SetAlignH(align Align)

SetAlignH sets the horizontal alignment for all the grid cells The alignment of an individual cell can be set by settings its layout parameters.

func (*GridLayout) SetAlignV Uses

func (g *GridLayout) SetAlignV(align Align)

SetAlignV sets the vertical alignment for all the grid cells The alignment of an individual cell can be set by settings its layout parameters.

func (*GridLayout) SetColAlignH Uses

func (g *GridLayout) SetColAlignH(col int, align Align)

SetColAlignH sets the horizontal alignment for all the cells of the specified column. The function panics if the supplied column is invalid.

func (*GridLayout) SetColAlignV Uses

func (g *GridLayout) SetColAlignV(col int, align Align)

SetColAlignV sets the vertical alignment for all the cells of the specified column. The function panics if the supplied column is invalid

func (*GridLayout) SetExpandH Uses

func (g *GridLayout) SetExpandH(expand bool)

SetExpandH sets it the columns should expand horizontally if possible

func (*GridLayout) SetExpandV Uses

func (g *GridLayout) SetExpandV(expand bool)

SetExpandV sets it the rowss should expand vertically if possible

type GridLayoutParams Uses

type GridLayoutParams struct {
    ColSpan int   // Number of additional columns to ocuppy to the right
    AlignH  Align // Vertical alignment
    AlignV  Align // Horizontal alignment
}

GridLayoutParams describes layout parameter for an specific child

type HBoxLayout Uses

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

HBoxLayout implements a panel layout which arranges the panel children horizontally. The children can be separated by a space in pixels set by SetSpacing(). The whole group of children can be aligned horizontally by SetAlignH() which can accept the following types of alignment:

AlignLeft: Try to align the group of children to the left if the panel width is
greater the the sum of the children widths + spacing.

AlignRight: Try to align the group of children to the right if the panel width is
greater the the sum of the children widths + spacing.

AlignCenter: Try to align the group of children in the center if the panel width is
greater the the sum of the children widths + spacing.

AlignWidth - Try to align the individual children with the same same space between each other.
Each individual child can be aligned vertically by SetLayoutParameters()

If the layout method SetAutoHeight(true) is called, the panel minimum content height will be the height of the child with the largest height.

If the layout method SetAutoWidth(true) is called, the panel minimum content width will be the sum of its children's widths plus the spacing.

func NewHBoxLayout Uses

func NewHBoxLayout() *HBoxLayout

NewHBoxLayout creates and returns a pointer to a new horizontal box layout

func (*HBoxLayout) Recalc Uses

func (bl *HBoxLayout) Recalc(ipan IPanel)

Recalc recalculates and sets the position and sizes of all children

func (*HBoxLayout) SetAlignH Uses

func (bl *HBoxLayout) SetAlignH(align Align)

SetAlignH sets the horizontal alignment of the whole group of items inside the parent panel and updates the layout. This only has any effect if there are no expanded items.

func (*HBoxLayout) SetAutoHeight Uses

func (bl *HBoxLayout) SetAutoHeight(state bool)

SetAutoHeight sets if the panel minimum height should be the height of the largest of its children's height.

func (*HBoxLayout) SetAutoWidth Uses

func (bl *HBoxLayout) SetAutoWidth(state bool)

SetAutoWidth sets if the panel minimum width should be sum of its children's width plus the spacing

func (*HBoxLayout) SetSpacing Uses

func (bl *HBoxLayout) SetSpacing(spacing float32)

SetSpacing sets the horizontal spacing between the items in pixels and updates the layout if possible

type HBoxLayoutParams Uses

type HBoxLayoutParams struct {
    Expand float32 // item expand horizontally factor (0 - no expand)
    AlignV Align   // item vertical alignment
}

HBoxLayoutParams specify the vertical alignment of each individual child.

type IBuilderLayout Uses

type IBuilderLayout interface {
    BuildLayout(b *Builder, am map[string]interface{}) (ILayout, error)
    BuildParams(b *Builder, am map[string]interface{}) (interface{}, error)
}

IBuilderLayout is the interface for all layout builders

type ILayout Uses

type ILayout interface {
    Recalc(ipan IPanel)
}

ILayout is the interface for layouts

type IPanel Uses

type IPanel interface {
    graphic.IGraphic
    GetPanel() *Panel
    SetRoot(*Root)
    Root() *Root
    LostKeyFocus()
    TotalHeight() float32
    TotalWidth() float32
    SetLayout(ILayout)
    SetPosition(x, y float32)
    SetPositionX(x float32)
    SetPositionY(y float32)
}

IPanel is the interface for all panel types

type Image Uses

type Image struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

Image is a Panel which contains a single Image

func NewImage Uses

func NewImage(imgfile string) (image *Image, err error)

NewImage creates and returns an image panel with the image from the specified image used as a texture. Initially the size of the panel content area is the exact size of the image.

func NewImageFromRGBA Uses

func NewImageFromRGBA(rgba *image.RGBA) *Image

NewImageFromRGBA creates and returns an image panel from the specified image

func NewImageFromTex Uses

func NewImageFromTex(tex *texture.Texture2D) *Image

NewImageFromTex creates and returns an image panel from the specified texture2D

func (*Image) SetImage Uses

func (i *Image) SetImage(imgfile string) error

SetImage sets the image from the specified image file

func (*Image) SetTexture Uses

func (i *Image) SetTexture(tex *texture.Texture2D) *texture.Texture2D

SetTexture changes the image texture to the specified texture2D. It returns a pointer to the previous texture.

type ImageButton Uses

type ImageButton struct {
    *Panel // Embedded Panel
    // contains filtered or unexported fields
}

ImageButton represents an image button GUI element

func NewImageButton Uses

func NewImageButton(normalImgPath string) (*ImageButton, error)

NewImageButton creates and returns a pointer to a new ImageButton widget with the specified image.

func (*ImageButton) Dispose Uses

func (b *ImageButton) Dispose()

Dispose releases resources used by this widget

func (*ImageButton) SetFontSize Uses

func (b *ImageButton) SetFontSize(size float64)

SetFontSize sets the font size of the label/icon

func (*ImageButton) SetIcon Uses

func (b *ImageButton) SetIcon(icode string)

SetIcon sets the icon

func (*ImageButton) SetImage Uses

func (b *ImageButton) SetImage(state ButtonState, imgfile string) error

SetImage sets the button left image from the specified filename If there is currently a selected icon, it is removed

func (*ImageButton) SetStyles Uses

func (b *ImageButton) SetStyles(bs *ImageButtonStyles)

SetStyles set the button styles overriding the default style

func (*ImageButton) SetText Uses

func (b *ImageButton) SetText(text string)

SetText sets the text of the label

type ImageButtonStyle Uses

type ImageButtonStyle BasicStyle

ImageButtonStyle contains the styling of an ImageButton.

type ImageButtonStyles Uses

type ImageButtonStyles struct {
    Normal   ImageButtonStyle
    Over     ImageButtonStyle
    Focus    ImageButtonStyle
    Pressed  ImageButtonStyle
    Disabled ImageButtonStyle
}

ImageButtonStyles contains one ImageButtonStyle for each possible ImageButton state.

type ImageLabel Uses

type ImageLabel struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

ImageLabel is a panel which can contain an Image or Icon plus a Label side by side.

func NewImageLabel Uses

func NewImageLabel(text string) *ImageLabel

NewImageLabel creates and returns a pointer to a new image label widget with the specified text for the label and no image/icon

func (*ImageLabel) CopyFields Uses

func (il *ImageLabel) CopyFields(other *ImageLabel)

CopyFields copies another image label icon/image and text to this one

func (*ImageLabel) ImageVisible Uses

func (il *ImageLabel) ImageVisible() bool

ImageVisible returns the image visibility

func (*ImageLabel) SetBgColor Uses

func (il *ImageLabel) SetBgColor(color *math32.Color)

SetBgColor sets the color of the image label background The color alpha is set to 1.0

func (*ImageLabel) SetBgColor4 Uses

func (il *ImageLabel) SetBgColor4(color *math32.Color4)

SetBgColor4 sets the color4 of the image label background

func (*ImageLabel) SetColor Uses

func (il *ImageLabel) SetColor(color *math32.Color)

SetColor sets the color of the label and icon text

func (*ImageLabel) SetColor4 Uses

func (il *ImageLabel) SetColor4(color *math32.Color4)

SetColor4 sets the color4 of the label and icon

func (*ImageLabel) SetFontSize Uses

func (il *ImageLabel) SetFontSize(size float64)

SetFontSize sets the size of the image label font size

func (*ImageLabel) SetIcon Uses

func (il *ImageLabel) SetIcon(icon string)

SetIcon sets the image label icon from the default Icon font. If there is currently a selected image, it is removed

func (*ImageLabel) SetImage Uses

func (il *ImageLabel) SetImage(img *Image)

SetImage sets the image label image

func (*ImageLabel) SetImageFromFile Uses

func (il *ImageLabel) SetImageFromFile(imgfile string) error

SetImageFromFile sets the image label image from the specified filename If there is currently a selected icon, it is removed

func (*ImageLabel) SetImageVisible Uses

func (il *ImageLabel) SetImageVisible(vis bool)

SetImageVisible sets the image visibility

func (*ImageLabel) SetText Uses

func (il *ImageLabel) SetText(text string)

SetText sets the text of the image label

func (*ImageLabel) Text Uses

func (il *ImageLabel) Text() string

Text returns the current label text

type ImageLabelStyle Uses

type ImageLabelStyle BasicStyle

ImageLabelStyle contains the styling of an ImageLabel.

type ItemScroller Uses

type ItemScroller struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

ItemScroller is the GUI element that allows scrolling of IPanels

func NewHScroller Uses

func NewHScroller(width, height float32) *ItemScroller

NewHScroller creates and returns a pointer to a new horizontal scroller panel with the specified dimensions.

func NewVScroller Uses

func NewVScroller(width, height float32) *ItemScroller

NewVScroller creates and returns a pointer to a new vertical scroller panel with the specified dimensions.

func (*ItemScroller) Add Uses

func (s *ItemScroller) Add(item IPanel)

Add appends the specified item to the end of the scroller

func (*ItemScroller) ApplyStyle Uses

func (s *ItemScroller) ApplyStyle(style int)

ApplyStyle applies the specified style to the ItemScroller

func (*ItemScroller) Clear Uses

func (s *ItemScroller) Clear()

Clear removes and disposes of all the scroller children

func (*ItemScroller) First Uses

func (s *ItemScroller) First() int

First returns the position of the first visible item

func (*ItemScroller) InsertAt Uses

func (s *ItemScroller) InsertAt(pos int, item IPanel)

InsertAt inserts an item at the specified position

func (*ItemScroller) ItemAt Uses

func (s *ItemScroller) ItemAt(pos int) IPanel

ItemAt returns the item at the specified position. Returns nil if the position is invalid.

func (*ItemScroller) ItemPosition Uses

func (s *ItemScroller) ItemPosition(item IPanel) int

ItemPosition returns the position of the specified item in the scroller of -1 if not found

func (*ItemScroller) ItemVisible Uses

func (s *ItemScroller) ItemVisible(pos int) bool

ItemVisible returns indication if the item at the specified position is completely visible or not

func (*ItemScroller) Len Uses

func (s *ItemScroller) Len() int

Len return the number of items in the scroller

func (*ItemScroller) Remove Uses

func (s *ItemScroller) Remove(item IPanel)

Remove removes the specified item from the ItemScroller

func (*ItemScroller) RemoveAt Uses

func (s *ItemScroller) RemoveAt(pos int) IPanel

RemoveAt removes item from the specified position

func (*ItemScroller) ScrollDown Uses

func (s *ItemScroller) ScrollDown()

ScrollDown scrolls the list down one item if possible

func (*ItemScroller) ScrollUp Uses

func (s *ItemScroller) ScrollUp()

ScrollUp scrolls the list up one item if possible

func (*ItemScroller) SetAutoButtonSize Uses

func (s *ItemScroller) SetAutoButtonSize(autoButtonSize bool)

SetAutoButtonSize specified whether the scrollbutton size should be adjusted relative to the size of the content/view

func (*ItemScroller) SetAutoHeight Uses

func (s *ItemScroller) SetAutoHeight(maxHeight float32)

SetAutoHeight sets the maximum automatic height

func (*ItemScroller) SetAutoWidth Uses

func (s *ItemScroller) SetAutoWidth(maxWidth float32)

SetAutoWidth sets the maximum automatic width

func (*ItemScroller) SetFirst Uses

func (s *ItemScroller) SetFirst(pos int)

SetFirst set the position of first visible if possible

func (*ItemScroller) SetStyles Uses

func (s *ItemScroller) SetStyles(ss *ItemScrollerStyles)

SetStyles set the scroller styles overriding the default style

type ItemScrollerStyle Uses

type ItemScrollerStyle BasicStyle

ItemScrollerStyle contains the styling of a ItemScroller

type ItemScrollerStyles Uses

type ItemScrollerStyles struct {
    Normal   ItemScrollerStyle
    Over     ItemScrollerStyle
    Focus    ItemScrollerStyle
    Disabled ItemScrollerStyle
}

ItemScrollerStyles contains a ItemScrollerStyle for each valid GUI state

type Label Uses

type Label struct {
    Panel // Embedded Panel
    // contains filtered or unexported fields
}

Label is a panel which contains a texture with text. The content size of the label panel is the exact size of the texture.

func NewIcon Uses

func NewIcon(icon string) *Label

NewIcon creates and returns a label panel with the specified text drawn using the default icon font.

func NewLabel Uses

func NewLabel(text string) *Label

NewLabel creates and returns a label panel with the specified text drawn using the default text font.

func NewLabelWithFont Uses

func NewLabelWithFont(msg string, font *text.Font) *Label

NewLabelWithFont creates and returns a label panel with the specified text drawn using the specified font.

func (*Label) BgColor Uses

func (l *Label) BgColor() math32.Color4

BgColor returns returns the background color.

func (*Label) Color Uses

func (l *Label) Color() math32.Color4

Color returns the text color.

func (*Label) Font Uses

func (l *Label) Font() *text.Font

Font returns the font.

func (*Label) FontDPI Uses

func (l *Label) FontDPI() float64

FontDPI returns the resolution of the font in dots per inch (DPI).

func (*Label) FontSize Uses

func (l *Label) FontSize() float64

FontSize returns the point size of the font.

func (*Label) LineSpacing Uses

func (l *Label) LineSpacing() float64

LineSpacing returns the spacing between lines.

func (*Label) SetBgColor Uses

func (l *Label) SetBgColor(color *math32.Color) *Label

SetBgColor sets the background color. The color alpha is set to 1.0

func (*Label) SetBgColor4 Uses

func (l *Label) SetBgColor4(color *math32.Color4) *Label

SetBgColor4 sets the background color.

func (*Label) SetColor Uses

func (l *Label) SetColor(color *math32.Color) *Label

SetColor sets the text color. Alpha is set to 1 (opaque).

func (*Label) SetColor4 Uses

func (l *Label) SetColor4(color4 *math32.Color4) *Label

SetColor4 sets the text color.

func (*Label) SetFont Uses

func (l *Label) SetFont(f *text.Font)

SetFont sets the font.

func (*Label) SetFontDPI Uses

func (l *Label) SetFontDPI(dpi float64) *Label

SetFontDPI sets the resolution of the font in dots per inch (DPI).

func (*Label) SetFontSize Uses

func (l *Label) SetFontSize(size float64) *Label

SetFontSize sets the point size of the font.

func (*Label) SetLineSpacing Uses

func (l *Label) SetLineSpacing(spacing float64) *Label

SetLineSpacing sets the spacing between lines.

func (*Label) SetText Uses

func (l *Label) SetText(text string)

SetText sets and draws the label text using the font.

func (*Label) Text Uses

func (l *Label) Text() string

Text returns the label text.

type LabelStyle Uses

type LabelStyle struct {
    PanelStyle
    text.FontAttributes
    FgColor math32.Color4
}

LabelStyle contains all the styling attributes of a Label. It's essentially a BasicStyle combined with FontAttributes.

type List Uses

type List struct {
    ItemScroller // Embedded scroller
    // contains filtered or unexported fields
}

List represents a list GUI element

func NewHList Uses

func NewHList(width, height float32) *List

NewHList creates and returns a pointer to a new horizontal list panel with the specified dimensions

func NewVList Uses

func NewVList(width, height float32) *List

NewVList creates and returns a pointer to a new vertical list panel with the specified dimensions

func (*List) Add Uses

func (li *List) Add(item IPanel)

Add add a list item at the end of the list

func (*List) InsertAt Uses

func (li *List) InsertAt(pos int, item IPanel)

InsertAt inserts a list item at the specified position Returs true if the item was successfully inserted

func (*List) ItemAt Uses

func (li *List) ItemAt(pos int) IPanel

ItemAt returns the list item at the specified position

func (*List) ItemPosition Uses

func (li *List) ItemPosition(item IPanel) int

ItemPosition returns the position of the specified item in the list or -1 if not found

func (*List) Remove Uses

func (li *List) Remove(item IPanel)

Remove removes the specified item from the list

func (*List) RemoveAt Uses

func (li *List) RemoveAt(pos int) IPanel

RemoveAt removes the list item from the specified position

func (*List) SelectPos Uses

func (li *List) SelectPos(pos int, state bool)

SelectPos selects or unselects the item at the specified position

func (*List) Selected Uses

func (li *List) Selected() []IPanel

Selected returns list with the currently selected items

func (*List) SetItemPadLeftAt Uses

func (li *List) SetItemPadLeftAt(pos int, pad float32)

SetItemPadLeftAt sets the additional left padding for this item It is used mainly by the tree control

func (*List) SetSelected Uses

func (li *List) SetSelected(item IPanel, state bool)

SetSelected selects or unselects the specified item

func (*List) SetSingle Uses

func (li *List) SetSingle(state bool)

SetSingle sets the single/multiple selection flag of the list

func (*List) SetStyles Uses

func (li *List) SetStyles(s *ListStyles)

SetStyles set the listr styles overriding the default style

func (*List) Single Uses

func (li *List) Single() bool

Single returns the current state of the single/multiple selection flag

type ListItem Uses

type ListItem struct {
    Panel // Container panel
    // contains filtered or unexported fields
}

ListItem encapsulates each item inserted into the list

func (*ListItem) SetHighlighted Uses

func (litem *ListItem) SetHighlighted(state bool)

SetHighlighted sets this item selected state

func (*ListItem) SetSelected Uses

func (litem *ListItem) SetSelected(state bool)

SetSelected sets this item selected state

type ListItemStyle Uses

type ListItemStyle BasicStyle

ListItemStyle contains the styling of a list item.

type ListItemStyles Uses

type ListItemStyles struct {
    Normal      ListItemStyle
    Over        ListItemStyle
    Selected    ListItemStyle
    Highlighted ListItemStyle
    SelHigh     ListItemStyle
}

ListItemStyles contains one ListItemStyle for each possible item state.

type ListStyles Uses

type ListStyles struct {
    Scroller *ItemScrollerStyles
    Item     *ListItemStyles
}

ListStyles encapsulates a set of styles for the list and item.

type Menu struct {
    Panel // embedded panel
    // contains filtered or unexported fields
}

Menu is the menu GUI element

func NewMenu Uses

func NewMenu() *Menu

NewMenu creates and returns a pointer to a new empty vertical menu

func NewMenuBar Uses

func NewMenuBar() *Menu

NewMenuBar creates and returns a pointer to a new empty menu bar

func (m *Menu) AddMenu(text string, subm *Menu) *MenuItem

AddMenu creates and adds a new menu item to this menu with the specified text and sub menu. Returns the pointer to the created menu item.

func (m *Menu) AddOption(text string) *MenuItem

AddOption creates and adds a new menu item to this menu with the specified text and returns the pointer to the created menu item.

func (m *Menu) AddSeparator() *MenuItem

AddSeparator creates and adds a new separator to the menu

func (m *Menu) RemoveItem(mi *MenuItem)

RemoveItem removes the specified menu item from this menu

type MenuBodyStyle BasicStyle

MenuBodyStyle describes the style of the menu body

type MenuBodyStyles struct {
    Normal   MenuBodyStyle
    Over     MenuBodyStyle
    Focus    MenuBodyStyle
    Disabled MenuBodyStyle
}

MenuBodyStyles describes all styles of the menu body

type MenuItem struct {
    Panel // embedded panel
    // contains filtered or unexported fields
}

MenuItem is an option of a Menu

func (mi *MenuItem) Id() string

Id returns this menu item current id

func (mi *MenuItem) IdPath() []string

IdPath returns a slice with the path of menu items ids to this menu item

func (mi *MenuItem) SetEnabled(enabled bool) *MenuItem

SetEnabled sets the enabled state of this menu item

func (mi *MenuItem) SetIcon(icon string) *MenuItem

SetIcon sets the left icon of this menu item If an image was previously set it is replaced by this icon

func (mi *MenuItem) SetId(id string) *MenuItem

SetId sets this menu item string id which can be used to identify the selected menu option.

func (mi *MenuItem) SetImage(img *Image)

SetImage sets the left image of this menu item If an icon was previously set it is replaced by this image

func (mi *MenuItem) SetShortcut(mods window.ModifierKey, key window.Key) *MenuItem

SetShortcut sets the keyboard shortcut of this menu item

func (mi *MenuItem) SetSubmenu(smi *MenuItem) *MenuItem

SetSubmenu sets an associated sub menu item for this menu item

func (mi *MenuItem) SetText(text string) *MenuItem

SetText sets the text of this menu item

type MenuItemStyle struct {
    PanelStyle
    FgColor          math32.Color4
    IconPaddings     RectBounds
    ShortcutPaddings RectBounds
    RiconPaddings    RectBounds
}

MenuItemStyle describes the style of a menu item

type MenuItemStyles struct {
    Normal    MenuItemStyle
    Over      MenuItemStyle
    Disabled  MenuItemStyle
    Separator MenuItemStyle
}

MenuItemStyles describes all the menu item styles

type MenuStyles struct {
    Body *MenuBodyStyles // Menu body styles
    Item *MenuItemStyles // Menu item styles
}

MenuStyles describes all styles of the menu body and menu item

type Panel Uses

type Panel struct {
    *graphic.Graphic // Embedded graphic
    // contains filtered or unexported fields
}

Panel is 2D rectangular graphic which by default has a quad (2 triangles) geometry. When using the default geometry, a panel has margins, borders, paddings and a content area. The content area can be associated with a texture It is the building block of most GUI widgets.

func NewPanel Uses

func NewPanel(width, height float32) *Panel

NewPanel creates and returns a pointer to a new panel with the specified dimensions in pixels and a default quad geometry

func (*Panel) Add Uses

func (p *Panel) Add(ichild IPanel) *Panel

Add adds a child panel to this one

func (*Panel) ApplyStyle Uses

func (p *Panel) ApplyStyle(ps *PanelStyle)

ApplyStyle applies the provided PanelStyle to the panel

func (*Panel) Borders Uses

func (p *Panel) Borders() RectBounds

Borders returns this panel current border sizes

func (*Panel) BordersColor4 Uses

func (p *Panel) BordersColor4() math32.Color4

BordersColor4 returns current border color

func (*Panel) Bounded Uses

func (p *Panel) Bounded() bool

Bounded returns this panel bounded state

func (*Panel) Color4 Uses

func (p *Panel) Color4() math32.Color4

Color4 returns the current color of the panel content area

func (*Panel) ContainsPosition Uses

func (p *Panel) ContainsPosition(x, y float32) bool

ContainsPosition returns indication if this panel contains the specified screen position in pixels.

func (*Panel) ContentCoords Uses

func (p *Panel) ContentCoords(wx, wy float32) (float32, float32)

ContentCoords converts the specified window absolute coordinates in pixels (as informed by OnMouse event) to this panel internal content area pixel coordinates

func (*Panel) ContentHeight Uses

func (p *Panel) ContentHeight() float32

ContentHeight returns the current height of the content area in pixels

func (*Panel) ContentWidth Uses

func (p *Panel) ContentWidth() float32

ContentWidth returns the current width of the content area in pixels

func (*Panel) Enabled Uses

func (p *Panel) Enabled() bool

Enabled returns the current enabled state of this panel

func (*Panel) GetPanel Uses

func (p *Panel) GetPanel() *Panel

GetPanel satisfies the IPanel interface and returns pointer to this panel

func (*Panel) Height Uses

func (p *Panel) Height() float32

Height returns the current panel external height in pixels

func (*Panel) Initialize Uses

func (p *Panel) Initialize(width, height float32)

Initialize initializes this panel and is normally used by other types which embed a panel.

func (*Panel) InitializeGraphic Uses

func (p *Panel) InitializeGraphic(width, height float32, gr *graphic.Graphic)

InitializeGraphic initializes this panel with a different graphic

func (*Panel) InsideBorders Uses

func (p *Panel) InsideBorders(x, y float32) bool

InsideBorders returns indication if the specified screen position in pixels is inside the panel borders, including the borders width. Unlike "ContainsPosition" is does not consider the panel margins.

func (*Panel) Intersects Uses

func (p *Panel) Intersects(other *Panel) bool

Intersects returns if this panel intersects with the other panel

func (*Panel) Layout Uses

func (p *Panel) Layout() ILayout

Layout returns this panel current layout

func (*Panel) LayoutParams Uses

func (p *Panel) LayoutParams() interface{}

LayoutParams returns this panel current layout parameters

func (*Panel) LostKeyFocus Uses

func (p *Panel) LostKeyFocus()

LostKeyFocus satisfies the IPanel interface and is called by gui root container when the panel loses the key focus

func (*Panel) Margins Uses

func (p *Panel) Margins() RectBounds

Margins returns the current margin sizes in pixels

func (*Panel) Material Uses

func (p *Panel) Material() *material.Material

Material returns a pointer for this panel core.Material

func (*Panel) MinHeight Uses

func (p *Panel) MinHeight() float32

MinHeight returns the minimum height of this panel (ContentHeight = 0)

func (*Panel) MinWidth Uses

func (p *Panel) MinWidth() float32

MinWidth returns the minimum width of this panel (ContentWidth = 0)

func (*Panel) NDC2Pix Uses

func (p *Panel) NDC2Pix(nx, ny float32) (x, y float32)

NDC2Pix converts the specified NDC coordinates (-1,1) to relative pixel coordinates for this panel content area. 0,0 1,0 0,0 w,0 +--------+ +---------+ | | -------> | | +--------+ +---------+ 0,-1 1,-1 0,h w,h

func (*Panel) Paddings Uses

func (p *Panel) Paddings() RectBounds

Paddings returns this panel padding sizes in pixels

func (*Panel) Pix2NDC Uses

func (p *Panel) Pix2NDC(px, py float32) (nx, ny float32)

Pix2NDC converts the specified relative pixel coordinates to NDC coordinates for this panel content area 0,0 w,0 0,0 1,0 +---------+ +---------+ | | ------> | | +---------+ +---------+ 0,h w,h 0,-1 1,-1

func (*Panel) Pospix Uses

func (p *Panel) Pospix() math32.Vector3

Pospix returns this panel absolute coordinate in pixels

func (*Panel) Remove Uses

func (p *Panel) Remove(ichild IPanel) bool

Remove removes the specified child from this panel

func (*Panel) RenderSetup Uses

func (p *Panel) RenderSetup(gl *gls.GLS, rinfo *core.RenderInfo)

RenderSetup is called by the Engine before drawing the object

func (*Panel) Root Uses

func (p *Panel) Root() *Root

Root satisfies the IPanel interface Returns the pointer to the root panel for this panel's root.

func (*Panel) SetBorders Uses

func (p *Panel) SetBorders(top, right, bottom, left float32)

SetBorders sets this panel border sizes in pixels and recalculates the panel external size

func (*Panel) SetBordersColor Uses

func (p *Panel) SetBordersColor(color *math32.Color)

SetBordersColor sets the color of this panel borders The borders opacity is set to 1.0 (full opaque)

func (*Panel) SetBordersColor4 Uses

func (p *Panel) SetBordersColor4(color *math32.Color4)

SetBordersColor4 sets the color and opacity of this panel borders

func (*Panel) SetBordersFrom Uses

func (p *Panel) SetBordersFrom(src *RectBounds)

SetBordersFrom sets this panel border sizes from the specified RectBounds pointer and recalculates the panel size

func (*Panel) SetBounded Uses

func (p *Panel) SetBounded(bounded bool)

SetBounded sets this panel bounded state

func (*Panel) SetColor Uses

func (p *Panel) SetColor(color *math32.Color) *Panel

SetColor sets the color of the panel paddings and content area

func (*Panel) SetColor4 Uses

func (p *Panel) SetColor4(color *math32.Color4) *Panel

SetColor4 sets the color of the panel paddings and content area

func (*Panel) SetContentAspectHeight Uses

func (p *Panel) SetContentAspectHeight(height float32)

SetContentAspectHeight sets the height of the content area of the panel to the specified value and adjusts its width to keep the same aspect ratio.

func (*Panel) SetContentAspectWidth Uses

func (p *Panel) SetContentAspectWidth(width float32)

SetContentAspectWidth sets the width of the content area of the panel to the specified value and adjusts its height to keep the same aspect radio.

func (*Panel) SetContentHeight Uses

func (p *Panel) SetContentHeight(height float32)

SetContentHeight sets this panel content height to the specified dimension in pixels. The external size of the panel may increase or decrease to accommodate the new width

func (*Panel) SetContentSize Uses

func (p *Panel) SetContentSize(width, height float32)

SetContentSize sets this panel content size to the specified dimensions. The external size of the panel may increase or decrease to acomodate the new content size.

func (*Panel) SetContentWidth Uses

func (p *Panel) SetContentWidth(width float32)

SetContentWidth sets this panel content width to the specified dimension in pixels. The external size of the panel may increase or decrease to accommodate the new width

func (*Panel) SetEnabled Uses

func (p *Panel) SetEnabled(state bool)

SetEnabled sets the panel enabled state A disabled panel do not process key or mouse events.

func (*Panel) SetHeight Uses

func (p *Panel) SetHeight(height float32)

SetHeight sets this panel external height in pixels. The internal panel areas and positions are recalculated

func (*Panel) SetLayout Uses

func (p *Panel) SetLayout(ilayout ILayout)

SetLayout sets the layout to use to position the children of this panel To remove the layout, call this function passing nil as parameter.

func (*Panel) SetLayoutParams Uses

func (p *Panel) SetLayoutParams(params interface{})

SetLayoutParams sets the layout parameters for this panel

func (*Panel) SetMargins Uses

func (p *Panel) SetMargins(top, right, bottom, left float32)

SetMargins set this panel margin sizes in pixels and recalculates the panel external size

func (*Panel) SetMarginsFrom Uses

func (p *Panel) SetMarginsFrom(src *RectBounds)

SetMarginsFrom sets this panel margins sizes from the specified RectBounds pointer and recalculates the panel external size

func (*Panel) SetModelMatrix Uses

func (p *Panel) SetModelMatrix(gl *gls.GLS, mm *math32.Matrix4)

SetModelMatrix calculates and sets the specified matrix with the model matrix for this panel

func (*Panel) SetPaddings Uses

func (p *Panel) SetPaddings(top, right, bottom, left float32)

SetPaddings sets the panel padding sizes in pixels

func (*Panel) SetPaddingsColor Uses

func (p *Panel) SetPaddingsColor(color *math32.Color)

SetPaddingsColor sets the color of this panel paddings.

func (*Panel) SetPaddingsFrom Uses

func (p *Panel) SetPaddingsFrom(src *RectBounds)

SetPaddingsFrom sets this panel padding sizes from the specified RectBounds pointer and recalculates the panel size

func (*Panel) SetPosition Uses

func (p *Panel) SetPosition(x, y float32)

SetPosition sets this panel absolute position in pixel coordinates from left to right and from top to bottom of the screen.

func (*Panel) SetRoot Uses

func (p *Panel) SetRoot(root *Root)

SetRoot satisfies the IPanel interface. Sets the pointer to the root panel for this panel and all its children.

func (*Panel) SetSize Uses

func (p *Panel) SetSize(width, height float32)

SetSize sets this panel external width and height in pixels.

func (*Panel) SetTopChild Uses

func (p *Panel) SetTopChild(ipan IPanel)

SetTopChild sets the Z coordinate of the specified panel to be on top of all other children of this panel. The function does not check if the specified panel is a child of this one.

func (*Panel) SetWidth Uses

func (p *Panel) SetWidth(width float32)

SetWidth sets this panel external width in pixels. The internal panel areas and positions are recalculated

func (*Panel) Size Uses

func (p *Panel) Size() (float32, float32)

Size returns this panel current external width and height in pixels

func (*Panel) TotalHeight Uses

func (p *Panel) TotalHeight() float32

TotalHeight satisfies the IPanel interface and returns the total height of this panel considering visible not bounded children

func (*Panel) TotalWidth Uses

func (p *Panel) TotalWidth() float32

TotalWidth satisfies the IPanel interface and returns the total width of this panel considering visible not bounded children

func (*Panel) UpdateMatrixWorld Uses

func (p *Panel) UpdateMatrixWorld()

UpdateMatrixWorld overrides the standard core.Node version which is called by the Engine before rendering the frame.

func (*Panel) Width Uses

func (p *Panel) Width() float32

Width returns the current panel external width in pixels

type PanelStyle Uses

type PanelStyle struct {
    Margin      RectBounds
    Border      RectBounds
    Padding     RectBounds
    BorderColor math32.Color4
    BgColor     math32.Color4
}

PanelStyle contains all the styling attributes of a Panel.

type Rect Uses

type Rect struct {
    X      float32
    Y      float32
    Width  float32
    Height float32
}

Rect represents a rectangle.

func (*Rect) Contains Uses

func (r *Rect) Contains(x, y float32) bool

Contains determines whether a 2D point is inside the Rect.

type RectBounds Uses

type RectBounds struct {
    Top    float32
    Right  float32
    Bottom float32
    Left   float32
}

RectBounds specifies the size of the boundaries of a rectangle. It can represent the thickness of the borders, the margins, or the padding of a rectangle.

func (*RectBounds) Set Uses

func (bs *RectBounds) Set(top, right, bottom, left float32)

Set sets the values of the RectBounds.

type Root Uses

type Root struct {
    Panel             // embedded panel
    core.TimerManager // embedded TimerManager
    // contains filtered or unexported fields
}

Root is the container and dispatcher of panel events

func NewRoot Uses

func NewRoot(gs *gls.GLS, win window.IWindow) *Root

NewRoot creates and returns a pointer to a gui root panel for the specified window

func (*Root) Add Uses

func (r *Root) Add(ipan IPanel)

Add adds the specified panel to the root container list of children Overrides the Panel version because it needs to set the root panel field

func (*Root) ClearKeyFocus Uses

func (r *Root) ClearKeyFocus()

ClearKeyFocus clears the key focus panel (if any) without calling LostKeyFocus() for previous focused panel

func (*Root) HasKeyFocus Uses

func (r *Root) HasKeyFocus(ipan IPanel) bool

HasKeyFocus checks if the specified panel has the key focus

func (*Root) HasMouseFocus Uses

func (r *Root) HasMouseFocus(ipan IPanel) bool

HasMouseFocus checks if the specified panel has the mouse focus

func (*Root) SetCursorCrosshair Uses

func (r *Root) SetCursorCrosshair()

SetCursorCrosshair sets the cursor over the associated window to the crosshair type.

func (*Root) SetCursorDiagResize1 Uses

func (r *Root) SetCursorDiagResize1()

SetCursorDiag1 sets the cursor over the associated window to the diagonal (/) resize type.

func (*Root) SetCursorDiagResize2 Uses

func (r *Root) SetCursorDiagResize2()

SetCursorDiag2 sets the cursor over the associated window to the diagonal (\) resize type.

func (*Root) SetCursorHResize Uses

func (r *Root) SetCursorHResize()

SetCursorHResize sets the cursor over the associated window to the horizontal resize type.

func (*Root) SetCursorHand Uses

func (r *Root) SetCursorHand()

SetCursorHand sets the cursor over the associated window to the hand type.

func (*Root) SetCursorNormal Uses

func (r *Root) SetCursorNormal()

SetCursorNormal sets the cursor over the associated window to the standard type.

func (*Root) SetCursorText Uses

func (r *Root) SetCursorText()

SetCursorText sets the cursor over the associated window to the I-Beam type.

func (*Root) SetCursorVResize Uses

func (r *Root) SetCursorVResize()

SetCursorVResize sets the cursor over the associated window to the vertical resize type.

func (*Root) SetKeyFocus Uses

func (r *Root) SetKeyFocus(ipan IPanel)

SetKeyFocus sets the panel which will receive all keyboard events Passing nil will remove the focus (if any)

func (*Root) SetModal Uses

func (r *Root) SetModal(ipan IPanel)

SetModal sets the modal panel. If there is a modal panel, only events for this panel are dispatched To remove the modal panel call this function with a nil panel.

func (*Root) SetMouseFocus Uses

func (r *Root) SetMouseFocus(ipan IPanel)

SetMouseFocus sets the panel which will receive all mouse events Passing nil will restore the default event processing

func (*Root) SetScrollFocus Uses

func (r *Root) SetScrollFocus(ipan IPanel)

SetScrollFocus sets the panel which will receive all scroll events Passing nil will restore the default event processing

func (*Root) StopPropagation Uses

func (r *Root) StopPropagation(events int)

StopPropagation stops the propagation of the current event to outside the root panel (for example the 3D camera)

func (*Root) SubscribeWin Uses

func (r *Root) SubscribeWin()

SubscribeWin subscribes this root panel to window events

func (*Root) Window Uses

func (r *Root) Window() window.IWindow

Window returns the associated IWindow.

type ScrollBar Uses

type ScrollBar struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

ScrollBar is the scrollbar GUI element.

func NewHScrollBar Uses

func NewHScrollBar(width, height float32) *ScrollBar

NewHScrollBar creates and returns a pointer to a new horizontal scroll bar with the specified dimensions.

func NewVScrollBar Uses

func NewVScrollBar(width, height float32) *ScrollBar

NewVScrollBar creates and returns a pointer to a new vertical scroll bar with the specified dimensions.

func (*ScrollBar) SetButtonSize Uses

func (sb *ScrollBar) SetButtonSize(size float32)

SetButtonSize sets the button size

func (*ScrollBar) SetValue Uses

func (sb *ScrollBar) SetValue(v float32)

SetValue sets the position of the button of the scrollbar from 0.0 (minimum) to 1.0 (maximum).

func (*ScrollBar) Value Uses

func (sb *ScrollBar) Value() float64

Value returns the current position of the button in the scrollbar The returned value is between 0.0 and 1.0

type ScrollBarStyle Uses

type ScrollBarStyle struct {
    PanelStyle
    Button       PanelStyle
    ButtonLength float32 // This is the default/minimum button length

}

ScrollBarStyle contains the styling of a ScrollBar.

type ScrollBarStyles Uses

type ScrollBarStyles struct {
    Normal   ScrollBarStyle
    Over     ScrollBarStyle
    Disabled ScrollBarStyle
}

ScrollBarStyles contains a ScrollBarStyle for each valid GUI state.

type ScrollMode Uses

type ScrollMode int

ScrollMode specifies which scroll directions are allowed.

type ScrollbarInterlocking Uses

type ScrollbarInterlocking int

ScrollbarInterlocking specifies what happens where the vertical and horizontal scrollbars meet.

type ScrollbarPosition Uses

type ScrollbarPosition int

ScrollbarPosition specifies where the scrollbar is located. For the vertical scrollbar it specifies whether it's added to the left or to the right. For the horizontal scrollbar it specifies whether it's added to the top or to the bottom.

type Scroller Uses

type Scroller struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

Scroller is the GUI element that allows scrolling of a target IPanel. A scroller can have up to two scrollbars, one vertical and one horizontal. The vertical scrollbar, if any, can be located either on the left or on the right. The horizontal scrollbar, if any, can be located either on the top or on the bottom. The interlocking of the scrollbars (which happens when both scrollbars are visible) can be configured. Whether each scrollbar overlaps the content can also be configured (useful for transparent UIs).

func NewScroller Uses

func NewScroller(width, height float32, mode ScrollMode, target IPanel) *Scroller

NewScroller creates and returns a pointer to a new Scroller with the specified target IPanel and ScrollMode.

func (*Scroller) CornerCovered Uses

func (s *Scroller) CornerCovered() bool

CornerCovered returns whether the corner covering panel is being shown when appropriate

func (*Scroller) HorizontalScrollbarAutoSizeButton Uses

func (s *Scroller) HorizontalScrollbarAutoSizeButton() bool

HorizontalScrollbarAutoSizeButton returns whether the horizontal scrollbar button is sized automatically

func (*Scroller) HorizontalScrollbarBroadness Uses

func (s *Scroller) HorizontalScrollbarBroadness() float32

HorizontalScrollbarBroadness returns the broadness of the horizontal scrollbar

func (*Scroller) HorizontalScrollbarOverlapping Uses

func (s *Scroller) HorizontalScrollbarOverlapping() bool

HorizontalScrollbarOverlapping returns whether the horizontal scrollbar overlaps the content area

func (*Scroller) HorizontalScrollbarPosition Uses

func (s *Scroller) HorizontalScrollbarPosition() ScrollbarPosition

HorizontalScrollbarPosition returns the current position of the horizontal scrollbar (i.e. top or bottom)

func (*Scroller) ScrollMode Uses

func (s *Scroller) ScrollMode() ScrollMode

ScrollMode returns the current scroll mode

func (*Scroller) ScrollTo Uses

func (s *Scroller) ScrollTo(x, y float32)

ScrollTo scrolls the target panel such that the specified target point is centered on the scroller's view area

func (*Scroller) ScrollbarInterlocking Uses

func (s *Scroller) ScrollbarInterlocking() ScrollbarInterlocking

ScrollbarInterlocking returns the current scrollbar interlocking mode

func (*Scroller) SetCornerCovered Uses

func (s *Scroller) SetCornerCovered(state bool)

SetCornerCovered specifies whether the corner covering panel is shown when appropriate

func (*Scroller) SetHorizontalScrollbarAutoSizeButton Uses

func (s *Scroller) SetHorizontalScrollbarAutoSizeButton(state bool)

SetHorizontalScrollbarAutoSizeButton specifies whether the horizontal scrollbar button is sized automatically

func (*Scroller) SetHorizontalScrollbarBroadness Uses

func (s *Scroller) SetHorizontalScrollbarBroadness(broadness float32)

SetHorizontalScrollbarBroadness sets the broadness of the horizontal scrollbar

func (*Scroller) SetHorizontalScrollbarOverlapping Uses

func (s *Scroller) SetHorizontalScrollbarOverlapping(state bool)

SetHorizontalScrollbarOverlapping specifies whether the horizontal scrollbar overlaps the content area

func (*Scroller) SetHorizontalScrollbarPosition Uses

func (s *Scroller) SetHorizontalScrollbarPosition(pos ScrollbarPosition)

SetHorizontalScrollbarPosition sets the position of the horizontal scrollbar (i.e. top or bottom)

func (*Scroller) SetScrollMode Uses

func (s *Scroller) SetScrollMode(mode ScrollMode)

SetScrollMode sets the scroll mode

func (*Scroller) SetScrollbarInterlocking Uses

func (s *Scroller) SetScrollbarInterlocking(interlocking ScrollbarInterlocking)

SetScrollbarInterlocking sets the scrollbar interlocking mode

func (*Scroller) SetVerticalScrollbarAutoSizeButton Uses

func (s *Scroller) SetVerticalScrollbarAutoSizeButton(state bool)

SetVerticalScrollbarAutoSizeButton specifies whether the vertical scrollbar button is sized automatically

func (*Scroller) SetVerticalScrollbarBroadness Uses

func (s *Scroller) SetVerticalScrollbarBroadness(broadness float32)

SetVerticalScrollbarBroadness sets the broadness of the vertical scrollbar

func (*Scroller) SetVerticalScrollbarOverlapping Uses

func (s *Scroller) SetVerticalScrollbarOverlapping(state bool)

SetVerticalScrollbarOverlapping specifies whether the vertical scrollbar overlaps the content area

func (*Scroller) SetVerticalScrollbarPosition Uses

func (s *Scroller) SetVerticalScrollbarPosition(pos ScrollbarPosition)

SetVerticalScrollbarPosition sets the position of the vertical scrollbar (i.e. left or right)

func (*Scroller) Update Uses

func (s *Scroller) Update()

Update updates the visibility of the scrollbars, corner panel, and then recalculates

func (*Scroller) VerticalScrollbarAutoSizeButton Uses

func (s *Scroller) VerticalScrollbarAutoSizeButton() bool

VerticalScrollbarAutoSizeButton returns whether the vertical scrollbar button is sized automatically

func (*Scroller) VerticalScrollbarBroadness Uses

func (s *Scroller) VerticalScrollbarBroadness() float32

VerticalScrollbarBroadness returns the broadness of the vertical scrollbar

func (*Scroller) VerticalScrollbarOverlapping Uses

func (s *Scroller) VerticalScrollbarOverlapping() bool

VerticalScrollbarOverlapping returns whether the vertical scrollbar overlaps the content area

func (*Scroller) VerticalScrollbarPosition Uses

func (s *Scroller) VerticalScrollbarPosition() ScrollbarPosition

VerticalScrollbarPosition returns the current position of the vertical scrollbar (i.e. left or right)

type ScrollerScrollbarStyle Uses

type ScrollerScrollbarStyle struct {
    ScrollBarStyle                   // Embedded ScrollBarStyle (TODO, should be ScrollBarStyle*S*, implement style logic)
    Position       ScrollbarPosition // Specifies the positioning of the scrollbar
    Broadness      float32           // Broadness of the scrollbar
    OverlapContent bool              // Specifies whether the scrollbar is shown above the content area
    AutoSizeButton bool              // Specifies whether the scrollbar button size is adjusted based on content/view proportion
}

ScrollerScrollbarStyle is the set of style options for a scrollbar that is part of a scroller.

type ScrollerStyle Uses

type ScrollerStyle struct {
    PanelStyle                                   // Embedded PanelStyle
    VerticalScrollbar     ScrollerScrollbarStyle // The style of the vertical scrollbar
    HorizontalScrollbar   ScrollerScrollbarStyle // The style of the horizontal scrollbar
    CornerPanel           PanelStyle             // The style of the corner panel
    ScrollbarInterlocking ScrollbarInterlocking  // Specifies what happens where the vertical and horizontal scrollbars meet
    CornerCovered         bool                   // True indicates that the corner panel should be visible when appropriate
}

ScrollerStyle contains the styling of a Scroller

type Slider Uses

type Slider struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

Slider is the GUI element for sliders and progress bars

func NewHSlider Uses

func NewHSlider(width, height float32) *Slider

NewHSlider creates and returns a pointer to a new horizontal slider with the specified initial dimensions.

func NewVSlider Uses

func NewVSlider(width, height float32) *Slider

NewVSlider creates and returns a pointer to a new vertical slider with the specified initial dimensions.

func (*Slider) ScaleFactor Uses

func (s *Slider) ScaleFactor() float32

ScaleFactor returns the slider current scale factor (default = 1.0)

func (*Slider) SetScaleFactor Uses

func (s *Slider) SetScaleFactor(factor float32) *Slider

SetScaleFactor set the slider scale factor (default = 1.0)

func (*Slider) SetStyles Uses

func (s *Slider) SetStyles(ss *SliderStyles) *Slider

SetStyles set the slider styles overriding the default style

func (*Slider) SetText Uses

func (s *Slider) SetText(text string) *Slider

SetText sets the text of the slider optional label

func (*Slider) SetValue Uses

func (s *Slider) SetValue(value float32) *Slider

SetValue sets the value of the slider considering the current scale factor and updates its visual appearance.

func (*Slider) Value Uses

func (s *Slider) Value() float32

Value returns the current value of the slider considering the current scale factor

type SliderStyle Uses

type SliderStyle BasicStyle

SliderStyle contains the styling of a Slider

type SliderStyles Uses

type SliderStyles struct {
    Normal   SliderStyle
    Over     SliderStyle
    Focus    SliderStyle
    Disabled SliderStyle
}

SliderStyles contains a SliderStyle for each valid GUI state

type Splitter Uses

type Splitter struct {
    Panel       // Embedded panel
    P0    Panel // Left/Top panel
    P1    Panel // Right/Bottom panel
    // contains filtered or unexported fields
}

Splitter is a GUI element that splits two panels and can be adjusted

func NewHSplitter Uses

func NewHSplitter(width, height float32) *Splitter

NewHSplitter creates and returns a pointer to a new horizontal splitter widget with the specified initial dimensions

func NewVSplitter Uses

func NewVSplitter(width, height float32) *Splitter

NewVSplitter creates and returns a pointer to a new vertical splitter widget with the specified initial dimensions

func (*Splitter) SetSplit Uses

func (s *Splitter) SetSplit(pos float32)

SetSplit sets the position of the splitter bar. It accepts a value from 0.0 to 1.0

func (*Splitter) Split Uses

func (s *Splitter) Split() float32

Split returns the current position of the splitter bar. It returns a value from 0.0 to 1.0

type SplitterStyle Uses

type SplitterStyle struct {
    SpacerBorderColor math32.Color4
    SpacerColor       math32.Color4
    SpacerSize        float32
}

SplitterStyle contains the styling of a Splitter

type SplitterStyles Uses

type SplitterStyles struct {
    Normal SplitterStyle
    Over   SplitterStyle
    Drag   SplitterStyle
}

SplitterStyles contains a SplitterStyle for each valid GUI state

type Style Uses

type Style struct {
    Color         ColorStyle
    Font          *text.Font
    FontIcon      *text.Font
    Label         LabelStyle
    Button        ButtonStyles
    CheckRadio    CheckRadioStyles
    Edit          EditStyles
    ScrollBar     ScrollBarStyles
    Slider        SliderStyles
    Splitter      SplitterStyles
    Window        WindowStyles
    ItemScroller  ItemScrollerStyles
    Scroller      ScrollerStyle
    List          ListStyles
    DropDown      DropDownStyles
    Folder        FolderStyles
    Tree          TreeStyles
    ControlFolder ControlFolderStyles
    Menu          MenuStyles
    Table         TableStyles
    ImageButton   ImageButtonStyles
    TabBar        TabBarStyles
}

Style contains the styles for all GUI elements

func NewDarkStyle Uses

func NewDarkStyle() *Style

NewDarkStyle creates and returns a pointer to the a new "dark" style

func NewLightStyle Uses

func NewLightStyle() *Style

NewLightStyle creates and returns a pointer to the a new "light" style

func StyleDefault Uses

func StyleDefault() *Style

StyleDefault returns a pointer to the current default style

type Tab Uses

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

Tab describes an individual tab of the TabBar

func (*Tab) Content Uses

func (tab *Tab) Content() IPanel

Content returns a pointer to the specified Tab content panel

func (*Tab) Header Uses

func (tab *Tab) Header() *Panel

Header returns a pointer to this Tab header panel. Can be used to set an event handler when the Tab header is right clicked. (to show a context Menu for example).

func (*Tab) Pinned Uses

func (tab *Tab) Pinned() bool

Pinned returns this tab pinned state

func (*Tab) SetContent Uses

func (tab *Tab) SetContent(ipan IPanel)

SetContent sets or replaces this tab content panel.

func (*Tab) SetIcon Uses

func (tab *Tab) SetIcon(icon string) *Tab

SetIcon sets the optional icon of the Tab header

func (*Tab) SetImage Uses

func (tab *Tab) SetImage(imgfile string) error

SetImage sets the optional image of the Tab header

func (*Tab) SetPinned Uses

func (tab *Tab) SetPinned(pinned bool)

SetPinned sets the tab pinned state. A pinned tab cannot be removed by the user because the close icon is not shown.

func (*Tab) SetText Uses

func (tab *Tab) SetText(text string) *Tab

SetText sets the text of the tab header

type TabBar Uses

type TabBar struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

TabBar is a panel which can contain other panels arranged in horizontal Tabs. Only one panel is visible at a time. To show another panel the corresponding Tab must be selected.

func NewTabBar Uses

func NewTabBar(width, height float32) *TabBar

NewTabBar creates and returns a pointer to a new TabBar widget with the specified width and height

func (*TabBar) AddTab Uses

func (tb *TabBar) AddTab(text string) *Tab

AddTab creates and adds a new Tab panel with the specified header text at the end of this TabBar list of tabs. Returns the pointer to thew new Tab.

func (*TabBar) InsertTab Uses

func (tb *TabBar) InsertTab(text string, pos int) *Tab

InsertTab creates and inserts a new Tab panel with the specified header text at the specified position in the TabBar from left to right. Returns the pointer to the new Tab or nil if the position is invalid.

func (*TabBar) MoveTab Uses

func (tb *TabBar) MoveTab(src, dest int) error

MoveTab moves a Tab to another position in the Tabs list

func (*TabBar) RemoveTab Uses

func (tb *TabBar) RemoveTab(pos int) error

RemoveTab removes the tab at the specified position in the TabBar. Returns an error if the position is invalid.

func (*TabBar) Selected Uses

func (tb *TabBar) Selected() int

Selected returns the position of the selected Tab. Returns value < 0 if there is no selected Tab.

func (*TabBar) SetSelected Uses

func (tb *TabBar) SetSelected(pos int) *Tab

SetSelected sets the selected tab of the TabBar to the tab with the specified position. Returns the pointer of the selected tab or nil if the position is invalid.

func (*TabBar) TabAt Uses

func (tb *TabBar) TabAt(pos int) *Tab

TabAt returns the pointer of the Tab object at the specified position. Return nil if the position is invalid

func (*TabBar) TabCount Uses

func (tb *TabBar) TabCount() int

TabCount returns the current number of Tabs in the TabBar

func (*TabBar) TabPosition Uses

func (tb *TabBar) TabPosition(tab *Tab) int

TabPosition returns the position of the Tab specified by its pointer

type TabBarStyle Uses

type TabBarStyle BasicStyle

TabBarStyle describes the style of the TabBar

type TabBarStyles Uses

type TabBarStyles struct {
    SepHeight          float32     // Separator width
    ListButtonIcon     string      // Icon for list button
    ListButtonPaddings RectBounds  // Paddings for list button
    Normal             TabBarStyle // Style for normal exhibition
    Over               TabBarStyle // Style when cursor is over the TabBar
    Focus              TabBarStyle // Style when the TabBar has key focus
    Disabled           TabBarStyle // Style when the TabBar is disabled
    Tab                TabStyles   // Style for Tabs
}

TabBarStyles describes all the TabBarStyles

type TabStyle Uses

type TabStyle BasicStyle

TabStyle describes the style of the individual Tabs header

type TabStyles Uses

type TabStyles struct {
    IconPaddings  RectBounds // Paddings for optional icon
    ImagePaddings RectBounds // Paddings for optional image
    IconClose     string     // Codepoint for close icon in Tab header
    Normal        TabStyle   // Style for normal exhibition
    Over          TabStyle   // Style when cursor is over the Tab
    Focus         TabStyle   // Style when the Tab has key focus
    Disabled      TabStyle   // Style when the Tab is disabled
    Selected      TabStyle   // Style when the Tab is selected
}

TabStyles describes all Tab styles

type Table Uses

type Table struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

Table implements a panel which can contains child panels organized in rows and columns.

func NewTable Uses

func NewTable(width, height float32, cols []TableColumn) (*Table, error)

NewTable creates and returns a pointer to a new Table with the specified width, height and columns

func (*Table) AddRow Uses

func (t *Table) AddRow(values map[string]interface{})

AddRow adds a new row at the end of the table with the specified values

func (*Table) Cell Uses

func (t *Table) Cell(col string, ri int) interface{}

Cell returns the current content of the specified cell

func (*Table) Clear Uses

func (t *Table) Clear()

Clear removes all rows from the table

func (*Table) EnableColResize Uses

func (t *Table) EnableColResize(colid string, enable bool)

EnableColResize enable or disables if the specified column can be resized by the user using the mouse.

func (*Table) InsertRow Uses

func (t *Table) InsertRow(row int, values map[string]interface{})

InsertRow inserts the specified values in a new row at the specified index

func (*Table) RemoveRow Uses

func (t *Table) RemoveRow(row int)

RemoveRow removes from the specified row from the table

func (*Table) Row Uses

func (t *Table) Row(ri int) map[string]interface{}

Row returns a map with the current contents of the specified row index

func (*Table) RowCount Uses

func (t *Table) RowCount() int

RowCount returns the current number of rows in the table

func (*Table) Rows Uses

func (t *Table) Rows(fi, li int) []map[string]interface{}

Rows returns a slice of maps with the contents of the table rows specified by the rows first and last index. To get all the table rows, use Rows(0, -1)

func (*Table) SelectedRows Uses

func (t *Table) SelectedRows() []int

SelectedRows returns a slice with the indexes of the currently selected rows If no row are selected returns an empty slice

func (*Table) SetCell Uses

func (t *Table) SetCell(row int, colid string, value interface{})

SetCell sets the value of the cell specified by its row and column id The function panics if the passed row or column id is invalid

func (*Table) SetColExpand Uses

func (t *Table) SetColExpand(colid string, expand float32)

SetColExpand sets the column expand factor. When the table width is increased the columns widths are increased proportionally to their expand factor. A column with expand factor = 0 is not increased.

func (*Table) SetColFormat Uses

func (t *Table) SetColFormat(id, format string)

SetColFormat sets the formatting string (Printf) for the specified column Update must be called to update the table.

func (*Table) SetColOrder Uses

func (t *Table) SetColOrder(colid string, order int)

SetColOrder sets the exhibition order of the specified column. The previous column which has the specified order will have the original column order.

func (*Table) SetColWidth Uses

func (t *Table) SetColWidth(colid string, width float32)

SetColWidth sets the specified column width and may change the widths of the columns to the right

func (*Table) SetRow Uses

func (t *Table) SetRow(row int, values map[string]interface{})

SetRow sets the value of all the cells of the specified row from the specified map indexed by column id.

func (*Table) SetRows Uses

func (t *Table) SetRows(values []map[string]interface{})

SetRows clears all current rows of the table and sets new rows from the specifying parameter. Each row is a map keyed by the colum id. The map value currently can be a string or any number type If a row column is not found it is ignored

func (*Table) SetSelectionType Uses

func (t *Table) SetSelectionType(sel TableSelType)

SetSelectionType sets this table selection type Possible values are: TableSelSingleRow|TableSelMultiRow

func (*Table) SetStatusText Uses

func (t *Table) SetStatusText(text string)

SetStatusText sets the text of status line at the bottom of the table It does not change its current visibility

func (*Table) SetStyles Uses

func (t *Table) SetStyles(ts *TableStyles)

SetStyles set this table styles overriding the default

func (*Table) ShowAllColumns Uses

func (t *Table) ShowAllColumns()

ShowAllColumns shows all the table columns

func (*Table) ShowColumn Uses

func (t *Table) ShowColumn(col string, show bool)

ShowColumn sets the visibility of the column with the specified id If the column id does not exit the function panics.

func (*Table) ShowHeader Uses

func (t *Table) ShowHeader(show bool)

ShowHeader shows or hides the table header

func (*Table) ShowStatus Uses

func (t *Table) ShowStatus(show bool)

ShowStatus sets the visibility of the status lines at the bottom of the table

func (*Table) SortColumn Uses

func (t *Table) SortColumn(col string, asString bool, asc bool)

SortColumn sorts the specified column interpreting its values as strings or numbers and sorting in ascending or descending order. This sorting is independent of the sort configuration of column set when the table was created

type TableCell Uses

type TableCell struct {
    Tab   *Table      // Pointer to table
    Row   int         // Row index
    Col   string      // Column id
    Value interface{} // Cell value
}

TableCell describes a table cell. It is used as a parameter for formatting function

type TableClickEvent Uses

type TableClickEvent struct {
    window.MouseEvent         // Embedded window mouse event
    X                 float32 // Table content area X coordinate
    Y                 float32 // Table content area Y coordinate
    Header            bool    // True if header was clicked
    Row               int     // Index of table row (may be -1)
    Col               string  // Id of table column (may be empty)
    ColOrder          int     // Current column exhibition order
}

TableClickEvent describes a mouse click event over a table It contains the original mouse event plus additional information

type TableColumn Uses

type TableColumn struct {
    Id         string          // Column id used to reference the column. Must be unique
    Header     string          // Column name shown in the table header
    Width      float32         // Initial column width in pixels
    Minwidth   float32         // Minimum width in pixels for this column
    Hidden     bool            // Hidden flag
    Align      Align           // Cell content alignment: AlignLeft|AlignCenter|AlignRight
    Format     string          // Format string for formatting the columns' cells
    FormatFunc TableFormatFunc // Format function (overrides Format string)
    Expand     float32         // Column width expansion factor (0 for no expansion)
    Sort       TableSortType   // Column sort type
    Resize     bool            // Allow column to be resized by user
}

TableColumn describes a table column

type TableFormatFunc Uses

type TableFormatFunc func(cell TableCell) string

TableFormatFunc is the type for formatting functions

type TableHeaderStyle Uses

type TableHeaderStyle BasicStyle

TableHeaderStyle describes the style of the table header

type TableResizerStyle Uses

type TableResizerStyle struct {
    Width       float32
    Border      RectBounds
    BorderColor math32.Color4
    BgColor     math32.Color4
}

TableResizerStyle describes the style of the table resizer panel

type TableRowStyle Uses

type TableRowStyle BasicStyle

TableRowStyle describes the style of the table row

type TableSelType Uses

type TableSelType int

TableSelType is the type used to specify the table row selection

const (
    // TableSelSingleRow is the single row selection mode (default)
    TableSelSingleRow TableSelType = iota
    // TableSelMultiRow is the multiple row selection mode
    TableSelMultiRow
)

type TableSortType Uses

type TableSortType int

TableSortType is the type used to specify the sort method for a table column

const (
    TableSortNone TableSortType = iota
    TableSortString
    TableSortNumber
)

The various sorting types

type TableStatusStyle Uses

type TableStatusStyle BasicStyle

TableStatusStyle describes the style of the table status line panel

type TableStyles Uses

type TableStyles struct {
    Header    TableHeaderStyle
    RowEven   TableRowStyle
    RowOdd    TableRowStyle
    RowCursor TableRowStyle
    RowSel    TableRowStyle
    Status    TableStatusStyle
    Resizer   TableResizerStyle
}

TableStyles describes all styles of the table header and rows

type Tree Uses

type Tree struct {
    List // Embedded list panel
    // contains filtered or unexported fields
}

Tree is the tree structure GUI element.

func NewTree Uses

func NewTree(width, height float32) *Tree

NewTree creates and returns a pointer to a new tree widget.

func (*Tree) Add Uses

func (t *Tree) Add(ichild IPanel)

Add child panel to the end tree.

func (*Tree) AddNode Uses

func (t *Tree) AddNode(text string) *TreeNode

AddNode adds a new tree node with the specified text at the end of this tree and returns a pointer to the new node.

func (*Tree) FindChild Uses

func (t *Tree) FindChild(child IPanel) (*TreeNode, int)

FindChild searches for the specified child in the tree and all its children. If found, returns the parent node and its position relative to the parent. If the parent is the tree returns nil as the parent If not found returns nil and -1

func (*Tree) Initialize Uses

func (t *Tree) Initialize(width, height float32)

Initialize initializes the tree with the specified initial width and height It is normally used when the folder is embedded in another object.

func (*Tree) InsertAt Uses

func (t *Tree) InsertAt(pos int, child IPanel)

InsertAt inserts a child panel at the specified position in the tree.

func (*Tree) InsertNodeAt Uses

func (t *Tree) InsertNodeAt(pos int, text string) *TreeNode

InsertNodeAt inserts at the specified position a new tree node with the specified text at the end of this tree and returns pointer to the new node.

func (*Tree) Remove Uses

func (t *Tree) Remove(child IPanel)

Remove removes the specified child from the tree or any of its children nodes.

func (*Tree) Selected Uses

func (t *Tree) Selected() IPanel

Selected returns the currently selected element or nil

func (*Tree) SetStyles Uses

func (t *Tree) SetStyles(s *TreeStyles)

SetStyles sets the tree styles overriding the default style.

type TreeNode Uses

type TreeNode struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

TreeNode is a tree node.

func (*TreeNode) Add Uses

func (n *TreeNode) Add(child IPanel)

Add adds a child panel to this node

func (*TreeNode) AddNode Uses

func (n *TreeNode) AddNode(text string) *TreeNode

AddNode adds a new node to this one and return its pointer

func (*TreeNode) FindChild Uses

func (n *TreeNode) FindChild(child IPanel) (*TreeNode, int)

FindChild searches for the specified child in this node and all its children. If found, returns the parent node and its position relative to the parent. If not found returns nil and -1

func (*TreeNode) InsertAt Uses

func (n *TreeNode) InsertAt(pos int, child IPanel)

InsertAt inserts a child panel at the specified position in this node If the position is invalid, the function panics

func (*TreeNode) InsertNodeAt Uses

func (n *TreeNode) InsertNodeAt(pos int, text string) *TreeNode

InsertNodeAt inserts a new node at the specified position in this node If the position is invalid, the function panics

func (*TreeNode) Len Uses

func (n *TreeNode) Len() int

Len returns the number of immediate children of this node

func (*TreeNode) Remove Uses

func (n *TreeNode) Remove(child IPanel)

Remove removes the specified child from this node or any of its children nodes

func (*TreeNode) SetExpanded Uses

func (n *TreeNode) SetExpanded(state bool)

SetExpanded sets the expanded state of this node

type TreeNodeStyle Uses

type TreeNodeStyle struct {
    PanelStyle
    FgColor math32.Color4
    Icons   [2]string
}

TreeNodeStyle contains the styling of a TreeNode.

type TreeNodeStyles Uses

type TreeNodeStyles struct {
    Normal TreeNodeStyle
}

TreeNodeStyles contains a TreeNodeStyle for each valid GUI state.

type TreeStyles Uses

type TreeStyles struct {
    List     *ListStyles     // Styles for the embedded list
    Node     *TreeNodeStyles // Styles for the node panel
    Padlevel float32         // Left padding indentation
}

TreeStyles contains the styling of all tree components for each valid GUI state.

type VBoxLayout Uses

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

VBoxLayout implements a panel layout which arranges the panel children vertically. The children can be separated by a space in pixels set by SetSpacing(). The whole group of children can be aligned vertically by SetAlignV() which can accept the following types of alignment:

AlignTop: Try to align the group of children to the top if the panel height is
greater the the sum of the children heights + spacing.

AlignBottom: Try to align the group of children to the bottoom if the panel height is
greater the the sum of the children heights + spacing.

AlignCenter: Try to align the group of children in the center if the panel height is
greater the the sum of the children heights + spacing.

AlignHeight: Try to align the individual children vertically with the same same space between each other.
Each individual child can be aligned horizontally by SetLayoutParameters()

If the layout method SetAutoHeight(true) is called, the panel minimum content height will be the sum of its children's heights plus the spacing.

If the layout method SetAutoWidth(true) is called, the panel minimum content width will be the width of the widest child.

func NewVBoxLayout Uses

func NewVBoxLayout() *VBoxLayout

NewVBoxLayout creates and returns a pointer to a new horizontal box layout

func (*VBoxLayout) Recalc Uses

func (bl *VBoxLayout) Recalc(ipan IPanel)

Recalc recalculates and sets the position and sizes of all children

func (*VBoxLayout) SetAlignV Uses

func (bl *VBoxLayout) SetAlignV(align Align)

SetAlignV sets the vertical alignment of the whole group of items inside the parent panel and updates the layout if possible. This only has any effect if there are no expanded items.

func (*VBoxLayout) SetAutoHeight Uses

func (bl *VBoxLayout) SetAutoHeight(state bool)

SetAutoHeight sets if the panel minimum height should be the height of the largest of its children's height.

func (*VBoxLayout) SetAutoWidth Uses

func (bl *VBoxLayout) SetAutoWidth(state bool)

SetAutoWidth sets if the panel minimum width should be sum of its children's width plus the spacing

func (*VBoxLayout) SetSpacing Uses

func (bl *VBoxLayout) SetSpacing(spacing float32)

SetSpacing sets the horizontal spacing between the items in pixels and updates the layout if possible

type VBoxLayoutParams Uses

type VBoxLayoutParams struct {
    Expand float32 // item expand vertically factor (0 - no expand)
    AlignH Align   // item horizontal alignment
}

VBoxLayoutParams specify the horizontal alignment of each individual child.

type Window Uses

type Window struct {
    Panel // Embedded Panel
    // contains filtered or unexported fields
}

Window represents a window GUI element

func NewWindow Uses

func NewWindow(width, height float32) *Window

NewWindow creates and returns a pointer to a new window with the specified dimensions

func (*Window) Add Uses

func (w *Window) Add(ichild IPanel) *Window

Add adds a child panel to the client area of this window

func (*Window) SetCloseButton Uses

func (w *Window) SetCloseButton(state bool)

SetCloseButton sets whether the window has a close button on the top right.

func (*Window) SetLayout Uses

func (w *Window) SetLayout(layout ILayout)

SetLayout sets the layout of the client panel.

func (*Window) SetResizable Uses

func (w *Window) SetResizable(state bool)

SetResizable sets whether the window is resizable.

func (*Window) SetTitle Uses

func (w *Window) SetTitle(text string)

SetTitle sets the title of the window.

type WindowStyle Uses

type WindowStyle struct {
    PanelStyle
    TitleStyle WindowTitleStyle
}

WindowStyle contains the styling of a Window

type WindowStyles Uses

type WindowStyles struct {
    Normal   WindowStyle
    Over     WindowStyle
    Focus    WindowStyle
    Disabled WindowStyle
}

WindowStyles contains a WindowStyle for each valid GUI state

type WindowTitle Uses

type WindowTitle struct {
    Panel // Embedded panel
    // contains filtered or unexported fields
}

WindowTitle represents the title bar of a Window

type WindowTitleStyle Uses

type WindowTitleStyle struct {
    PanelStyle
    FgColor math32.Color4
}

WindowTitleStyle contains the styling for a window title.

Directories

PathSynopsis
assetsCode generated by go-bindata.
assets/icon

Package gui imports 25 packages (graph) and is imported by 16 packages. Updated 2019-05-19. Refresh now. Tools for package owners.