goui

package module
v0.0.0-...-0d67019 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetElementById

func GetElementById[T any](v *View, id string) (elem T, ok bool)

Types

type CloseChan

type CloseChan chan struct{}

type CloseHandler

type CloseHandler func()

type Context

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

func NewContext

func NewContext(window *Window, e app.FrameEvent) *Context

NewContext creates a new Context with the given window and frame event.

Parameters: - window: a pointer to the Window struct. - e: the app.FrameEvent.

Returns: - a pointer to the newly created Context.

func (*Context) FontsDir

func (c *Context) FontsDir() *embed.FS

func (Context) Gtx

func (c Context) Gtx() layout.Context

Gtx returns the layout.Context associated with the Context.

func (*Context) SetFontsDir

func (c *Context) SetFontsDir(fs *embed.FS)

func (*Context) SetView

func (c *Context) SetView(v types.View)

func (Context) View

func (c Context) View() types.View

func (Context) Window

func (c Context) Window() types.Window

Window returns the Window associated with the Context.

type View

type View struct {
	*widget.Widget
	// contains filtered or unexported fields
}

func ConfigureView

func ConfigureView(
	view types.View,
	viewModel types.ViewModel,
	viewScreen *ViewScreen,
) *View

func (*View) Destroy

func (v *View) Destroy(ctx types.Context) (err error)

func (*View) Draw

func (v *View) Draw(gtx giolayout.Context) giolayout.Dimensions

func (*View) DrawView

func (v *View) DrawView(ctx types.Context) giolayout.Dimensions

func (*View) ExportFunction

func (v *View) ExportFunction(name string, fn any)

func (*View) FindBinding

func (v *View) FindBinding(name string) types.Bindable

func (*View) FindFunction

func (v *View) FindFunction(name string) any

func (*View) HandleEvents

func (v *View) HandleEvents(ctx types.Context)

func (*View) Initialize

func (v *View) Initialize(ctx types.Context) (err error)

func (*View) SetViewRoot

func (v *View) SetViewRoot(root types.UIElement)

func (*View) ViewModel

func (v *View) ViewModel() types.ViewModel

type ViewModel

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

func (*ViewModel) Destroy

func (vm *ViewModel) Destroy() (err error)

func (*ViewModel) GetBinding

func (vm *ViewModel) GetBinding(name string) types.Bindable

func (*ViewModel) Initialize

func (vm *ViewModel) Initialize() (err error)

func (*ViewModel) RegisterBinding

func (vm *ViewModel) RegisterBinding(binding types.Bindable)

func (*ViewModel) RegisterBindings

func (vm *ViewModel) RegisterBindings(bindings ...types.Bindable)

type ViewScreen

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

func NewViewScreen

func NewViewScreen(
	fs embed.FS,
	screenName string,
) *ViewScreen

type Window

type Window struct {
	OnClose CloseHandler // OnClose callback
	// contains filtered or unexported fields
}

func NewWindow

func NewWindow(title string) *Window

NewWindow creates a new Window with the given title.

It returns a pointer to the newly created Window.

func (Window) Invalidate

func (wnd Window) Invalidate()

func (*Window) SetFullscreen

func (wnd *Window) SetFullscreen(fullscreen bool)

SetFullscreen sets the fullscreen mode for the window.

fullscreen: a boolean indicating whether the window should be in fullscreen mode or not.

func (*Window) SetMaxSize

func (wnd *Window) SetMaxSize(size types.WindowSize)

SetMaxSize sets the maximum size of the Window.

It takes a types.WindowSize parameter `size` representing the new maximum size of the Window. If the Window is in the initialization state, the maximum size is stored in the `initState` field. Otherwise, the maximum size is directly applied to the window.

func (*Window) SetMinSize

func (wnd *Window) SetMinSize(size types.WindowSize)

SetMinSize sets the minimum size of the Window.

It takes a types.WindowSize parameter `size` representing the new minimum size of the Window. If the Window is in the initialization state, the minimum size is stored in the `initState` field. Otherwise, the minimum size is directly applied to the window.

func (*Window) SetNavigationColor

func (wnd *Window) SetNavigationColor(color color.NRGBA)

SetNavigationColor sets the navigation color of the windows Android navigation bar or the address bar in browsers.

It takes a color.NRGBA parameter `color` representing the new navigation color of the Window. If the Window is in the initialization state, the navigation color is stored in the `initState` field. Otherwise, the navigation color is directly applied to the window.

func (*Window) SetSize

func (wnd *Window) SetSize(size types.WindowSize)

SetSize sets the size of the Window.

It takes a types.WindowSize parameter `size` representing the new size of the Window. If the Window is in the initialization state, the size is stored in the `initState` field. Otherwise, the size is directly applied to the window.

func (*Window) SetStatusColor

func (wnd *Window) SetStatusColor(color color.NRGBA)

SetStatusColor sets the status color of the windows Andoid status bar.

It takes a color.NRGBA parameter `color` representing the new status color bar color of the Android Window. If the Window is in the initialization state, the status color is stored in the `initState` field. Otherwise, the status color is directly applied to the window.

func (*Window) SetTitle

func (wnd *Window) SetTitle(title string)

SetTitle sets the title of the Window.

It takes a string parameter `title` representing the new title of the Window. If the Window is in the initialization state, the title is stored in the `initState` field. Otherwise the title is directly applied to the window.

func (*Window) SetView

func (wnd *Window) SetView(view types.View)

SetScreen sets the view for the Window.

This method swaps out the original view for the new view.

func (*Window) Show

func (wnd *Window) Show(view types.View) (CloseChan, error)

Show shows the window with the given view.

It takes a View parameter and returns a CloseChan and an error. The CloseChan is a channel that will receive a value when the window is closed. The error is non-nil if the window is already running.

func (Window) Theme

func (wnd Window) Theme() *material.Theme

Theme returns the material theme associated with the Window.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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