Documentation ¶
Overview ¶
Package ui contains golem's user-interface implementation.
Index ¶
- Constants
- type Callback
- type Color
- type ColorScheme
- type CompletionBar
- type StatusBar
- type TabBar
- type TabBarTab
- type WebView
- type Window
- func (w *Window) AttachWebView(wv WebView)
- func (w *Window) HideUI()
- func (w *Window) SetTitle(title string)
- func (w *Window) Show()
- func (w *Window) ShowUI()
- func (w *Window) SwitchToWebView(wv WebView)
- func (w *Window) ToggleStatusBar()
- func (w *Window) ToggleTabBar()
- func (w *Window) ToggleUI()
- func (w *Window) UpdateLocation()
- func (w *Window) UpdateState(state cmd.State)
Constants ¶
const CompletionBarSpacing = 5
CompletionBarSpacing is the spacing between the columns in the completion bar.
const MaxWidth = 3
MaxWidth is the maximum number of tabs in the completions (i.e. the maximum table width.)
const SurroundingCompletions = 5
SurroundingCompletions counts how many completions before and after the current option should be displayed.
const TabBarSpacing = 1
TabBarSpacing is the spacing between individual tabs in the tab bar.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callback ¶
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 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( emphasized, unemphasized, err, secure, key, cursor, num, fgFocus, bgFocus, load, bg, tabbarBg Color) *ColorScheme
NewColorScheme creates a new color scheme, given the specified colors.
type CompletionBar ¶
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 ¶
SetCmdMarkup sets the text markup of the command status.
func (*StatusBar) SetLocationMarkup ¶
SetLocationMarkup sets the text markup of the location.
type TabBar ¶
type TabBar struct { *gtk.ScrolledWindow // contains filtered or unexported fields }
A TabBar is a bar containing tab displays.
func (*TabBar) AddTab ¶
AddTab is a wrapper around AddTabs which inserts a single tab at the specified index.
func (*TabBar) AppendTab ¶
AppendTab is a wrapper around appendTabs which appends a single TabBarTab to the TabBar.
func (*TabBar) FocusTab ¶
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 ¶
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) SetLoadProgress ¶
SetLoadProgress sets the load progress to be displayed for this tab.
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 { *StatusBar *TabBar *CompletionBar WebView *gtk.Window *ColorScheme Callback // 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 (*Window) AttachWebView ¶
AttachWebView connects a web view to the window, but doesn't show it yet.
func (*Window) SwitchToWebView ¶
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 ¶
UpdateState updates the (command) state display of the window.