Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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) 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 {
Menu
// position hint
PositionHint layout.Direction
// contains filtered or unexported fields
}
func NewContextMenu ¶
func NewContextMenu(options [][]MenuOption, absPosition bool) *ContextMenu
func (*ContextMenu) Update ¶
func (m *ContextMenu) Update(gtx C) bool
Update the state and reports if the menu is active.
type D ¶
type D = layout.Dimensions
type DropdownMenu ¶ added in v0.5.0
type DropdownMenu struct {
Menu
// contains filtered or unexported fields
}
func NewDropdownMenu ¶ added in v0.5.0
func NewDropdownMenu(options [][]MenuOption) *DropdownMenu
func (*DropdownMenu) Layout ¶ added in v0.5.0
func (m *DropdownMenu) Layout(gtx C, th *theme.Theme) D
func (*DropdownMenu) ToggleVisibility ¶ added in v0.5.0
func (m *DropdownMenu) ToggleVisibility(gtx C) bool
ToggleVisibility toggles the visibility state and report the changed state.
func (*DropdownMenu) Update ¶ added in v0.5.0
func (m *DropdownMenu) Update(gtx C) bool
Update states and report whether the dropdown menu has just dismissed.