tk

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2018 License: BSD-3-Clause Imports: 3 Imported by: 2

Documentation

Overview

Package tk is a wm[0] toolkit.

[0]: https://godoc.org/gitlab.com/cznic/wm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Meter

type Meter interface {
	// Metrics is called when window's viewport is set or updated.  The
	// result .Height reflects the total contents height. The result .Width
	// reflect the maximum width of the content in area.  If any of the
	// values are unknown a negative number is returned in the respective
	// output variable.
	Metrics(viewport wm.Rectangle) wm.Size
}

Meter provides metrics of content displayed in the client area of a window.

type Scrollbar

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

Scrollbar represents an UI element used to show that a View content overflows its window and provide visual feedback of the position of its viewport.

Scrollbar methods must be called only directly from an event handler goroutine or from a function that was enqueued using wm.Application.Post or wm.Application.PostWait.

func NewScrollbar

func NewScrollbar(w *wm.Window) *Scrollbar

NewScrollbar returns a newly created Scrollbar.

func (*Scrollbar) HandlePosition

func (s *Scrollbar) HandlePosition() int

HandlePosition returns the position of the scrollbar handle.

func (*Scrollbar) HandleSize

func (s *Scrollbar) HandleSize() int

HandleSize returns the size of the scrollbar handle.

func (*Scrollbar) OnClickDecrement

func (s *Scrollbar) OnClickDecrement(h wm.OnMouseHandler, finalize func())

OnClickDecrement sets a handler invokend on clicking the left arrow of a horizontal scrollbar or the up arrow of a vertical scrollbar. When the event handler is removed, finalize is called, if not nil.

func (*Scrollbar) OnClickDecrementPage

func (s *Scrollbar) OnClickDecrementPage(h wm.OnMouseHandler, finalize func())

OnClickDecrementPage sets a handler invokend on clicking the area between the left arrow of and the scrollbar handle of a horizontal scrollbar or between the the up arrow and the scrollbar handle of a vertical scrollbar. When the event handler is removed, finalize is called, if not nil.

func (*Scrollbar) OnClickIncrement

func (s *Scrollbar) OnClickIncrement(h wm.OnMouseHandler, finalize func())

OnClickIncrement sets a handler invokend on clicking the right arrow of a horizontal scrollbar or the down arrow of a vertical scrollbar. When the event handler is removed, finalize is called, if not nil.

func (*Scrollbar) OnClickIncrementPage

func (s *Scrollbar) OnClickIncrementPage(h wm.OnMouseHandler, finalize func())

OnClickIncrementPage sets a handler invokend on clicking the area between the scrollbar handle and the right arrow of a horizontal scrollbar or between the scrollbar handle an dthe down arrow of a vertical scrollbar. When the event handler is removed, finalize is called, if not nil.

func (*Scrollbar) OnPaint

func (s *Scrollbar) OnPaint(h wm.OnPaintHandler, finalize func())

OnPaint sets a paint handler. When the event handler is removed, finalize is called, if not nil.

func (*Scrollbar) OnSetHandlePosition

func (s *Scrollbar) OnSetHandlePosition(h wm.OnSetIntHandler, finalize func())

OnSetHandlePosition sets a handler invoked on SetHandlePosition. When the event handler is removed, finalize is called, if not nil.

func (*Scrollbar) OnSetHandleSize

func (s *Scrollbar) OnSetHandleSize(h wm.OnSetIntHandler, finalize func())

OnSetHandleSize sets a handler invoked on SetHandleSize. When the event handler is removed, finalize is called, if not nil.

func (*Scrollbar) OnSetPosition

func (s *Scrollbar) OnSetPosition(h wm.OnSetPositionHandler, finalize func())

OnSetPosition sets a handler invoked on SetPosition. When the event handler is removed, finalize is called, if not nil.

func (*Scrollbar) OnSetSize

func (s *Scrollbar) OnSetSize(h wm.OnSetSizeHandler, finalize func())

OnSetSize sets a handler invoked on SetSize. When the event handler is removed, finalize is called, if not nil.

func (*Scrollbar) OnSetStyle

func (s *Scrollbar) OnSetStyle(h wm.OnSetStyleHandler, finalize func())

OnSetStyle sets a handler invoked on SetStyle. When the event handler is removed, finalize is called, if not nil.

func (*Scrollbar) Paint

func (s *Scrollbar) Paint(ctx wm.PaintContext)

Paint ask the scrollbar to render itself. It is intended to be only called from a "hook" paint handler that determines where the scrollbar appears.

func (*Scrollbar) Position

func (s *Scrollbar) Position() wm.Position

Position returns the position of the scrollbar.

func (*Scrollbar) RemoveOnClickDecrement

func (s *Scrollbar) RemoveOnClickDecrement()

RemoveOnClickDecrement undoes the most recent OnClickDecrement call. The function will panic if there is no handler set.

func (*Scrollbar) RemoveOnClickDecrementPage

func (s *Scrollbar) RemoveOnClickDecrementPage()

RemoveOnClickDecrementPage undoes the most recent OnClickDecrement call. The function will panic if there is no handler set.

func (*Scrollbar) RemoveOnClickIncrement

func (s *Scrollbar) RemoveOnClickIncrement()

RemoveOnClickIncrement undoes the most recent OnClickIncrement call. The function will panic if there is no handler set.

func (*Scrollbar) RemoveOnClickIncrementPage

func (s *Scrollbar) RemoveOnClickIncrementPage()

RemoveOnClickIncrementPage undoes the most recent OnClickIncrementPage call. The function will panic if there is no handler set.

func (*Scrollbar) RemoveOnPaint

func (s *Scrollbar) RemoveOnPaint()

RemoveOnPaint undoes the most recent OnPaint call. The function will panic if there is no handler set.

func (*Scrollbar) RemoveOnSetHandlePosition

func (s *Scrollbar) RemoveOnSetHandlePosition()

RemoveOnSetHandlePosition undoes the most recent OnSetHandlePosition call. The function will panic if there is no handler set.

func (*Scrollbar) RemoveOnSetHandleSize

func (s *Scrollbar) RemoveOnSetHandleSize()

RemoveOnSetHandleSize undoes the most recent OnSetHandleSize call. The function will panic if there is no handler set.

func (*Scrollbar) RemoveOnSetPosition

func (s *Scrollbar) RemoveOnSetPosition()

RemoveOnSetPosition undoes the most recent OnSetPosition call. The function will panic if there is no handler set.

func (*Scrollbar) RemoveOnSetSize

func (s *Scrollbar) RemoveOnSetSize()

RemoveOnSetSize undoes the most recent OnSetSize call. The function will panic if there is no handler set.

func (*Scrollbar) RemoveOnSetStyle

func (s *Scrollbar) RemoveOnSetStyle()

RemoveOnSetStyle undoes the most recent OnSetStyle call. The function will panic if there is no handler set.

func (*Scrollbar) SetHandlePosition

func (s *Scrollbar) SetHandlePosition(v int)

SetHandlePosition sets the scrollbar handle position.

func (*Scrollbar) SetHandleSize

func (s *Scrollbar) SetHandleSize(v int)

SetHandleSize sets the scrollbar handle size.

func (*Scrollbar) SetPosition

func (s *Scrollbar) SetPosition(v wm.Position)

SetPosition sets the scrollbar position.

func (*Scrollbar) SetSize

func (s *Scrollbar) SetSize(v wm.Size)

SetSize sets the scrollbar size.

func (*Scrollbar) SetStyle

func (s *Scrollbar) SetStyle(v wm.Style)

SetStyle sets the scrollbar style.

func (*Scrollbar) SetView

func (s *Scrollbar) SetView(origin, viewportSize, contentSize int)

SetView sets the scrollbar parameters based on the view parameters. SetView panics when origin < 0.

func (*Scrollbar) Size

func (s *Scrollbar) Size() wm.Size

Size returns the size of the scrollbar.

func (*Scrollbar) Style

func (s *Scrollbar) Style() wm.Style

Style returns the style of the scrollbar.

type View

type View struct {
	*wm.Window // Underlying window.
	// contains filtered or unexported fields
}

View displays content possibly overflowing the size of its client area.

View methods must be called only directly from an event handler goroutine or from a function that was enqueued using wm.Application.Post or wm.Application.PostWait.

func NewView

func NewView(w *wm.Window, meter Meter) *View

NewView configures w to show scrollbars when content, measured using the meter parameter, overflows the client area of w and returns the resulting View. The user can use the scrollbars to control the View's Origin.

NewView must be called only directly from an event handler goroutine or from a function that was enqueued using wm.Application.Post or wm.Application.PostWait.

func (*View) End

func (v *View) End()

End makes the view show the ending of its content.

func (*View) Home

func (v *View) Home()

Home makes the view show the beginning of its content.

func (*View) HorizontalScrollbarEnabled

func (v *View) HorizontalScrollbarEnabled() bool

HorizontalScrollbarEnabled reports whether the horizontal scrollbar is enabled.

func (*View) OnSetHorizontalScrollbarEnabled

func (v *View) OnSetHorizontalScrollbarEnabled(h wm.OnSetBoolHandler, finalize func())

OnSetHorizontalScrollbarEnabled sets a handler invoked on SetHorizontalScrollbarEnabled. When the event handler is removed, finalize is called, if not nil.

func (*View) OnSetVerticalScrollbarEnabled

func (v *View) OnSetVerticalScrollbarEnabled(h wm.OnSetBoolHandler, finalize func())

OnSetVerticalScrollbarEnabled sets a handler invoked on SetVerticalScrollbarEnabled. When the event handler is removed, finalize is called, if not nil.

func (*View) PageDown

func (v *View) PageDown()

PageDown makes the view show the next page of content.

func (*View) PageUp

func (v *View) PageUp()

PageUp makes the view show the previous page of content.

func (*View) RemoveOnSetHorizontalScrollbarEnabled

func (v *View) RemoveOnSetHorizontalScrollbarEnabled()

RemoveOnSetHorizontalScrollbarEnabled undoes the most recent OnSetHorizontalScrollbarEnabled call. The function will panic if there is no handler set.

func (*View) RemoveOnSetVerticalScrollbarEnabled

func (v *View) RemoveOnSetVerticalScrollbarEnabled()

RemoveOnSetVerticalScrollbarEnabled undoes the most recent OnSetVerticalScrollbarEnabled call. The function will panic if there is no handler set.

func (*View) SetHorizontalScrollbarEnabled

func (v *View) SetHorizontalScrollbarEnabled(b bool)

SetHorizontalScrollbarEnabled sets whether the horizontal scrollbar is enabled.

func (*View) SetVerticalScrollbarEnabled

func (v *View) SetVerticalScrollbarEnabled(b bool)

SetVerticalScrollbarEnabled sets whether the vertical scrollbar is enabled.

func (*View) VerticalScrollbarEnabled

func (v *View) VerticalScrollbarEnabled() bool

VerticalScrollbarEnabled reports whether the vertical scrollbar is enabled.

Jump to

Keyboard shortcuts

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