button

package
v0.0.0-...-af996ba Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// StdButton is the theme all new Buttons get by default.
	StdButton = NewTheme()
)

Functions

This section is empty.

Types

type BaseTextTheme

type BaseTextTheme struct {
	BaseTheme
	TextWhenLight    color.Color // The text color to use when the background is considered to be 'light'.
	TextWhenDark     color.Color // The text color to use when the background is considered to be 'dark'.
	TextWhenDisabled color.Color // The text color to use when disabled.
	Font             *font.Font  // The font to use.
}

BaseTextTheme contains the common theme elements used in all buttons that display text.

func (*BaseTextTheme) Init

func (theme *BaseTextTheme) Init()

Init initializes the theme with its default values.

type BaseTheme

type BaseTheme struct {
	ClickAnimationTime    time.Duration // The amount of time to spend animating the click action.
	CornerRadius          float64       // The amount of rounding to use on the corners.
	Background            color.Color   // The background color when enabled but not pressed or focused.
	BackgroundWhenPressed color.Color   // The background color when enabled and pressed.
	GradientAdjustment    float64       // The amount to vary the color when creating the background gradient.
	DisabledAdjustment    float64       // The amount to adjust the background brightness when disabled.
	OutlineAdjustment     float64       // The amount to adjust the background brightness when using it to draw the button outline.
}

BaseTheme contains the common theme elements used in all buttons.

func (*BaseTheme) Gradient

func (theme *BaseTheme) Gradient(base color.Color) *draw.Gradient

Gradient returns a gradient for the specified color.

func (*BaseTheme) Init

func (theme *BaseTheme) Init()

Init initializes the theme with its default values.

type Button

type Button struct {
	widget.Block
	Theme *Theme // The theme the button will use to draw itself.
	Title string // The title of the button.
	// contains filtered or unexported fields
}

Button represents a clickable text button.

func New

func New(title string) *Button

New creates a new button with the specified title.

func (*Button) BaseBackground

func (button *Button) BaseBackground() color.Color

BaseBackground returns this button's current base background color.

func (*Button) Click

func (button *Button) Click()

Click makes the button behave as if a user clicked on it.

func (*Button) Sizes

func (button *Button) Sizes(hint geom.Size) (min, pref, max geom.Size)

Sizes implements Sizer

func (*Button) TextColor

func (button *Button) TextColor() color.Color

TextColor returns this button's current text color.

type Theme

type Theme struct {
	BaseTextTheme
	HorizontalMargin float64 // The margin on the left and right side of the text.
	VerticalMargin   float64 // The margin on the top and bottom of the text.
	MinimumTextWidth float64 // The minimum space to permit for text.
}

Theme contains the theme elements for Buttons.

func NewTheme

func NewTheme() *Theme

NewTheme creates a new button theme.

func (*Theme) Init

func (theme *Theme) Init()

Init initializes the theme with its default values.

Jump to

Keyboard shortcuts

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