Documentation
¶
Index ¶
- Constants
- Variables
- type Alignment
- type BasicTextConstructorArgs
- type Composable
- type Composer
- type TextOption
- func Selectable() TextOption
- func StyleWithColor(color graphics.Color) TextOptiondeprecated
- func StyleWithFont(font gioFont.Font) TextOptiondeprecated
- func StyleWithSelectionColor(color graphics.Color) TextOption
- func StyleWithStrikethrough() TextOption
- func StyleWithTextSize(sizeInSP float32) TextOptiondeprecated
- func WithAdditionalTextStyle(ts *text.TextStyle) TextOption
- func WithAlignment(alignment style.TextAlign) TextOption
- func WithColor(color graphics.Color) TextOption
- func WithGioAlignment(alignment Alignment) TextOption
- func WithLineHeight(lineHeightInSP float32) TextOptiondeprecated
- func WithLineHeightScale(lineHeightScale float32) TextOption
- func WithMaxLines(maxLines int) TextOption
- func WithModifier(m ui.Modifier) TextOption
- func WithTextStyle(ts *text.TextStyle) TextOption
- func WithTextStyleOptions(options ...text.TextStyleOption) TextOption
- func WithTruncator(truncator string) TextOption
- func WithWrapPolicy(wrapPolicy WrapPolicy) TextOptiondeprecated
- type TextOptions
- type ThemeManager
- type WrapPolicy
Constants ¶
const BasicTextNodeID = "BasicText"
Variables ¶
var GetThemeManager = theme.GetThemeManager
Functions ¶
This section is empty.
Types ¶
type BasicTextConstructorArgs ¶
type BasicTextConstructorArgs struct {
Value string
Options TextOptions
// contains filtered or unexported fields
}
type Composable ¶
type Composable = api.Composable
func Text ¶
func Text(value string, options ...TextOption) Composable
Text renders a text leaf. The value is stored in a slot for tooling.
type TextOption ¶
type TextOption func(*TextOptions)
func Selectable ¶
func Selectable() TextOption
TextSelectable sets the text to be selectable. stores *widget.Selectable in runtime memoization
func StyleWithColor
deprecated
func StyleWithColor(color graphics.Color) TextOption
Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions
func StyleWithFont
deprecated
func StyleWithFont(font gioFont.Font) TextOption
Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions
func StyleWithSelectionColor ¶
func StyleWithSelectionColor(color graphics.Color) TextOption
StyleWithSelectionColor sets the selection highlight color. Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions
func StyleWithStrikethrough ¶
func StyleWithStrikethrough() TextOption
StyleWithStrikethrough enables strikethrough text decoration. Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions
func StyleWithTextSize
deprecated
func StyleWithTextSize(sizeInSP float32) TextOption
Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions
func WithAdditionalTextStyle ¶
func WithAdditionalTextStyle(ts *text.TextStyle) TextOption
merge TextStyle
func WithAlignment ¶
func WithAlignment(alignment style.TextAlign) TextOption
func WithColor ¶
func WithColor(color graphics.Color) TextOption
func WithGioAlignment ¶
func WithGioAlignment(alignment Alignment) TextOption
func WithLineHeight
deprecated
func WithLineHeight(lineHeightInSP float32) TextOption
Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions
func WithMaxLines ¶
func WithMaxLines(maxLines int) TextOption
func WithModifier ¶
func WithModifier(m ui.Modifier) TextOption
func WithTextStyleOptions ¶
func WithTextStyleOptions(options ...text.TextStyleOption) TextOption
func WithTruncator ¶
func WithTruncator(truncator string) TextOption
func WithWrapPolicy
deprecated
func WithWrapPolicy(wrapPolicy WrapPolicy) TextOption
Deprecated: use WithTextStyle, WithAdditionalTextStyle or WithTextStyleOptions
type TextOptions ¶
type TextOptions struct {
Modifier ui.Modifier
TextStyle *text.TextStyle
MaxLines int
// Truncator is the text that will be shown at the end of the final
// line if MaxLines is exceeded. Defaults to "…" if empty.
Truncator string
// LineHeightScale applies a scaling factor to the LineHeight. If zero, a
// sensible default will be used.
LineHeightScale maybe.Maybe[float32]
// Selectable provides text selection state for the label. If not set, the label cannot
// be selected or copied interactively.
Selectable maybe.Maybe[bool]
// SelectionColor is the color of the background for selected text.
SelectionColor graphics.Color
}
func DefaultTextOptions ¶
func DefaultTextOptions() TextOptions
type ThemeManager ¶
type ThemeManager = theme.ThemeManager
type WrapPolicy ¶
type WrapPolicy = text.WrapPolicy
WrapPolicy configures strategies for choosing where to break lines of text for line wrapping.
const ( // WrapHeuristically tries to minimize breaking within words (UAX#14 text segments) // while also ensuring that text fits within the given MaxWidth. It will only break // a line within a word (on a UAX#29 grapheme cluster boundary) when that word cannot // fit on a line by itself. Additionally, when the final word of a line is being // truncated, this policy will preserve as many symbols of that word as // possible before the truncator. WrapHeuristically WrapPolicy = text.WrapHeuristically // WrapWords does not permit words (UAX#14 text segments) to be broken across lines. // This means that sometimes long words will exceed the MaxWidth they are wrapped with. WrapWords WrapPolicy = text.WrapWords // WrapGraphemes will maximize the amount of text on each line at the expense of readability, // breaking any word across lines on UAX#29 grapheme cluster boundaries to maximize the number of // grapheme clusters on each line. WrapGraphemes WrapPolicy = text.WrapGraphemes )