menu

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type C

type C = layout.Context

type ContextArea

type ContextArea struct {

	// Activation is the pointer Buttons within the context area
	// that trigger the presentation of the contextual widget. If this
	// is zero, it will default to pointer.ButtonSecondary.
	Activation pointer.Buttons
	// AbsolutePosition will position the contextual widget in the
	// relative to the position of the context area instead of relative
	// to the position of the click event that triggered the activation.
	// This is useful for controls (like button-activated menus) where
	// the contextual content should not be precisely attached to the
	// click position, but should instead be attached to the button.
	AbsolutePosition bool
	// PositionHint tells the ContextArea the closest edge/corner of the
	// window to where it is being used in the layout. This helps it to
	// position the contextual widget without it overflowing the edge of
	// the window.
	PositionHint layout.Direction
	// contains filtered or unexported fields
}

ContextArea is a region of the UI that responds to certain keyboard input events by displaying a contextual widget. The contextual widget is overlaid using an op.DeferOp. The contextual widget can be dismissed by primary-clicking within or outside of it.

func (*ContextArea) Activated

func (r *ContextArea) Activated() bool

Activated returns true if the context area has become active since the last call to Activated.

func (ContextArea) Active

func (r ContextArea) Active() bool

Active returns whether the ContextArea is currently active (whether it is currently displaying overlaid content or not).

func (*ContextArea) Dismiss

func (r *ContextArea) Dismiss()

Dismiss sets the ContextArea to not be active.

func (*ContextArea) Dismissed

func (r *ContextArea) Dismissed() bool

Dismissed returns true if the context area has been dismissed since the last call to Dismissed.

func (*ContextArea) Layout

func (r *ContextArea) Layout(gtx C, w layout.Widget) D

Layout renders the context area and also the provided widget overlaid using an op.DeferOp.

func (*ContextArea) SetActive

func (r *ContextArea) SetActive(position f32.Point)

func (*ContextArea) Update

func (r *ContextArea) Update(gtx C)

Update performs event processing for the context area but does not lay it out. It is automatically invoked by Layout() if it has not already been called during a given frame.

type ContextMenu

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

func NewContextMenu

func NewContextMenu(options [][]MenuOption, absPosition bool) *ContextMenu

func (*ContextMenu) Layout

func (m *ContextMenu) Layout(gtx C, th *theme.Theme) D

func (*ContextMenu) Update

func (m *ContextMenu) Update(gtx C)

type D

type D = layout.Dimensions
type MenuOption struct {
	Layout    func(gtx C, th *theme.Theme) D
	OnClicked func() error
}

Jump to

Keyboard shortcuts

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