view

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package view contains code for the view in the MVC pattern.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chart

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

Chart shows a stock chart for a single stock.

func NewChart

func NewChart() *Chart

NewChart creates a new Chart.

func (*Chart) Close

func (ch *Chart) Close()

Close frees the resources backing the chart.

func (*Chart) Render

func (ch *Chart) Render(vc viewContext) error

Render renders the Chart.

func (*Chart) SetAddButtonClickCallback

func (ch *Chart) SetAddButtonClickCallback(cb func())

SetAddButtonClickCallback sets the callback for add button clicks.

func (*Chart) SetData

func (ch *Chart) SetData(data *ChartData) error

SetData sets the data to be shown on the chart.

func (*Chart) SetError

func (ch *Chart) SetError(error bool)

SetError toggles the Chart's error indicator.

func (*Chart) SetLoading

func (ch *Chart) SetLoading(loading bool)

SetLoading toggles the Chart's loading indicator.

func (*Chart) SetRefreshButtonClickCallback

func (ch *Chart) SetRefreshButtonClickCallback(cb func())

SetRefreshButtonClickCallback sets the callback for refresh button clicks.

func (*Chart) Update

func (ch *Chart) Update() (dirty bool)

Update updates the Chart.

type ChartData added in v1.1.0

type ChartData struct {
	Symbol string
	Quote  *model.Quote
	Chart  *model.Chart
}

ChartData has the data to be shown on the chart.

type ChartThumb

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

ChartThumb shows a thumbnail for a stock.

func NewChartThumb

func NewChartThumb() *ChartThumb

NewChartThumb creates a ChartThumb.

func (*ChartThumb) Close

func (ch *ChartThumb) Close()

Close frees the resources backing the chart thumbnail.

func (*ChartThumb) Render

func (ch *ChartThumb) Render(vc viewContext) error

Render renders the ChartThumb.

func (*ChartThumb) SetData

func (ch *ChartThumb) SetData(data *ChartData) error

SetData sets the data to be shown on the chart.

func (*ChartThumb) SetError

func (ch *ChartThumb) SetError(error bool)

SetError toggles the Chart's error indicator.

func (*ChartThumb) SetLoading

func (ch *ChartThumb) SetLoading(loading bool)

SetLoading toggles the Chart's loading indicator.

func (*ChartThumb) SetRemoveButtonClickCallback

func (ch *ChartThumb) SetRemoveButtonClickCallback(cb func())

SetRemoveButtonClickCallback sets the callback for remove button clicks.

func (*ChartThumb) SetThumbClickCallback

func (ch *ChartThumb) SetThumbClickCallback(cb func())

SetThumbClickCallback sets the callback for thumbnail clicks.

func (*ChartThumb) Update

func (ch *ChartThumb) Update() (dirty bool)

Update updates the ChartThumb.

type Title added in v1.1.0

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

Title renders the the title bar.

func NewTitle added in v1.1.0

func NewTitle() *Title

NewTitle creates a new Title.

func (*Title) Render added in v1.1.0

func (t *Title) Render(win *glfw.Window)

Render renders the Title.

func (*Title) SetData added in v1.1.0

func (t *Title) SetData(data *ChartData) error

SetData sets the Title's stock.

type View

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

The View renders the UI to view and edit the model's stocks that it observes.

func New

func New() *View

New creates a new View.

func (*View) AddChartThumb

func (v *View) AddChartThumb(th *ChartThumb)

AddChartThumb adds the ChartThumbnail to the side bar.

func (*View) Init

func (v *View) Init(ctx context.Context) (cleanup func(), err error)

Init initializes the View and returns a cleanup function.

func (*View) RemoveChartThumb

func (v *View) RemoveChartThumb(th *ChartThumb)

RemoveChartThumb removes the ChartThumbnail from the side bar.

func (*View) RunLoop

func (v *View) RunLoop(ctx context.Context, preupdate func(context.Context) error) error

RunLoop runs the "game loop".

func (*View) SetChart

func (v *View) SetChart(ch *Chart)

SetChart sets the View's main chart.

func (*View) SetChartZoomChangeCallback added in v1.1.0

func (v *View) SetChartZoomChangeCallback(cb func(zoomzoomChange ZoomChange))

SetChartZoomChangeCallback sets the callback for when the chart is zoomed in or out.

func (*View) SetInputSymbolSubmittedCallback

func (v *View) SetInputSymbolSubmittedCallback(cb func(symbol string))

SetInputSymbolSubmittedCallback sets the callback for when a new symbol is entered.

func (*View) SetTitle added in v1.1.0

func (v *View) SetTitle(title *Title)

SetTitle sets the View's title.

func (*View) WakeLoop

func (v *View) WakeLoop()

WakeLoop wakes up the loop if it is asleep.

type ZoomChange added in v1.1.0

type ZoomChange int

ZoomChange specifies whether the user zooms in or out.

const (
	ZoomChangeUnspecified ZoomChange = iota
	ZoomIn
	ZoomOut
)

ZoomChange values.

func (ZoomChange) String added in v1.1.0

func (i ZoomChange) String() string

Jump to

Keyboard shortcuts

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