flow

package
v0.5.52 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package flow provides declarative widget wrappers for MeUi. Widgets are defined as Go structs and built into a meui.Widget tree via Build(), which works like a compile-time QML parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyLayout

func ApplyLayout(w meui.Widget, ww *W)

ApplyLayout sets layout/geometry/common properties on a widget.

func ApplyProperties

func ApplyProperties(props map[string]interface{}, wrapper interface{}) error

ApplyProperties sets struct fields by their qml tag from a property map. wrapper must be a pointer to a struct (e.g. &Button{}). The qml tag on each field determines which property name it maps to. Properties prefixed with "anchors." or "Layout." are skipped — handled by ApplyLayout.

Types

type BuildContext

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

BuildContext holds the registry of named widgets for reference capture.

func Build

func Build(root WidgetWrapper) (meui.Widget, *BuildContext)

func NewBuildContext

func NewBuildContext() *BuildContext

func (*BuildContext) Get

func (ctx *BuildContext) Get(id string) meui.Widget

func (*BuildContext) Register

func (ctx *BuildContext) Register(id string, w meui.Widget)

type Button

type Button struct {
	W
	Text         string                `qml:"text"`
	Icon         string                `qml:"icon"`
	OnClick      func()                `qml:"onClicked"`
	OnRightClick func()                `qml:"onRightClicked"`
	OnCreated    func(*widgets.Button) `qml:"-"`
}

func (*Button) Build

func (b *Button) Build(ctx *BuildContext) meui.Widget

type Calendar

type Calendar struct {
	W
	OnCreated func(*widgets.Calendar) `qml:"-"`
}

func (*Calendar) Build

func (c *Calendar) Build(ctx *BuildContext) meui.Widget

type CheckBox

type CheckBox struct {
	W
	Text      string                  `qml:"text"`
	Checked   bool                    `qml:"checked"`
	OnCreated func(*widgets.CheckBox) `qml:"-"`
}

func (*CheckBox) Build

func (c *CheckBox) Build(ctx *BuildContext) meui.Widget

type CodeEditor

type CodeEditor struct {
	W
	Text            string                    `qml:"text"`
	Language        string                    `qml:"language"`
	ShowLineNumbers bool                      `qml:"showLineNumbers"`
	ReadOnly        bool                      `qml:"readOnly"`
	OnCreated       func(*widgets.CodeEditor) `qml:"-"`
}

func (*CodeEditor) Build

func (c *CodeEditor) Build(ctx *BuildContext) meui.Widget

type ColorField

type ColorField struct {
	W
	OnCreated func(*widgets.ColorField) `qml:"-"`
}

func (*ColorField) Build

func (c *ColorField) Build(ctx *BuildContext) meui.Widget

type ColorPicker

type ColorPicker struct {
	W
	OnCreated func(*widgets.ColorPicker) `qml:"-"`
}

func (*ColorPicker) Build

func (c *ColorPicker) Build(ctx *BuildContext) meui.Widget

type ComboBox

type ComboBox struct {
	W
	Options       []string                `qml:"options"`
	SelectedIndex int                     `qml:"currentIndex"`
	Editable      bool                    `qml:"editable"`
	Placeholder   string                  `qml:"placeholder"`
	OnCreated     func(*widgets.ComboBox) `qml:"-"`
}

func (*ComboBox) Build

func (c *ComboBox) Build(ctx *BuildContext) meui.Widget

type ContextMenu

type ContextMenu struct {
	W
	Items     []widgets.MenuItem
	OnCreated func(*widgets.ContextMenu) `qml:"-"`
}

func (*ContextMenu) Build

func (c *ContextMenu) Build(ctx *BuildContext) meui.Widget

type DataTable

type DataTable struct {
	W
	Columns   []widgets.DataColumn
	OnCreated func(*widgets.DataTable) `qml:"-"`
}

func (*DataTable) Build

func (d *DataTable) Build(ctx *BuildContext) meui.Widget

type DatePicker

type DatePicker struct {
	W
	OnCreated func(*widgets.DatePicker) `qml:"-"`
}

func (*DatePicker) Build

func (d *DatePicker) Build(ctx *BuildContext) meui.Widget

type Dialog

type Dialog struct {
	W
	Title     string                         `qml:"title"`
	Modal     bool                           `qml:"modal"`
	OnCreated func(*widgets.ModalPopupPanel) `qml:"-"`
}

func (*Dialog) Build

func (d *Dialog) Build(ctx *BuildContext) meui.Widget

type DockPanel

type DockPanel struct {
	W
	OnCreated func(*widgets.DockPanel) `qml:"-"`
}

func (*DockPanel) Build

func (d *DockPanel) Build(ctx *BuildContext) meui.Widget

type GroupBox

type GroupBox struct {
	W
	Title     string                  `qml:"title"`
	OnCreated func(*widgets.GroupBox) `qml:"-"`
}

func (*GroupBox) Build

func (g *GroupBox) Build(ctx *BuildContext) meui.Widget

type HStack

type HStack struct {
	W
	Spacing  float32
	Children []WidgetWrapper
}

func (*HStack) Build

func (h *HStack) Build(ctx *BuildContext) meui.Widget

type Label

type Label struct {
	W
	Text      string               `qml:"text"`
	HAlign    string               `qml:"horizontalAlignment"`
	VAlign    string               `qml:"verticalAlignment"`
	Color     graphics.Color       `qml:"color"`
	RichText  bool                 `qml:"richText"`
	WrapMode  string               `qml:"wrapMode"`
	OnCreated func(*widgets.Label) `qml:"-"`
}

func (*Label) Build

func (l *Label) Build(ctx *BuildContext) meui.Widget

type ListView

type ListView struct {
	W
	Items         []string                `qml:"model"`
	SelectedIndex int                     `qml:"currentIndex"`
	OnCreated     func(*widgets.ListView) `qml:"-"`
}

func (*ListView) Build

func (l *ListView) Build(ctx *BuildContext) meui.Widget

type MarkdownEditor

type MarkdownEditor struct {
	W
	Text       string                        `qml:"text"`
	ReadOnly   bool                          `qml:"readOnly"`
	Mode       string                        `qml:"mode"`       // "split", "source", "preview"
	SplitRatio float32                       `qml:"splitRatio"` // 0..1, source share
	OnCreated  func(*widgets.MarkdownEditor) `qml:"-"`
	OnChanged  func(string)                  `qml:"-"`
}

MarkdownEditor is the two-pane markdown editor: a source pane and a rendered preview over the same document.

func (*MarkdownEditor) Build

func (m *MarkdownEditor) Build(ctx *BuildContext) meui.Widget

type MarkdownView

type MarkdownView struct {
	W
	Text      string                      `qml:"text"`
	OnCreated func(*widgets.MarkdownView) `qml:"-"`
}

func (*MarkdownView) Build

func (m *MarkdownView) Build(ctx *BuildContext) meui.Widget

type MdiContainer

type MdiContainer struct {
	W
	Children  []WidgetWrapper
	OnCreated func(*widgets.MdiContainer) `qml:"-"`
}

func (*MdiContainer) Build

func (m *MdiContainer) Build(ctx *BuildContext) meui.Widget

type MdiWindow

type MdiWindow struct {
	W
	Title     string `qml:"title"`
	Children  []WidgetWrapper
	OnCreated func(*widgets.MdiWindow) `qml:"-"`
}

func (*MdiWindow) Build

func (m *MdiWindow) Build(ctx *BuildContext) meui.Widget
type MenuBar struct {
	W
	OnCreated func(*widgets.MenuBar) `qml:"-"`
}
func (m *MenuBar) Build(ctx *BuildContext) meui.Widget

type Panel

type Panel struct {
	W
	Children []WidgetWrapper
}

func (*Panel) Build

func (p *Panel) Build(ctx *BuildContext) meui.Widget

type ProgressBar

type ProgressBar struct {
	W
	Value     float32                    `qml:"value"`
	Minimum   float32                    `qml:"minimum"`
	Maximum   float32                    `qml:"maximum"`
	OnCreated func(*widgets.ProgressBar) `qml:"-"`
}

func (*ProgressBar) Build

func (p *ProgressBar) Build(ctx *BuildContext) meui.Widget

type RadioButton

type RadioButton struct {
	W
	Text      string                     `qml:"text"`
	GroupID   string                     `qml:"groupID"`
	Selected  bool                       `qml:"selected"`
	OnCreated func(*widgets.RadioButton) `qml:"-"`
}

func (*RadioButton) Build

func (r *RadioButton) Build(ctx *BuildContext) meui.Widget

type ScrollBar

type ScrollBar struct {
	W
	Value       float32                  `qml:"value"`
	Minimum     float32                  `qml:"minimum"`
	Maximum     float32                  `qml:"maximum"`
	PageSize    float32                  `qml:"pageSize"`
	Orientation string                   `qml:"orientation"`
	OnCreated   func(*widgets.ScrollBar) `qml:"-"`
}

func (*ScrollBar) Build

func (s *ScrollBar) Build(ctx *BuildContext) meui.Widget

type ScrollPane

type ScrollPane struct {
	W
	ContentWidth              float32                   `qml:"contentWidth"`
	ContentHeight             float32                   `qml:"contentHeight"`
	HorizontalScrollBarPolicy string                    `qml:"horizontalScrollBarPolicy"`
	VerticalScrollBarPolicy   string                    `qml:"verticalScrollBarPolicy"`
	OnCreated                 func(*widgets.ScrollPane) `qml:"-"`
}

func (*ScrollPane) Build

func (s *ScrollPane) Build(ctx *BuildContext) meui.Widget

type Slider

type Slider struct {
	W
	Value       float32               `qml:"value"`
	Minimum     float32               `qml:"minimum"`
	Maximum     float32               `qml:"maximum"`
	StepSize    float32               `qml:"stepSize"`
	Orientation string                `qml:"orientation"`
	OnCreated   func(*widgets.Slider) `qml:"-"`
}

func (*Slider) Build

func (s *Slider) Build(ctx *BuildContext) meui.Widget

type SpinBox

type SpinBox struct {
	W
	Value     float32                `qml:"value"`
	Minimum   float32                `qml:"minimum"`
	Maximum   float32                `qml:"maximum"`
	StepSize  float32                `qml:"stepSize"`
	Decimals  int                    `qml:"decimals"`
	OnCreated func(*widgets.SpinBox) `qml:"-"`
}

func (*SpinBox) Build

func (s *SpinBox) Build(ctx *BuildContext) meui.Widget

type SplitView

type SplitView struct {
	W
	SplitPosition float32 `qml:"splitPosition"`
	HandleSize    float32 `qml:"handleSize"`
	Orientation   string  `qml:"orientation"`
	Children      []WidgetWrapper
	OnCreated     func(*widgets.SplitView) `qml:"-"`
}

func (*SplitView) Build

func (s *SplitView) Build(ctx *BuildContext) meui.Widget

type StackPanel

type StackPanel struct {
	W
	Orientation string `qml:"orientation"`
	ItemSizes   []float32
	Children    []WidgetWrapper
	OnCreated   func(*widgets.StackPanel) `qml:"-"`
}

func (*StackPanel) Build

func (s *StackPanel) Build(ctx *BuildContext) meui.Widget

type StatusBar

type StatusBar struct {
	W
	Text      string                   `qml:"text"`
	OnCreated func(*widgets.StatusBar) `qml:"-"`
}

func (*StatusBar) Build

func (s *StatusBar) Build(ctx *BuildContext) meui.Widget

type Switch

type Switch struct {
	W
	Text      string                `qml:"text"`
	Checked   bool                  `qml:"checked"`
	OnCreated func(*widgets.Switch) `qml:"-"`
}

func (*Switch) Build

func (s *Switch) Build(ctx *BuildContext) meui.Widget

type TabItem

type TabItem struct {
	Title   string
	Icon    string
	Content WidgetWrapper
	Pinned  bool
}

type TabPanel

type TabPanel struct {
	W
	Closable    bool `qml:"closable"`
	Orientation int  `qml:"orientation"`
	Tabs        []TabItem
	OnCreated   func(*widgets.TabPanel) `qml:"-"`
}

func (*TabPanel) Build

func (t *TabPanel) Build(ctx *BuildContext) meui.Widget

type Table

type Table struct {
	W
	Columns         []string             `qml:"columns"`
	ShowGrid        bool                 `qml:"showGrid"`
	Sortable        bool                 `qml:"sortable"`
	Resizable       bool                 `qml:"resizable"`
	Reorderable     bool                 `qml:"reorderable"`
	MultiSelect     bool                 `qml:"multiSelect"`
	Editable        bool                 `qml:"editable"`
	AlternatingRows bool                 `qml:"alternatingRows"`
	OnCreated       func(*widgets.Table) `qml:"-"`
}

func (*Table) Build

func (t *Table) Build(ctx *BuildContext) meui.Widget

type TextArea

type TextArea struct {
	W
	Text        string                  `qml:"text"`
	Placeholder string                  `qml:"placeholder"`
	ReadOnly    bool                    `qml:"readOnly"`
	Wrap        bool                    `qml:"wrap"`
	WordWrap    bool                    `qml:"wordWrap"`
	MaxLength   int                     `qml:"maxLength"`
	OnCreated   func(*widgets.TextArea) `qml:"-"`
}

func (*TextArea) Build

func (t *TextArea) Build(ctx *BuildContext) meui.Widget

type TextField

type TextField struct {
	W
	Text        string                   `qml:"text"`
	Placeholder string                   `qml:"placeholder"`
	ReadOnly    bool                     `qml:"readOnly"`
	MaxLength   int                      `qml:"maxLength"`
	OnCreated   func(*widgets.TextField) `qml:"-"`
}

func (*TextField) Build

func (t *TextField) Build(ctx *BuildContext) meui.Widget

type TimePicker

type TimePicker struct {
	W
	OnCreated func(*widgets.TimePicker) `qml:"-"`
}

func (*TimePicker) Build

func (t *TimePicker) Build(ctx *BuildContext) meui.Widget

type ToolBar

type ToolBar struct {
	W
	OnCreated func(*widgets.ToolBar) `qml:"-"`
}

func (*ToolBar) Build

func (t *ToolBar) Build(ctx *BuildContext) meui.Widget

type ToolTip

type ToolTip struct {
	W
	Text      string                 `qml:"text"`
	Delay     float32                `qml:"delay"`
	OnCreated func(*widgets.Tooltip) `qml:"-"`
}

func (*ToolTip) Build

func (t *ToolTip) Build(ctx *BuildContext) meui.Widget

type Tree

type Tree struct {
	W
	Model      []string            `qml:"model"`
	ItemHeight float32             `qml:"itemHeight"`
	OnCreated  func(*widgets.Tree) `qml:"-"`
}

func (*Tree) Build

func (t *Tree) Build(ctx *BuildContext) meui.Widget

type VStack

type VStack struct {
	W
	Spacing  float32
	Children []WidgetWrapper
}

func (*VStack) Build

func (v *VStack) Build(ctx *BuildContext) meui.Widget

type W

type W struct {
	ID      string  `qml:"id"`
	X       float32 `qml:"x"`
	Y       float32 `qml:"y"`
	Width   float32 `qml:"width"`
	Height  float32 `qml:"height"`
	Visible bool    `qml:"visible"`
	Enabled bool    `qml:"enabled"`
	// visibleSet/enabledSet record that QML explicitly set the property —
	// the Go zero value of both bools is false, but "unset" must mean
	// enabled+visible (widgets default to enabled). Without the markers
	// every flow widget without an explicit `enabled: true` was silently
	// disabled.
	VisibleSet bool    `qml:"-"`
	EnabledSet bool    `qml:"-"`
	Opacity    float32 `qml:"opacity"`

	// Layout properties (prefix "Layout.")
	FillWidth       bool    `qml:"Layout.fillWidth"`
	FillHeight      bool    `qml:"Layout.fillHeight"`
	MinimumWidth    float32 `qml:"Layout.minimumWidth"`
	MaximumWidth    float32 `qml:"Layout.maximumWidth"`
	MinimumHeight   float32 `qml:"Layout.minimumHeight"`
	MaximumHeight   float32 `qml:"Layout.maximumHeight"`
	PreferredWidth  float32 `qml:"Layout.preferredWidth"`
	PreferredHeight float32 `qml:"Layout.preferredHeight"`
	MarginLeft      float32 `qml:"Layout.leftMargin"`
	MarginRight     float32 `qml:"Layout.rightMargin"`
	MarginTop       float32 `qml:"Layout.topMargin"`
	MarginBottom    float32 `qml:"Layout.bottomMargin"`
	LayoutAlignment int     `qml:"Layout.alignment"`

	// Anchors (prefix "anchors.")
	AnchorsFill         string  `qml:"anchors.fill"`
	AnchorsCenterIn     string  `qml:"anchors.centerIn"`
	AnchorLeft          string  `qml:"anchors.left"`
	AnchorRight         string  `qml:"anchors.right"`
	AnchorTop           string  `qml:"anchors.top"`
	AnchorBottom        string  `qml:"anchors.bottom"`
	AnchorHCenter       string  `qml:"anchors.horizontalCenter"`
	AnchorVCenter       string  `qml:"anchors.verticalCenter"`
	AnchorMargins       float32 `qml:"anchors.margins"`
	AnchorLeftMargin    float32 `qml:"anchors.leftMargin"`
	AnchorRightMargin   float32 `qml:"anchors.rightMargin"`
	AnchorTopMargin     float32 `qml:"anchors.topMargin"`
	AnchorBottomMargin  float32 `qml:"anchors.bottomMargin"`
	AnchorHCenterOffset float32 `qml:"anchors.horizontalCenterOffset"`
	AnchorVCenterOffset float32 `qml:"anchors.verticalCenterOffset"`
}

W is the common base embedded by all flow wrappers.

type WidgetWrapper

type WidgetWrapper interface {
	Build(ctx *BuildContext) meui.Widget
}

WidgetWrapper is the interface implemented by all declarative wrappers.

type Window

type Window struct {
	W
	Title    string `qml:"title"`
	Children []WidgetWrapper
}

func (*Window) Build

func (w *Window) Build(ctx *BuildContext) meui.Widget

Jump to

Keyboard shortcuts

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