props

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorPropertyList = []string{
		"Color",
		"PushedColor",
		"SelectedColor",
		"BorderColor",
		"PushedBorderColor",
		"SelectedBorderColor",
		"TextColor",
		"PushedTextColor",
		"SelectedTextColor",
		"LineColor",
		"PushedLineColor",
		"SelectedLineColor",
		"BarColor",
		"PushedBarColor",
		"BackgroundColor",
		"MenuBackgroundColor",
	}
)
View Source
var (
	EmbedFontProps = []FontPropertyName{
		Font,
	}
)
View Source
var (
	FontPropertyList = []string{
		"Font",
		"RegularFont",
		"BoldFont",
		"ItalicFont",
		"BoldItalicFont",
		"MonoFont",
		"MonoBoldFont",
	}
)
View Source
var (
	PropsMap map[string]*Properties
)
View Source
var (
	SizePropertyList = []string{
		"Width",
		"Height",
		"BorderWidth",
		"PushedBorderWidth",
		"SelectedBorderWidth",
		"LineWidth",
		"InnerPadding",
		"Padding",
		"CornerRadius",
		"FontSize",
		"BarSize",
		"CtrlSize",
	}
)

Functions

This section is empty.

Types

type ColorPropertyName

type ColorPropertyName int
const (
	Color ColorPropertyName = iota
	PushedColor
	SelectedColor
	BorderColor
	PushedBorderColor
	SelectedBorderColor
	TextColor
	PushedTextColor
	SelectedTextColor
	LineColor
	PushedLineColor
	SelectedLineColor
	BarColor
	PushedBarColor
	BackgroundColor
	MenuBackgroundColor
	NumColorProperties
)

func (ColorPropertyName) MarshalText

func (p ColorPropertyName) MarshalText() ([]byte, error)

func (ColorPropertyName) String

func (p ColorPropertyName) String() string

func (*ColorPropertyName) UnmarshalText

func (p *ColorPropertyName) UnmarshalText(text []byte) error

type FontPropertyName

type FontPropertyName int
const (
	Font FontPropertyName = iota
	RegularFont
	BoldFont
	ItalicFont
	BoldItalicFont
	MonoFont
	MonoBoldFont
	NumFontProperties
)

func (FontPropertyName) MarshalText

func (p FontPropertyName) MarshalText() ([]byte, error)

func (FontPropertyName) String

func (p FontPropertyName) String() string

func (*FontPropertyName) UnmarshalText

func (p *FontPropertyName) UnmarshalText(text []byte) error

type Properties

type Properties struct {
	ColorMap map[ColorPropertyName]color.Color
	FontMap  map[FontPropertyName]*fonts.Font
	SizeMap  map[SizePropertyName]float64
	// contains filtered or unexported fields
}

Properties dienen dazu, graphische Eigenschaften von Widgets hierarchisch zu verwalten. In einem Properties-Objekt können drei Arten von Eigenschaften verwaltet werden: Farben (Datentyp: color.Color), Schriftarten (Datentyp: *opentype.Font) und Zahlen (Datentyp: float64). Durch die Hierarchie ist es möglich für einzelne Widgets vom Standard abweichende Eigenschaften zu definieren.

func NewProperties

func NewProperties(parent *Properties) *Properties

Erzeugt ein neues Property-Objekt und hinterlegt parent als Vater-Property.

func NewPropsFromData

func NewPropsFromData(parent *Properties, data []byte) *Properties

func NewPropsFromFile

func NewPropsFromFile(parent *Properties, fileName string) *Properties

func NewPropsFromUser

func NewPropsFromUser(parent *Properties, fileName string) *Properties

func (*Properties) Color

func (p *Properties) Color(name ColorPropertyName) color.Color

Das sind die Hauptmethoden, um Farben, Font oder Groessen aus den Properties zu lesen. Kann ein Property nicht gefunden werden, dann wird (falls vorhanden) das Parent-Property angefragt.

func (*Properties) DelColor

func (p *Properties) DelColor(name ColorPropertyName)

Auf Typen- oder Objekt-Stufe definierte Eigenschaften können mit den Del-Methoden wieder entfernt werden, so dass der Eintrag des Parents wieder aktiviert wird. Existiert die Eigenschaft in den Properties nicht, sind die Methoden no-op. Auf Properties der obersten Hierarchiestufe (d.h. mit parent == nil) haben die Methoden keinen Einfluss.

func (*Properties) DelFont

func (p *Properties) DelFont(name FontPropertyName)

func (*Properties) DelSize

func (p *Properties) DelSize(name SizePropertyName)

func (*Properties) Font

func (p *Properties) Font(name FontPropertyName) *fonts.Font

func (*Properties) SetColor

func (p *Properties) SetColor(name ColorPropertyName, col color.Color)

Über diese Methoden können einzelne Eigenschaften auf Typen- oder Objekt- ebene definiert werden.

func (*Properties) SetFont

func (p *Properties) SetFont(name FontPropertyName, fnt *fonts.Font)

func (*Properties) SetSize

func (p *Properties) SetSize(name SizePropertyName, size float64)

func (*Properties) Size

func (p *Properties) Size(name SizePropertyName) float64

type PropertyEmbed

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

func (*PropertyEmbed) BackgroundColor

func (pe *PropertyEmbed) BackgroundColor() color.Color

func (*PropertyEmbed) BarColor

func (pe *PropertyEmbed) BarColor() color.Color

func (*PropertyEmbed) BarSize

func (pe *PropertyEmbed) BarSize() float64

func (*PropertyEmbed) BorderColor

func (pe *PropertyEmbed) BorderColor() color.Color

func (*PropertyEmbed) BorderWidth

func (pe *PropertyEmbed) BorderWidth() float64

func (*PropertyEmbed) Color

func (pe *PropertyEmbed) Color() color.Color

func (*PropertyEmbed) CornerRadius

func (pe *PropertyEmbed) CornerRadius() float64

func (*PropertyEmbed) CtrlSize

func (pe *PropertyEmbed) CtrlSize() float64

func (*PropertyEmbed) Font

func (pe *PropertyEmbed) Font() *fonts.Font

func (*PropertyEmbed) FontSize

func (pe *PropertyEmbed) FontSize() float64

func (*PropertyEmbed) Height

func (pe *PropertyEmbed) Height() float64

func (*PropertyEmbed) Init

func (pe *PropertyEmbed) Init(parent *Properties)

func (*PropertyEmbed) Init2

func (pe *PropertyEmbed) Init2(parent *Properties, propFile string)

func (*PropertyEmbed) InitByName

func (pe *PropertyEmbed) InitByName(name string)

func (*PropertyEmbed) InnerPadding

func (pe *PropertyEmbed) InnerPadding() float64

func (*PropertyEmbed) LineColor

func (pe *PropertyEmbed) LineColor() color.Color

func (*PropertyEmbed) LineWidth

func (pe *PropertyEmbed) LineWidth() float64

func (*PropertyEmbed) MenuBackgroundColor

func (pe *PropertyEmbed) MenuBackgroundColor() color.Color

func (*PropertyEmbed) Padding

func (pe *PropertyEmbed) Padding() float64

func (*PropertyEmbed) PushedBarColor

func (pe *PropertyEmbed) PushedBarColor() color.Color

func (*PropertyEmbed) PushedBorderColor

func (pe *PropertyEmbed) PushedBorderColor() color.Color

func (*PropertyEmbed) PushedBorderWidth

func (pe *PropertyEmbed) PushedBorderWidth() float64

func (*PropertyEmbed) PushedColor

func (pe *PropertyEmbed) PushedColor() color.Color

func (*PropertyEmbed) PushedLineColor

func (pe *PropertyEmbed) PushedLineColor() color.Color

func (*PropertyEmbed) PushedTextColor

func (pe *PropertyEmbed) PushedTextColor() color.Color

func (*PropertyEmbed) SelectedBorderColor

func (pe *PropertyEmbed) SelectedBorderColor() color.Color

func (*PropertyEmbed) SelectedBorderWidth

func (pe *PropertyEmbed) SelectedBorderWidth() float64

func (*PropertyEmbed) SelectedColor

func (pe *PropertyEmbed) SelectedColor() color.Color

func (*PropertyEmbed) SelectedLineColor

func (pe *PropertyEmbed) SelectedLineColor() color.Color

func (*PropertyEmbed) SelectedTextColor

func (pe *PropertyEmbed) SelectedTextColor() color.Color

func (*PropertyEmbed) SetBackgroundColor

func (pe *PropertyEmbed) SetBackgroundColor(c color.Color)

func (*PropertyEmbed) SetBarColor

func (pe *PropertyEmbed) SetBarColor(c color.Color)

func (*PropertyEmbed) SetBarSize

func (pe *PropertyEmbed) SetBarSize(s float64)

func (*PropertyEmbed) SetBorderColor

func (pe *PropertyEmbed) SetBorderColor(c color.Color)

func (*PropertyEmbed) SetBorderWidth

func (pe *PropertyEmbed) SetBorderWidth(s float64)

func (*PropertyEmbed) SetColor

func (pe *PropertyEmbed) SetColor(c color.Color)

func (*PropertyEmbed) SetCornerRadius

func (pe *PropertyEmbed) SetCornerRadius(s float64)

func (*PropertyEmbed) SetCtrlSize

func (pe *PropertyEmbed) SetCtrlSize(s float64)

func (*PropertyEmbed) SetFont

func (pe *PropertyEmbed) SetFont(f *fonts.Font)

func (*PropertyEmbed) SetFontSize

func (pe *PropertyEmbed) SetFontSize(s float64)

func (*PropertyEmbed) SetHeight

func (pe *PropertyEmbed) SetHeight(s float64)

func (*PropertyEmbed) SetInnerPadding

func (pe *PropertyEmbed) SetInnerPadding(s float64)

func (*PropertyEmbed) SetLineColor

func (pe *PropertyEmbed) SetLineColor(c color.Color)

func (*PropertyEmbed) SetLineWidth

func (pe *PropertyEmbed) SetLineWidth(s float64)

func (*PropertyEmbed) SetMenuBackgroundColor

func (pe *PropertyEmbed) SetMenuBackgroundColor(c color.Color)

func (*PropertyEmbed) SetPadding

func (pe *PropertyEmbed) SetPadding(s float64)

func (*PropertyEmbed) SetPushedBarColor

func (pe *PropertyEmbed) SetPushedBarColor(c color.Color)

func (*PropertyEmbed) SetPushedBorderColor

func (pe *PropertyEmbed) SetPushedBorderColor(c color.Color)

func (*PropertyEmbed) SetPushedBorderWidth

func (pe *PropertyEmbed) SetPushedBorderWidth(s float64)

func (*PropertyEmbed) SetPushedColor

func (pe *PropertyEmbed) SetPushedColor(c color.Color)

func (*PropertyEmbed) SetPushedLineColor

func (pe *PropertyEmbed) SetPushedLineColor(c color.Color)

func (*PropertyEmbed) SetPushedTextColor

func (pe *PropertyEmbed) SetPushedTextColor(c color.Color)

func (*PropertyEmbed) SetSelectedBorderColor

func (pe *PropertyEmbed) SetSelectedBorderColor(c color.Color)

func (*PropertyEmbed) SetSelectedBorderWidth

func (pe *PropertyEmbed) SetSelectedBorderWidth(s float64)

func (*PropertyEmbed) SetSelectedColor

func (pe *PropertyEmbed) SetSelectedColor(c color.Color)

func (*PropertyEmbed) SetSelectedLineColor

func (pe *PropertyEmbed) SetSelectedLineColor(c color.Color)

func (*PropertyEmbed) SetSelectedTextColor

func (pe *PropertyEmbed) SetSelectedTextColor(c color.Color)

func (*PropertyEmbed) SetTextColor

func (pe *PropertyEmbed) SetTextColor(c color.Color)

func (*PropertyEmbed) SetWidth

func (pe *PropertyEmbed) SetWidth(s float64)

func (*PropertyEmbed) TextColor

func (pe *PropertyEmbed) TextColor() color.Color

func (*PropertyEmbed) Width

func (pe *PropertyEmbed) Width() float64

type SizePropertyName

type SizePropertyName int
const (
	Width SizePropertyName = iota
	Height
	BorderWidth
	PushedBorderWidth
	SelectedBorderWidth
	LineWidth
	InnerPadding
	Padding
	CornerRadius
	FontSize
	BarSize
	CtrlSize
	NumSizeProperties
)

func (SizePropertyName) MarshalText

func (p SizePropertyName) MarshalText() ([]byte, error)

func (SizePropertyName) String

func (p SizePropertyName) String() string

func (*SizePropertyName) UnmarshalText

func (p *SizePropertyName) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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