flowui

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package flowui implements an interactive graph renderer.

Index

Constants

This section is empty.

Variables

View Source
var ErrNodeNotLinkable = errors.New("node cannot be linked by user")

Functions

This section is empty.

Types

type FlowchartView

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

func NewFlowchartView

func NewFlowchartView(l *flow.Layout) (*FlowchartView, *gtk.DrawingArea, error)

NewFlowchartView constructs a new flowchart display widget, reading nodes and position information from the provided layout.

func (*FlowchartView) AddNode added in v0.3.0

func (fcv *FlowchartView) AddNode(n flow.Node, x, y float64) error

AddNode inserts a new node into the layout and view.

func (*FlowchartView) AddOverlay added in v0.3.0

func (fcv *FlowchartView) AddOverlay(o Overlay)

AddOverlay installs the provided overlay.

func (*FlowchartView) ClearSelection added in v0.4.3

func (fcv *FlowchartView) ClearSelection()

func (*FlowchartView) DeleteNode added in v0.3.0

func (fcv *FlowchartView) DeleteNode(n flow.Node) error

DeleteNode removes a node from the flowchart, breaking all links.

func (*FlowchartView) GetAtPosition added in v0.3.0

func (fcv *FlowchartView) GetAtPosition(x, y float64) interface{}

GetAtPosition returns the pad or node at the given position, or nil if the provided position was empty space.

func (*FlowchartView) GetSelection

func (fcv *FlowchartView) GetSelection() interface{}

GetSelection returns the currently selected node or pad.

func (*FlowchartView) GetViewParameters added in v0.5.2

func (fcv *FlowchartView) GetViewParameters() (float64, float64, float64)

GetViewParameters returns the X & Y offsets of the current view, as well as the current zoom level.

func (*FlowchartView) Rebuild added in v0.4.8

func (fcv *FlowchartView) Rebuild() error

Rebuild discards all internal state, rebuilding the view internals from the layout.

func (*FlowchartView) SetDoubleClickCallback added in v0.4.5

func (fcv *FlowchartView) SetDoubleClickCallback(cb func(interface{}, float64, float64))

SetDoubleClickCallback sets a callback to be invoked when a\ double-click happens with mouse button one.

func (*FlowchartView) SetRenderer added in v0.5.4

func (fcv *FlowchartView) SetRenderer(r render.Appearance)

SetRenderer changes the renderer to the provided object.

func (*FlowchartView) SetViewParameters added in v0.5.2

func (fcv *FlowchartView) SetViewParameters(x, y, zoom float64)

SetViewParameters sets the X & Y offsets of the current view, as well as the current zoom level.

type Model

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

Model encapsulates the state of the flowchart.

func (*Model) Draw

func (m *Model) Draw(da *gtk.DrawingArea, cr *cairo.Context, animStep int64)

func (*Model) HitTest

func (m *Model) HitTest(p hit.Point) hit.TestableObj

func (*Model) MoveTarget

func (m *Model) MoveTarget(t hit.TestableObj, x, y float64)

func (*Model) OnUserLinksPads

func (m *Model) OnUserLinksPads(startPad, endPad *circPad) error

func (*Model) SetTargetActive

func (m *Model) SetTargetActive(target hit.TestableObj, a bool)

func (*Model) TargetPos

func (m *Model) TargetPos(t hit.TestableObj) (x, y float64)

type Overlay added in v0.3.0

type Overlay interface {
	// Configure is called when the width/height of the drawing area is updated.
	Configure(w, h int)
	// HandleMotionEvent is called on move movement. If the event should be
	// intercepted and not processed by the flowchart, HandleMotionEvent() should
	// return true.
	HandleMotionEvent(*gdk.EventMotion) bool
	// HandlePressEvent is called on move presses. If the event should be
	// intercepted and not processed by the flowchart, HandleMotionEvent() should
	// return true.
	HandlePressEvent(evt *gdk.Event, press bool) bool
	// HandleScrollEvent is called on mouse-wheel events. If the event should
	// be intercepted and not processed by the flowchart, HandleScrollEvent should
	// return true.
	HandleScrollEvent(evt *gdk.EventScroll) bool
	// Draw is called to draw the overlay.
	Draw(da *gtk.DrawingArea, cr *cairo.Context)
}

Overlay visual elements drawn over the top of the flowchart.

type UserLinkable

type UserLinkable interface {
	flow.Node
	LinkPads(toNode flow.Node, fromPad, toPad flow.Pad) (flow.Edge, error)
}

UserLinkable describes a node which can have pads linked to another by the user performing a drag from one node to another.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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