gui

package
v0.0.0-...-c2c5ea0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2017 License: BSD-2-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package gui implements the GUI infraestructure and several widgets.

Index

Constants

View Source
const (
	AlignNone   = Align(iota) // No aligh
	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
)
View Source
const (
	DockTop = iota + 1
	DockRight
	DockBottom
	DockLeft
	DockCenter
)
View Source
const (
	OnClick       = "gui.OnClick"       // Widget clicked by mouse 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
)

Consolidate window events plus GUI events

View Source
const (
	StopGUI = 0x01             // Stop event propagation to GUI
	Stop3D  = 0x02             // Stop event propagation to 3D
	StopAll = StopGUI | Stop3D // Stop event propagation
)
View Source
const (
	OverStyle = iota + 1
	FocusStyle
	DisabledStyle
	NormalStyle
	DefaultStyle
)
View Source
const (
	// Name of the event generated when the table is right or left clicked
	// Parameter is TableClickEvent
	OnTableClick = "onTableClick"
	// Name of the event generated when the table row count changes (no parameters)
	OnTableRowCount = "onTableRowCount"
)
View Source
const (
	// Single row selection mode (default)
	TableSelSingleRow = iota
	// Multiple row selection mode
	TableSelMultiRow
)
View Source
const (
	ResizeTop = Resizable(1 << (iota + 1))
	ResizeRight
	ResizeBottom
	ResizeLeft
	ResizeAll = ResizeTop | ResizeRight | ResizeBottom | ResizeLeft
)
View Source
const OnListItemResize = "gui.OnListItemResize"

Event sent to list item child panel on resize

Variables

This section is empty.

Functions

This section is empty.

Types

type Align

type Align int

type BorderSizes

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

func (*BorderSizes) Set

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

type Button

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

func NewButton

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

func (b *Button) SetIcon(icode int)

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

func (*Button) SetImage

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

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

SetStyles set the button styles overriding the default style

type ButtonState

type ButtonState int
const (
	ButtonNormal ButtonState = iota
	ButtonOver
	//ButtonFocus
	ButtonPressed
	ButtonDisabled
)

type ButtonStyle

type ButtonStyle struct {
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color
	FgColor     math32.Color
}

Button style

type ButtonStyles

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

All Button styles

type Chart

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

func NewChart(width, height float32) *Chart

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

func (*Chart) AddLineGraph

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

AddLineGraph adds a line graph to the chart

func (*Chart) ClearScaleX

func (ch *Chart) ClearScaleX()

ClearScaleX removes the X scale if it was previously set

func (*Chart) ClearScaleY

func (ch *Chart) ClearScaleY()

ClearScaleY removes the Y scale if it was previously set

func (*Chart) RangeY

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

Returns the current y range

func (*Chart) RemoveGraph

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

RemoveGraph removes and disposes of the specified graph from the chart

func (*Chart) SetFontSizeX

func (ch *Chart) SetFontSizeX(size float64)

SetFontSizeX sets the font size for the x scale labels

func (*Chart) SetFontSizeY

func (ch *Chart) SetFontSizeY(size float64)

SetFontSizeY sets the font size for the y scale labels

func (*Chart) SetFormatX

func (ch *Chart) SetFormatX(format string)

SetFormatX sets the string format of the X scale labels

func (*Chart) SetFormatY

func (ch *Chart) SetFormatY(format string)

SetFormatY sets the string format of the Y scale labels

func (*Chart) SetMarginX

func (ch *Chart) SetMarginX(bottom float32)

SetMarginX sets the x scale margin

func (*Chart) SetMarginY

func (ch *Chart) SetMarginY(left float32)

SetMarginY sets the y scale margin

func (*Chart) SetRangeX

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

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

SetRangeY sets the minimum and maximum values of the y scale

func (*Chart) SetRangeYauto

func (ch *Chart) SetRangeYauto(auto bool)

SetRangeYauto sets the state of the auto

func (*Chart) SetScaleX

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

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

SetScaleY sets the Y scale number of lines and color

func (*Chart) SetTitle

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

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

func NewCheckBox

func NewCheckBox(text string) *CheckRadio

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

func NewRadioButton

func NewRadioButton(text string) *CheckRadio

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

func (*CheckRadio) Group

func (cb *CheckRadio) Group() string

Group returns the name of the radio group

func (*CheckRadio) SetGroup

func (cb *CheckRadio) SetGroup(group string)

SetGroup sets the name of the radio group

func (*CheckRadio) SetStyles

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

SetStyles set the button styles overriding the default style

func (*CheckRadio) SetValue

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

SetValue sets the current state of the checkbox

func (*CheckRadio) Value

func (cb *CheckRadio) Value() bool

Value returns the current state of the checkbox

type CheckRadioStyle

type CheckRadioStyle struct {
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color4
	FgColor     math32.Color
}

type CheckRadioStyles

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

type ControlFolder

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

func NewControlFolder

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

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

func (*ControlFolder) AddGroup

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

func (*ControlFolder) AddPanel

func (f *ControlFolder) AddPanel(pan IPanel)

func (*ControlFolder) AddSlider

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

func (*ControlFolder) Clear

func (f *ControlFolder) Clear()

func (*ControlFolder) Initialize

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

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

func (*ControlFolder) SetStyles

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

SetStyles set the folder styles overriding the default style

type ControlFolderGroup

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

func (*ControlFolderGroup) AddCheckBox

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

func (*ControlFolderGroup) AddPanel

func (g *ControlFolderGroup) AddPanel(pan IPanel)

func (*ControlFolderGroup) AddSlider

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

type ControlFolderStyles

type ControlFolderStyles struct {
	Folder *FolderStyles
	Tree   *TreeStyles
}

type DockLayout

type DockLayout struct {
}

func NewDockLayout

func NewDockLayout() *DockLayout

func (*DockLayout) Recalc

func (dl *DockLayout) Recalc(ipan IPanel)

type DockLayoutParams

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

func NewDropDown

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 add 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 successfuly inserted

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

ItemAt returns the list item at the specified position

func (dd *DropDown) RemoveAt(pos int)

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

func (dd *DropDown) SelectPos(pos int)

SelectPos selects the item at the specified position

func (dd *DropDown) Selected() *ImageLabel

Returns the currently selected item or nil if not item was selected

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

SetSelected sets the selected item

type DropDownStyle struct {
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color
	FgColor     math32.Color
}

DropDown list style

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

DropDown list styles

type Edit

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

func NewEdit

func NewEdit(width int, placeHolder string) *Edit

NewEdit creates and returns a pointer to a new edit widget

func (*Edit) CursorBack

func (ed *Edit) CursorBack()

CursorBack deletes the character at left of the cursor if possible

func (*Edit) CursorDelete

func (ed *Edit) CursorDelete()

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

func (*Edit) CursorEnd

func (ed *Edit) CursorEnd()

CursorEnd moves the edit cursor to the end of the text

func (*Edit) CursorHome

func (ed *Edit) CursorHome()

CursorHome moves the edit cursor to the beginning of the text

func (*Edit) CursorInput

func (ed *Edit) CursorInput(s string)

CursorInput inserts the specified string at the current cursor position

func (*Edit) CursorLeft

func (ed *Edit) CursorLeft()

CursorLeft moves the edit cursor one character left if possible

func (*Edit) CursorPos

func (ed *Edit) CursorPos(col int)

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

func (*Edit) CursorRight

func (ed *Edit) CursorRight()

CursorRight moves the edit cursor one character right if possible

func (*Edit) LostKeyFocus

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

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

SetFontSize sets label font size (overrides Label.SetFontSize)

func (*Edit) SetStyles

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

SetStyles set the button styles overriding the default style

func (*Edit) SetText

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

SetText sets this edit text

func (*Edit) Text

func (ed *Edit) Text() string

Text returns the current edited text

type EditStyle

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

type EditStyles

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

type FillLayout

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

func NewFillLayout

func NewFillLayout(width, height bool) *FillLayout

NewFillLayout creates and returns a pointer of a new fill layout

func (*FillLayout) Recalc

func (f *FillLayout) Recalc(ipan IPanel)

Recalc is called by the panel which has this layout

type Folder

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

func NewFolder

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

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

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

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

SetStyles set the folder styles overriding the default style

func (*Folder) TotalHeight

func (f *Folder) TotalHeight() float32

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

type FolderStyle

type FolderStyle struct {
	Margins     BorderSizes
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color
	FgColor     math32.Color
	Icons       [2]int
}

type FolderStyles

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

type Graph

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

Graph

func (*Graph) RenderSetup

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

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

SetColor sets the color of the graph

func (*Graph) SetData

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

SetData sets the graph data

func (*Graph) SetLineWidth

func (lg *Graph) SetLineWidth(width float32)

SetLineWidth sets the graph line width

type GridLayout

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

func NewGridLayout

func NewGridLayout() *GridLayout

NewGridLayout creates and returns a pointer of a new grid layout

func (*GridLayout) Recalc

func (g *GridLayout) Recalc(ipan IPanel)

type GridLayoutParams

type GridLayoutParams struct {
	Row     int   // grid layout row number from 0
	Col     int   // grid layout column number from 0
	ColSpan int   // number of additional columns to ocuppy to the right
	AlignH  Align // vertical alignment
	AlignV  Align // horizontal alignment
}

type HBoxLayout

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

func NewHBoxLayout

func NewHBoxLayout() *HBoxLayout

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

func (*HBoxLayout) Recalc

func (bl *HBoxLayout) Recalc(ipan IPanel)

Recalc recalculates and sets the position and sizes of all children

func (*HBoxLayout) SetAlignH

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 if possible. This only has any effect if there are no expanded items.

func (*HBoxLayout) SetSpacing

func (bl *HBoxLayout) SetSpacing(spacing float32)

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

type HBoxLayoutParams

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

Parameters for individual children

type ILayout

type ILayout interface {
	Recalc(ipan IPanel)
}

type IPanel

type IPanel interface {
	graphic.IGraphic
	GetPanel() *Panel
	SetRoot(*Root)
	LostKeyFocus()
	TotalHeight() float32
}

IPanel is the interface for all panel types

type Image

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

func NewImage

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

func NewImageFromRGBA(rgba *image.RGBA) *Image

NewImageFromRGBA creates and returns an image panel from the specified image

func NewImageFromTex

func NewImageFromTex(tex *texture.Texture2D) *Image

NewImageFromTex creates and returns an image panel from the specified texture2D

func (*Image) SetTexture

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

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

func NewImageButton

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

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

func (*ImageButton) Dispose

func (b *ImageButton) Dispose()

Dispose releases resources used by this widget

func (*ImageButton) SetFontSize

func (b *ImageButton) SetFontSize(size float64)

SetFontSize sets the font size of the label/icon

func (*ImageButton) SetIcon

func (b *ImageButton) SetIcon(icode int)

SetIcon sets the icon

func (*ImageButton) SetImage

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

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

SetStyles set the button styles overriding the default style

func (*ImageButton) SetText

func (b *ImageButton) SetText(text string)

SetText sets the text of the label

type ImageButtonStyle

type ImageButtonStyle struct {
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color4
	FgColor     math32.Color
}

ImageButton style

type ImageButtonStyles

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

All ImageButton styles

type ImageLabel

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

func NewImageLabel

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

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

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

func (*ImageLabel) ImageVisible

func (il *ImageLabel) ImageVisible() bool

ImageVisible returns the image visibility

func (*ImageLabel) SetBgColor

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

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

SetBgColor4 sets the color4 of the image label background

func (*ImageLabel) SetColor

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

SetColor sets the color of the label and icon text

func (*ImageLabel) SetColor4

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

SetColor4 sets the color4 of the label and icon

func (*ImageLabel) SetFontSize

func (il *ImageLabel) SetFontSize(size float64)

SetFontSize sets the size of the image label font size

func (*ImageLabel) SetIcon

func (il *ImageLabel) SetIcon(icode int)

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

func (*ImageLabel) SetImage

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

SetImage sets the image label image

func (*ImageLabel) SetImageFromFile

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

func (il *ImageLabel) SetImageVisible(vis bool)

SetImageVisible sets the image visibility

func (*ImageLabel) SetText

func (il *ImageLabel) SetText(text string)

SetText sets the text of the image label

func (*ImageLabel) Text

func (il *ImageLabel) Text() string

Text returns the current label text

type ImageLabelStyle

type ImageLabelStyle struct {
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color4
	FgColor     math32.Color4
}

ImageLabel style

type Label

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

func NewIconLabel

func NewIconLabel(msg string) *Label

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

func NewLabel

func NewLabel(msg string) *Label

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

func (*Label) BgColor

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

BgColor returns the current color the label background

func (*Label) Color

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

Color returns the current color of the label text

func (*Label) FontSize

func (l *Label) FontSize() float64

FontSize returns the current label font size

func (*Label) SetBgColor

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

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

func (*Label) SetBgColor4

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

SetBgColor4 sets the color4 of the label background

func (*Label) SetColor

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

SetColor sets the color of the label text The color alpha is set to 1.0

func (*Label) SetColor4

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

SetColor4 sets the color4 of the label text

func (*Label) SetFontSize

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

SetFontSize sets label font size

func (*Label) SetText

func (l *Label) SetText(msg string)

SetText draws the label text using the current font

func (*Label) Text

func (l *Label) Text() string

Text returns the current label text

type List

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

func NewHList

func NewHList(width, height float32) *List

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

func NewVList

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

func (li *List) Add(item IPanel)

Add add a list item at the end of the list

func (*List) InsertAt

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

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

func (*List) ItemAt

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

ItemAt returns the list item at the specified position

func (*List) ItemPosition

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

func (li *List) Remove(item IPanel)

Remove removes the specified item from the list

func (*List) RemoveAt

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

RemoveAt removes the list item from the specified position

func (*List) SelectPos

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

SelectPos selects or unselects the item at the specified position

func (*List) Selected

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

Selected returns list with the currently selected items

func (*List) SetItemPadLeftAt

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

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

Select selects or unselects the specified item

func (*List) SetSingle

func (li *List) SetSingle(state bool)

SetSingle sets the single/multiple selection flag of the list

func (*List) SetStyles

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

SetStyles set the listr styles overriding the default style

func (*List) Single

func (li *List) Single() bool

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

type ListItem

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

All items inserted into the list are encapsulated inside a ListItem

func (*ListItem) SetHighlighted

func (litem *ListItem) SetHighlighted(state bool)

setHighlighted sets this item selected state

func (*ListItem) SetSelected

func (litem *ListItem) SetSelected(state bool)

setSelected sets this item selected state

type ListItemStyle

type ListItemStyle struct {
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color4
	FgColor     math32.Color
}

type ListItemStyles

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

type ListStyles

type ListStyles struct {
	Scroller *ScrollerStyles
	Item     *ListItemStyles
}
type Menu struct {
	Panel // embedded panel
	// contains filtered or unexported fields
}

func NewMenu

func NewMenu() *Menu

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

func NewMenuBar

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 struct {
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color
	FgColor     math32.Color
}

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(icode int) *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 {
	Border           BorderSizes
	Paddings         BorderSizes
	BorderColor      math32.Color4
	BgColor          math32.Color
	FgColor          math32.Color
	IconPaddings     BorderSizes
	ShortcutPaddings BorderSizes
	RiconPaddings    BorderSizes
}

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

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 wit a texture It is the building block of most GUI widgets.

func NewPanel

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

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

Add adds a child panel to this one

func (*Panel) Borders

func (p *Panel) Borders() BorderSizes

Borders returns this panel current border sizes

func (*Panel) BordersColor4

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

BorderColor4 returns current border color

func (*Panel) Bounded

func (p *Panel) Bounded() bool

Bounded returns this panel bounded state

func (*Panel) Color4

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

Color4 returns the current color of the panel content area

func (*Panel) ContainsPosition

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

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

func (*Panel) ContentCoords

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

func (p *Panel) ContentHeight() float32

ContentHeight returns the current height of the content area in pixels

func (*Panel) ContentWidth

func (p *Panel) ContentWidth() float32

ContentWidth returns the current width of the content area in pixels

func (*Panel) Enabled

func (p *Panel) Enabled() bool

Enabled returns the current enabled state of this panel

func (*Panel) GetPanel

func (pan *Panel) GetPanel() *Panel

GetPanel satisfies the IPanel interface and returns pointer to this panel

func (*Panel) Height

func (p *Panel) Height() float32

Height returns the current panel external height in pixels

func (*Panel) Initialize

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

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

InitializeGraphic initializes this panel with a different graphic

func (*Panel) InsideBorders

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) LostKeyFocus

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

func (p *Panel) Margins() BorderSizes

Margins returns the current margin sizes in pixels

func (*Panel) Material

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

Material returns a pointer for this panel core.Material

func (*Panel) MinHeight

func (p *Panel) MinHeight() float32

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

func (*Panel) MinWidth

func (p *Panel) MinWidth() float32

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

func (*Panel) NDC2Pix

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

func (p *Panel) Paddings() BorderSizes

Paddings returns this panel padding sizes in pixels

func (*Panel) Pix2NDC

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

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

Pospix returns this panel absolute coordinate in pixels

func (*Panel) Remove

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

Remove removes the specified child from this panel

func (*Panel) RenderSetup

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

RenderSetup is called by the Engine before drawing the object

func (*Panel) Root

func (p *Panel) Root() *Root

Root returns the pointer for this panel root panel

func (*Panel) SetBorders

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

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

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

SetBordersColor4 sets the color and opacity of this panel borders

func (*Panel) SetBordersFrom

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

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

func (*Panel) SetBounded

func (p *Panel) SetBounded(bounded bool)

SetBounded sets this panel bounded state

func (*Panel) SetColor

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

SetColor sets the color of the panel paddings and content area

func (*Panel) SetColor4

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

SetColor4 sets the color of the panel paddings and content area

func (*Panel) SetContentAspectHeight

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

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

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 acomodate the new width

func (*Panel) SetContentSize

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

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 acomodate the new width

func (*Panel) SetEnabled

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

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

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

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

SetLayoutParams sets the layout parameters for this panel

func (*Panel) SetMargins

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

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

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

func (*Panel) SetModelMatrix

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

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

SetPaddings sets the panel padding sizes in pixels

func (*Panel) SetPaddingsColor

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

SetPaddingsColor sets the color of this panel paddings.

func (*Panel) SetPaddingsFrom

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

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

func (*Panel) SetPosition

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

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

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

SetSize sets this panel external width and height in pixels.

func (*Panel) SetTopChild

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

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

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

Size returns this panel current external width and height in pixels

func (*Panel) TotalHeight

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) UpdateMatrixWorld

func (p *Panel) UpdateMatrixWorld()

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

func (*Panel) Width

func (p *Panel) Width() float32

Width returns the current panel external width in pixels

type Rect

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

func (*Rect) Contains

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

type Resizable

type Resizable int

type Root

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

func NewRoot

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

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

func (r *Root) ClearKeyFocus()

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

func (*Root) HasKeyFocus

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

HasKeyFocus checks if the specified panel has the key focus

func (*Root) HasMouseFocus

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

HasMouseFocus checks if the specified panel has the mouse focus

func (*Root) SetCursorDrag

func (r *Root) SetCursorDrag()

SetCursorDrag sets the cursor of the associated window to drag type

func (*Root) SetCursorHResize

func (r *Root) SetCursorHResize()

SetCursorHResize sets the cursor of the associated window to horizontal resize type

func (*Root) SetCursorNormal

func (r *Root) SetCursorNormal()

SetCursorNormal sets the cursor of the associated window to standard type

func (*Root) SetCursorVResize

func (r *Root) SetCursorVResize()

SetCursorVResize sets the cursor of the associated window to vertical resize type

func (*Root) SetKeyFocus

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) SetMouseFocus

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

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

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

func (r *Root) SubscribeWin()

SubscribeWin subscribes this root panel to window events

type ScrollBar

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

func NewHScrollBar

func NewHScrollBar(width, height float32) *ScrollBar

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

func NewVScrollBar

func NewVScrollBar(width, height float32) *ScrollBar

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

func (*ScrollBar) SetValue

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

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 ScrollBarButtonStyle

type ScrollBarButtonStyle struct {
	Borders      BorderSizes
	BordersColor math32.Color4
	Color        math32.Color
	Size         float32
}

type ScrollBarStyle

type ScrollBarStyle struct {
	Paddings     BorderSizes
	Borders      BorderSizes
	BordersColor math32.Color4
	Color        math32.Color
	Button       ScrollBarButtonStyle
}

type Scroller

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

func NewHScroller

func NewHScroller(width, height float32) *Scroller

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

func NewVScroller

func NewVScroller(width, height float32) *Scroller

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

func (*Scroller) Add

func (s *Scroller) Add(item IPanel)

Add appends the specified item to the end of the scroller

func (*Scroller) ApplyStyle

func (s *Scroller) ApplyStyle(style int)

func (*Scroller) Clear

func (s *Scroller) Clear()

Clear removes and disposes of all the scroller children

func (*Scroller) First

func (s *Scroller) First() int

First returns the position of the first visible item

func (*Scroller) InsertAt

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

InsertAt inserts an item at the specified position

func (*Scroller) ItemAt

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

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

func (*Scroller) ItemPosition

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

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

func (*Scroller) ItemVisible

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

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

func (*Scroller) Len

func (s *Scroller) Len() int

Len return the number of items in the scroller

func (*Scroller) Remove

func (s *Scroller) Remove(item IPanel)

Remove removes the specified item from the Scroller

func (*Scroller) RemoveAt

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

RemoveAt removes item from the specified position

func (*Scroller) ScrollDown

func (s *Scroller) ScrollDown()

ScrollDown scrolls the list down one item if possible

func (*Scroller) ScrollUp

func (s *Scroller) ScrollUp()

ScrollUp scrolls the list up one item if possible

func (*Scroller) SetAutoHeight

func (s *Scroller) SetAutoHeight(maxHeight float32)

func (*Scroller) SetAutoWidth

func (s *Scroller) SetAutoWidth(maxWidth float32)

func (*Scroller) SetFirst

func (s *Scroller) SetFirst(pos int)

SetFirst set the position of first visible if possible

func (*Scroller) SetStyles

func (s *Scroller) SetStyles(ss *ScrollerStyles)

SetStyles set the scroller styles overriding the default style

type ScrollerStyle

type ScrollerStyle struct {
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color
	FgColor     math32.Color
}

type ScrollerStyles

type ScrollerStyles struct {
	Normal   ScrollerStyle
	Over     ScrollerStyle
	Focus    ScrollerStyle
	Disabled ScrollerStyle
}

type Slider

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

func NewHSlider

func NewHSlider(width, height float32) *Slider

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

func NewVSlider

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

func (s *Slider) ScaleFactor() float32

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

func (*Slider) SetScaleFactor

func (s *Slider) SetScaleFactor(factor float32)

SetScaleFactor set the slider scale factor (default = 1.0)

func (*Slider) SetStyles

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

SetStyles set the slider styles overriding the default style

func (*Slider) SetText

func (s *Slider) SetText(text string)

SetText sets the text of the slider optional label

func (*Slider) SetValue

func (s *Slider) SetValue(value float32)

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

func (*Slider) Value

func (s *Slider) Value() float32

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

type SliderStyle

type SliderStyle struct {
	Border      BorderSizes   // outer panel border sizes
	BorderColor math32.Color4 // outer panel border colors
	Paddings    BorderSizes   // outer panel padding sizes
	BgColor     math32.Color4 // outer panel color
	FgColor     math32.Color4 // slider panel color
}

SliderStyle

type SliderStyles

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

All Slider styles

type Splitter

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

func NewHSplitter

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

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

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

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

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

type SplitterStyles

type SplitterStyles struct {
	Normal SplitterStyle
	Over   SplitterStyle
	Drag   SplitterStyle
}

type Style

type Style struct {
	Font          *text.Font
	FontIcon      *text.Font
	Button        ButtonStyles
	CheckRadio    CheckRadioStyles
	Edit          EditStyles
	ScrollBar     ScrollBarStyle
	Slider        SliderStyles
	Splitter      SplitterStyles
	Window        WindowStyles
	Scroller      ScrollerStyles
	List          ListStyles
	DropDown      DropDownStyles
	Folder        FolderStyles
	Tree          TreeStyles
	ControlFolder ControlFolderStyles
	Menu          MenuStyles
	Table         TableStyles
	ImageButton   ImageButtonStyles
}

All styles

var StyleDefault *Style

Pointer to default style

type Table

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

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

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

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

Cell returns the current content of the specified cell

func (*Table) Clear

func (t *Table) Clear()

Clear removes all rows from the table

func (*Table) EnableColResize

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

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

func (t *Table) RemoveRow(row int)

RemoveRow removes from the specified row from the table

func (*Table) Row

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

func (t *Table) RowCount() int

RowCount returns the current number of rows in the table

func (*Table) Rows

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

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

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

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

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

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

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

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

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

func (t *Table) SetSelectionType(sel TableSelType)

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

func (*Table) SetStatusText

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

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

SetStyles set this table styles overriding the default

func (*Table) ShowAllColumns

func (t *Table) ShowAllColumns()

ShowAllColumns shows all the table columns

func (*Table) ShowColumn

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

func (t *Table) ShowHeader(show bool)

ShowHeader shows or hides the table header

func (*Table) ShowStatus

func (t *Table) ShowStatus(show bool)

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

func (*Table) SortColumn

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

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

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

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

type TableFormatFunc func(cell TableCell) string

TableFormatFunc is the type for formatting functions

type TableHeaderStyle

type TableHeaderStyle struct {
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color
	FgColor     math32.Color
}

TableHeaderStyle describes the style of the table header

type TableResizerStyle

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

TableResizerStyle describes the style of the table resizer panel

type TableRowStyle

type TableRowStyle struct {
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color
	FgColor     math32.Color
}

TableRowStyle describes the style of the table row

type TableRowStyles

type TableRowStyles struct {
	Normal   TableRowStyle
	Selected TableRowStyle
}

TableRowStyles describes all styles for the table row

type TableSelType

type TableSelType int

TableSelType is the type used to specify the table row selection

type TableSortType

type TableSortType int

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

const (
	TableSortNone TableSortType = iota
	TableSortString
	TableSortNumber
)

type TableStatusStyle

type TableStatusStyle struct {
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color
	FgColor     math32.Color
}

TableStatusStyle describes the style of the table status line panel

type TableStyles

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

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

func NewTree

func NewTree(width, height float32) *Tree

NewTree creates and returns a pointer to a new tree widget

func (*Tree) Add

func (t *Tree) Add(ichild IPanel)

Add child panel to the end tree

func (*Tree) AddNode

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

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

func (*Tree) FindChild

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

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

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

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

func (*Tree) InsertNodeAt

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

func (t *Tree) Remove(child IPanel)

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

func (*Tree) Selected

func (t *Tree) Selected() IPanel

Selected returns the currently selected element or nil

func (*Tree) SetStyles

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

SetStyles set the tree styles overriding the default style

type TreeNode

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

func (*TreeNode) Add

func (n *TreeNode) Add(child IPanel)

Add adds a child panel to this node

func (*TreeNode) AddNode

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

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

func (*TreeNode) FindChild

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

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

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

func (n *TreeNode) Len() int

Len returns the number of immediate children of this node

func (*TreeNode) Remove

func (n *TreeNode) Remove(child IPanel)

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

func (*TreeNode) SetExpanded

func (n *TreeNode) SetExpanded(state bool)

SetExpanded sets the expanded state of this node

type TreeNodeStyle

type TreeNodeStyle struct {
	Margins     BorderSizes
	Border      BorderSizes
	Paddings    BorderSizes
	BorderColor math32.Color4
	BgColor     math32.Color4
	FgColor     math32.Color
	Icons       [2]int
}

type TreeNodeStyles

type TreeNodeStyles struct {
	Normal TreeNodeStyle
}

type TreeStyles

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

type VBoxLayout

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

func NewVBoxLayout

func NewVBoxLayout() *VBoxLayout

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

func (*VBoxLayout) Recalc

func (bl *VBoxLayout) Recalc(ipan IPanel)

Recalc recalculates and sets the position and sizes of all children

func (*VBoxLayout) SetAlignV

func (bl *VBoxLayout) SetAlignV(align Align)

SetAlignH sets the horizontal 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) SetSpacing

func (bl *VBoxLayout) SetSpacing(spacing float32)

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

type VBoxLayoutParams

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

Parameters for individual children

type Window

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

func NewWindow

func NewWindow(width, height float32) *Window

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

func (*Window) Add

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

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

func (*Window) SetLayout

func (w *Window) SetLayout(layout ILayout) *Window

SetLayout set the layout of this window content area

func (*Window) SetResizable

func (w *Window) SetResizable(res Resizable)

SetResizable set the borders which are resizable

func (*Window) SetTitle

func (w *Window) SetTitle(text string)

SetTitle sets the title of this window

type WindowStyle

type WindowStyle struct {
	Border           BorderSizes
	Paddings         BorderSizes
	BorderColor      math32.Color4
	TitleBorders     BorderSizes
	TitleBorderColor math32.Color4
	TitleBgColor     math32.Color4
	TitleFgColor     math32.Color4
}

type WindowStyles

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

All Window styles

type WindowTitle

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

Directories

Path Synopsis
This file was generated from the original 'codepoints' file from the material design icon fonts: https://github.com/google/material-design-icons
This file was generated from the original 'codepoints' file from the material design icon fonts: https://github.com/google/material-design-icons

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL