states

package
v0.0.0-...-b6ae310 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2015 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package states defines constants of the substates used in golem's state machine.

Index

Constants

View Source
const (
	// NormalSubstateNormal indicates "normal mode"
	NormalSubstateNormal cmd.Substate = iota
	// NormalSubstateQuickmark indicates quickmark bindings mode.
	NormalSubstateQuickmark
	// NormalSubstateQuickmarkTab indicates quickmark bindings mode opening in
	// a new tab.
	NormalSubstateQuickmarkTab
	// NormalSubstateQuickmarkWindow indicates quickmark bindings mode opening
	// in a new window.
	NormalSubstateQuickmarkWindow
	// NormalSubstateQuickmarksRapid indicates quickmark bindings mode opening
	// several quickmarks in background tabs.
	NormalSubstateQuickmarksRapid
)
View Source
const (
	// CommandLineSubstateCommand indicates a command being entered.
	CommandLineSubstateCommand cmd.Substate = iota
	// CommandLineSubstateSearch indicates a search being entered.
	CommandLineSubstateSearch
	// CommandLineSubstateBackSearch indicates a backwards search being entered.
	CommandLineSubstateBackSearch
)
View Source
const (
	// StatusSubstateMinor indicates a minor, inconsequential status.
	StatusSubstateMinor cmd.Substate = iota
	// StatusSubstateMajor indicates a more important status.
	StatusSubstateMajor
	// StatusSubstateError indicates an error status.
	StatusSubstateError
)
View Source
const (
	// HintsSubstateFollow indicates to follow (click) an item.
	HintsSubstateFollow cmd.Substate = iota
	// HintsSubstateBackground indicates to follow a link in a background tab.
	HintsSubstateBackground
	// HintsSubstateRapid indicates to follow several links in background tabs.
	HintsSubstateRapid
	// HintsSubstateTab indicates to follow a link in a new tab.
	HintsSubstateTab
	// HintsSubstateWindow indicates to follow a link in a new window.
	HintsSubstateWindow
	// HintsSubstateSearchEngine indicates to register a new search engine on
	// the page.
	HintsSubstateSearchEngine
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HintsCallback

type HintsCallback interface {
	LinkHintsMode() (int64, error)
	FormVariableHintsMode() (int64, error)
	ClickHintsMode() (int64, error)
	EndHintsMode() error
	FilterHintsMode(string) (bool, error)
}

HintsCallback is an interface for golem.(*webView), implementing the methods needed by hints. (mostly web extension calls)

type HintsMode

type HintsMode struct {
	*cmd.StateIndependant
	cmd.Substate
	HintsCallback
	CurrentKeys      []cmd.Key
	ExecuterFunction func(string) bool
}

HintsMode is a mode which displays key strings on items of intrest in a web view, and allows the selection of said items by typing these key strings.

func NewHintsMode

func NewHintsMode(
	s cmd.State,
	st cmd.Substate,
	cb HintsCallback,
	e func(string) bool) (*HintsMode, <-chan error)

NewHintsMode creates a new hints mode.

It returns a hints mode, and asynchronously either an error or nil in the given channel.

The special error nil is returned if no error occured, but hints mode should stop.

The channel is closed when initialization finishes.

func (*HintsMode) GetStateIndependant

func (s *HintsMode) GetStateIndependant() *cmd.StateIndependant

GetStateIndependant gets the state independant associated with this state.

func (*HintsMode) GetSubstate

func (s *HintsMode) GetSubstate() cmd.Substate

GetSubstate gets the substate associated with this state.

func (*HintsMode) ProcessKeyPress

func (s *HintsMode) ProcessKeyPress(key cmd.RealKey) (cmd.State, bool)

ProcessKeyPress processes exactly one key press in hints mode.

It returns the new state, and whether the key press was swallowed or not.

Jump to

Keyboard shortcuts

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