Documentation
¶
Overview ¶
Package gui implements the GUI infraestructure and several widgets.
Index ¶
- Constants
- func SetStyleDefault(s *Style)
- type Align
- type BasicStyle
- type ButtonState
- type ColorStyle
- type FillLayout
- type GridLayout
- func (g *GridLayout) Recalc(ipan IPanel)
- func (g *GridLayout) SetAlignH(align Align)
- func (g *GridLayout) SetAlignV(align Align)
- func (g *GridLayout) SetColAlignH(col int, align Align)
- func (g *GridLayout) SetColAlignV(col int, align Align)
- func (g *GridLayout) SetExpandH(expand bool)
- func (g *GridLayout) SetExpandV(expand bool)
- type GridLayoutParams
- type HBoxLayout
- type HBoxLayoutParams
- type ILayout
- type IPanel
- type Image
- type ImageButton
- type ImageButtonStyle
- type ImageButtonStyles
- type ImageLabel
- func (il *ImageLabel) CopyFields(other *ImageLabel)
- func (il *ImageLabel) ImageVisible() bool
- func (il *ImageLabel) SetBgColor(color *math32.Color)
- func (il *ImageLabel) SetBgColor4(color *math32.Color4)
- func (il *ImageLabel) SetColor(color *math32.Color)
- func (il *ImageLabel) SetColor4(color *math32.Color4)
- func (il *ImageLabel) SetFontSize(size float64)
- func (il *ImageLabel) SetIcon(icon string)
- func (il *ImageLabel) SetImage(img *Image)
- func (il *ImageLabel) SetImageFromFile(imgfile string) error
- func (il *ImageLabel) SetImageVisible(vis bool)
- func (il *ImageLabel) SetText(text string)
- func (il *ImageLabel) Text() string
- type ImageLabelStyle
- type Label
- func (l *Label) BgColor() math32.Color4
- func (l *Label) Color() math32.Color4
- func (l *Label) Font() *text.Font
- func (l *Label) FontDPI() float64
- func (l *Label) FontSize() float64
- func (l *Label) LineSpacing() float64
- func (l *Label) SetBgColor(color *math32.Color) *Label
- func (l *Label) SetBgColor4(color *math32.Color4) *Label
- func (l *Label) SetColor(color *math32.Color) *Label
- func (l *Label) SetColor4(color4 *math32.Color4) *Label
- func (l *Label) SetFont(f *text.Font)
- func (l *Label) SetFontDPI(dpi float64) *Label
- func (l *Label) SetFontSize(size float64) *Label
- func (l *Label) SetLineSpacing(spacing float64) *Label
- func (l *Label) SetText(text string)
- func (l *Label) Text() string
- type LabelStyle
- type Panel
- func (p *Panel) Add(ichild IPanel) *Panel
- func (p *Panel) ApplyStyle(ps *PanelStyle)
- func (p *Panel) Borders() RectBounds
- func (p *Panel) BordersColor4() math32.Color4
- func (p *Panel) Bounded() bool
- func (p *Panel) Color4() math32.Color4
- func (p *Panel) ContainsPosition(x, y float32) bool
- func (p *Panel) ContentCoords(wx, wy float32) (float32, float32)
- func (p *Panel) ContentHeight() float32
- func (p *Panel) ContentWidth() float32
- func (p *Panel) Enabled() bool
- func (p *Panel) GetPanel() *Panel
- func (p *Panel) Height() float32
- func (p *Panel) Initialize(width, height float32)
- func (p *Panel) InitializeGraphic(width, height float32, gr *graphic.Graphic)
- func (p *Panel) InsideBorders(x, y float32) bool
- func (p *Panel) Intersects(other *Panel) bool
- func (p *Panel) Layout() ILayout
- func (p *Panel) LayoutParams() interface{}
- func (p *Panel) LostKeyFocus()
- func (p *Panel) Margins() RectBounds
- func (p *Panel) Material() *material.Material
- func (p *Panel) MinHeight() float32
- func (p *Panel) MinWidth() float32
- func (p *Panel) NDC2Pix(nx, ny float32) (x, y float32)
- func (p *Panel) Paddings() RectBounds
- func (p *Panel) Pix2NDC(px, py float32) (nx, ny float32)
- func (p *Panel) Pospix() math32.Vector3
- func (p *Panel) Remove(ichild IPanel) bool
- func (p *Panel) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo)
- func (p *Panel) Root() *Root
- func (p *Panel) SetBorders(top, right, bottom, left float32)
- func (p *Panel) SetBordersColor(color *math32.Color)
- func (p *Panel) SetBordersColor4(color *math32.Color4)
- func (p *Panel) SetBordersFrom(src *RectBounds)
- func (p *Panel) SetBounded(bounded bool)
- func (p *Panel) SetColor(color *math32.Color) *Panel
- func (p *Panel) SetColor4(color *math32.Color4) *Panel
- func (p *Panel) SetContentAspectHeight(height float32)
- func (p *Panel) SetContentAspectWidth(width float32)
- func (p *Panel) SetContentHeight(height float32)
- func (p *Panel) SetContentSize(width, height float32)
- func (p *Panel) SetContentWidth(width float32)
- func (p *Panel) SetEnabled(state bool)
- func (p *Panel) SetHeight(height float32)
- func (p *Panel) SetLayout(ilayout ILayout)
- func (p *Panel) SetLayoutParams(params interface{})
- func (p *Panel) SetMargins(top, right, bottom, left float32)
- func (p *Panel) SetMarginsFrom(src *RectBounds)
- func (p *Panel) SetModelMatrix(gl *gls.GLS, mm *math32.Matrix4)
- func (p *Panel) SetPaddings(top, right, bottom, left float32)
- func (p *Panel) SetPaddingsColor(color *math32.Color)
- func (p *Panel) SetPaddingsFrom(src *RectBounds)
- func (p *Panel) SetPosition(x, y float32)
- func (p *Panel) SetRoot(root *Root)
- func (p *Panel) SetSize(width, height float32)
- func (p *Panel) SetTopChild(ipan IPanel)
- func (p *Panel) SetWidth(width float32)
- func (p *Panel) Size() (float32, float32)
- func (p *Panel) TotalHeight() float32
- func (p *Panel) TotalWidth() float32
- func (p *Panel) UpdateMatrixWorld()
- func (p *Panel) Width() float32
- type PanelStyle
- type Rect
- type RectBounds
- type Root
- func (r *Root) Add(ipan IPanel)
- func (r *Root) ClearKeyFocus()
- func (r *Root) GetWH() (float32, float32)
- func (r *Root) HasKeyFocus(ipan IPanel) bool
- func (r *Root) HasMouseFocus(ipan IPanel) bool
- func (r *Root) SetGs(gs *gls.GLS)
- func (r *Root) SetKeyFocus(ipan IPanel)
- func (r *Root) SetModal(ipan IPanel)
- func (r *Root) SetMouseFocus(ipan IPanel)
- func (r *Root) SetScrollFocus(ipan IPanel)
- func (r *Root) StopPropagation(events int)
- func (r *Root) SubscribeMoblie()
- type Style
- type VBoxLayout
- type VBoxLayoutParams
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 ( OnClick = "gui.OnClick" // Widget clicked by mouse left button or key OnCursorEnter = "gui.OnCursorEnter" // cursor enters the panel area OnCursorLeave = "gui.OnCursorLeave" // cursor leaves the panel area OnMouseOut = "gui.OnMouseOut" // mouse button pressed outside of the panel 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 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 ( StyleOver = iota + 1 StyleFocus StyleDisabled StyleNormal StyleDef )
States that a GUI element can be in
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BasicStyle ¶
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 ButtonState ¶
type ButtonState int
ButtonState specifies a button state.
const ( ButtonNormal ButtonState = iota ButtonOver ButtonPressed ButtonDisabled )
The possible button states.
type ColorStyle ¶
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 FillLayout ¶
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 ¶
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 GridLayout ¶
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 ¶
func NewGridLayout(ncols int) *GridLayout
NewGridLayout creates and returns a pointer of a new grid layout
func (*GridLayout) Recalc ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
func (g *GridLayout) SetExpandH(expand bool)
SetExpandH sets it the columns should expand horizontally if possible
func (*GridLayout) SetExpandV ¶
func (g *GridLayout) SetExpandV(expand bool)
SetExpandV sets it the rowss should expand vertically if possible
type GridLayoutParams ¶
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 ¶
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 ¶
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. This only has any effect if there are no expanded items.
func (*HBoxLayout) SetAutoHeight ¶
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 ¶
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 ¶
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 }
HBoxLayoutParams specify the vertical alignment of each individual child.
type IPanel ¶
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 ¶
type Image struct { Panel // Embedded panel // contains filtered or unexported fields }
Image is a Panel which contains a single Image
func NewImage ¶
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 ¶
NewImageFromRGBA creates and returns an image panel from the specified image
func NewImageFromTex ¶
NewImageFromTex creates and returns an image panel from the specified texture2D
type ImageButton ¶
type ImageButton struct { *Panel // Embedded Panel // contains filtered or unexported fields }
ImageButton represents an image button GUI element
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) 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 BasicStyle
ImageButtonStyle contains the styling of an ImageButton.
type ImageButtonStyles ¶
type ImageButtonStyles struct { Normal ImageButtonStyle Over ImageButtonStyle Focus ImageButtonStyle Pressed ImageButtonStyle Disabled ImageButtonStyle }
ImageButtonStyles contains one ImageButtonStyle for each possible ImageButton state.
type ImageLabel ¶
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 ¶
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(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 ¶
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
type ImageLabelStyle ¶
type ImageLabelStyle BasicStyle
ImageLabelStyle contains the styling of an ImageLabel.
type Label ¶
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 ¶
NewIcon creates and returns a label panel with the specified text drawn using the default icon font.
func NewLabel ¶
NewLabel creates and returns a label panel with the specified text drawn using the default text font.
func NewLabelWithFont ¶
NewLabelWithFont creates and returns a label panel with the specified text drawn using the specified font.
func (*Label) LineSpacing ¶
LineSpacing returns the spacing between lines.
func (*Label) SetBgColor ¶
SetBgColor sets the background color. The color alpha is set to 1.0
func (*Label) SetBgColor4 ¶
SetBgColor4 sets the background color.
func (*Label) SetFontDPI ¶
SetFontDPI sets the resolution of the font in dots per inch (DPI).
func (*Label) SetFontSize ¶
SetFontSize sets the point size of the font.
func (*Label) SetLineSpacing ¶
SetLineSpacing sets the spacing between lines.
type LabelStyle ¶
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 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 with a texture It is the building block of most GUI widgets.
func NewPanel ¶
NewPanel creates and returns a pointer to a new panel with the specified dimensions in pixels and a default quad geometry
func (*Panel) ApplyStyle ¶
func (p *Panel) ApplyStyle(ps *PanelStyle)
ApplyStyle applies the provided PanelStyle to the panel
func (*Panel) Borders ¶
func (p *Panel) Borders() RectBounds
Borders returns this panel current border sizes
func (*Panel) BordersColor4 ¶
BordersColor4 returns current border color
func (*Panel) ContainsPosition ¶
ContainsPosition returns indication if this panel contains the specified screen position in pixels.
func (*Panel) ContentCoords ¶
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 ¶
ContentHeight returns the current height of the content area in pixels
func (*Panel) ContentWidth ¶
ContentWidth returns the current width of the content area in pixels
func (*Panel) Initialize ¶
Initialize initializes this panel and is normally used by other types which embed a panel.
func (*Panel) InitializeGraphic ¶
InitializeGraphic initializes this panel with a different graphic
func (*Panel) InsideBorders ¶
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 ¶
Intersects returns if this panel intersects with the other panel
func (*Panel) LayoutParams ¶
func (p *Panel) LayoutParams() interface{}
LayoutParams returns this panel current layout parameters
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() RectBounds
Margins returns the current margin sizes in pixels
func (*Panel) NDC2Pix ¶
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() RectBounds
Paddings returns this panel padding sizes in pixels
func (*Panel) Pix2NDC ¶
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) RenderSetup ¶
func (p *Panel) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo)
RenderSetup is called by the Engine before drawing the object
func (*Panel) Root ¶
Root satisfies the IPanel interface Returns the pointer to the root panel for this panel's root.
func (*Panel) SetBorders ¶
SetBorders sets this panel border sizes in pixels and recalculates the panel external size
func (*Panel) SetBordersColor ¶
SetBordersColor sets the color of this panel borders The borders opacity is set to 1.0 (full opaque)
func (*Panel) SetBordersColor4 ¶
SetBordersColor4 sets the color and opacity of this panel borders
func (*Panel) SetBordersFrom ¶
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 ¶
SetBounded sets this panel bounded state
func (*Panel) SetContentAspectHeight ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
SetEnabled sets the panel enabled state A disabled panel do not process key or mouse events.
func (*Panel) SetHeight ¶
SetHeight sets this panel external height in pixels. The internal panel areas and positions are recalculated
func (*Panel) SetLayout ¶
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 ¶
SetMargins set this panel margin sizes in pixels and recalculates the panel external size
func (*Panel) SetMarginsFrom ¶
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 ¶
SetModelMatrix calculates and sets the specified matrix with the model matrix for this panel
func (*Panel) SetPaddings ¶
SetPaddings sets the panel padding sizes in pixels
func (*Panel) SetPaddingsColor ¶
SetPaddingsColor sets the color of this panel paddings.
func (*Panel) SetPaddingsFrom ¶
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 ¶
SetPosition sets this panel absolute position in pixel coordinates from left to right and from top to bottom of the screen.
func (*Panel) SetRoot ¶
SetRoot satisfies the IPanel interface. Sets the pointer to the root panel for this panel and all its children.
func (*Panel) SetTopChild ¶
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 ¶
SetWidth sets this panel external width in pixels. The internal panel areas and positions are recalculated
func (*Panel) TotalHeight ¶
TotalHeight satisfies the IPanel interface and returns the total height of this panel considering visible not bounded children
func (*Panel) TotalWidth ¶
TotalWidth satisfies the IPanel interface and returns the total width 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.
type PanelStyle ¶
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 RectBounds ¶
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 ¶
func (bs *RectBounds) Set(top, right, bottom, left float32)
Set sets the values of the RectBounds.
type Root ¶
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 ¶
NewRoot creates and returns a pointer to a gui root panel for the specified window func NewRoot(gs *gls.GLS, win window.IWindow) *Root { func NewRoot(gs *gls.GLS, moblie *moblie.Moblie) *Root { func NewRoot(gs *gls.GLS, win window.IWindow) *Root {
func (*Root) Add ¶
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 ¶
HasKeyFocus checks if the specified panel has the key focus
func (*Root) HasMouseFocus ¶
HasMouseFocus checks if the specified panel has the mouse focus
func (*Root) SetKeyFocus ¶
SetKeyFocus sets the panel which will receive all keyboard events Passing nil will remove the focus (if any)
func (*Root) SetModal ¶
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 ¶
SetMouseFocus sets the panel which will receive all mouse events Passing nil will restore the default event processing
func (*Root) SetScrollFocus ¶
SetScrollFocus sets the panel which will receive all scroll events Passing nil will restore the default event processing
func (*Root) StopPropagation ¶
StopPropagation stops the propagation of the current event to outside the root panel (for example the 3D camera)
func (*Root) SubscribeMoblie ¶
func (r *Root) SubscribeMoblie()
SubscribeWin subscribes this root panel to window events
type Style ¶
type Style struct { Color ColorStyle Font *text.Font FontIcon *text.Font Label LabelStyle ImageButton ImageButtonStyles }
Style contains the styles for all GUI elements
func NewDarkStyle ¶
func NewDarkStyle() *Style
NewDarkStyle creates and returns a pointer to the a new "dark" style
func NewLightStyle ¶
func NewLightStyle() *Style
NewLightStyle creates and returns a pointer to the a new "light" style
func StyleDefault ¶
func StyleDefault() *Style
StyleDefault returns a pointer to the current default style
type VBoxLayout ¶
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 ¶
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)
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 ¶
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 ¶
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 ¶
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 }
VBoxLayoutParams specify the horizontal alignment of each individual child.