gui

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreaAppendText

func AreaAppendText(newText *ui.AttributedString, what string, attrs ...ui.Attribute)

func HorizontalBreak

func HorizontalBreak(box *GuiBox)

func InitColumns

func InitColumns(mh *TableData, parts []TableColumnData)

func VerticalBreak

func VerticalBreak(box *GuiBox)

Types

type GuiBox

type GuiBox struct {
	Name   string     // field for human readable name
	Axis   int        // does it add items to the X or Y axis
	Window *GuiWindow // the parent Window

	// andlabs/ui abstraction mapping
	UiBox *ui.Box
	// contains filtered or unexported fields
}

GuiBox is any type of ui.Hbox or ui.Vbox There can be lots of these for each GuiWindow

func (*GuiBox) AddTableBox

func (b *GuiBox) AddTableBox(name string, rowcount int, parts []TableColumnData) *TableData

func (*GuiBox) Append

func (b *GuiBox) Append(child ui.Control, x bool)

func (*GuiBox) ShowTextBox

func (b *GuiBox) ShowTextBox(newText *ui.AttributedString, custom func(*GuiButton), name string)

type GuiButton

type GuiButton struct {
	Name string  // field for human readable name
	Box  *GuiBox // what box the button click was in

	// a callback function for the main application
	Custom func(*GuiButton)
	Values interface{}
	Color  color.RGBA

	// andlabs/ui abstraction mapping
	B  *ui.Button
	FB *ui.FontButton
	CB *ui.ColorButton
}

Note: every mouse click is handled as a 'Button' regardless of where the user clicks it. You could probably call this 'GuiMouseClick'

type GuiConfig

type GuiConfig struct {
	Title  string
	Width  int
	Height int
	Exit   func(*Node)

	Debug        bool
	DebugNode    bool
	DebugTabs    bool
	DebugTable   bool
	DebugWindow  bool
	DebugToolkit bool
	// contains filtered or unexported fields
}
var Config GuiConfig

type GuiData

type GuiData struct {
	// a fallback default function to handle mouse events
	// if nothing else is defined to handle them
	MouseClick func(*GuiButton)

	// A map of all the entry boxes
	// AllEntries []*GuiEntry
	WindowMap map[string]*GuiWindow

	// Store access to everything via binary tree's
	NodeMap   map[string]*Node
	NodeArray []*Node
	NodeSlice []*Node

	// A map of all buttons everywhere on all
	// windows, all tabs, across all goroutines
	// This is "GLOBAL"
	//
	// This has to work this way because of how
	// andlabs/ui & andlabs/libui work
	AllButtons []*GuiButton
}
var Data GuiData

All GUI Data Structures and functions that are external If you need cross platform support, these might only be the safe way to interact with the GUI

type GuiWindow

type GuiWindow struct {
	Name      string // field for human readable name
	Width     int
	Height    int
	Axis      int  // does it add items to the X or Y axis
	TabNumber *int // the andlabs/ui tab index

	// the components of the window
	BoxMap map[string]*GuiBox

	// andlabs/ui abstraction mapping
	UiWindow *ui.Window
	UiTab    *ui.Tab // if this != nil, the window is 'tabbed'
	// contains filtered or unexported fields
}

stores information on the 'window'

This merges the concept of andlabs/ui *Window and *Tab

More than one Window is not supported in a cross platform sense & may never be. On Windows and MacOS, you have to have 'tabs'. Even under Linux, more than one Window is currently unstable

This code will make a 'GuiWindow' regardless of if it is a stand alone window (which is more or less working on Linux) or a 'tab' inside a window (which is all that works on MacOS and MSWindows.

This struct keeps track of what is in the window so you can destroy and replace it with something else

Jump to

Keyboard shortcuts

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