Documentation
¶
Index ¶
- Constants
- Variables
- func FontMatch(fontstr string) (string, *opentype.FaceOptions, error)
- func Run[T comparable](items Menu[T], conf *Config, wlDisplay string, hover func(T)) (ret T, werr error)
- type Action
- type Alignment
- type ColorPair
- type Config
- type ContextMenu
- type Item
- type Menu
- type OverflowItem
- type QuitEvent
- type SubImage
- type SurfaceImage
Constants ¶
View Source
const ( ItemPrev = iota ItemNext ItemFirst ItemLast )
enum for keyboard menu navigation
Variables ¶
View Source
var DefaultConfig = Config{ FontName: "monospace:size=12", BackgroundColor: "#FFFFFF", ForegroundColor: "#2E3436", SelbackgroundColor: "#3584E4", SelforegroundColor: "#FFFFFF", SeparatorColor: "#CDC7C2", BorderColor: "#E6E6E6", MinItemWidth: 130, BorderSize: 1, SeperatorLength: 3, Alignment: AlignLeft, IconSize: 24, PaddingX: 4, PaddingY: 4, }
View Source
var ErrExited = errors.New("quit-request received")
Functions ¶
Types ¶
type Config ¶
type Config struct {
/* the values below are set by menu.ctxmenu.h */
FontName string
BackgroundColor string
ForegroundColor string
SelbackgroundColor string
SelforegroundColor string
SeparatorColor string
BorderColor string
MinItemWidth int
BorderSize int
SeperatorLength int
IconSize int
PaddingX, PaddingY int
Alignment Alignment
}
Config holds configurations for ctxmenu
type ContextMenu ¶
type ContextMenu struct {
*Config
// contains filtered or unexported fields
}
func (*ContextMenu) Monitor ¶
func (ctxmenu *ContextMenu) Monitor() image.Rectangle
type Item ¶
type Item[T comparable] struct { Label string /* string to be drawed on menu */ Output T /* string to be outputed when item is clicked */ Imagefile string SubMenu Menu[T] }
type Menu ¶
type Menu[T comparable] []Item[T]
type OverflowItem ¶
type OverflowItem int
const ( OverflowTop OverflowItem = iota - 1 OverflowNone OverflowBottom )
type SubImage ¶
SubImage is a wrapper to offset an draw.Image to specific Boundaries
func (*SubImage) At ¶
At returns the color of the pixel at (x, y). At(Bounds().Min.X, Bounds().Min.Y) returns the upper-left pixel of the grid. At(Bounds().Max.X-1, Bounds().Max.Y-1) returns the lower-right one.
func (*SubImage) Bounds ¶
Bounds returns the domain for which At can return non-zero color. The bounds do not necessarily contain the point (0, 0).
func (*SubImage) ColorModel ¶
ColorModel returns the Image's color model.
type SurfaceImage ¶
func NewSurfaceImage ¶
func (*SurfaceImage) Buffer ¶
func (img *SurfaceImage) Buffer() *proto.Buffer
func (*SurfaceImage) Close ¶
func (img *SurfaceImage) Close()
func (*SurfaceImage) Resize ¶
func (img *SurfaceImage) Resize(newrect image.Rectangle)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
