Version: v0.0.0-...-b6ae310 Latest Latest

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

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



Package ui contains golem's user-interface implementation.



View Source
const CompletionBarSpacing = 5

CompletionBarSpacing is the spacing between the columns in the completion bar.

View Source
const MaxWidth = 3

MaxWidth is the maximum number of tabs in the completions (i.e. the maximum table width.)

View Source
const SurroundingCompletions = 5

SurroundingCompletions counts how many completions before and after the current option should be displayed.

View Source
const TabBarSpacing = 1

TabBarSpacing is the spacing between individual tabs in the tab bar.


This section is empty.


This section is empty.


type Callback

type Callback interface {
	TabGo(index int) error

A Callback is an interface implemented by the underlying logic of the window, and allows the UI to invoke a limited number of methods.

For most things, logic will be handled in the logical package; however where this would be more difficult the ui package listens for events and passes them through the Callback.

type Color

type Color uint32

A Color represents a single RGB color.

type ColorScheme

type ColorScheme struct {
	FgEmphasized   Color
	FgUnemphasized Color
	FgError        Color
	FgSecure       Color
	FgKey          Color
	FgCursor       Color
	Num            Color
	FgFocus        Color
	BgFocus        Color
	FgLoad         Color
	Bg             Color
	TabBarBg       Color
	MarkupReplacer *strings.Replacer
	CSS            string

A ColorScheme encompasses the colors used in a Window.

Its CSS parameter is the CSS string to be used with the color scheme.

Its MarkupReplacer is a Replacer which "converts" an internal markup representation into pango's text markup.

Internal tags are <em> (for emphasis), <secure>, <key>, <num>, <focus>, <load>, <cursor> and <error>.

func NewColorScheme

func NewColorScheme(
	tabbarBg Color) *ColorScheme

NewColorScheme creates a new color scheme, given the specified colors.

type CompletionBar

type CompletionBar struct {
	Container *gtk.Grid
	// contains filtered or unexported fields

A CompletionBar is a horizontal bar for displaying the current completion a some context surrounding it.

func (*CompletionBar) Resize

func (cb *CompletionBar) Resize()

Resize recomputes the sizes of items in the completion bar.

func (*CompletionBar) Update

func (cb *CompletionBar) Update()

Update updates the display of completions

func (*CompletionBar) UpdateAt

func (cb *CompletionBar) UpdateAt(at int)

UpdateAt updates the current completion.

func (*CompletionBar) UpdateCompletions

func (cb *CompletionBar) UpdateCompletions(completions []string)

UpdateCompletions updates the array of available completions.

type StatusBar

type StatusBar struct {
	CmdStatusLeft  *gtk.Label
	CmdStatusMid   *gtk.Label
	CmdStatusRight *gtk.Label
	LocationStatus *gtk.Label
	Container      gtk.Container

A StatusBar contains the status bar UI elements.

func (*StatusBar) SetCmdMarkup

func (s *StatusBar) SetCmdMarkup(left, mid, right string)

SetCmdMarkup sets the text markup of the command status.

func (*StatusBar) SetLocationMarkup

func (s *StatusBar) SetLocationMarkup(label string)

SetLocationMarkup sets the text markup of the location.

type TabBar

type TabBar struct {
	// contains filtered or unexported fields

A TabBar is a bar containing tab displays.

func NewTabBar

func NewTabBar(parent *Window) (*TabBar, error)

NewTabBar creates a new TabBar for a Window.

func (*TabBar) AddTab

func (tb *TabBar) AddTab(i int) (*TabBarTab, error)

AddTab is a wrapper around AddTabs which inserts a single tab at the specified index.

func (*TabBar) AddTabs

func (tb *TabBar) AddTabs(i, j int) ([]*TabBarTab, error)

AddTabs creates a new sequence of tabs between two indicies.

func (*TabBar) AppendTab

func (tb *TabBar) AppendTab() (*TabBarTab, error)

AppendTab is a wrapper around appendTabs which appends a single TabBarTab to the TabBar.

func (*TabBar) CloseTabs

func (tb *TabBar) CloseTabs(i, j int)

CloseTabs removes the tabs between the given indicies (slice indexes)

func (*TabBar) FocusTab

func (tb *TabBar) FocusTab(i int)

FocusTab focuses the tab at the given index.

Any currently focused tab is unfocused.

func (*TabBar) UpdateFormatString

func (tb *TabBar) UpdateFormatString()

UpdateFormatString checks if the format string is still valid, and if not, updates it and redraws all tabs.

type TabBarTab

type TabBarTab struct {
	// contains filtered or unexported fields

A TabBarTab is the display of a single tab name.

func (*TabBarTab) Free

func (t *TabBarTab) Free()

Free ensures that all connections which could keep the tab from being GC'd are broken.

func (*TabBarTab) SetIcon

func (t *TabBarTab) SetIcon(to uintptr)

SetIcon sets the icon the the supplied pointer to a cairo_surface_t.

func (*TabBarTab) SetLoadProgress

func (t *TabBarTab) SetLoadProgress(to float64)

SetLoadProgress sets the load progress to be displayed for this tab.

func (*TabBarTab) SetTitle

func (t *TabBarTab) SetTitle(title string)

SetTitle sets the tabs title.

type WebView

type WebView interface {
	GetTop() int64
	GetHeight() int64
	GetWebView() *webkit.WebView
	IsQuickmarked() bool
	IsBookmarked() bool

The WebView interface keeps methods the UI needs to call on web views.

type Window

type Window struct {

	// The number of the active tab.
	TabNumber int
	// The number of total tabs in this window.
	TabCount int
	// contains filtered or unexported fields

A Window is one of golem's windows.

func NewWindow

func NewWindow(webView WebView, callback Callback) (*Window, error)

NewWindow creates a new window containing the given WebView.

func (*Window) AttachWebView

func (w *Window) AttachWebView(wv WebView)

AttachWebView connects a web view to the window, but doesn't show it yet.

func (*Window) HideUI

func (w *Window) HideUI()

HideUI hides all UI (non-webkit) elements.

func (*Window) SetTitle

func (w *Window) SetTitle(title string)

SetTitle wraps gtk.Window.SetTitle in glib's main context.

func (*Window) Show

func (w *Window) Show()

Show shows the window.

func (*Window) ShowUI

func (w *Window) ShowUI()

ShowUI shows all UI elements.

func (*Window) SwitchToWebView

func (w *Window) SwitchToWebView(wv WebView)

SwitchToWebView switches the shown web view.

func (*Window) ToggleStatusBar

func (w *Window) ToggleStatusBar()

ToggleStatusBar toggles the visibility of the status bar.

func (*Window) ToggleTabBar

func (w *Window) ToggleTabBar()

ToggleTabBar toggles the visibility of the tab bar.

func (*Window) ToggleUI

func (w *Window) ToggleUI()

ToggleUI toggles all UI (non-webkit) elements.

func (*Window) UpdateLocation

func (w *Window) UpdateLocation()

UpdateLocation updates the location display of the window.

func (*Window) UpdateState

func (w *Window) UpdateState(state cmd.State)

UpdateState updates the (command) state display of the window.

Jump to

Keyboard shortcuts

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