Updated doc comments

This commit is contained in:
Alexei Anoshenko 2024-12-05 20:15:39 +03:00
parent 0919376f09
commit a8242c99fe
58 changed files with 3121 additions and 3514 deletions

View File

@ -17,10 +17,11 @@
NewViewShadow function -> NewShadow NewViewShadow function -> NewShadow
NewInsetViewShadow function -> NewInsetShadow NewInsetViewShadow function -> NewInsetShadow
NewShadowWithParams function -> NewShadowProperty NewShadowWithParams function -> NewShadowProperty
NewColumnSeparator function -> NewColumnSeparatorProperty
* Added functions: NewBounds, NewEllipticRadius, NewRadii, NewLinearGradient, NewCircleRadialGradient, * Added functions: NewBounds, NewEllipticRadius, NewRadii, NewLinearGradient, NewCircleRadialGradient,
NewEllipseRadialGradient, GetPushTransform, GetPushDuration, GetPushTiming, IsMoveToFrontAnimation, NewEllipseRadialGradient, GetPushTransform, GetPushDuration, GetPushTiming, IsMoveToFrontAnimation,
GetBackground, GetMask, GetBackgroundClip,GetBackgroundOrigin, GetMaskClip, GetMaskOrigin. GetBackground, GetMask, GetBackgroundClip,GetBackgroundOrigin, GetMaskClip, GetMaskOrigin, NewColumnSeparator.
* Added SetConicGradientFillStyle and SetConicGradientStrokeStyle methods to Canvas interface. * Added SetConicGradientFillStyle and SetConicGradientStrokeStyle methods to Canvas interface.

View File

@ -15,12 +15,16 @@ type AngleUnitType uint8
const ( const (
// Radian - angle in radians // Radian - angle in radians
Radian AngleUnitType = 0 Radian AngleUnitType = 0
// Radian - angle in radians * π // Radian - angle in radians * π
PiRadian AngleUnitType = 1 PiRadian AngleUnitType = 1
// Degree - angle in degrees // Degree - angle in degrees
Degree AngleUnitType = 2 Degree AngleUnitType = 2
// Gradian - angle in gradian (1400 of a full circle) // Gradian - angle in gradian (1400 of a full circle)
Gradian AngleUnitType = 3 Gradian AngleUnitType = 3
// Turn - angle in turns (1 turn = 360 degree) // Turn - angle in turns (1 turn = 360 degree)
Turn AngleUnitType = 4 Turn AngleUnitType = 4
) )

View File

@ -11,132 +11,146 @@ import (
const ( const (
// AnimationTag is the constant for "animation" property tag. // AnimationTag is the constant for "animation" property tag.
// //
// Used by `View`. // Used by View.
// Sets and starts animations. // Sets and starts animations.
// //
// Supported types: `Animation`, `[]Animation`. // Supported types: Animation, []Animation.
// //
// Internal type is `[]Animation`, other types converted to it during assignment. // Internal type is []Animation, other types converted to it during assignment.
// See `Animation` description for more details. // See Animation description for more details.
AnimationTag PropertyName = "animation" AnimationTag PropertyName = "animation"
// AnimationPaused is the constant for "animation-paused" property tag. // AnimationPaused is the constant for "animation-paused" property tag.
// //
// Used by `Animation`. // Used by Animation.
// Controls whether the animation is running or paused. // Controls whether the animation is running or paused.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - Animation is paused. // - true, 1, "true", "yes", "on", or "1" - Animation is paused.
// `false` or `0` or "false", "no", "off", "0" - Animation is playing. // - false, 0, "false", "no", "off", or "0" - Animation is playing.
AnimationPaused PropertyName = "animation-paused" AnimationPaused PropertyName = "animation-paused"
// Transition is the constant for "transition" property tag. // Transition is the constant for "transition" property tag.
// //
// Used by `View`. // Used by View.
// Sets transition animation of view properties. Each provided property must contain `Animation` which describe how //
// Sets transition animation of view properties. Each provided property must contain Animation which describe how
// particular property will be animated on property value change. Transition animation can be applied to properties of the // particular property will be animated on property value change. Transition animation can be applied to properties of the
// type `SizeUnit`, `Color`, `AngleUnit`, `float64` and composite properties that contain elements of the listed types(for // type SizeUnit, Color, AngleUnit, float64 and composite properties that contain elements of the listed types(for
// example, "shadow", "border", etc.). If we'll try to animate other properties with internal type like `bool` or // example, "shadow", "border", etc.). If we'll try to animate other properties with internal type like bool or
// `string` no error will occur, simply there will be no animation. // string no error will occur, simply there will be no animation.
// //
// Supported types: `Params`. // Supported types: Params.
// //
// See `Params` description for more details. // See Params description for more details.
Transition PropertyName = "transition" Transition PropertyName = "transition"
// PropertyTag is the constant for "property" property tag. // PropertyTag is the constant for "property" property tag.
// //
// Used by `Animation`. // Used by Animation.
// Describes a scenario for changing a `View`'s property. Used only for animation script.
// //
// Supported types: `[]AnimatedProperty`, `AnimatedProperty`. // Describes a scenario for changing a View's property. Used only for animation script.
// //
// Internal type is `[]AnimatedProperty`, other types converted to it during assignment. // Supported types: []AnimatedProperty, AnimatedProperty.
// See `AnimatedProperty` description for more details. //
// Internal type is []AnimatedProperty, other types converted to it during assignment.
// See AnimatedProperty description for more details.
PropertyTag PropertyName = "property" PropertyTag PropertyName = "property"
// Duration is the constant for "duration" property tag. // Duration is the constant for "duration" property tag.
// //
// Used by `Animation`. // Used by Animation.
//
// Sets the length of time in seconds that an animation takes to complete one cycle. // Sets the length of time in seconds that an animation takes to complete one cycle.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
Duration PropertyName = "duration" Duration PropertyName = "duration"
// Delay is the constant for "delay" property tag. // Delay is the constant for "delay" property tag.
// //
// Used by `Animation`. // Used by Animation.
//
// Specifies the amount of time in seconds to wait from applying the animation to an element before beginning to perform // Specifies the amount of time in seconds to wait from applying the animation to an element before beginning to perform
// the animation. The animation can start later, immediately from its beginning or immediately and partway through the // the animation. The animation can start later, immediately from its beginning or immediately and partway through the
// animation. // animation.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
Delay PropertyName = "delay" Delay PropertyName = "delay"
// TimingFunction is the constant for "timing-function" property tag. // TimingFunction is the constant for "timing-function" property tag.
// //
// Used by `Animation`. // Used by Animation.
//
// Set how an animation progresses through the duration of each cycle. // Set how an animation progresses through the duration of each cycle.
// //
// Supported types: `string`. // Supported types: string.
// //
// Values: // Values:
// "ease"(`EaseTiming`) - Speed increases towards the middle and slows down at the end. // - "ease" (EaseTiming) - Speed increases towards the middle and slows down at the end.
// "ease-in"(`EaseInTiming`) - Speed is slow at first, but increases in the end. // - "ease-in" (EaseInTiming) - Speed is slow at first, but increases in the end.
// "ease-out"(`EaseOutTiming`) - Speed is fast at first, but decreases in the end. // - "ease-out" (EaseOutTiming) - Speed is fast at first, but decreases in the end.
// "ease-in-out"(`EaseInOutTiming`) - Speed is slow at first, but quickly increases and at the end it decreases again. // - "ease-in-out" (EaseInOutTiming) - Speed is slow at first, but quickly increases and at the end it decreases again.
// "linear"(`LinearTiming`) - Constant speed. // - "linear" (LinearTiming) - Constant speed.
// - "step(n)" (StepTiming(n int) function) - Timing function along stepCount stops along the transition, displaying each stop for equal lengths of time.
// - "cubic-bezier(x1, y1, x2, y2)" (CubicBezierTiming(x1, y1, x2, y2 float64) function) - Cubic-Bezier curve timing function. x1 and x2 must be in the range [0, 1].
TimingFunction PropertyName = "timing-function" TimingFunction PropertyName = "timing-function"
// IterationCount is the constant for "iteration-count" property tag. // IterationCount is the constant for "iteration-count" property tag.
// //
// Used by `Animation`. // Used by Animation.
//
// Sets the number of times an animation sequence should be played before stopping. Used only for animation script. // Sets the number of times an animation sequence should be played before stopping. Used only for animation script.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Internal type is `int`, other types converted to it during assignment. // Internal type is int, other types converted to it during assignment.
IterationCount PropertyName = "iteration-count" IterationCount PropertyName = "iteration-count"
// AnimationDirection is the constant for "animation-direction" property tag. // AnimationDirection is the constant for "animation-direction" property tag.
// //
// Used by `Animation`. // Used by Animation.
//
// Whether an animation should play forward, backward, or alternate back and forth between playing the sequence forward // Whether an animation should play forward, backward, or alternate back and forth between playing the sequence forward
// and backward. Used only for animation script. // and backward. Used only for animation script.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NormalAnimation`) or "normal" - The animation plays forward every iteration, that is, when the animation ends, it is immediately reset to its starting position and played again. // - 0 (NormalAnimation) or "normal" - The animation plays forward every iteration, that is, when the animation ends, it is immediately reset to its starting position and played again.
// `1`(`ReverseAnimation`) or "reverse" - The animation plays backwards, from the last position to the first, and then resets to the final position and plays again. // - 1 (ReverseAnimation) or "reverse" - The animation plays backwards, from the last position to the first, and then resets to the final position and plays again.
// `2`(`AlternateAnimation`) or "alternate" - The animation changes direction in each cycle, that is, in the first cycle, it starts from the start position, reaches the end position, and in the second cycle, it continues from the end position and reaches the start position, and so on. // - 2 (AlternateAnimation) or "alternate" - The animation changes direction in each cycle, that is, in the first cycle, it starts from the start position, reaches the end position, and in the second cycle, it continues from the end position and reaches the start position, and so on.
// `3`(`AlternateReverseAnimation`) or "alternate-reverse" - The animation starts playing from the end position and reaches the start position, and in the next cycle, continuing from the start position, it goes to the end position. // - 3 (AlternateReverseAnimation) or "alternate-reverse" - The animation starts playing from the end position and reaches the start position, and in the next cycle, continuing from the start position, it goes to the end position.
AnimationDirection PropertyName = "animation-direction" AnimationDirection PropertyName = "animation-direction"
// NormalAnimation is value of the "animation-direction" property. // NormalAnimation is value of the "animation-direction" property.
//
// The animation plays forwards each cycle. In other words, each time the animation cycles, // The animation plays forwards each cycle. In other words, each time the animation cycles,
// the animation will reset to the beginning state and start over again. This is the default value. // the animation will reset to the beginning state and start over again. This is the default value.
NormalAnimation = 0 NormalAnimation = 0
// ReverseAnimation is value of the "animation-direction" property. // ReverseAnimation is value of the "animation-direction" property.
//
// The animation plays backwards each cycle. In other words, each time the animation cycles, // The animation plays backwards each cycle. In other words, each time the animation cycles,
// the animation will reset to the end state and start over again. Animation steps are performed // the animation will reset to the end state and start over again. Animation steps are performed
// backwards, and timing functions are also reversed. // backwards, and timing functions are also reversed.
//
// For example, an "ease-in" timing function becomes "ease-out". // For example, an "ease-in" timing function becomes "ease-out".
ReverseAnimation = 1 ReverseAnimation = 1
// AlternateAnimation is value of the "animation-direction" property. // AlternateAnimation is value of the "animation-direction" property.
//
// The animation reverses direction each cycle, with the first iteration being played forwards. // The animation reverses direction each cycle, with the first iteration being played forwards.
// The count to determine if a cycle is even or odd starts at one. // The count to determine if a cycle is even or odd starts at one.
AlternateAnimation = 2 AlternateAnimation = 2
// AlternateReverseAnimation is value of the "animation-direction" property. // AlternateReverseAnimation is value of the "animation-direction" property.
//
// The animation reverses direction each cycle, with the first iteration being played backwards. // The animation reverses direction each cycle, with the first iteration being played backwards.
// The count to determine if a cycle is even or odd starts at one. // The count to determine if a cycle is even or odd starts at one.
AlternateReverseAnimation = 3 AlternateReverseAnimation = 3
@ -200,6 +214,7 @@ type animationData struct {
} }
// Animation interface is used to set animation parameters. Used properties: // Animation interface is used to set animation parameters. Used properties:
//
// "property", "id", "duration", "delay", "timing-function", "iteration-count", and "animation-direction" // "property", "id", "duration", "delay", "timing-function", "iteration-count", and "animation-direction"
type Animation interface { type Animation interface {
Properties Properties

View File

@ -4,154 +4,155 @@ package rui
const ( const (
// TransitionRunEvent is the constant for "transition-run-event" property tag. // TransitionRunEvent is the constant for "transition-run-event" property tag.
// //
// Used by `View`. // Used by View:
// Is fired when a transition is first created, i.e. before any transition delay has begun. // Is fired when a transition is first created, i.e. before any transition delay has begun.
// //
// General listener format: // General listener format:
// `func(view rui.View, propertyName string)`. // func(view rui.View, propertyName rui.PropertyName).
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// propertyName - Name of the property. // - propertyName - Name of the property.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, // func(view rui.View),
// `func(propertyName string)`, // func(propertyName rui.PropertyName)
// `func()`. // func().
TransitionRunEvent PropertyName = "transition-run-event" TransitionRunEvent PropertyName = "transition-run-event"
// TransitionStartEvent is the constant for "transition-start-event" property tag. // TransitionStartEvent is the constant for "transition-start-event" property tag.
// //
// Used by `View`. // Used by View:
// Is fired when a transition has actually started, i.e., after "delay" has ended. // Is fired when a transition has actually started, i.e., after "delay" has ended.
// //
// General listener format: // General listener format:
// `func(view rui.View, propertyName string)`. // func(view rui.View, propertyName rui.PropertyName).
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// propertyName - Name of the property. // - propertyName - Name of the property.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, // func(view rui.View)
// `func(propertyName string)`, // func(propertyName rui.PropertyName)
// `func()`. // func()
TransitionStartEvent PropertyName = "transition-start-event" TransitionStartEvent PropertyName = "transition-start-event"
// TransitionEndEvent is the constant for "transition-end-event" property tag. // TransitionEndEvent is the constant for "transition-end-event" property tag.
// //
// Used by `View`. // Used by View:
// Is fired when a transition has completed. // Is fired when a transition has completed.
// //
// General listener format: // General listener format:
// `func(view rui.View, propertyName string)`. // func(view rui.View, propertyName rui.PropertyName).
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// propertyName - Name of the property. // - propertyName - Name of the property.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, // func(view rui.View)
// `func(propertyName string)`, // func(propertyName rui.PropertyName)
// `func()`. // func()
TransitionEndEvent PropertyName = "transition-end-event" TransitionEndEvent PropertyName = "transition-end-event"
// TransitionCancelEvent is the constant for "transition-cancel-event" property tag. // TransitionCancelEvent is the constant for "transition-cancel-event" property tag.
// //
// Used by `View`. // Used by View:
// Is fired when a transition is cancelled. The transition is cancelled when: * A new property transition has begun. * The // Is fired when a transition is cancelled. The transition is cancelled when:
// "visibility" property is set to "gone". * The transition is stopped before it has run to completion, e.g. by moving the // - A new property transition has begun.
// mouse off a hover-transitioning view. // - The "visibility" property is set to "gone".
// - The transition is stopped before it has run to completion, e.g. by moving the mouse off a hover-transitioning view.
// //
// General listener format: // General listener format:
// `func(view rui.View, propertyName string)`. // func(view rui.View, propertyName rui.PropertyName).
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// propertyName - Name of the property. // - propertyName - Name of the property.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, // func(view rui.View)
// `func(propertyName string)`, // func(propertyName rui.PropertyName)
// `func()`. // func()
TransitionCancelEvent PropertyName = "transition-cancel-event" TransitionCancelEvent PropertyName = "transition-cancel-event"
// AnimationStartEvent is the constant for "animation-start-event" property tag. // AnimationStartEvent is the constant for "animation-start-event" property tag.
// //
// Used by `View`. // Used by View:
// Fired when an animation has started. If there is an "animation-delay", this event will fire once the delay period has // Fired when an animation has started. If there is an "animation-delay", this event will fire once the delay period has
// expired. // expired.
// //
// General listener format: // General listener format:
// `func(view rui.View, animationId string)`. // func(view rui.View, animationId string).
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// animationId - Id of the animation. // - animationId - Id of the animation.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, // func(view rui.View)
// `func(animationId string)`, // func(animationId string)
// `func()`. // func()
AnimationStartEvent PropertyName = "animation-start-event" AnimationStartEvent PropertyName = "animation-start-event"
// AnimationEndEvent is the constant for "animation-end-event" property tag. // AnimationEndEvent is the constant for "animation-end-event" property tag.
// //
// Used by `View`. // Used by View:
// Fired when an animation has completed. If the animation aborts before reaching completion, such as if the element is // Fired when an animation has completed. If the animation aborts before reaching completion, such as if the element is
// removed or the animation is removed from the element, the "animation-end-event" is not fired. // removed or the animation is removed from the element, the "animation-end-event" is not fired.
// //
// General listener format: // General listener format:
// `func(view rui.View, animationId string)`. // func(view rui.View, animationId string).
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// animationId - Id of the animation. // - animationId - Id of the animation.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, // func(view rui.View)
// `func(animationId string)`, // func(animationId string)
// `func()`. // func()
AnimationEndEvent PropertyName = "animation-end-event" AnimationEndEvent PropertyName = "animation-end-event"
// AnimationCancelEvent is the constant for "animation-cancel-event" property tag. // AnimationCancelEvent is the constant for "animation-cancel-event" property tag.
// //
// Used by `View`. // Used by View:
// Fired when an animation unexpectedly aborts. In other words, any time it stops running without sending the // Fired when an animation unexpectedly aborts. In other words, any time it stops running without sending the
// "animation-end-event". This might happen when the animation-name is changed such that the animation is removed, or when // "animation-end-event". This might happen when the animation-name is changed such that the animation is removed, or when
// the animating view is hidden. Therefore, either directly or because any of its containing views are hidden. The event // the animating view is hidden. Therefore, either directly or because any of its containing views are hidden. The event
// is not supported by all browsers. // is not supported by all browsers.
// //
// General listener format: // General listener format:
// `func(view rui.View, animationId string)`. // func(view rui.View, animationId string).
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// animationId - Id of the animation. // - animationId - Id of the animation.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, // func(view rui.View)
// `func(animationId string)`, // func(animationId string)
// `func()`. // func()
AnimationCancelEvent PropertyName = "animation-cancel-event" AnimationCancelEvent PropertyName = "animation-cancel-event"
// AnimationIterationEvent is the constant for "animation-iteration-event" property tag. // AnimationIterationEvent is the constant for "animation-iteration-event" property tag.
// //
// Used by `View`. // Used by View:
// Fired when an iteration of an animation ends, and another one begins. This event does not occur at the same time as the // Fired when an iteration of an animation ends, and another one begins. This event does not occur at the same time as the
// animation end event, and therefore does not occur for animations with an "iteration-count" of one. // animation end event, and therefore does not occur for animations with an "iteration-count" of one.
// //
// General listener format: // General listener format:
// `func(view rui.View, animationId string)`. // func(view rui.View, animationId string).
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// animationId - Id of the animation. // - animationId - Id of the animation.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, // func(view rui.View)
// `func(animationId string)`, // func(animationId string)
// `func()`. // func()
AnimationIterationEvent PropertyName = "animation-iteration-event" AnimationIterationEvent PropertyName = "animation-iteration-event"
) )

View File

@ -141,7 +141,7 @@ func (app *wasmApp) init(params AppParams) {
div := document.Call("createElement", "div") div := document.Call("createElement", "div")
div.Set("className", "ruiRoot") div.Set("className", "ruiRoot")
div.Set("id", "ruiRootView") div.Set("id", "ruiRootView")
viewHTML(app.session.RootView(), buffer) viewHTML(app.session.RootView(), buffer, "")
div.Set("innerHTML", buffer.String()) div.Set("innerHTML", buffer.String())
body.Call("appendChild", div) body.Call("appendChild", div)

View File

@ -6,36 +6,24 @@ import (
const ( const (
// BorderBox is the value of the following properties: // BorderBox is the value of the following properties:
// // - BackgroundClip - The background extends to the outside edge of the border (but underneath the border in z-ordering).
// * BackgroundClip - The background extends to the outside edge of the border (but underneath the border in z-ordering). // - BackgroundOrigin - The background is positioned relative to the border box.
// // - MaskClip - The painted content is clipped to the border box.
// * BackgroundOrigin - The background is positioned relative to the border box. // - MaskOrigin - The mask is positioned relative to the border box.
//
// * MaskClip - The painted content is clipped to the border box.
//
// * MaskOrigin - The mask is positioned relative to the border box.
BorderBox = 0 BorderBox = 0
// PaddingBox is value of the BackgroundClip and MaskClip property: // PaddingBox is value of the BackgroundClip and MaskClip property:
// // - BackgroundClip - The background extends to the outside edge of the padding. No background is drawn beneath the border.
// * BackgroundClip - The background extends to the outside edge of the padding. No background is drawn beneath the border. // - BackgroundOrigin - The background is positioned relative to the padding box.
// // - MaskClip - The painted content is clipped to the padding box.
// * BackgroundOrigin - The background is positioned relative to the padding box. // - MaskOrigin - The mask is positioned relative to the padding box.
//
// * MaskClip - The painted content is clipped to the padding box.
//
// * MaskOrigin - The mask is positioned relative to the padding box.
PaddingBox = 1 PaddingBox = 1
// ContentBox is value of the BackgroundClip and MaskClip property: // ContentBox is value of the BackgroundClip and MaskClip property:
// // - BackgroundClip - The background is painted within (clipped to) the content box.
// * BackgroundClip - The background is painted within (clipped to) the content box. // - BackgroundOrigin - The background is positioned relative to the content box.
// // - MaskClip - The painted content is clipped to the content box.
// * BackgroundOrigin - The background is positioned relative to the content box. // - MaskOrigin - The mask is positioned relative to the content box.
//
// * MaskClip - The painted content is clipped to the content box.
//
// * MaskOrigin - The mask is positioned relative to the content box.
ContentBox = 2 ContentBox = 2
) )
@ -58,7 +46,6 @@ type backgroundElement struct {
dataProperty dataProperty
} }
// NewBackgroundImage creates the new background image
func createBackground(obj DataObject) BackgroundElement { func createBackground(obj DataObject) BackgroundElement {
var result BackgroundElement = nil var result BackgroundElement = nil
@ -280,12 +267,14 @@ func backgroundStyledPropery(view View, subviewID []string, tag PropertyName) []
} }
// GetBackground returns the view background. // GetBackground returns the view background.
//
// If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned. // If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned.
func GetBackground(view View, subviewID ...string) []BackgroundElement { func GetBackground(view View, subviewID ...string) []BackgroundElement {
return backgroundStyledPropery(view, subviewID, Background) return backgroundStyledPropery(view, subviewID, Background)
} }
// GetMask returns the view mask. // GetMask returns the view mask.
//
// If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned. // If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned.
func GetMask(view View, subviewID ...string) []BackgroundElement { func GetMask(view View, subviewID ...string) []BackgroundElement {
return backgroundStyledPropery(view, subviewID, Mask) return backgroundStyledPropery(view, subviewID, Mask)
@ -293,7 +282,7 @@ func GetMask(view View, subviewID ...string) []BackgroundElement {
// GetBackgroundClip returns a "background-clip" of the subview. Returns one of next values: // GetBackgroundClip returns a "background-clip" of the subview. Returns one of next values:
// //
// BorderBox (0), PaddingBox (1), ContentBox (2) // BorderBox (0), PaddingBox (1), ContentBox (2)
// //
// If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned. // If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned.
func GetBackgroundClip(view View, subviewID ...string) int { func GetBackgroundClip(view View, subviewID ...string) int {
@ -302,7 +291,7 @@ func GetBackgroundClip(view View, subviewID ...string) int {
// GetBackgroundOrigin returns a "background-origin" of the subview. Returns one of next values: // GetBackgroundOrigin returns a "background-origin" of the subview. Returns one of next values:
// //
// BorderBox (0), PaddingBox (1), ContentBox (2) // BorderBox (0), PaddingBox (1), ContentBox (2)
// //
// If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned. // If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned.
func GetBackgroundOrigin(view View, subviewID ...string) int { func GetBackgroundOrigin(view View, subviewID ...string) int {
@ -311,7 +300,7 @@ func GetBackgroundOrigin(view View, subviewID ...string) int {
// GetMaskClip returns a "mask-clip" of the subview. Returns one of next values: // GetMaskClip returns a "mask-clip" of the subview. Returns one of next values:
// //
// BorderBox (0), PaddingBox (1), ContentBox (2) // BorderBox (0), PaddingBox (1), ContentBox (2)
// //
// If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned. // If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned.
func GetMaskClip(view View, subviewID ...string) int { func GetMaskClip(view View, subviewID ...string) int {
@ -320,7 +309,7 @@ func GetMaskClip(view View, subviewID ...string) int {
// GetMaskOrigin returns a "mask-origin" of the subview. Returns one of next values: // GetMaskOrigin returns a "mask-origin" of the subview. Returns one of next values:
// //
// BorderBox (0), PaddingBox (1), ContentBox (2) // BorderBox (0), PaddingBox (1), ContentBox (2)
// //
// If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned. // If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned.
func GetMaskOrigin(view View, subviewID ...string) int { func GetMaskOrigin(view View, subviewID ...string) int {

View File

@ -19,6 +19,13 @@ type BackgroundGradientAngle struct {
} }
// NewBackgroundConicGradient creates the new background conic gradient // NewBackgroundConicGradient creates the new background conic gradient
//
// The following properties can be used:
// - "gradient" [Gradient] - Describes gradient stop points. This is a mandatory property while describing background gradients.
// - "center-x" [CenterX] - center X point of the gradient.
// - "center-y" [CenterY] - center Y point of the gradient.
// - "from" [From] - start angle position of the gradient.
// - "repeating" [Repeating] - Defines whether stop points needs to be repeated after the last one.
func NewBackgroundConicGradient(params Params) BackgroundElement { func NewBackgroundConicGradient(params Params) BackgroundElement {
result := new(backgroundConicGradient) result := new(backgroundConicGradient)
result.init() result.init()

View File

@ -7,50 +7,59 @@ import (
// Constants related to view's background description // Constants related to view's background description
const ( const (
// NoRepeat is value of the Repeat property of an background image: // NoRepeat is value of the Repeat property of an background image:
//
// The image is not repeated (and hence the background image painting area // The image is not repeated (and hence the background image painting area
// will not necessarily be entirely covered). The position of the non-repeated // will not necessarily be entirely covered). The position of the non-repeated
// background image is defined by the background-position CSS property. // background image is defined by the background-position CSS property.
NoRepeat = 0 NoRepeat = 0
// RepeatXY is value of the Repeat property of an background image: // RepeatXY is value of the Repeat property of an background image:
//
// The image is repeated as much as needed to cover the whole background // The image is repeated as much as needed to cover the whole background
// image painting area. The last image will be clipped if it doesn't fit. // image painting area. The last image will be clipped if it doesn't fit.
RepeatXY = 1 RepeatXY = 1
// RepeatX is value of the Repeat property of an background image: // RepeatX is value of the Repeat property of an background image:
//
// The image is repeated horizontally as much as needed to cover // The image is repeated horizontally as much as needed to cover
// the whole width background image painting area. The image is not repeated vertically. // the whole width background image painting area. The image is not repeated vertically.
// The last image will be clipped if it doesn't fit. // The last image will be clipped if it doesn't fit.
RepeatX = 2 RepeatX = 2
// RepeatY is value of the Repeat property of an background image: // RepeatY is value of the Repeat property of an background image:
//
// The image is repeated vertically as much as needed to cover // The image is repeated vertically as much as needed to cover
// the whole height background image painting area. The image is not repeated horizontally. // the whole height background image painting area. The image is not repeated horizontally.
// The last image will be clipped if it doesn't fit. // The last image will be clipped if it doesn't fit.
RepeatY = 3 RepeatY = 3
// RepeatRound is value of the Repeat property of an background image: // RepeatRound is value of the Repeat property of an background image:
//
// As the allowed space increases in size, the repeated images will stretch (leaving no gaps) // As the allowed space increases in size, the repeated images will stretch (leaving no gaps)
// until there is room (space left >= half of the image width) for another one to be added. // until there is room (space left >= half of the image width) for another one to be added.
// When the next image is added, all of the current ones compress to allow room. // When the next image is added, all of the current ones compress to allow room.
RepeatRound = 4 RepeatRound = 4
// RepeatSpace is value of the Repeat property of an background image: // RepeatSpace is value of the Repeat property of an background image:
//
// The image is repeated as much as possible without clipping. The first and last images // The image is repeated as much as possible without clipping. The first and last images
// are pinned to either side of the element, and whitespace is distributed evenly between the images. // are pinned to either side of the element, and whitespace is distributed evenly between the images.
RepeatSpace = 5 RepeatSpace = 5
// ScrollAttachment is value of the Attachment property of an background image: // ScrollAttachment is value of the Attachment property of an background image:
//
// The background is fixed relative to the element itself and does not scroll with its contents. // The background is fixed relative to the element itself and does not scroll with its contents.
// (It is effectively attached to the element's border.) // (It is effectively attached to the element's border.)
ScrollAttachment = 0 ScrollAttachment = 0
// FixedAttachment is value of the Attachment property of an background image: // FixedAttachment is value of the Attachment property of an background image:
//
// The background is fixed relative to the viewport. Even if an element has // The background is fixed relative to the viewport. Even if an element has
// a scrolling mechanism, the background doesn't move with the element. // a scrolling mechanism, the background doesn't move with the element.
FixedAttachment = 1 FixedAttachment = 1
// LocalAttachment is value of the Attachment property of an background image: // LocalAttachment is value of the Attachment property of an background image:
//
// The background is fixed relative to the element's contents. If the element has a scrolling mechanism, // The background is fixed relative to the element's contents. If the element has a scrolling mechanism,
// the background scrolls with the element's contents, and the background painting area // the background scrolls with the element's contents, and the background painting area
// and background positioning area are relative to the scrollable area of the element // and background positioning area are relative to the scrollable area of the element
@ -63,6 +72,16 @@ type backgroundImage struct {
} }
// NewBackgroundImage creates the new background image // NewBackgroundImage creates the new background image
//
// The following properties can be used:
// - "src" [Source] - the name of the image in the "images" folder of the resources, or the URL of the image or inline-image.
// - "width" [Width] - the width of the image.
// - "height" [Height] - the height of the image.
// - "image-horizontal-align" [ImageHorizontalAlign] - the horizontal alignment of the image relative to view's bounds.
// - "image-vertical-align" [ImageVerticalAlign] - the vertical alignment of the image relative to view's bounds.
// - "repeat" [Repeat] - the repetition of the image.
// - "fit" [Fit] - the image scaling parameters.
// - "attachment" [Attachment] - defines whether a background image's position is fixed within the viewport or scrolls with its containing block.
func NewBackgroundImage(params Params) BackgroundElement { func NewBackgroundImage(params Params) BackgroundElement {
result := new(backgroundImage) result := new(backgroundImage)
result.init() result.init()

View File

@ -37,7 +37,7 @@ type BackgroundGradientPoint struct {
// Can take a value of Color type or string (color constant or textual description of the color) // Can take a value of Color type or string (color constant or textual description of the color)
Color any Color any
// Pos - the distance from the start of the gradient straight line. Optional (may be nil). // Pos - the distance from the start of the gradient straight line. Optional (may be nil).
// Can take a value of SizeUnit type or string (angle constant or textual description of the SizeUnit) // Can take a value of SizeUnit type or string (size constant or textual description of the SizeUnit)
Pos any Pos any
} }
@ -50,13 +50,11 @@ type backgroundLinearGradient struct {
} }
// NewBackgroundLinearGradient creates the new background linear gradient. // NewBackgroundLinearGradient creates the new background linear gradient.
//
// The following properties can be used: // The following properties can be used:
// // - "gradient" [Gradient] - Describes gradient stop points. This is a mandatory property while describing background gradients.
// "gradient" (Gradient) - Describes gradient stop points. This is a mandatory property while describing background gradients. // - "direction" [Direction] - Defines the direction of the gradient line.
// // - "repeating" [Repeating] - Defines whether stop points needs to be repeated after the last one.
// "direction" (Direction) - Defines the direction of the gradient line.
//
// "repeating" (Repeating) - Defines whether stop points needs to be repeated after the last one.
func NewBackgroundLinearGradient(params Params) BackgroundElement { func NewBackgroundLinearGradient(params Params) BackgroundElement {
result := new(backgroundLinearGradient) result := new(backgroundLinearGradient)
result.init() result.init()

View File

@ -40,17 +40,13 @@ type backgroundRadialGradient struct {
} }
// NewBackgroundRadialGradient creates the new background radial gradient. // NewBackgroundRadialGradient creates the new background radial gradient.
//
// The following properties can be used: // The following properties can be used:
// // - "gradient" (Gradient) - Describes gradient stop points. This is a mandatory property while describing background gradients.
// "gradient" (Gradient) - Describes gradient stop points. This is a mandatory property while describing background gradients. // - "center-x" (CenterX), "center-y" (CenterY) - Defines the gradient center point cooordinates.
// // - "radial-gradient-radius" (RadialGradientRadius) - Defines radius of the radial gradient.
// "center-x" (CenterX), "center-y" (CenterY) - Defines the gradient center point cooordinates. // - "radial-gradient-shape" (RadialGradientShape) - Defines shape of the radial gradient.
// // - "repeating" (Repeating) - Defines whether stop points needs to be repeated after the last one.
// "radial-gradient-radius" (RadialGradientRadius) - Defines radius of the radial gradient.
//
// "radial-gradient-shape" (RadialGradientShape) - Defines shape of the radial gradient.
//
// "repeating" (Repeating) - Defines whether stop points needs to be repeated after the last one.
func NewBackgroundRadialGradient(params Params) BackgroundElement { func NewBackgroundRadialGradient(params Params) BackgroundElement {
result := new(backgroundRadialGradient) result := new(backgroundRadialGradient)
result.init() result.init()

120
border.go
View File

@ -27,150 +27,150 @@ const (
// LeftStyle is the constant for "left-style" property tag. // LeftStyle is the constant for "left-style" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Left border line style. // Left border line style.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn. // - 0 (NoneLine) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border. // - 1 (SolidLine) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border. // - 2 (DashedLine) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border. // - 3 (DottedLine) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border. // - 4 (DoubleLine) or "double" - Double line as a border.
LeftStyle PropertyName = "left-style" LeftStyle PropertyName = "left-style"
// RightStyle is the constant for "right-style" property tag. // RightStyle is the constant for "right-style" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Right border line style. // Right border line style.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn. // - 0 (NoneLine) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border. // - 1 (SolidLine) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border. // - 2 (DashedLine) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border. // - 3 (DottedLine) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border. // - 4 (DoubleLine) or "double" - Double line as a border.
RightStyle PropertyName = "right-style" RightStyle PropertyName = "right-style"
// TopStyle is the constant for "top-style" property tag. // TopStyle is the constant for "top-style" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Top border line style. // Top border line style.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn. // - 0 (NoneLine) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border. // - 1 (SolidLine) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border. // - 2 (DashedLine) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border. // - 3 (DottedLine) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border. // - 4 (DoubleLine) or "double" - Double line as a border.
TopStyle PropertyName = "top-style" TopStyle PropertyName = "top-style"
// BottomStyle is the constant for "bottom-style" property tag. // BottomStyle is the constant for "bottom-style" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Bottom border line style. // Bottom border line style.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn. // - 0 (NoneLine) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border. // - 1 (SolidLine) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border. // - 2 (DashedLine) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border. // - 3 (DottedLine) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border. // - 4 (DoubleLine) or "double" - Double line as a border.
BottomStyle PropertyName = "bottom-style" BottomStyle PropertyName = "bottom-style"
// LeftWidth is the constant for "left-width" property tag. // LeftWidth is the constant for "left-width" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Left border line width. // Left border line width.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See [SizeUnit] description for more details.
LeftWidth PropertyName = "left-width" LeftWidth PropertyName = "left-width"
// RightWidth is the constant for "right-width" property tag. // RightWidth is the constant for "right-width" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Right border line width. // Right border line width.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See [SizeUnit] description for more details.
RightWidth PropertyName = "right-width" RightWidth PropertyName = "right-width"
// TopWidth is the constant for "top-width" property tag. // TopWidth is the constant for "top-width" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Top border line width. // Top border line width.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See [SizeUnit] description for more details.
TopWidth PropertyName = "top-width" TopWidth PropertyName = "top-width"
// BottomWidth is the constant for "bottom-width" property tag. // BottomWidth is the constant for "bottom-width" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Bottom border line width. // Bottom border line width.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See [SizeUnit] description for more details.
BottomWidth PropertyName = "bottom-width" BottomWidth PropertyName = "bottom-width"
// LeftColor is the constant for "left-color" property tag. // LeftColor is the constant for "left-color" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Left border line color. // Left border line color.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See [Color] description for more details.
LeftColor PropertyName = "left-color" LeftColor PropertyName = "left-color"
// RightColor is the constant for "right-color" property tag. // RightColor is the constant for "right-color" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Right border line color. // Right border line color.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See [Color] description for more details.
RightColor PropertyName = "right-color" RightColor PropertyName = "right-color"
// TopColor is the constant for "top-color" property tag. // TopColor is the constant for "top-color" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Top border line color. // Top border line color.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See [Color] description for more details.
TopColor PropertyName = "top-color" TopColor PropertyName = "top-color"
// BottomColor is the constant for "bottom-color" property tag. // BottomColor is the constant for "bottom-color" property tag.
// //
// Used by `BorderProperty`. // Used by BorderProperty.
// Bottom border line color. // Bottom border line color.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See [Color] description for more details.
BottomColor PropertyName = "bottom-color" BottomColor PropertyName = "bottom-color"
) )

View File

@ -20,6 +20,7 @@ type boundsPropertyData struct {
} }
// NewBoundsProperty creates the new BoundsProperty object. // NewBoundsProperty creates the new BoundsProperty object.
//
// The following SizeUnit properties can be used: "left" (Left), "right" (Right), "top" (Top), and "bottom" (Bottom). // The following SizeUnit properties can be used: "left" (Left), "right" (Right), "top" (Top), and "bottom" (Bottom).
func NewBoundsProperty(params Params) BoundsProperty { func NewBoundsProperty(params Params) BoundsProperty {
bounds := new(boundsPropertyData) bounds := new(boundsPropertyData)
@ -36,7 +37,9 @@ func NewBoundsProperty(params Params) BoundsProperty {
} }
// NewBounds creates the new BoundsProperty object. // NewBounds creates the new BoundsProperty object.
//
// The arguments specify the boundaries in a clockwise direction: "top", "right", "bottom", and "left". // The arguments specify the boundaries in a clockwise direction: "top", "right", "bottom", and "left".
//
// If the argument is specified as int or float64, the value is considered to be in pixels. // If the argument is specified as int or float64, the value is considered to be in pixels.
func NewBounds[topType SizeUnit | int | float64, rightType SizeUnit | int | float64, bottomType SizeUnit | int | float64, leftType SizeUnit | int | float64]( func NewBounds[topType SizeUnit | int | float64, rightType SizeUnit | int | float64, bottomType SizeUnit | int | float64, leftType SizeUnit | int | float64](
top topType, right rightType, bottom bottomType, left leftType) BoundsProperty { top topType, right rightType, bottom bottomType, left leftType) BoundsProperty {

106
canvas.go
View File

@ -129,15 +129,15 @@ type Canvas interface {
ClipPath(path Path) ClipPath(path Path)
// SetScale adds a scaling transformation to the canvas units horizontally and/or vertically. // SetScale adds a scaling transformation to the canvas units horizontally and/or vertically.
// x - scaling factor in the horizontal direction. A negative value flips pixels across // * x - scaling factor in the horizontal direction. A negative value flips pixels across
// the vertical axis. A value of 1 results in no horizontal scaling; // the vertical axis. A value of 1 results in no horizontal scaling;
// y - scaling factor in the vertical direction. A negative value flips pixels across // * y - scaling factor in the vertical direction. A negative value flips pixels across
// the horizontal axis. A value of 1 results in no vertical scaling. // the horizontal axis. A value of 1 results in no vertical scaling.
SetScale(x, y float64) SetScale(x, y float64)
// SetTranslation adds a translation transformation to the current matrix. // SetTranslation adds a translation transformation to the current matrix.
// x - distance to move in the horizontal direction. Positive values are to the right, and negative to the left; // * x - distance to move in the horizontal direction. Positive values are to the right, and negative to the left;
// y - distance to move in the vertical direction. Positive values are down, and negative are up. // * y - distance to move in the vertical direction. Positive values are down, and negative are up.
SetTranslation(x, y float64) SetTranslation(x, y float64)
// SetRotation adds a rotation to the transformation matrix. // SetRotation adds a rotation to the transformation matrix.
@ -147,12 +147,13 @@ type Canvas interface {
// SetTransformation multiplies the current transformation with the matrix described by the arguments // SetTransformation multiplies the current transformation with the matrix described by the arguments
// of this method. This lets you scale, rotate, translate (move), and skew the context. // of this method. This lets you scale, rotate, translate (move), and skew the context.
// The transformation matrix is described by: // The transformation matrix is described by:
// ⎡ xScale xSkew dx ⎤ // ⎡ xScale xSkew dx ⎤
// ⎢ ySkew yScale dy ⎥ // ⎢ ySkew yScale dy ⎥
// ⎣ 0 0 1 ⎦ // ⎣ 0 0 1 ⎦
// xScale, yScale - horizontal and vertical scaling. A value of 1 results in no scaling; // where
// xSkew, ySkew - horizontal and vertical skewing; // * xScale, yScale - horizontal and vertical scaling. A value of 1 results in no scaling;
// dx, dy - horizontal and vertical translation (moving). // * xSkew, ySkew - horizontal and vertical skewing;
// * dx, dy - horizontal and vertical translation (moving).
SetTransformation(xScale, yScale, xSkew, ySkew, dx, dy float64) SetTransformation(xScale, yScale, xSkew, ySkew, dx, dy float64)
// ResetTransformation resets the current transform to the identity matrix // ResetTransformation resets the current transform to the identity matrix
@ -165,63 +166,64 @@ type Canvas interface {
SetSolidColorStrokeStyle(color Color) SetSolidColorStrokeStyle(color Color)
// SetLinearGradientFillStyle sets a gradient along the line connecting two given coordinates to use inside shapes // SetLinearGradientFillStyle sets a gradient along the line connecting two given coordinates to use inside shapes
// x0, y0 - coordinates of the start point; // * x0, y0 - coordinates of the start point;
// x1, y1 - coordinates of the end point; // * x1, y1 - coordinates of the end point;
// startColor, endColor - the start and end color // * startColor, endColor - the start and end color
// stopPoints - the array of stop points // * stopPoints - the array of stop points
SetLinearGradientFillStyle(x0, y0 float64, color0 Color, x1, y1 float64, color1 Color, stopPoints []GradientPoint) SetLinearGradientFillStyle(x0, y0 float64, color0 Color, x1, y1 float64, color1 Color, stopPoints []GradientPoint)
// SetLinearGradientStrokeStyle sets a gradient along the line connecting two given coordinates to use for the strokes (outlines) around shapes // SetLinearGradientStrokeStyle sets a gradient along the line connecting two given coordinates to use for the strokes (outlines) around shapes
// x0, y0 - coordinates of the start point; // * x0, y0 - coordinates of the start point;
// x1, y1 - coordinates of the end point; // * x1, y1 - coordinates of the end point;
// color0, color1 - the start and end color // * color0, color1 - the start and end color
// stopPoints - the array of stop points // * stopPoints - the array of stop points
SetLinearGradientStrokeStyle(x0, y0 float64, color0 Color, x1, y1 float64, color1 Color, stopPoints []GradientPoint) SetLinearGradientStrokeStyle(x0, y0 float64, color0 Color, x1, y1 float64, color1 Color, stopPoints []GradientPoint)
// SetRadialGradientFillStyle sets a radial gradient using the size and coordinates of two circles // SetRadialGradientFillStyle sets a radial gradient using the size and coordinates of two circles
// to use inside shapes // to use inside shapes
// x0, y0 - coordinates of the center of the start circle; // * x0, y0 - coordinates of the center of the start circle;
// r0 - the radius of the start circle; // * r0 - the radius of the start circle;
// x1, y1 - coordinates the center of the end circle; // * x1, y1 - coordinates the center of the end circle;
// r1 - the radius of the end circle; // * r1 - the radius of the end circle;
// color0, color1 - the start and end color // * color0, color1 - the start and end color
// stopPoints - the array of stop points // * stopPoints - the array of stop points
SetRadialGradientFillStyle(x0, y0, r0 float64, color0 Color, x1, y1, r1 float64, color1 Color, stopPoints []GradientPoint) SetRadialGradientFillStyle(x0, y0, r0 float64, color0 Color, x1, y1, r1 float64, color1 Color, stopPoints []GradientPoint)
// SetRadialGradientStrokeStyle sets a radial gradient using the size and coordinates of two circles // SetRadialGradientStrokeStyle sets a radial gradient using the size and coordinates of two circles
// to use for the strokes (outlines) around shapes // to use for the strokes (outlines) around shapes
// x0, y0 - coordinates of the center of the start circle; // * x0, y0 - coordinates of the center of the start circle;
// r0 - the radius of the start circle; // * r0 - the radius of the start circle;
// x1, y1 - coordinates the center of the end circle; // * x1, y1 - coordinates the center of the end circle;
// r1 - the radius of the end circle; // * r1 - the radius of the end circle;
// color0, color1 - the start and end color // * color0, color1 - the start and end color
// stopPoints - the array of stop points // * stopPoints - the array of stop points
SetRadialGradientStrokeStyle(x0, y0, r0 float64, color0 Color, x1, y1, r1 float64, color1 Color, stopPoints []GradientPoint) SetRadialGradientStrokeStyle(x0, y0, r0 float64, color0 Color, x1, y1, r1 float64, color1 Color, stopPoints []GradientPoint)
// SetConicGradientFillStyle sets a conic gradient around a point // SetConicGradientFillStyle sets a conic gradient around a point
// to use inside shapes // to use inside shapes
// x, y - coordinates of the center of the conic gradient in pilels; // * x, y - coordinates of the center of the conic gradient in pilels;
// startAngle - the angle at which to begin the gradient, in radians. The angle starts from a line going horizontally right from the center, and proceeds clockwise. // * startAngle - the angle at which to begin the gradient, in radians. The angle starts from a line going horizontally right from the center, and proceeds clockwise.
// startColor - the start color; // * startColor - the start color;
// endColor - the end color; // * endColor - the end color;
// stopPoints - the array of stop points. The Pos field of GradientPoint, in the range from 0 to 1, specifies the angle in turns. // * stopPoints - the array of stop points. The Pos field of GradientPoint, in the range from 0 to 1, specifies the angle in turns.
SetConicGradientFillStyle(x, y, startAngle float64, startColor, endColor Color, stopPoints []GradientPoint) SetConicGradientFillStyle(x, y, startAngle float64, startColor, endColor Color, stopPoints []GradientPoint)
// SetConicGradientFillStyle sets a conic gradient around a point // SetConicGradientFillStyle sets a conic gradient around a point
// to use inside shapes // to use inside shapes
// x, y - coordinates of the center of the conic gradient in pilels; // * x, y - coordinates of the center of the conic gradient in pilels;
// startAngle - the angle at which to begin the gradient, in radians. The angle starts from a line going horizontally right from the center, and proceeds clockwise. // * startAngle - the angle at which to begin the gradient, in radians. The angle starts from a line going horizontally right from the center, and proceeds clockwise.
// startColor - the start color; // * startColor - the start color;
// endColor - the end color; // * endColor - the end color;
// stopPoints - the array of stop points. The Pos field of GradientPoint, in the range from 0 to 1, specifies the angle in turns. // * stopPoints - the array of stop points. The Pos field of GradientPoint, in the range from 0 to 1, specifies the angle in turns.
SetConicGradientStrokeStyle(x, y, startAngle float64, startColor, endColor Color, stopPoints []GradientPoint) SetConicGradientStrokeStyle(x, y, startAngle float64, startColor, endColor Color, stopPoints []GradientPoint)
// SetImageFillStyle set the image as the filling pattern. // SetImageFillStyle set the image as the filling pattern.
// repeat - indicating how to repeat the pattern's image. Possible values are: //
// NoRepeat (0) - neither direction, // repeat - indicating how to repeat the pattern's image. Possible values are:
// RepeatXY (1) - both directions, // * NoRepeat (0) - neither direction,
// RepeatX (2) - horizontal only, // * RepeatXY (1) - both directions,
// RepeatY (3) - vertical only. // * RepeatX (2) - horizontal only,
// * RepeatY (3) - vertical only.
SetImageFillStyle(image Image, repeat int) SetImageFillStyle(image Image, repeat int)
// SetLineWidth the line width, in coordinate space units. Zero, negative, Infinity, and NaN values are ignored. // SetLineWidth the line width, in coordinate space units. Zero, negative, Infinity, and NaN values are ignored.
@ -258,9 +260,9 @@ type Canvas interface {
SetTextAlign(align int) SetTextAlign(align int)
// SetShadow sets shadow parameters: // SetShadow sets shadow parameters:
// offsetX, offsetY - the distance that shadows will be offset horizontally and vertically; // * offsetX, offsetY - the distance that shadows will be offset horizontally and vertically;
// blur - the amount of blur applied to shadows. Must be non-negative; // * blur - the amount of blur applied to shadows. Must be non-negative;
// color - the color of shadows. // * color - the color of shadows.
SetShadow(offsetX, offsetY, blur float64, color Color) SetShadow(offsetX, offsetY, blur float64, color Color)
// ResetShadow sets shadow parameters to default values (invisible shadow) // ResetShadow sets shadow parameters to default values (invisible shadow)
@ -292,10 +294,10 @@ type Canvas interface {
FillAndStrokeRoundedRect(x, y, width, height, r float64) FillAndStrokeRoundedRect(x, y, width, height, r float64)
// FillEllipse draws a ellipse that is filled according to the current FillStyle. // FillEllipse draws a ellipse that is filled according to the current FillStyle.
// x, y - coordinates of the ellipse's center; // * x, y - coordinates of the ellipse's center;
// radiusX - the ellipse's major-axis radius. Must be non-negative; // * radiusX - the ellipse's major-axis radius. Must be non-negative;
// radiusY - the ellipse's minor-axis radius. Must be non-negative; // * radiusY - the ellipse's minor-axis radius. Must be non-negative;
// rotation - the rotation of the ellipse, expressed in radians. // * rotation - the rotation of the ellipse, expressed in radians.
FillEllipse(x, y, radiusX, radiusY, rotation float64) FillEllipse(x, y, radiusX, radiusY, rotation float64)
// StrokeRoundedRect draws a ellipse that is stroked (outlined) according // StrokeRoundedRect draws a ellipse that is stroked (outlined) according

View File

@ -10,16 +10,18 @@ import (
// Event occurs when the checkbox becomes checked/unchecked. // Event occurs when the checkbox becomes checked/unchecked.
// //
// General listener format: // General listener format:
// `func(checkbox rui.Checkbox, checked bool)`. //
// func(checkbox rui.Checkbox, checked bool)
// //
// where: // where:
// checkbox - Interface of a checkbox which generated this event, // - checkbox - Interface of a checkbox which generated this event,
// checked - Checkbox state. // - checked - Checkbox state.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(checkbox rui.Checkbox)`, //
// `func(checked bool)`, // func(checkbox rui.Checkbox)
// `func()`. // func(checked bool)
// func()
const CheckboxChangedEvent PropertyName = "checkbox-event" const CheckboxChangedEvent PropertyName = "checkbox-event"
// Checkbox represent a Checkbox view // Checkbox represent a Checkbox view

View File

@ -19,6 +19,14 @@ func ARGB[T int | uint | int8 | uint8](alpha, red, green, blue T) Color {
(Color(blue) & 0xFF) (Color(blue) & 0xFF)
} }
// RGB creates Color using red, green and blue components
func RGB[T int | uint | int8 | uint8](red, green, blue T) Color {
return (Color(0xFF) << 24) +
((Color(red) & 0xFF) << 16) +
((Color(green) & 0xFF) << 8) +
(Color(blue) & 0xFF)
}
// ARGB - return alpha, red, green and blue components of the color // ARGB - return alpha, red, green and blue components of the color
func (color Color) ARGB() (uint8, uint8, uint8, uint8) { func (color Color) ARGB() (uint8, uint8, uint8, uint8) {
return uint8(color >> 24), return uint8(color >> 24),

View File

@ -12,19 +12,19 @@ const (
// Event generated when color picker value has been changed. // Event generated when color picker value has been changed.
// //
// General listener format: // General listener format:
// `func(picker rui.ColorPicker, newColor, oldColor rui.Color)`. // func(picker rui.ColorPicker, newColor, oldColor rui.Color)
// //
// where: // where:
// picker - Interface of a color picker which generated this event, // - picker - Interface of a color picker which generated this event,
// newColor - New color value, // - newColor - New color value,
// oldColor - Old color value. // - oldColor - Old color value.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(picker rui.ColorPicker, newColor rui.Color)`, // func(picker rui.ColorPicker, newColor rui.Color)
// `func(newColor, oldColor rui.Color)`, // func(newColor, oldColor rui.Color)
// `func(newColor rui.Color)`, // func(newColor rui.Color)
// `func(picker rui.ColorPicker)`, // func(picker rui.ColorPicker)
// `func()`. // func()
ColorChangedEvent PropertyName = "color-changed" ColorChangedEvent PropertyName = "color-changed"
// ColorPickerValue is the constant for "color-picker-value" property tag. // ColorPickerValue is the constant for "color-picker-value" property tag.

View File

@ -8,110 +8,110 @@ import (
const ( const (
// ColumnCount is the constant for "column-count" property tag. // ColumnCount is the constant for "column-count" property tag.
// //
// Used by `ColumnLayout`. // Used by ColumnLayout.
// Specifies number of columns into which the content is break. Values less than zero are not valid. If this property // Specifies number of columns into which the content is break. Values less than zero are not valid. If this property
// value is 0 then the number of columns is calculated based on the "column-width" property. // value is 0 then the number of columns is calculated based on the "column-width" property.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0` or "0" - Use "column-width" to control how many columns will be created. // - 0 or "0" - Use "column-width" to control how many columns will be created.
// >= `0` or >= "0" - Тhe number of columns into which the content is divided. // - positive value - Тhe number of columns into which the content is divided.
ColumnCount PropertyName = "column-count" ColumnCount PropertyName = "column-count"
// ColumnWidth is the constant for "column-width" property tag. // ColumnWidth is the constant for "column-width" property tag.
// //
// Used by `ColumnLayout`. // Used by ColumnLayout.
// Specifies the width of each column. // Specifies the width of each column.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See [SizeUnit] description for more details.
ColumnWidth PropertyName = "column-width" ColumnWidth PropertyName = "column-width"
// ColumnGap is the constant for "column-gap" property tag. // ColumnGap is the constant for "column-gap" property tag.
// //
// Used by `ColumnLayout`. // Used by ColumnLayout.
// Set the size of the gap (gutter) between columns. // Set the size of the gap (gutter) between columns.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See [SizeUnit] description for more details.
ColumnGap PropertyName = "column-gap" ColumnGap PropertyName = "column-gap"
// ColumnSeparator is the constant for "column-separator" property tag. // ColumnSeparator is the constant for "column-separator" property tag.
// //
// Used by `ColumnLayout`. // Used by ColumnLayout.
// Specifies the line drawn between columns in a multi-column layout. // Specifies the line drawn between columns in a multi-column layout.
// //
// Supported types: `ColumnSeparatorProperty`, `ViewBorder`. // Supported types: ColumnSeparatorProperty, ViewBorder.
// //
// Internal type is `ColumnSeparatorProperty`, other types converted to it during assignment. // Internal type is ColumnSeparatorProperty, other types converted to it during assignment.
// See `ColumnSeparatorProperty` and `ViewBorder` description for more details. // See [ColumnSeparatorProperty] and [ViewBorder] description for more details.
ColumnSeparator PropertyName = "column-separator" ColumnSeparator PropertyName = "column-separator"
// ColumnSeparatorStyle is the constant for "column-separator-style" property tag. // ColumnSeparatorStyle is the constant for "column-separator-style" property tag.
// //
// Used by `ColumnLayout`. // Used by ColumnLayout.
// Controls the style of the line drawn between columns in a multi-column layout. // Controls the style of the line drawn between columns in a multi-column layout.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneLine`) or "none" - The separator will not be drawn. // - 0 (NoneLine) or "none" - The separator will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a separator. // - 1 (SolidLine) or "solid" - Solid line as a separator.
// `2`(`DashedLine`) or "dashed" - Dashed line as a separator. // - 2 (DashedLine) or "dashed" - Dashed line as a separator.
// `3`(`DottedLine`) or "dotted" - Dotted line as a separator. // - 3 (DottedLine) or "dotted" - Dotted line as a separator.
// `4`(`DoubleLine`) or "double" - Double line as a separator. // - 4 (DoubleLine) or "double" - Double line as a separator.
ColumnSeparatorStyle PropertyName = "column-separator-style" ColumnSeparatorStyle PropertyName = "column-separator-style"
// ColumnSeparatorWidth is the constant for "column-separator-width" property tag. // ColumnSeparatorWidth is the constant for "column-separator-width" property tag.
// //
// Used by `ColumnLayout`. // Used by ColumnLayout.
// Set the width of the line drawn between columns in a multi-column layout. // Set the width of the line drawn between columns in a multi-column layout.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
ColumnSeparatorWidth PropertyName = "column-separator-width" ColumnSeparatorWidth PropertyName = "column-separator-width"
// ColumnSeparatorColor is the constant for "column-separator-color" property tag. // ColumnSeparatorColor is the constant for "column-separator-color" property tag.
// //
// Used by `ColumnLayout`. // Used by ColumnLayout.
// Set the color of the line drawn between columns in a multi-column layout. // Set the color of the line drawn between columns in a multi-column layout.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See Color description for more details.
ColumnSeparatorColor PropertyName = "column-separator-color" ColumnSeparatorColor PropertyName = "column-separator-color"
// ColumnFill is the constant for "column-fill" property tag. // ColumnFill is the constant for "column-fill" property tag.
// //
// Used by `ColumnLayout`. // Used by ColumnLayout.
// Controls how a `ColumnLayout`'s content is balanced when broken into columns. Default value is "balance". // Controls how a ColumnLayout's content is balanced when broken into columns. Default value is "balance".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`ColumnFillBalance`) or "balance" - Content is equally divided between columns. // - 0 (ColumnFillBalance) or "balance" - Content is equally divided between columns.
// `1`(`ColumnFillAuto`) or "auto" - Columns are filled sequentially. Content takes up only the room it needs, possibly resulting in some columns remaining empty. // - 1 (ColumnFillAuto) or "auto" - Columns are filled sequentially. Content takes up only the room it needs, possibly resulting in some columns remaining empty.
ColumnFill PropertyName = "column-fill" ColumnFill PropertyName = "column-fill"
// ColumnSpanAll is the constant for "column-span-all" property tag. // ColumnSpanAll is the constant for "column-span-all" property tag.
// //
// Used by `ColumnLayout`. // Used by ColumnLayout.
// Property used in views placed inside the column layout container. Makes it possible for a view to span across all // Property used in views placed inside the column layout container. Makes it possible for a view to span across all
// columns. Default value is `false`. // columns. Default value is false.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - View will span across all columns. // - true, 1, "true", "yes", "on", or "1" - View will span across all columns.
// `false` or `0` or "false", "no", "off", "0" - View will be a part of a column. // - false, 0, "false", "no", "off", or "0" - View will be a part of a column.
ColumnSpanAll PropertyName = "column-span-all" ColumnSpanAll PropertyName = "column-span-all"
) )

View File

@ -58,15 +58,13 @@ func newColumnSeparatorProperty(value any) ColumnSeparatorProperty {
return nil return nil
} }
// NewColumnSeparator creates the new ColumnSeparatorProperty. // NewColumnSeparatorProperty creates the new ColumnSeparatorProperty.
//
// The following properties can be used: // The following properties can be used:
// // - "style" (Style) - Determines the line style (type is int). Valid values: 0 (NoneLine), 1 (SolidLine), 2 (DashedLine), 3 (DottedLine), or 4 (DoubleLine);
// "style" (Style). Determines the line style (int). Valid values: 0 (NoneLine), 1 (SolidLine), 2 (DashedLine), 3 (DottedLine), or 4 (DoubleLine); // - "color" (ColorTag) - Determines the line color (type is [Color]);
// // - "width" (Width) - Determines the line thickness (type is [SizeUnit]).
// "color" (ColorTag). Determines the line color (Color); func NewColumnSeparatorProperty(params Params) ColumnSeparatorProperty {
//
// "width" (Width). Determines the line thickness (SizeUnit).
func NewColumnSeparator(params Params) ColumnSeparatorProperty {
separator := new(columnSeparatorProperty) separator := new(columnSeparatorProperty)
separator.init() separator.init()
if params != nil { if params != nil {
@ -79,6 +77,20 @@ func NewColumnSeparator(params Params) ColumnSeparatorProperty {
return separator return separator
} }
// NewColumnSeparator creates the new ColumnSeparatorProperty.
//
// Arguments:
// - style - determines the line style. Valid values: 0 [NoneLine], 1 [SolidLine], 2 [DashedLine], 3 [DottedLine], or 4 [DoubleLine];
// - color - determines the line color;
// - width - determines the line thickness.
func NewColumnSeparator(style int, color Color, width SizeUnit) ColumnSeparatorProperty {
return NewColumnSeparatorProperty(Params{
Width: width,
Style: style,
ColorTag: color,
})
}
func (separator *columnSeparatorProperty) init() { func (separator *columnSeparatorProperty) init() {
separator.dataProperty.init() separator.dataProperty.init()
separator.normalize = normalizeVolumnSeparatorTag separator.normalize = normalizeVolumnSeparatorTag

View File

@ -10,99 +10,88 @@ import (
const ( const (
// DataList is the constant for "data-list" property tag. // DataList is the constant for "data-list" property tag.
// //
// Used by `ColorPicker`, `DatePicker`, `EditView`, `NumberPicker`, `TimePicker`. // Used by ColorPicker, DatePicker, EditView, NumberPicker, TimePicker.
//
// # Usage in ColorPicker
// //
// Usage in `ColorPicker`:
// List of pre-defined colors. // List of pre-defined colors.
// //
// Supported types: `[]string`, `string`, `[]fmt.Stringer`, `[]Color`, `[]SizeUnit`, `[]AngleUnit`, `[]any` containing // Supported types: []string, string, []fmt.Stringer, []Color, []any containing
// elements of `string`, `fmt.Stringer`, `bool`, `rune`, `float32`, `float64`, `int`, `int8` … `int64`, `uint`, `uint8` … // elements of string, fmt.Stringer, int, int8…int64, uint, uint8…uint64.
// `uint64`.
// //
// Internal type is `[]string`, other types converted to it during assignment. // Internal type is []string, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - contain single item. // - string - contain single item.
// `[]string` - an array of items. // - []string - an array of items.
// `[]fmt.Stringer` - an array of objects convertible to a string. // - []fmt.Stringer - an array of objects convertible to a string.
// `[]Color` - An array of color values which will be converted to a string array. // - []Color - An array of color values which will be converted to a string array.
// `[]SizeUnit` - an array of size unit values which will be converted to a string array. // - []any - this array must contain only types which were listed in Types section.
// `[]any` - this array must contain only types which were listed in Types section. //
// # Usage in DatePicker
// //
// Usage in `DatePicker`:
// List of predefined dates. If we set this property, date picker may have a drop-down menu with a list of these values. // List of predefined dates. If we set this property, date picker may have a drop-down menu with a list of these values.
// Some browsers may ignore this property, such as Safari for macOS. The value of this property must be an array of // Some browsers may ignore this property, such as Safari for macOS. The value of this property must be an array of
// strings in the format "YYYY-MM-DD". // strings in the format "YYYY-MM-DD".
// //
// Supported types: `[]string`, `string`, `[]fmt.Stringer`, `[]Color`, `[]SizeUnit`, `[]AngleUnit`, `[]any` containing // Supported types: []string, string, []fmt.Stringer, []time.Time, []any containing elements of string, fmt.Stringer, time.Time.
// elements of `string`, `fmt.Stringer`, `bool`, `rune`, `float32`, `float64`, `int`, `int8` … `int64`, `uint`, `uint8` …
// `uint64`.
// //
// Internal type is `[]string`, other types converted to it during assignment. // Internal type is []string, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - contain single item. // - string - contain single item.
// `[]string` - an array of items. // - []string - an array of items.
// `[]fmt.Stringer` - an array of objects convertible to a string. // - []fmt.Stringer - an array of objects convertible to a string.
// `[]Color` - An array of color values which will be converted to a string array. // - []time.Time - an array of Time values which will be converted to a string array.
// `[]SizeUnit` - an array of size unit values which will be converted to a string array. // - []any - this array must contain only types which were listed in Types section.
// `[]any` - this array must contain only types which were listed in Types section. //
// # Usage in EditView
// //
// Usage in `EditView`:
// Array of recommended values. // Array of recommended values.
// //
// Supported types: `[]string`, `string`, `[]fmt.Stringer`, `[]Color`, `[]SizeUnit`, `[]AngleUnit`, `[]any` containing // Supported types: []string, string, []fmt.Stringer, and []any containing
// elements of `string`, `fmt.Stringer`, `bool`, `rune`, `float32`, `float64`, `int`, `int8` … `int64`, `uint`, `uint8` … // elements of string, fmt.Stringer, bool, rune, float32, float64, int, int8…int64, uint, uint8…uint64.
// `uint64`.
// //
// Internal type is `[]string`, other types converted to it during assignment. // Internal type is []string, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - contain single item. // - string - contain single item.
// `[]string` - an array of items. // - []string - an array of items.
// `[]fmt.Stringer` - an array of objects convertible to a string. // - []fmt.Stringer - an array of objects convertible to a string.
// `[]Color` - An array of color values which will be converted to a string array. // - []any - this array must contain only types which were listed in Types section.
// `[]SizeUnit` - an array of size unit values which will be converted to a string array. //
// `[]any` - this array must contain only types which were listed in Types section. // # Usage in NumberPicker
// //
// Usage in `NumberPicker`:
// Specify an array of recommended values. // Specify an array of recommended values.
// //
// Supported types: `[]string`, `string`, `[]fmt.Stringer`, `[]Color`, `[]SizeUnit`, `[]AngleUnit`, `[]float`, `[]int`, // Supported types: []string, string, []fmt.Stringer, []float, []int, []bool, []any containing elements
// `[]bool`, `[]any` containing elements of `string`, `fmt.Stringer`, `bool`, `rune`, `float32`, `float64`, `int`, `int8` // of string, fmt.Stringer, rune, float32, float64, int, int8…int64, uint, uint8…uint64.
// … `int64`, `uint`, `uint8` … `uint64`.
// //
// Internal type is `[]string`, other types converted to it during assignment. // Internal type is []string, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - must contain integer or floating point number, converted to `[]string`. // - string - must contain integer or floating point number, converted to []string.
// `[]string` - an array of strings which must contain integer or floating point numbers, stored as is. // - []string - an array of strings which must contain integer or floating point numbers, stored as is.
// `[]fmt.Stringer` - object which implement this interface must contain integer or floating point numbers, converted to a `[]string`. // - []fmt.Stringer - object which implement this interface must contain integer or floating point numbers, converted to a []string.
// `[]Color` - an array of color values, converted to `[]string`. // - []float - converted to []string.
// `[]SizeUnit` - an array of size unit, converted to `[]string`. // - []int - converted to []string.
// `[]AngleUnit` - an array of angle unit, converted to `[]string`. // - []any - an array which may contain types listed in Types section above, each value will be converted to a string and wrapped to array.
// `[]float` - converted to `[]string`. //
// `[]int` - converted to `[]string`. // # Usage in TimePicker
// `[]bool` - converted to `[]string`.
// `[]any` - an array which may contain types listed in Types section above, each value will be converted to a `string` and wrapped to array.
// //
// Usage in `TimePicker`:
// An array of recommended values. The value of this property must be an array of strings in the format "HH:MM:SS" or // An array of recommended values. The value of this property must be an array of strings in the format "HH:MM:SS" or
// "HH:MM". // "HH:MM".
// //
// Supported types: `[]string`, `string`, `[]fmt.Stringer`, `[]Color`, `[]SizeUnit`, `[]AngleUnit`, `[]any` containing // Supported types: []string, string, []fmt.Stringer, []time.Time, []any containing elements of string, fmt.Stringer, time.Time.
// elements of `string`, `fmt.Stringer`, `bool`, `rune`, `float32`, `float64`, `int`, `int8` … `int64`, `uint`, `uint8` …
// `uint64`.
// //
// Internal type is `[]string`, other types converted to it during assignment. // Internal type is []string, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - contain single item. // - string - contain single item.
// `[]string` - an array of items. // - []string - an array of items.
// `[]fmt.Stringer` - an array of objects convertible to a string. // - []fmt.Stringer - an array of objects convertible to a string.
// `[]Color` - An array of color values which will be converted to a string array. // - []time.Time - An array of Time values which will be converted to a string array.
// `[]SizeUnit` - an array of size unit values which will be converted to a string array. // - []any - this array must contain only types which were listed in Types section.
// `[]any` - this array must contain only types which were listed in Types section.
DataList PropertyName = "data-list" DataList PropertyName = "data-list"
) )

View File

@ -10,103 +10,103 @@ import (
const ( const (
// DateChangedEvent is the constant for "date-changed" property tag. // DateChangedEvent is the constant for "date-changed" property tag.
// //
// Used by `DatePicker`. // Used by DatePicker.
// Occur when date picker value has been changed. // Occur when date picker value has been changed.
// //
// General listener format: // General listener format:
// `func(picker rui.DatePicker, newDate, oldDate time.Time)`. // func(picker rui.DatePicker, newDate time.Time, oldDate time.Time)
// //
// where: // where:
// picker - Interface of a date picker which generated this event, // - picker - Interface of a date picker which generated this event,
// newDate - New date value, // - newDate - New date value,
// oldDate - Old date value. // - oldDate - Old date value.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(picker rui.DatePicker, newDate time.Time)`, // func(picker rui.DatePicker, newDate time.Time)
// `func(newDate, oldDate time.Time)`, // func(newDate time.Time, oldDate time.Time)
// `func(newDate time.Time)`, // func(newDate time.Time)
// `func(picker rui.DatePicker)`, // func(picker rui.DatePicker)
// `func()`. // func()
DateChangedEvent PropertyName = "date-changed" DateChangedEvent PropertyName = "date-changed"
// DatePickerMin is the constant for "date-picker-min" property tag. // DatePickerMin is the constant for "date-picker-min" property tag.
// //
// Used by `DatePicker`. // Used by DatePicker.
// Minimum date value. // Minimum date value.
// //
// Supported types: `time.Time`, `string`. // Supported types: time.Time, string.
// //
// Internal type is `time.Time`, other types converted to it during assignment. // Internal type is time.Time, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - values of this type parsed and converted to `time.Time`. The following formats are supported: // string - values of this type parsed and converted to time.Time. The following formats are supported:
// "YYYYMMDD" - "20240102". // - "YYYYMMDD" - "20240102".
// "Mon-DD-YYYY" - "Jan-02-24". // - "Mon-DD-YYYY" - "Jan-02-24".
// "Mon-DD-YY" - "Jan-02-2024". // - "Mon-DD-YY" - "Jan-02-2024".
// "DD-Mon-YYYY" - "02-Jan-2024". // - "DD-Mon-YYYY" - "02-Jan-2024".
// "YYYY-MM-DD" - "2024-01-02". // - "YYYY-MM-DD" - "2024-01-02".
// "Month DD, YYYY" - "January 02, 2024". // - "Month DD, YYYY" - "January 02, 2024".
// "DD Month YYYY" - "02 January 2024". // - "DD Month YYYY" - "02 January 2024".
// "MM/DD/YYYY" - "01/02/2024". // - "MM/DD/YYYY" - "01/02/2024".
// "MM/DD/YY" - "01/02/24". // - "MM/DD/YY" - "01/02/24".
// "MMDDYY" - "010224". // - "MMDDYY" - "010224".
DatePickerMin PropertyName = "date-picker-min" DatePickerMin PropertyName = "date-picker-min"
// DatePickerMax is the constant for "date-picker-max" property tag. // DatePickerMax is the constant for "date-picker-max" property tag.
// //
// Used by `DatePicker`. // Used by DatePicker.
// Maximum date value. // Maximum date value.
// //
// Supported types: `time.Time`, `string`. // Supported types: time.Time, string.
// //
// Internal type is `time.Time`, other types converted to it during assignment. // Internal type is time.Time, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - values of this type parsed and converted to `time.Time`. The following formats are supported: // string - values of this type parsed and converted to time.Time. The following formats are supported:
// "YYYYMMDD" - "20240102". // - "YYYYMMDD" - "20240102".
// "Mon-DD-YYYY" - "Jan-02-24". // - "Mon-DD-YYYY" - "Jan-02-24".
// "Mon-DD-YY" - "Jan-02-2024". // - "Mon-DD-YY" - "Jan-02-2024".
// "DD-Mon-YYYY" - "02-Jan-2024". // - "DD-Mon-YYYY" - "02-Jan-2024".
// "YYYY-MM-DD" - "2024-01-02". // - "YYYY-MM-DD" - "2024-01-02".
// "Month DD, YYYY" - "January 02, 2024". // - "Month DD, YYYY" - "January 02, 2024".
// "DD Month YYYY" - "02 January 2024". // - "DD Month YYYY" - "02 January 2024".
// "MM/DD/YYYY" - "01/02/2024". // - "MM/DD/YYYY" - "01/02/2024".
// "MM/DD/YY" - "01/02/24". // - "MM/DD/YY" - "01/02/24".
// "MMDDYY" - "010224". // - "MMDDYY" - "010224".
DatePickerMax PropertyName = "date-picker-max" DatePickerMax PropertyName = "date-picker-max"
// DatePickerStep is the constant for "date-picker-step" property tag. // DatePickerStep is the constant for "date-picker-step" property tag.
// //
// Used by `DatePicker`. // Used by DatePicker.
// Date change step in days. // Date change step in days.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// >= `0` or >= "0" - Step value in days used to increment or decrement date. // positive value - Step value in days used to increment or decrement date.
DatePickerStep PropertyName = "date-picker-step" DatePickerStep PropertyName = "date-picker-step"
// DatePickerValue is the constant for "date-picker-value" property tag. // DatePickerValue is the constant for "date-picker-value" property tag.
// //
// Used by `DatePicker`. // Used by DatePicker.
// Current value. // Current value.
// //
// Supported types: `time.Time`, `string`. // Supported types: time.Time, string.
// //
// Internal type is `time.Time`, other types converted to it during assignment. // Internal type is time.Time, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - values of this type parsed and converted to `time.Time`. The following formats are supported: // string - values of this type parsed and converted to time.Time. The following formats are supported:
// "YYYYMMDD" - "20240102". // - "YYYYMMDD" - "20240102".
// "Mon-DD-YYYY" - "Jan-02-24". // - "Mon-DD-YYYY" - "Jan-02-24".
// "Mon-DD-YY" - "Jan-02-2024". // - "Mon-DD-YY" - "Jan-02-2024".
// "DD-Mon-YYYY" - "02-Jan-2024". // - "DD-Mon-YYYY" - "02-Jan-2024".
// "YYYY-MM-DD" - "2024-01-02". // - "YYYY-MM-DD" - "2024-01-02".
// "Month DD, YYYY" - "January 02, 2024". // - "Month DD, YYYY" - "January 02, 2024".
// "DD Month YYYY" - "02 January 2024". // - "DD Month YYYY" - "02 January 2024".
// "MM/DD/YYYY" - "01/02/2024". // - "MM/DD/YYYY" - "01/02/2024".
// "MM/DD/YY" - "01/02/24". // - "MM/DD/YY" - "01/02/24".
// "MMDDYY" - "010224". // - "MMDDYY" - "010224".
DatePickerValue PropertyName = "date-picker-value" DatePickerValue PropertyName = "date-picker-value"
dateFormat = "2006-01-02" dateFormat = "2006-01-02"

View File

@ -6,25 +6,24 @@ import "strings"
const ( const (
// Summary is the constant for "summary" property tag. // Summary is the constant for "summary" property tag.
// //
// Used by `DetailsView`. // Used by DetailsView.
// The content of this property is used as the label for the disclosure widget. // The content of this property is used as the label for the disclosure widget.
// //
// Supported types: `string`, `View`. // Supported types:
// // - string - Summary as a text.
// `string` - Summary as a text. // - View - Summary as a view, in this case it can be quite complex if needed.
// `View` - Summary as a view, in this case it can be quite complex if needed.
Summary PropertyName = "summary" Summary PropertyName = "summary"
// Expanded is the constant for "expanded" property tag. // Expanded is the constant for "expanded" property tag.
// //
// Used by `DetailsView`. // Used by DetailsView.
// Controls the content expanded state of the details view. Default value is `false`. // Controls the content expanded state of the details view. Default value is false.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - Content is visible. // - true, 1, "true", "yes", "on", or "1" - Content is visible.
// `false` or `0` or "false", "no", "off", "0" - Content is collapsed(hidden). // - false, 0, "false", "no", "off", or "0" - Content is collapsed (hidden).
Expanded PropertyName = "expanded" Expanded PropertyName = "expanded"
) )

View File

@ -7,17 +7,22 @@ import (
// DropDownEvent is the constant for "drop-down-event" property tag. // DropDownEvent is the constant for "drop-down-event" property tag.
// //
// Used by `DropDownList`. // Used by DropDownList.
// Occur when a list item becomes selected. // Occur when a list item becomes selected.
// //
// General listener format: // General listener format:
// `func(list rui.DropDownList, index int)`. //
// func(list rui.DropDownList, index int)
// //
// where: // where:
// list - Interface of a drop down list which generated this event, // - list - Interface of a drop down list which generated this event,
// index - Index of a newly selected item. // - index - Index of a newly selected item.
// //
// Allowed listener formats: // Allowed listener formats:
//
// func(index int)
// func(list rui.DropDownList)
// func()
const DropDownEvent PropertyName = "drop-down-event" const DropDownEvent PropertyName = "drop-down-event"
// DropDownList represent a DropDownList view // DropDownList represent a DropDownList view

View File

@ -9,61 +9,61 @@ import (
const ( const (
// EditTextChangedEvent is the constant for "edit-text-changed" property tag. // EditTextChangedEvent is the constant for "edit-text-changed" property tag.
// //
// Used by `EditView`. // Used by EditView.
// Occur when edit view text has been changed. // Occur when edit view text has been changed.
// //
// General listener format: // General listener format:
// `func(editView rui.EditView, newText, oldText string)`. // func(editView rui.EditView, newText string, oldText string).
// //
// where: // where:
// editView - Interface of an edit view which generated this event, // - editView - Interface of an edit view which generated this event,
// newText - New edit view text, // - newText - New edit view text,
// oldText - Previous edit view text. // - oldText - Previous edit view text.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(editView rui.EditView, newText string)`, // - func(editView rui.EditView, newText string)
// `func(newText, oldText string)`, // - func(newText string, oldText string)
// `func(newText string)`, // - func(newText string)
// `func(editView rui.EditView)`, // - func(editView rui.EditView)
// `func()`. // - func()
EditTextChangedEvent PropertyName = "edit-text-changed" EditTextChangedEvent PropertyName = "edit-text-changed"
// EditViewType is the constant for "edit-view-type" property tag. // EditViewType is the constant for "edit-view-type" property tag.
// //
// Used by `EditView`. // Used by EditView.
// Type of the text input. Default value is "text". // Type of the text input. Default value is "text".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`SingleLineText`) or "text" - One-line text editor. // - 0 (SingleLineText) or "text" - One-line text editor.
// `1`(`PasswordText`) or "password" - Password editor. The text is hidden by asterisks. // - 1 (PasswordText) or "password" - Password editor. The text is hidden by asterisks.
// `2`(`EmailText`) or "email" - Single e-mail editor. // - 2 (EmailText) or "email" - Single e-mail editor.
// `3`(`EmailsText`) or "emails" - Multiple e-mail editor. // - 3 (EmailsText) or "emails" - Multiple e-mail editor.
// `4`(`URLText`) or "url" - Internet address input editor. // - 4 (URLText) or "url" - Internet address input editor.
// `5`(`PhoneText`) or "phone" - Phone number editor. // - 5 (PhoneText) or "phone" - Phone number editor.
// `6`(`MultiLineText`) or "multiline" - Multi-line text editor. // - 6 (MultiLineText) or "multiline" - Multi-line text editor.
EditViewType PropertyName = "edit-view-type" EditViewType PropertyName = "edit-view-type"
// EditViewPattern is the constant for "edit-view-pattern" property tag. // EditViewPattern is the constant for "edit-view-pattern" property tag.
// //
// Used by `EditView`. // Used by EditView.
// Regular expression to limit editing of a text. // Regular expression to limit editing of a text.
// //
// Supported types: `string`. // Supported types: string.
EditViewPattern PropertyName = "edit-view-pattern" EditViewPattern PropertyName = "edit-view-pattern"
// Spellcheck is the constant for "spellcheck" property tag. // Spellcheck is the constant for "spellcheck" property tag.
// //
// Used by `EditView`. // Used by EditView.
// Enable or disable spell checker. Available in `SingleLineText` and `MultiLineText` types of edit view. Default value is // Enable or disable spell checker. Available in SingleLineText and MultiLineText types of edit view. Default value is
// `false`. // false.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - Enable spell checker for text. // - true, 1, "true", "yes", "on", "1" - Enable spell checker for text.
// `false` or `0` or "false", "no", "off", "0" - Disable spell checker for text. // - false, 0, "false", "no", "off", "0" - Disable spell checker for text.
Spellcheck PropertyName = "spellcheck" Spellcheck PropertyName = "spellcheck"
) )

View File

@ -11,46 +11,46 @@ import (
const ( const (
// FileSelectedEvent is the constant for "file-selected-event" property tag. // FileSelectedEvent is the constant for "file-selected-event" property tag.
// //
// Used by `FilePicker`. // Used by FilePicker.
// Fired when user selects file(s). // Fired when user selects file(s).
// //
// General listener format: // General listener format:
// `func(picker rui.FilePicker, files []rui.FileInfo)`. // func(picker rui.FilePicker, files []rui.FileInfo).
// //
// where: // where:
// picker - Interface of a file picker which generated this event, // picker - Interface of a file picker which generated this event,
// files - Array of description of selected files. // files - Array of description of selected files.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(picker rui.FilePicker)`, // func(picker rui.FilePicker)
// `func(files []rui.FileInfo)`, // func(files []rui.FileInfo)
// `func()`. // func()
FileSelectedEvent PropertyName = "file-selected-event" FileSelectedEvent PropertyName = "file-selected-event"
// Accept is the constant for "accept" property tag. // Accept is the constant for "accept" property tag.
// //
// Used by `FilePicker`. // Used by FilePicker.
// Set the list of allowed file extensions or MIME types. // Set the list of allowed file extensions or MIME types.
// //
// Supported types: `string`, `[]string`. // Supported types: string, []string.
// //
// Internal type is `string`, other types converted to it during assignment. // Internal type is string, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - may contain single value of multiple separated by comma(`,`). // - string - may contain single value of multiple separated by comma(,).
// `[]string` - an array of acceptable file extensions or MIME types. // - []string - an array of acceptable file extensions or MIME types.
Accept PropertyName = "accept" Accept PropertyName = "accept"
// Multiple is the constant for "multiple" property tag. // Multiple is the constant for "multiple" property tag.
// //
// Used by `FilePicker`. // Used by FilePicker.
// Controls whether multiple files can be selected. // Controls whether multiple files can be selected.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - Several files can be selected. // - true, 1, "true", "yes", "on", "1" - Several files can be selected.
// `false` or `0` or "false", "no", "off", "0" - Only one file can be selected. // - false, 0, "false", "no", "off", "0" - Only one file can be selected.
Multiple PropertyName = "multiple" Multiple PropertyName = "multiple"
) )

View File

@ -6,32 +6,32 @@ import "strings"
const ( const (
// FocusEvent is the constant for "focus-event" property tag. // FocusEvent is the constant for "focus-event" property tag.
// //
// Used by `View`. // Used by View.
// Occur when the view takes input focus. // Occur when the view takes input focus.
// //
// General listener format: // General listener format:
// `func(View)`. // func(rui.View).
// //
// where: // where:
// view - Interface of a view which generated this event. // view - Interface of a view which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`. // func().
FocusEvent PropertyName = "focus-event" FocusEvent PropertyName = "focus-event"
// LostFocusEvent is the constant for "lost-focus-event" property tag. // LostFocusEvent is the constant for "lost-focus-event" property tag.
// //
// Used by `View`. // Used by View.
// Occur when the View lost input focus. // Occur when the View lost input focus.
// //
// General listener format: // General listener format:
// `func(view rui.View)`. // func(view rui.View).
// //
// where: // where:
// view - Interface of a view which generated this event. // view - Interface of a view which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`. // func()
LostFocusEvent PropertyName = "lost-focus-event" LostFocusEvent PropertyName = "lost-focus-event"
) )

View File

@ -9,70 +9,70 @@ import (
const ( const (
// CellVerticalAlign is the constant for "cell-vertical-align" property tag. // CellVerticalAlign is the constant for "cell-vertical-align" property tag.
// //
// Used by `GridLayout`, `SvgImageView`. // Used by GridLayout, SvgImageView.
// //
// Usage in `GridLayout`: // Usage in GridLayout:
// Sets the default vertical alignment of `GridLayout` children within the cell they are occupying. // Sets the default vertical alignment of GridLayout children within the cell they are occupying.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`TopAlign`) or "top" - Top alignment. // - 0 (TopAlign) or "top" - Top alignment.
// `1`(`BottomAlign`) or "bottom" - Bottom alignment. // - 1 (BottomAlign) or "bottom" - Bottom alignment.
// `2`(`CenterAlign`) or "center" - Center alignment. // - 2 (CenterAlign) or "center" - Center alignment.
// `3`(`StretchAlign`) or "stretch" - Full height stretch. // - 3 (StretchAlign) or "stretch" - Full height stretch.
// //
// Usage in `SvgImageView`: // Usage in SvgImageView:
// Same as "vertical-align". // Same as "vertical-align".
CellVerticalAlign PropertyName = "cell-vertical-align" CellVerticalAlign PropertyName = "cell-vertical-align"
// CellHorizontalAlign is the constant for "cell-horizontal-align" property tag. // CellHorizontalAlign is the constant for "cell-horizontal-align" property tag.
// //
// Used by `GridLayout`, `SvgImageView`. // Used by GridLayout, SvgImageView.
// //
// Usage in `GridLayout`: // Usage in GridLayout:
// Sets the default horizontal alignment of `GridLayout` children within the occupied cell. // Sets the default horizontal alignment of GridLayout children within the occupied cell.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`LeftAlign`) or "left" - Left alignment. // - 0 (LeftAlign) or "left" - Left alignment.
// `1`(`RightAlign`) or "right" - Right alignment. // - 1 (RightAlign) or "right" - Right alignment.
// `2`(`CenterAlign`) or "center" - Center alignment. // - 2 (CenterAlign) or "center" - Center alignment.
// `3`(`StretchAlign`) or "stretch" - Full width stretch. // - 3 (StretchAlign) or "stretch" - Full width stretch.
// //
// Usage in `SvgImageView`: // Usage in SvgImageView:
// Same as "horizontal-align". // Same as "horizontal-align".
CellHorizontalAlign PropertyName = "cell-horizontal-align" CellHorizontalAlign PropertyName = "cell-horizontal-align"
// CellVerticalSelfAlign is the constant for "cell-vertical-self-align" property tag. // CellVerticalSelfAlign is the constant for "cell-vertical-self-align" property tag.
// //
// Used by `GridLayout`. // Used by GridLayout.
// Sets the vertical alignment of `GridLayout` children within the cell they are occupying. The property is set for the // Sets the vertical alignment of GridLayout children within the cell they are occupying. The property is set for the
// child view of `GridLayout`. // child view of GridLayout.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`TopAlign`) or "top" - Top alignment. // - 0 (TopAlign) or "top" - Top alignment.
// `1`(`BottomAlign`) or "bottom" - Bottom alignment. // - 1 (BottomAlign) or "bottom" - Bottom alignment.
// `2`(`CenterAlign`) or "center" - Center alignment. // - 2 (CenterAlign) or "center" - Center alignment.
// `3`(`StretchAlign`) or "stretch" - Full height stretch. // - 3 (StretchAlign) or "stretch" - Full height stretch.
CellVerticalSelfAlign PropertyName = "cell-vertical-self-align" CellVerticalSelfAlign PropertyName = "cell-vertical-self-align"
// CellHorizontalSelfAlign is the constant for "cell-horizontal-self-align" property tag. // CellHorizontalSelfAlign is the constant for "cell-horizontal-self-align" property tag.
// //
// Used by `GridLayout`. // Used by GridLayout.
// Sets the horizontal alignment of `GridLayout` children within the occupied cell. The property is set for the child view // Sets the horizontal alignment of GridLayout children within the occupied cell. The property is set for the child view
// of `GridLayout`. // of GridLayout.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`LeftAlign`) or "left" - Left alignment. // - 0 (LeftAlign) or "left" - Left alignment.
// `1`(`RightAlign`) or "right" - Right alignment. // - 1 (RightAlign) or "right" - Right alignment.
// `2`(`CenterAlign`) or "center" - Center alignment. // - 2 (CenterAlign) or "center" - Center alignment.
// `3`(`StretchAlign`) or "stretch" - Full width stretch. // - 3 (StretchAlign) or "stretch" - Full width stretch.
CellHorizontalSelfAlign PropertyName = "cell-horizontal-self-align" CellHorizontalSelfAlign PropertyName = "cell-horizontal-self-align"
) )

View File

@ -9,32 +9,32 @@ import (
const ( const (
// LoadedEvent is the constant for "loaded-event" property tag. // LoadedEvent is the constant for "loaded-event" property tag.
// //
// Used by `ImageView`. // Used by ImageView.
// Occur when the image has been loaded. // Occur when the image has been loaded.
// //
// General listener format: // General listener format:
// `func(image rui.ImageView)`. // func(image rui.ImageView)
// //
// where: // where:
// image - Interface of an image view which generated this event. // image - Interface of an image view which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`. // func()
LoadedEvent PropertyName = "loaded-event" LoadedEvent PropertyName = "loaded-event"
// ErrorEvent is the constant for "error-event" property tag. // ErrorEvent is the constant for "error-event" property tag.
// //
// Used by `ImageView`. // Used by ImageView.
// Occur when the image loading has been failed. // Occur when the image loading has been failed.
// //
// General listener format: // General listener format:
// `func(image rui.ImageView)`. // func(image rui.ImageView)
// //
// where: // where:
// image - Interface of an image view which generated this event. // image - Interface of an image view which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`. // func()
ErrorEvent PropertyName = "error-event" ErrorEvent PropertyName = "error-event"
// NoneFit - value of the "object-fit" property of an ImageView. The replaced content is not resized // NoneFit - value of the "object-fit" property of an ImageView. The replaced content is not resized

View File

@ -6,38 +6,42 @@ import "strings"
const ( const (
// KeyDownEvent is the constant for "key-down-event" property tag. // KeyDownEvent is the constant for "key-down-event" property tag.
// //
// Used by `View`. // Used by View.
// Is fired when a key is pressed. // Is fired when a key is pressed.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.KeyEvent)`. //
// func(view rui.View, event rui.KeyEvent).
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Key event. // - event - Key event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, //
// `func(event rui.KeyEvent)`, // func(view rui.View)
// `func()`. // func(event rui.KeyEvent)
// func()
KeyDownEvent PropertyName = "key-down-event" KeyDownEvent PropertyName = "key-down-event"
// KeyUpEvent is the constant for "key-up-event" property tag. // KeyUpEvent is the constant for "key-up-event" property tag.
// //
// Used by `View`. // Used by View.
// Is fired when a key is released. // Is fired when a key is released.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.KeyEvent)`. //
// func(view rui.View, event rui.KeyEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Key event. // - event - Key event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, //
// `func(event rui.KeyEvent)`, // func(view rui.View)
// `func()`. // func(event rui.KeyEvent)
// func()
KeyUpEvent PropertyName = "key-up-event" KeyUpEvent PropertyName = "key-up-event"
) )

View File

@ -10,77 +10,86 @@ import (
const ( const (
// ListItemClickedEvent is the constant for "list-item-clicked" property tag. // ListItemClickedEvent is the constant for "list-item-clicked" property tag.
// //
// Used by `ListView`. // Used by ListView.
// Occur when the user clicks on an item in the list. // Occur when the user clicks on an item in the list.
// //
// General listener format: // General listener format:
// `func(list rui.ListView, item int)`. //
// func(list rui.ListView, item int)
// //
// where: // where:
// list - Interface of a list which generated this event, // - list - Interface of a list which generated this event,
// item - An index of an item clicked. // - item - An index of an item clicked.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(item int)`, //
// `func(list rui.ListView)`, // func(item int)
// `func()`. // func(list rui.ListView)
// func()
ListItemClickedEvent PropertyName = "list-item-clicked" ListItemClickedEvent PropertyName = "list-item-clicked"
// ListItemSelectedEvent is the constant for "list-item-selected" property tag. // ListItemSelectedEvent is the constant for "list-item-selected" property tag.
// //
// Used by `ListView`. // Used by ListView.
// Occur when a list item becomes selected. // Occur when a list item becomes selected.
// //
// General listener format: // General listener format:
// `func(list rui.ListView, item int)`. //
// func(list rui.ListView, item int)
// //
// where: // where:
// list - Interface of a list which generated this event, // - list - Interface of a list which generated this event,
// item - An index of an item selected. // - item - An index of an item selected.
// //
// Allowed listener formats: // Allowed listener formats:
//
// func(item int)
// func(list rui.ListView)
// func()
ListItemSelectedEvent PropertyName = "list-item-selected" ListItemSelectedEvent PropertyName = "list-item-selected"
// ListItemCheckedEvent is the constant for "list-item-checked" property tag. // ListItemCheckedEvent is the constant for "list-item-checked" property tag.
// //
// Used by `ListView`. // Used by ListView.
// Occur when a list item checkbox becomes checked or unchecked. // Occur when a list item checkbox becomes checked or unchecked.
// //
// General listener format: // General listener format:
// `func(list rui.ListView, checkedItems []int)`. //
// func(list rui.ListView, checkedItems []int).
// //
// where: // where:
// list - Interface of a list which generated this event, // - list - Interface of a list which generated this event,
// checkedItems - Array of indices of marked elements. // - checkedItems - Array of indices of marked elements.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(checkedItems []int)`, //
// `func(list rui.ListView)`, // func(checkedItems []int)
// `func()`. // func(list rui.ListView)
// func()
ListItemCheckedEvent PropertyName = "list-item-checked" ListItemCheckedEvent PropertyName = "list-item-checked"
// ListItemStyle is the constant for "list-item-style" property tag. // ListItemStyle is the constant for "list-item-style" property tag.
// //
// Used by `ListView`. // Used by ListView.
// Defines the style of an unselected item. // Defines the style of an unselected item.
// //
// Supported types: `string`. // Supported types: string.
ListItemStyle PropertyName = "list-item-style" ListItemStyle PropertyName = "list-item-style"
// CurrentStyle is the constant for "current-style" property tag. // CurrentStyle is the constant for "current-style" property tag.
// //
// Used by `ListView`. // Used by ListView.
// Defines the style of the selected item when the `ListView` is focused. // Defines the style of the selected item when the ListView is focused.
// //
// Supported types: `string`. // Supported types: string.
CurrentStyle PropertyName = "current-style" CurrentStyle PropertyName = "current-style"
// CurrentInactiveStyle is the constant for "current-inactive-style" property tag. // CurrentInactiveStyle is the constant for "current-inactive-style" property tag.
// //
// Used by `ListView`. // Used by ListView.
// Defines the style of the selected item when the `ListView` is unfocused. // Defines the style of the selected item when the ListView is unfocused.
// //
// Supported types: `string`. // Supported types: string.
CurrentInactiveStyle PropertyName = "current-inactive-style" CurrentInactiveStyle PropertyName = "current-inactive-style"
) )

View File

@ -11,815 +11,496 @@ import (
const ( const (
// Controls is the constant for "controls" property tag. // Controls is the constant for "controls" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Controls whether the browser need to provide controls to allow user to control audio playback, volume, seeking and // Controls whether the browser need to provide controls to allow user to control audio playback, volume, seeking and
// pause/resume playback. Default value is `false`. // pause/resume playback. Default value is false.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - The browser will offer controls to allow the user to control audio playback, volume, seeking and pause/resume playback. // - true, 1, "true", "yes", "on", "1" - The browser will offer controls to allow the user to control audio playback, volume, seeking and pause/resume playback.
// `false` or `0` or "false", "no", "off", "0" - No controls will be visible to the end user. // - false, 0, "false", "no", "off", "0" - No controls will be visible to the end user.
//
// Usage in `VideoPlayer`:
// Whether the browser need to provide controls to allow user to control video playback, volume, seeking and pause/resume
// playback. Default value is `false`.
//
// Supported types: `bool`, `int`, `string`.
//
// Values:
// `true` or `1` or "true", "yes", "on", "1" - The browser will offer controls to allow the user to control video playback, volume, seeking and pause/resume playback.
// `false` or `0` or "false", "no", "off", "0" - No controls will be visible to the end user.
Controls PropertyName = "controls" Controls PropertyName = "controls"
// Loop is the constant for "loop" property tag. // Loop is the constant for "loop" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`: // Controls whether the audio player will play media in a loop. Default value is false.
// Controls whether the audio player will play media in a loop. Default value is `false`.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - The audio player will automatically seek back to the start upon reaching the end of the audio. // - true, 1, "true", "yes", "on", "1" - The audio player will automatically seek back to the start upon reaching the end of the audio.
// `false` or `0` or "false", "no", "off", "0" - Audio player will stop playing when the end of the media file has been reached. // - false, 0, "false", "no", "off", "0" - Audio player will stop playing when the end of the media file has been reached.
//
// Usage in `VideoPlayer`:
// Controls whether the video player will play media in a loop. Default value is `false`.
//
// Supported types: `bool`, `int`, `string`.
//
// Values:
// `true` or `1` or "true", "yes", "on", "1" - The video player will automatically seek back to the start upon reaching the end of the video.
// `false` or `0` or "false", "no", "off", "0" - Video player will stop playing when the end of the media file has been reached.
Loop PropertyName = "loop" Loop PropertyName = "loop"
// Muted is the constant for "muted" property tag. // Muted is the constant for "muted" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`: // Controls whether the audio will be initially silenced. Default value is false.
// Controls whether the audio will be initially silenced. Default value is `false`.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - Audio will be muted. // - true, 1, "true", "yes", "on", "1" - Audio will be muted.
// `false` or `0` or "false", "no", "off", "0" - Audio playing normally. // - false, 0, "false", "no", "off", "0" - Audio playing normally.
//
// Usage in `VideoPlayer`:
// Controls whether the video will be initially silenced. Default value is `false`.
//
// Supported types: `bool`, `int`, `string`.
//
// Values:
// `true` or `1` or "true", "yes", "on", "1" - Video will be muted.
// `false` or `0` or "false", "no", "off", "0" - Video playing normally.
Muted PropertyName = "muted" Muted PropertyName = "muted"
// Preload is the constant for "preload" property tag. // Preload is the constant for "preload" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Property is intended to provide a hint to the browser about what the author thinks will lead to the best user // Property is intended to provide a hint to the browser about what the author thinks will lead to the best user
// experience. Default value is different for each browser. // experience. Default value is different for each browser.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`PreloadNone`) or "none" - Media file must not be pre-loaded. // - 0 (PreloadNone) or "none" - Media file must not be pre-loaded.
// `1`(`PreloadMetadata`) or "metadata" - Only metadata is preloaded. // - 1 (PreloadMetadata) or "metadata" - Only metadata is preloaded.
// `2`(`PreloadAuto`) or "auto" - The entire media file can be downloaded even if the user doesn't have to use it. // - 2 (PreloadAuto) or "auto" - The entire media file can be downloaded even if the user doesn't have to use it.
//
// Usage in `VideoPlayer`:
// Property is intended to provide a hint to the browser about what the author thinks will lead to the best user
// experience. Default value is different for each browser.
//
// Supported types: `int`, `string`.
//
// Values:
// `0`(`PreloadNone`) or "none" - Media file must not be pre-loaded.
// `1`(`PreloadMetadata`) or "metadata" - Only metadata is preloaded.
// `2`(`PreloadAuto`) or "auto" - The entire media file can be downloaded even if the user doesn't have to use it.
Preload PropertyName = "preload" Preload PropertyName = "preload"
// AbortEvent is the constant for "abort-event" property tag. // AbortEvent is the constant for "abort-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Fired when the resource was not fully loaded, but not as the result of an error. // Fired when the resource was not fully loaded, but not as the result of an error.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Fired when the resource was not fully loaded, but not as the result of an error.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
AbortEvent PropertyName = "abort-event" AbortEvent PropertyName = "abort-event"
// CanPlayEvent is the constant for "can-play-event" property tag. // CanPlayEvent is the constant for "can-play-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the browser can play the media, but estimates that not enough data has been loaded to play the media up to // Occur when the browser can play the media, but estimates that not enough data has been loaded to play the media up to
// its end without having to stop for further buffering of content. // its end without having to stop for further buffering of content.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the browser can play the media, but estimates that not enough data has been loaded to play the media up to
// its end without having to stop for further buffering of content.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
CanPlayEvent PropertyName = "can-play-event" CanPlayEvent PropertyName = "can-play-event"
// CanPlayThroughEvent is the constant for "can-play-through-event" property tag. // CanPlayThroughEvent is the constant for "can-play-through-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the browser estimates it can play the media up to its end without stopping for content buffering. // Occur when the browser estimates it can play the media up to its end without stopping for content buffering.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the browser estimates it can play the media up to its end without stopping for content buffering.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
CanPlayThroughEvent PropertyName = "can-play-through-event" CanPlayThroughEvent PropertyName = "can-play-through-event"
// CompleteEvent is the constant for "complete-event" property tag. // CompleteEvent is the constant for "complete-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the rendering of an OfflineAudioContext has been terminated. // Occur when the rendering of an OfflineAudioContext has been terminated.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the rendering of an OfflineAudioContext has been terminated.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
CompleteEvent PropertyName = "complete-event" CompleteEvent PropertyName = "complete-event"
// DurationChangedEvent is the constant for "duration-changed-event" property tag. // DurationChangedEvent is the constant for "duration-changed-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the duration attribute has been updated. // Occur when the duration attribute has been updated.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer, duration float64)`. //
// func(player rui.MediaPlayer, duration float64).
// //
// where: // where:
// player - Interface of a player which generated this event, // - player - Interface of a player which generated this event,
// duration - Current duration. // - duration - Current duration.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(duration float64)`,
// `func()`.
// //
// Usage in `VideoPlayer`: // func(player rui.MediaPlayer),
// Occur when the duration attribute has been updated. // func(duration float64),
// // func()
// General listener format:
// `func(player rui.MediaPlayer, duration float64)`.
//
// where:
// player - Interface of a player which generated this event,
// duration - Current duration.
//
// Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(duration float64)`,
// `func()`.
DurationChangedEvent PropertyName = "duration-changed-event" DurationChangedEvent PropertyName = "duration-changed-event"
// EmptiedEvent is the constant for "emptied-event" property tag. // EmptiedEvent is the constant for "emptied-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the media has become empty; for example, this event is sent if the media has already been loaded(or // Occur when the media has become empty; for example, this event is sent if the media has already been loaded(or
// partially loaded), and the HTMLMediaElement.load method is called to reload it. // partially loaded), and the HTMLMediaElement.load method is called to reload it.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the media has become empty; for example, this event is sent if the media has already been loaded(or
// partially loaded), and the HTMLMediaElement.load method is called to reload it.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
EmptiedEvent PropertyName = "emptied-event" EmptiedEvent PropertyName = "emptied-event"
// EndedEvent is the constant for "ended-event" property tag. // EndedEvent is the constant for "ended-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the playback has stopped because the end of the media was reached. // Occur when the playback has stopped because the end of the media was reached.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the playback has stopped because the end of the media was reached.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
EndedEvent PropertyName = "ended-event" EndedEvent PropertyName = "ended-event"
// LoadedDataEvent is the constant for "loaded-data-event" property tag. // LoadedDataEvent is the constant for "loaded-data-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the first frame of the media has finished loading. // Occur when the first frame of the media has finished loading.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the first frame of the media has finished loading.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
LoadedDataEvent PropertyName = "loaded-data-event" LoadedDataEvent PropertyName = "loaded-data-event"
// LoadedMetadataEvent is the constant for "loaded-metadata-event" property tag. // LoadedMetadataEvent is the constant for "loaded-metadata-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the metadata has been loaded. // Occur when the metadata has been loaded.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the metadata has been loaded.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
LoadedMetadataEvent PropertyName = "loaded-metadata-event" LoadedMetadataEvent PropertyName = "loaded-metadata-event"
// LoadStartEvent is the constant for "load-start-event" property tag. // LoadStartEvent is the constant for "load-start-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Fired when the browser has started to load a resource. // Fired when the browser has started to load a resource.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Fired when the browser has started to load a resource.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
LoadStartEvent PropertyName = "load-start-event" LoadStartEvent PropertyName = "load-start-event"
// PauseEvent is the constant for "pause-event" property tag. // PauseEvent is the constant for "pause-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the playback has been paused. // Occur when the playback has been paused.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the playback has been paused.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
PauseEvent PropertyName = "pause-event" PauseEvent PropertyName = "pause-event"
// PlayEvent is the constant for "play-event" property tag. // PlayEvent is the constant for "play-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the playback has begun. // Occur when the playback has begun.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the playback has begun.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
PlayEvent PropertyName = "play-event" PlayEvent PropertyName = "play-event"
// PlayingEvent is the constant for "playing-event" property tag. // PlayingEvent is the constant for "playing-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the playback is ready to start after having been paused or delayed due to lack of data. // Occur when the playback is ready to start after having been paused or delayed due to lack of data.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the playback is ready to start after having been paused or delayed due to lack of data.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
PlayingEvent PropertyName = "playing-event" PlayingEvent PropertyName = "playing-event"
// ProgressEvent is the constant for "progress-event" property tag. // ProgressEvent is the constant for "progress-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Fired periodically as the browser loads a resource. // Fired periodically as the browser loads a resource.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Fired periodically as the browser loads a resource.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
ProgressEvent PropertyName = "progress-event" ProgressEvent PropertyName = "progress-event"
// RateChangedEvent is the constant for "rate-changed-event" property tag. // RateChangedEvent is the constant for "rate-changed-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the playback rate has changed. // Occur when the playback rate has changed.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer, rate float64)`. //
// func(player rui.MediaPlayer, rate float64).
// //
// where: // where:
// player - Interface of a player which generated this event, // - player - Interface of a player which generated this event,
// rate - Playback rate. // - rate - Playback rate.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(rate float64)`,
// `func()`.
// //
// Usage in `VideoPlayer`: // func(player rui.MediaPlayer),
// Occur when the playback rate has changed. // func(rate float64),
// // func()
// General listener format:
// `func(player rui.MediaPlayer, rate float64)`.
//
// where:
// player - Interface of a player which generated this event,
// rate - Playback rate.
//
// Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(rate float64)`,
// `func()`.
RateChangedEvent PropertyName = "rate-changed-event" RateChangedEvent PropertyName = "rate-changed-event"
// SeekedEvent is the constant for "seeked-event" property tag. // SeekedEvent is the constant for "seeked-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when a seek operation completed. // Occur when a seek operation completed.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when a seek operation completed.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
SeekedEvent PropertyName = "seeked-event" SeekedEvent PropertyName = "seeked-event"
// SeekingEvent is the constant for "seeking-event" property tag. // SeekingEvent is the constant for "seeking-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when a seek operation has began. // Occur when a seek operation has began.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when a seek operation has began.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
SeekingEvent PropertyName = "seeking-event" SeekingEvent PropertyName = "seeking-event"
// StalledEvent is the constant for "stalled-event" property tag. // StalledEvent is the constant for "stalled-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming. // Occur when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
StalledEvent PropertyName = "stalled-event" StalledEvent PropertyName = "stalled-event"
// SuspendEvent is the constant for "suspend-event" property tag. // SuspendEvent is the constant for "suspend-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the media data loading has been suspended. // Occur when the media data loading has been suspended.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the media data loading has been suspended.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
SuspendEvent PropertyName = "suspend-event" SuspendEvent PropertyName = "suspend-event"
// TimeUpdateEvent is the constant for "time-update-event" property tag. // TimeUpdateEvent is the constant for "time-update-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the time indicated by the currentTime attribute has been updated. // Occur when the time indicated by the currentTime attribute has been updated.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer, time float64)`. //
// func(player rui.MediaPlayer, time float64).
// //
// where: // where:
// player - Interface of a player which generated this event, // - player - Interface of a player which generated this event,
// time - Current time. // - time - Current time.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(time float64)`,
// `func()`.
// //
// Usage in `VideoPlayer`: // func(player rui.MediaPlayer),
// Occur when the time indicated by the currentTime attribute has been updated. // func(time float64),
// // func()
// General listener format:
// `func(player rui.MediaPlayer, time float64)`.
//
// where:
// player - Interface of a player which generated this event,
// time - Current time.
//
// Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(time float64)`,
// `func()`.
TimeUpdateEvent PropertyName = "time-update-event" TimeUpdateEvent PropertyName = "time-update-event"
// VolumeChangedEvent is the constant for "volume-changed-event" property tag. // VolumeChangedEvent is the constant for "volume-changed-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the volume has changed. // Occur when the volume has changed.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer, volume float64)`. //
// func(player rui.MediaPlayer, volume float64).
// //
// where: // where:
// player - Interface of a player which generated this event, // - player - Interface of a player which generated this event,
// volume - New volume level. // - volume - New volume level.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(volume float64)`,
// `func()`.
// //
// Usage in `VideoPlayer`: // func(player rui.MediaPlayer),
// Occur when the volume has changed. // func(volume float64),
// // func()
// General listener format:
// `func(player rui.MediaPlayer, volume float64)`.
//
// where:
// player - Interface of a player which generated this event,
// volume - New volume level.
//
// Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(volume float64)`,
// `func()`.
VolumeChangedEvent PropertyName = "volume-changed-event" VolumeChangedEvent PropertyName = "volume-changed-event"
// WaitingEvent is the constant for "waiting-event" property tag. // WaitingEvent is the constant for "waiting-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Occur when the playback has stopped because of a temporary lack of data. // Occur when the playback has stopped because of a temporary lack of data.
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer)`. //
// func(player rui.MediaPlayer)
// //
// where: // where:
// player - Interface of a player which generated this event. // player - Interface of a player which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`.
// //
// Usage in `VideoPlayer`: // func()
// Occur when the playback has stopped because of a temporary lack of data.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
WaitingEvent PropertyName = "waiting-event" WaitingEvent PropertyName = "waiting-event"
// PlayerErrorEvent is the constant for "player-error-event" property tag. // PlayerErrorEvent is the constant for "player-error-event" property tag.
// //
// Used by `AudioPlayer`, `VideoPlayer`. // Used by AudioPlayer, VideoPlayer.
// //
// Usage in `AudioPlayer`:
// Fired when the resource could not be loaded due to an error(for example, a network connectivity problem). // Fired when the resource could not be loaded due to an error(for example, a network connectivity problem).
// //
// General listener format: // General listener format:
// `func(player rui.MediaPlayer, code int, message string)`. //
// func(player rui.MediaPlayer, code int, message string).
// //
// where: // where:
// player - Interface of a player which generated this event, // - player - Interface of a player which generated this event,
// code - Error code. See below, // - code - Error code. See below,
// message - Error message, // - message - Error message,
// Error codes: // Error codes:
// `0`(`PlayerErrorUnknown`) - Unknown error, // - 0 (PlayerErrorUnknown) - Unknown error,
// `1`(`PlayerErrorAborted`) - Fetching the associated resource was interrupted by a user request, // - 1 (PlayerErrorAborted) - Fetching the associated resource was interrupted by a user request,
// `2`(`PlayerErrorNetwork`) - Some kind of network error has occurred that prevented the media from successfully ejecting, even though it was previously available, // - 2 (PlayerErrorNetwork) - Some kind of network error has occurred that prevented the media from successfully ejecting, even though it was previously available,
// `3`(`PlayerErrorDecode`) - Although the resource was previously identified as being used, an error occurred while trying to decode the media resource, // - 3 (PlayerErrorDecode) - Although the resource was previously identified as being used, an error occurred while trying to decode the media resource,
// `4`(`PlayerErrorSourceNotSupported`) - The associated resource object or media provider was found to be invalid. // - 4 (PlayerErrorSourceNotSupported) - The associated resource object or media provider was found to be invalid.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(code int, message string)`,
// `func(player rui.MediaPlayer)`,
// `func()`.
// //
// Usage in `VideoPlayer`: // func(code int, message string),
// Fired when the resource could not be loaded due to an error(for example, a network connectivity problem). // func(player rui.MediaPlayer),
// // func()
// General listener format:
// `func(player rui.MediaPlayer, code int, message string)`.
//
// where:
// player - Interface of a player which generated this event,
// code - Error code. See below,
// message - Error message,
// Error codes:
// `0`(`PlayerErrorUnknown`) - Unknown error,
// `1`(`PlayerErrorAborted`) - Fetching the associated resource was interrupted by a user request,
// `2`(`PlayerErrorNetwork`) - Some kind of network error has occurred that prevented the media from successfully ejecting, even though it was previously available,
// `3`(`PlayerErrorDecode`) - Although the resource was previously identified as being used, an error occurred while trying to decode the media resource,
// `4`(`PlayerErrorSourceNotSupported`) - The associated resource object or media provider was found to be invalid.
//
// Allowed listener formats:
// `func(code int, message string)`,
// `func(player rui.MediaPlayer)`,
// `func()`.
PlayerErrorEvent PropertyName = "player-error-event" PlayerErrorEvent PropertyName = "player-error-event"
// PreloadNone - value of the view "preload" property: indicates that the audio/video should not be preloaded. // PreloadNone - value of the view "preload" property: indicates that the audio/video should not be preloaded.

View File

@ -9,150 +9,166 @@ import (
const ( const (
// ClickEvent is the constant for "click-event" property tag. // ClickEvent is the constant for "click-event" property tag.
// //
// Used by `View`. // Used by View.
// Occur when the user clicks on the view. // Occur when the user clicks on the view.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.MouseEvent)`. //
// func(view rui.View, event rui.MouseEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Mouse event. // - event - Mouse event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, //
// `func(event rui.MouseEvent)`, // func(view rui.View)
// `func()`. // func(event rui.MouseEvent)
// func()
ClickEvent PropertyName = "click-event" ClickEvent PropertyName = "click-event"
// DoubleClickEvent is the constant for "double-click-event" property tag. // DoubleClickEvent is the constant for "double-click-event" property tag.
// //
// Used by `View`. // Used by View.
// Occur when the user double clicks on the view. // Occur when the user double clicks on the view.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.MouseEvent)`. //
// func(view rui.View, event rui.MouseEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Mouse event. // - event - Mouse event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, //
// `func(event rui.MouseEvent)`, // func(view rui.View)
// `func()`. // func(event rui.MouseEvent)
// func()
DoubleClickEvent PropertyName = "double-click-event" DoubleClickEvent PropertyName = "double-click-event"
// MouseDown is the constant for "mouse-down" property tag. // MouseDown is the constant for "mouse-down" property tag.
// //
// Used by `View`. // Used by View.
// Is fired at a View when a pointing device button is pressed while the pointer is inside the view. // Is fired at a View when a pointing device button is pressed while the pointer is inside the view.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.MouseEvent)`. //
// func(view rui.View, event rui.MouseEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Mouse event. // - event - Mouse event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, //
// `func(event rui.MouseEvent)`, // func(view rui.View)
// `func()`. // func(event rui.MouseEvent)
// func()
MouseDown PropertyName = "mouse-down" MouseDown PropertyName = "mouse-down"
// MouseUp is the constant for "mouse-up" property tag. // MouseUp is the constant for "mouse-up" property tag.
// //
// Used by `View`. // Used by View.
// Is fired at a View when a button on a pointing device (such as a mouse or trackpad) is released while the pointer is // Is fired at a View when a button on a pointing device (such as a mouse or trackpad) is released while the pointer is
// located inside it. "mouse-up" events are the counterpoint to "mouse-down" events. // located inside it. "mouse-up" events are the counterpoint to "mouse-down" events.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.MouseEvent)`. //
// func(view rui.View, event rui.MouseEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Mouse event. // - event - Mouse event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, //
// `func(event rui.MouseEvent)`, // func(view rui.View)
// `func()`. // func(event rui.MouseEvent)
// func()
MouseUp PropertyName = "mouse-up" MouseUp PropertyName = "mouse-up"
// MouseMove is the constant for "mouse-move" property tag. // MouseMove is the constant for "mouse-move" property tag.
// //
// Used by `View`. // Used by View.
// Is fired at a view when a pointing device(usually a mouse) is moved while the cursor's hotspot is inside it. // Is fired at a view when a pointing device(usually a mouse) is moved while the cursor's hotspot is inside it.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.MouseEvent)`. //
// func(view rui.View, event rui.MouseEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Mouse event. // - event - Mouse event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, //
// `func(event rui.MouseEvent)`, // func(view rui.View)
// `func()`. // func(event rui.MouseEvent)
// func()
MouseMove PropertyName = "mouse-move" MouseMove PropertyName = "mouse-move"
// MouseOut is the constant for "mouse-out" property tag. // MouseOut is the constant for "mouse-out" property tag.
// //
// Used by `View`. // Used by View.
// Is fired at a View when a pointing device (usually a mouse) is used to move the cursor so that it is no longer // Is fired at a View when a pointing device (usually a mouse) is used to move the cursor so that it is no longer
// contained within the view or one of its children. "mouse-out" is also delivered to a view if the cursor enters a child // contained within the view or one of its children. "mouse-out" is also delivered to a view if the cursor enters a child
// view, because the child view obscures the visible area of the view. // view, because the child view obscures the visible area of the view.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.MouseEvent)`. //
// func(view rui.View, event rui.MouseEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Mouse event. // - event - Mouse event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, //
// `func(event rui.MouseEvent)`, // func(view rui.View)
// `func()`. // func(event rui.MouseEvent)
// func()
MouseOut PropertyName = "mouse-out" MouseOut PropertyName = "mouse-out"
// MouseOver is the constant for "mouse-over" property tag. // MouseOver is the constant for "mouse-over" property tag.
// //
// Used by `View`. // Used by View.
// Is fired at a View when a pointing device (such as a mouse or trackpad) is used to move the cursor onto the view or one // Is fired at a View when a pointing device (such as a mouse or trackpad) is used to move the cursor onto the view or one
// of its child views. // of its child views.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.MouseEvent)`. //
// func(view rui.View, event rui.MouseEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Mouse event. // - event - Mouse event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, //
// `func(event rui.MouseEvent)`, // func(view rui.View)
// `func()`. // func(event rui.MouseEvent)
// func()
MouseOver PropertyName = "mouse-over" MouseOver PropertyName = "mouse-over"
// ContextMenuEvent is the constant for "context-menu-event" property tag. // ContextMenuEvent is the constant for "context-menu-event" property tag.
// //
// Used by `View`. // Used by View.
// Occur when the user calls the context menu by the right mouse clicking. // Occur when the user calls the context menu by the right mouse clicking.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.MouseEvent)`. //
// func(view rui.View, event rui.MouseEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Mouse event. // - event - Mouse event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(view rui.View)`, //
// `func(event rui.MouseEvent)`, // func(view rui.View)
// `func()`. // func(event rui.MouseEvent)
// func()
ContextMenuEvent PropertyName = "context-menu-event" ContextMenuEvent PropertyName = "context-menu-event"
// PrimaryMouseButton is a number of the main pressed button, usually the left button or the un-initialized state // PrimaryMouseButton is a number of the main pressed button, usually the left button or the un-initialized state

View File

@ -11,84 +11,86 @@ import (
const ( const (
// NumberChangedEvent is the constant for "number-changed" property tag. // NumberChangedEvent is the constant for "number-changed" property tag.
// //
// Used by `NumberPicker`. // Used by NumberPicker.
// Set listener(s) that track the change in the entered value. // Set listener(s) that track the change in the entered value.
// //
// General listener format: // General listener format:
// `func(picker rui.NumberPicker, newValue, oldValue float64)`. //
// func(picker rui.NumberPicker, newValue float64, oldValue float64)
// //
// where: // where:
// picker - Interface of a number picker which generated this event, // - picker - Interface of a number picker which generated this event,
// newValue - New value, // - newValue - New value,
// oldValue - Old Value. // - oldValue - Old Value.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(picker rui.NumberPicker, newValue float64)`, //
// `func(newValue, oldValue float64)`, // func(picker rui.NumberPicker, newValue float64)
// `func(newValue float64)`, // func(newValue float64, oldValue float64)
// `func()`. // func(newValue float64)
// func()
NumberChangedEvent PropertyName = "number-changed" NumberChangedEvent PropertyName = "number-changed"
// NumberPickerType is the constant for "number-picker-type" property tag. // NumberPickerType is the constant for "number-picker-type" property tag.
// //
// Used by `NumberPicker`. // Used by NumberPicker.
// Sets the visual representation. // Sets the visual representation.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NumberEditor`) or "editor" - Displayed as an editor. // - 0 (NumberEditor) or "editor" - Displayed as an editor.
// `1`(`NumberSlider`) or "slider" - Displayed as a slider. // - 1 (NumberSlider) or "slider" - Displayed as a slider.
NumberPickerType PropertyName = "number-picker-type" NumberPickerType PropertyName = "number-picker-type"
// NumberPickerMin is the constant for "number-picker-min" property tag. // NumberPickerMin is the constant for "number-picker-min" property tag.
// //
// Used by `NumberPicker`. // Used by NumberPicker.
// Set the minimum value. The default value is 0. // Set the minimum value. The default value is 0.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
NumberPickerMin PropertyName = "number-picker-min" NumberPickerMin PropertyName = "number-picker-min"
// NumberPickerMax is the constant for "number-picker-max" property tag. // NumberPickerMax is the constant for "number-picker-max" property tag.
// //
// Used by `NumberPicker`. // Used by NumberPicker.
// Set the maximum value. The default value is 1. // Set the maximum value. The default value is 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
NumberPickerMax PropertyName = "number-picker-max" NumberPickerMax PropertyName = "number-picker-max"
// NumberPickerStep is the constant for "number-picker-step" property tag. // NumberPickerStep is the constant for "number-picker-step" property tag.
// //
// Used by `NumberPicker`. // Used by NumberPicker.
// Set the value change step. // Set the value change step.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
NumberPickerStep PropertyName = "number-picker-step" NumberPickerStep PropertyName = "number-picker-step"
// NumberPickerValue is the constant for "number-picker-value" property tag. // NumberPickerValue is the constant for "number-picker-value" property tag.
// //
// Used by `NumberPicker`. // Used by NumberPicker.
// Current value. The default value is 0. // Current value. The default value is 0.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
NumberPickerValue PropertyName = "number-picker-value" NumberPickerValue PropertyName = "number-picker-value"
// NumberPickerValue is the constant for "number-picker-value" property tag. // NumberPickerValue is the constant for "number-picker-value" property tag.
// //
// Used by `NumberPicker`. // Used by NumberPicker.
// Precision of displaying fractional part in editor. The default value is 0 (not used). // Precision of displaying fractional part in editor. The default value is 0 (not used).
// //
// Supported types: `int`, `int8`...`int64`, `uint`, `uint8`...`uint64`, `string`. // Supported types: int, int8...int64, uint, uint8...uint64, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
NumberPickerPrecision PropertyName = "number-picker-precision" NumberPickerPrecision PropertyName = "number-picker-precision"
) )

View File

@ -20,11 +20,10 @@ type outlinePropertyData struct {
} }
// NewOutlineProperty creates the new OutlineProperty. // NewOutlineProperty creates the new OutlineProperty.
//
// The following properties can be used: // The following properties can be used:
// // - "color" (ColorTag) - Determines the line color (Color);
// "color" (ColorTag). Determines the line color (Color); // - "width" (Width) - Determines the line thickness (SizeUnit).
//
// "width" (Width). Determines the line thickness (SizeUnit).
func NewOutlineProperty(params Params) OutlineProperty { func NewOutlineProperty(params Params) OutlineProperty {
outline := new(outlinePropertyData) outline := new(outlinePropertyData)
outline.init() outline.init()

40
path.go
View File

@ -11,44 +11,44 @@ type Path interface {
// ArcTo adds a circular arc to the current sub-path, using the given control points and radius. // ArcTo adds a circular arc to the current sub-path, using the given control points and radius.
// The arc is automatically connected to the path's latest point with a straight line, if necessary. // The arc is automatically connected to the path's latest point with a straight line, if necessary.
// x0, y0 - coordinates of the first control point; // - x0, y0 - coordinates of the first control point;
// x1, y1 - coordinates of the second control point; // - x1, y1 - coordinates of the second control point;
// radius - the arc's radius. Must be non-negative. // - radius - the arc's radius. Must be non-negative.
ArcTo(x0, y0, x1, y1, radius float64) ArcTo(x0, y0, x1, y1, radius float64)
// Arc adds a circular arc to the current sub-path. // Arc adds a circular arc to the current sub-path.
// x, y - coordinates of the arc's center; // - x, y - coordinates of the arc's center;
// radius - the arc's radius. Must be non-negative; // - radius - the arc's radius. Must be non-negative;
// startAngle - the angle at which the arc starts, measured clockwise from the positive // - startAngle - the angle at which the arc starts, measured clockwise from the positive
// x-axis and expressed in radians. // x-axis and expressed in radians.
// endAngle - the angle at which the arc ends, measured clockwise from the positive // - endAngle - the angle at which the arc ends, measured clockwise from the positive
// x-axis and expressed in radians. // x-axis and expressed in radians.
// clockwise - if true, causes the arc to be drawn clockwise between the start and end angles, // - clockwise - if true, causes the arc to be drawn clockwise between the start and end angles,
// otherwise - counter-clockwise // otherwise - counter-clockwise
Arc(x, y, radius, startAngle, endAngle float64, clockwise bool) Arc(x, y, radius, startAngle, endAngle float64, clockwise bool)
// BezierCurveTo adds a cubic Bézier curve to the current sub-path. The starting point is // BezierCurveTo adds a cubic Bézier curve to the current sub-path. The starting point is
// the latest point in the current path. // the latest point in the current path.
// cp0x, cp0y - coordinates of the first control point; // - cp0x, cp0y - coordinates of the first control point;
// cp1x, cp1y - coordinates of the second control point; // - cp1x, cp1y - coordinates of the second control point;
// x, y - coordinates of the end point. // - x, y - coordinates of the end point.
BezierCurveTo(cp0x, cp0y, cp1x, cp1y, x, y float64) BezierCurveTo(cp0x, cp0y, cp1x, cp1y, x, y float64)
// QuadraticCurveTo adds a quadratic Bézier curve to the current sub-path. // QuadraticCurveTo adds a quadratic Bézier curve to the current sub-path.
// cpx, cpy - coordinates of the control point; // - cpx, cpy - coordinates of the control point;
// x, y - coordinates of the end point. // - x, y - coordinates of the end point.
QuadraticCurveTo(cpx, cpy, x, y float64) QuadraticCurveTo(cpx, cpy, x, y float64)
// Ellipse adds an elliptical arc to the current sub-path // Ellipse adds an elliptical arc to the current sub-path
// x, y - coordinates of the ellipse's center; // - x, y - coordinates of the ellipse's center;
// radiusX - the ellipse's major-axis radius. Must be non-negative; // - radiusX - the ellipse's major-axis radius. Must be non-negative;
// radiusY - the ellipse's minor-axis radius. Must be non-negative; // - radiusY - the ellipse's minor-axis radius. Must be non-negative;
// rotation - the rotation of the ellipse, expressed in radians; // - rotation - the rotation of the ellipse, expressed in radians;
// startAngle - the angle at which the ellipse starts, measured clockwise // - startAngle - the angle at which the ellipse starts, measured clockwise
// from the positive x-axis and expressed in radians; // from the positive x-axis and expressed in radians;
// endAngle - the angle at which the ellipse ends, measured clockwise // - endAngle - the angle at which the ellipse ends, measured clockwise
// from the positive x-axis and expressed in radians. // from the positive x-axis and expressed in radians.
// clockwise - if true, draws the ellipse clockwise, otherwise draws counter-clockwise // - clockwise - if true, draws the ellipse clockwise, otherwise draws counter-clockwise
Ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle float64, clockwise bool) Ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle float64, clockwise bool)
// Close adds a straight line from the current point to the start of the current sub-path. // Close adds a straight line from the current point to the start of the current sub-path.

View File

@ -4,114 +4,126 @@ package rui
const ( const (
// PointerDown is the constant for "pointer-down" property tag. // PointerDown is the constant for "pointer-down" property tag.
// //
// Used by `View`. // Used by View.
// Fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons depressed to at // Fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons depressed to at
// least one button depressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is // least one button depressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is
// fired when the stylus makes physical contact with the digitizer. // fired when the stylus makes physical contact with the digitizer.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.PointerEvent)`. //
// func(view rui.View, event rui.PointerEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Pointer event. // - event - Pointer event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(event rui.PointerEvent)`, //
// `func(view rui.View)`, // func(event rui.PointerEvent)
// `func()`. // func(view rui.View)
// func()
PointerDown PropertyName = "pointer-down" PointerDown PropertyName = "pointer-down"
// PointerUp is the constant for "pointer-up" property tag. // PointerUp is the constant for "pointer-up" property tag.
// //
// Used by `View`. // Used by View.
// Is fired when a pointer is no longer active. // Is fired when a pointer is no longer active.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.PointerEvent)`. //
// func(view rui.View, event rui.PointerEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Pointer event. // - event - Pointer event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(event rui.PointerEvent)`, //
// `func(view rui.View)`, // func(event rui.PointerEvent)
// `func()`. // func(view rui.View)
// func()
PointerUp PropertyName = "pointer-up" PointerUp PropertyName = "pointer-up"
// PointerMove is the constant for "pointer-move" property tag. // PointerMove is the constant for "pointer-move" property tag.
// //
// Used by `View`. // Used by View.
// Is fired when a pointer changes coordinates. // Is fired when a pointer changes coordinates.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.PointerEvent)`. //
// func(view rui.View, event rui.PointerEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Pointer event. // - event - Pointer event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(event rui.PointerEvent)`, //
// `func(view rui.View)`, // func(event rui.PointerEvent)
// `func()`. // func(view rui.View)
// func()
PointerMove PropertyName = "pointer-move" PointerMove PropertyName = "pointer-move"
// PointerCancel is the constant for "pointer-cancel" property tag. // PointerCancel is the constant for "pointer-cancel" property tag.
// //
// Used by `View`. // Used by View.
// Is fired if the pointer will no longer be able to generate events (for example the related device is deactivated). // Is fired if the pointer will no longer be able to generate events (for example the related device is deactivated).
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.PointerEvent)`. //
// func(view rui.View, event rui.PointerEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Pointer event. // - event - Pointer event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(event rui.PointerEvent)`, //
// `func(view rui.View)`, // func(event rui.PointerEvent)
// `func()`. // func(view rui.View)
// func()
PointerCancel PropertyName = "pointer-cancel" PointerCancel PropertyName = "pointer-cancel"
// PointerOut is the constant for "pointer-out" property tag. // PointerOut is the constant for "pointer-out" property tag.
// //
// Used by `View`. // Used by View.
// Is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing // Is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing
// the "pointer-up" event for a device that does not support hover (see "pointer-up"); after firing the "pointer-cancel" // the "pointer-up" event for a device that does not support hover (see "pointer-up"); after firing the "pointer-cancel"
// event (see "pointer-cancel"); when a pen stylus leaves the hover range detectable by the digitizer. // event (see "pointer-cancel"); when a pen stylus leaves the hover range detectable by the digitizer.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.PointerEvent)`. //
// func(view rui.View, event rui.PointerEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Pointer event. // - event - Pointer event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(event rui.PointerEvent)`, //
// `func(view rui.View)`, // func(event rui.PointerEvent)
// `func()`. // func(view rui.View)
// func()
PointerOut PropertyName = "pointer-out" PointerOut PropertyName = "pointer-out"
// PointerOver is the constant for "pointer-over" property tag. // PointerOver is the constant for "pointer-over" property tag.
// //
// Used by `View`. // Used by View.
// Is fired when a pointing device is moved into an view's hit test boundaries. // Is fired when a pointing device is moved into an view's hit test boundaries.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.PointerEvent)`. //
// func(view rui.View, event rui.PointerEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Pointer event. // - event - Pointer event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(event rui.PointerEvent)`, //
// `func(view rui.View)`, // func(event rui.PointerEvent)
// `func()`. // func(view rui.View)
// func()
PointerOver PropertyName = "pointer-over" PointerOver PropertyName = "pointer-over"
) )

154
popup.go
View File

@ -9,201 +9,207 @@ import (
const ( const (
// Title is the constant for "title" property tag. // Title is the constant for "title" property tag.
// //
// Used by `Popup`, `TabsLayout`. // Used by Popup, TabsLayout.
// //
// Usage in `Popup`: // Usage in Popup:
// Define the title. // Define the title.
// //
// Supported types: `string`. // Supported types: string.
// //
// Usage in `TabsLayout`: // Usage in TabsLayout:
// Set the title of the tab. The property is set for the child view of `TabsLayout`. // Set the title of the tab. The property is set for the child view of TabsLayout.
// //
// Supported types: `string`. // Supported types: string.
Title = "title" Title = "title"
// TitleStyle is the constant for "title-style" property tag. // TitleStyle is the constant for "title-style" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Set popup title style. Default title style is "ruiPopupTitle". // Set popup title style. Default title style is "ruiPopupTitle".
// //
// Supported types: `string`. // Supported types: string.
TitleStyle PropertyName = "title-style" TitleStyle PropertyName = "title-style"
// CloseButton is the constant for "close-button" property tag. // CloseButton is the constant for "close-button" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Controls whether a close button can be added to the popup. Default value is `false`. // Controls whether a close button can be added to the popup. Default value is false.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - Close button will be added to a title bar of a window. // - true, 1, "true", "yes", "on", "1" - Close button will be added to a title bar of a window.
// `false` or `0` or "false", "no", "off", "0" - Popup without a close button. // - false, 0, "false", "no", "off", "0" - Popup without a close button.
CloseButton PropertyName = "close-button" CloseButton PropertyName = "close-button"
// OutsideClose is the constant for "outside-close" property tag. // OutsideClose is the constant for "outside-close" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Controls whether popup can be closed by clicking outside of the window. Default value is `false`. // Controls whether popup can be closed by clicking outside of the window. Default value is false.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - Clicking outside the popup window will automatically call the `Dismiss()` method. // - true, 1, "true", "yes", "on", "1" - Clicking outside the popup window will automatically call the Dismiss() method.
// `false` or `0` or "false", "no", "off", "0" - Clicking outside the popup window has no effect. // - false, 0, "false", "no", "off", "0" - Clicking outside the popup window has no effect.
OutsideClose PropertyName = "outside-close" OutsideClose PropertyName = "outside-close"
// Buttons is the constant for "buttons" property tag. // Buttons is the constant for "buttons" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Buttons that will be placed at the bottom of the popup. // Buttons that will be placed at the bottom of the popup.
// //
// Supported types: `PopupButton`, `[]PopupButton`. // Supported types: PopupButton, []PopupButton.
// //
// Internal type is `[]PopupButton`, other types converted to it during assignment. // Internal type is []PopupButton, other types converted to it during assignment.
// See `PopupButton` description for more details. // See PopupButton description for more details.
Buttons PropertyName = "buttons" Buttons PropertyName = "buttons"
// ButtonsAlign is the constant for "buttons-align" property tag. // ButtonsAlign is the constant for "buttons-align" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Set the horizontal alignment of popup buttons. // Set the horizontal alignment of popup buttons.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`LeftAlign`) or "left" - Left alignment. // - 0 (LeftAlign) or "left" - Left alignment.
// `1`(`RightAlign`) or "right" - Right alignment. // - 1 (RightAlign) or "right" - Right alignment.
// `2`(`CenterAlign`) or "center" - Center alignment. // - 2 (CenterAlign) or "center" - Center alignment.
// `3`(`StretchAlign`) or "stretch" - Width alignment. // - 3 (StretchAlign) or "stretch" - Width alignment.
ButtonsAlign PropertyName = "buttons-align" ButtonsAlign PropertyName = "buttons-align"
// DismissEvent is the constant for "dismiss-event" property tag. // DismissEvent is the constant for "dismiss-event" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Used to track the closing state of the `Popup`. It occurs after the `Popup` disappears from the screen. // Used to track the closing state of the Popup. It occurs after the Popup disappears from the screen.
// //
// General listener format: // General listener format:
// `func(popup rui.Popup)`. //
// func(popup rui.Popup)
// //
// where: // where:
// popup - Interface of a popup which generated this event. // popup - Interface of a popup which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func()`. //
// func()
DismissEvent PropertyName = "dismiss-event" DismissEvent PropertyName = "dismiss-event"
// Arrow is the constant for "arrow" property tag. // Arrow is the constant for "arrow" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Add an arrow to popup. Default value is "none". // Add an arrow to popup. Default value is "none".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneArrow`) or "none" - No arrow. // - 0 (NoneArrow) or "none" - No arrow.
// `1`(`TopArrow`) or "top" - Arrow at the top side of the pop-up window. // - 1 (TopArrow) or "top" - Arrow at the top side of the pop-up window.
// `2`(`RightArrow`) or "right" - Arrow on the right side of the pop-up window. // - 2 (RightArrow) or "right" - Arrow on the right side of the pop-up window.
// `3`(`BottomArrow`) or "bottom" - Arrow at the bottom of the pop-up window. // - 3 (BottomArrow) or "bottom" - Arrow at the bottom of the pop-up window.
// `4`(`LeftArrow`) or "left" - Arrow on the left side of the pop-up window. // - 4 (LeftArrow) or "left" - Arrow on the left side of the pop-up window.
Arrow PropertyName = "arrow" Arrow PropertyName = "arrow"
// ArrowAlign is the constant for "arrow-align" property tag. // ArrowAlign is the constant for "arrow-align" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Set the horizontal alignment of the popup arrow. Default value is "center". // Set the horizontal alignment of the popup arrow. Default value is "center".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`TopAlign`/`LeftAlign`) or "top" - Top/left alignment. // - 0 (TopAlign/LeftAlign) or "top" - Top/left alignment.
// `1`(`BottomAlign`/`RightAlign`) or "bottom" - Bottom/right alignment. // - 1 (BottomAlign/RightAlign) or "bottom" - Bottom/right alignment.
// `2`(`CenterAlign`) or "center" - Center alignment. // - 2 (CenterAlign) or "center" - Center alignment.
ArrowAlign PropertyName = "arrow-align" ArrowAlign PropertyName = "arrow-align"
// ArrowSize is the constant for "arrow-size" property tag. // ArrowSize is the constant for "arrow-size" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Set the size(length) of the popup arrow. Default value is 16px defined by @ruiArrowSize constant. // Set the size(length) of the popup arrow. Default value is 16px defined by @ruiArrowSize constant.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
ArrowSize PropertyName = "arrow-size" ArrowSize PropertyName = "arrow-size"
// ArrowWidth is the constant for "arrow-width" property tag. // ArrowWidth is the constant for "arrow-width" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Set the width of the popup arrow. Default value is 16px defined by @ruiArrowWidth constant. // Set the width of the popup arrow. Default value is 16px defined by @ruiArrowWidth constant.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
ArrowWidth PropertyName = "arrow-width" ArrowWidth PropertyName = "arrow-width"
// ShowTransform is the constant for "show-transform" property tag. // ShowTransform is the constant for "show-transform" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Specify start translation, scale and rotation over x, y and z axes as well as a distortion // Specify start translation, scale and rotation over x, y and z axes as well as a distortion
// for an animated Popup showing/hidding. // for an animated Popup showing/hidding.
// //
// Supported types: `TransformProperty`, `string`. // Supported types: TransformProperty, string.
// //
// See `TransformProperty` description for more details. // See TransformProperty description for more details.
// //
// Conversion rules: // Conversion rules:
// `TransformProperty` - stored as is, no conversion performed. // - TransformProperty - stored as is, no conversion performed.
// `string` - string representation of `Transform` interface. Example: "_{translate-x = 10px, scale-y = 1.1}". // - string - string representation of Transform interface. Example:
//
// "_{ translate-x = 10px, scale-y = 1.1}"
ShowTransform = "show-transform" ShowTransform = "show-transform"
// ShowDuration is the constant for "show-duration" property tag. // ShowDuration is the constant for "show-duration" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Sets the length of time in seconds that a Popup show/hide animation takes to complete. // Sets the length of time in seconds that a Popup show/hide animation takes to complete.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
ShowDuration = "show-duration" ShowDuration = "show-duration"
// ShowTiming is the constant for "show-timing" property tag. // ShowTiming is the constant for "show-timing" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Set how a Popup show/hide animation progresses through the duration of each cycle. // Set how a Popup show/hide animation progresses through the duration of each cycle.
// //
// Supported types: `string`. // Supported types: string.
// //
// Values: // Values:
// "ease"(`EaseTiming`) - Speed increases towards the middle and slows down at the end. // - "ease" (EaseTiming) - Speed increases towards the middle and slows down at the end.
// "ease-in"(`EaseInTiming`) - Speed is slow at first, but increases in the end. // - "ease-in" (EaseInTiming) - Speed is slow at first, but increases in the end.
// "ease-out"(`EaseOutTiming`) - Speed is fast at first, but decreases in the end. // - "ease-out" (EaseOutTiming) - Speed is fast at first, but decreases in the end.
// "ease-in-out"(`EaseInOutTiming`) - Speed is slow at first, but quickly increases and at the end it decreases again. // - "ease-in-out" (EaseInOutTiming) - Speed is slow at first, but quickly increases and at the end it decreases again.
// "linear"(`LinearTiming`) - Constant speed. // - "linear" (LinearTiming) - Constant speed.
// - "step(n)" (StepTiming(n int) function) - Timing function along stepCount stops along the transition, displaying each stop for equal lengths of time.
// - "cubic-bezier(x1, y1, x2, y2)" (CubicBezierTiming(x1, y1, x2, y2 float64) function) - Cubic-Bezier curve timing function. x1 and x2 must be in the range [0, 1].
ShowTiming = "show-timing" ShowTiming = "show-timing"
// ShowOpacity is the constant for "show-opacity" property tag. // ShowOpacity is the constant for "show-opacity" property tag.
// //
// Used by `Popup`. // Used by Popup.
// In [1..0] range sets the start opacity of Popup show animation (the finish animation opacity is 1). // In [1..0] range sets the start opacity of Popup show animation (the finish animation opacity is 1).
// Opacity is the degree to which content behind the view is hidden, and is the opposite of transparency. // Opacity is the degree to which content behind the view is hidden, and is the opposite of transparency.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
ShowOpacity = "show-opacity" ShowOpacity = "show-opacity"
// ArrowOffset is the constant for "arrow-offset" property tag. // ArrowOffset is the constant for "arrow-offset" property tag.
// //
// Used by `Popup`. // Used by Popup.
// Set the offset of the popup arrow. // Set the offset of the popup arrow.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
ArrowOffset PropertyName = "arrow-offset" ArrowOffset PropertyName = "arrow-offset"
// NoneArrow is value of the popup "arrow" property: no arrow // NoneArrow is value of the popup "arrow" property: no arrow

View File

@ -17,7 +17,9 @@ func ShowMessage(title, text string, session Session) {
} }
// ShowQuestion displays a message with the given title and text and two buttons "Yes" and "No". // ShowQuestion displays a message with the given title and text and two buttons "Yes" and "No".
//
// When the "Yes" button is clicked, the message is closed and the onYes function is called (if it is not nil). // When the "Yes" button is clicked, the message is closed and the onYes function is called (if it is not nil).
//
// When the "No" button is pressed, the message is closed and the onNo function is called (if it is not nil). // When the "No" button is pressed, the message is closed and the onNo function is called (if it is not nil).
func ShowQuestion(title, text string, session Session, onYes func(), onNo func()) { func ShowQuestion(title, text string, session Session, onYes func(), onNo func()) {
textView := NewTextView(session, Params{ textView := NewTextView(session, Params{
@ -57,6 +59,7 @@ func ShowQuestion(title, text string, session Session, onYes func(), onNo func()
} }
// ShowCancellableQuestion displays a message with the given title and text and three buttons "Yes", "No" and "Cancel". // ShowCancellableQuestion displays a message with the given title and text and three buttons "Yes", "No" and "Cancel".
//
// When the "Yes", "No" or "Cancel" button is pressed, the message is closed and the onYes, onNo or onCancel function // When the "Yes", "No" or "Cancel" button is pressed, the message is closed and the onYes, onNo or onCancel function
// (if it is not nil) is called, respectively. // (if it is not nil) is called, respectively.
func ShowCancellableQuestion(title, text string, session Session, onYes func(), onNo func(), onCancel func()) { func ShowCancellableQuestion(title, text string, session Session, onYes func(), onNo func(), onCancel func()) {

View File

@ -9,22 +9,22 @@ import (
const ( const (
// ProgressBarMax is the constant for "progress-max" property tag. // ProgressBarMax is the constant for "progress-max" property tag.
// //
// Used by `ProgressBar`. // Used by ProgressBar.
// Maximum value, default is 1. // Maximum value, default is 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
ProgressBarMax PropertyName = "progress-max" ProgressBarMax PropertyName = "progress-max"
// ProgressBarValue is the constant for "progress-value" property tag. // ProgressBarValue is the constant for "progress-value" property tag.
// //
// Used by `ProgressBar`. // Used by ProgressBar.
// Current value, default is 0. // Current value, default is 0.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
ProgressBarValue PropertyName = "progress-value" ProgressBarValue PropertyName = "progress-value"
) )

File diff suppressed because it is too large Load Diff

View File

@ -149,9 +149,9 @@ const (
WhiteSpacePreLine = 4 WhiteSpacePreLine = 4
// WhiteSpaceBreakSpaces - the behavior is identical to that of WhiteSpacePreWrap, except that: // WhiteSpaceBreakSpaces - the behavior is identical to that of WhiteSpacePreWrap, except that:
// * Any sequence of preserved white space always takes up space, including at the end of the line. // - Any sequence of preserved white space always takes up space, including at the end of the line.
// * A line breaking opportunity exists after every preserved white space character, including between white space characters. // - A line breaking opportunity exists after every preserved white space character, including between white space characters.
// * Such preserved spaces take up space and do not hang, and thus affect the boxs intrinsic sizes (min-content size and max-content size). // - Such preserved spaces take up space and do not hang, and thus affect the boxs intrinsic sizes (min-content size and max-content size).
WhiteSpaceBreakSpaces = 5 WhiteSpaceBreakSpaces = 5
// WordBreakNormal - use the default line break rule. // WordBreakNormal - use the default line break rule.

342
radius.go
View File

@ -9,382 +9,382 @@ import (
const ( const (
// Radius is the constant for "radius" property tag. // Radius is the constant for "radius" property tag.
// //
// Used by `View`, `BackgroundElement`, `ClipShape`. // Used by View, BackgroundElement, ClipShape.
// //
// Usage in `View`: // Usage in View:
// Specifies the corners rounding radius of an element's outer border edge. // Specifies the corners rounding radius of an element's outer border edge.
// //
// Supported types: `RadiusProperty`, `SizeUnit`, `SizeFunc`, `BoxRadius`, `string`, `float`, `int`. // Supported types: RadiusProperty, SizeUnit, SizeFunc, BoxRadius, string, float, int.
// //
// Internal type is either `RadiusProperty` or `SizeUnit`, other types converted to them during assignment. // Internal type is either RadiusProperty or SizeUnit, other types converted to them during assignment.
// See `RadiusProperty`, `SizeUnit`, `SizeFunc` and `BoxRadius` description for more details. // See RadiusProperty, SizeUnit, SizeFunc and BoxRadius description for more details.
// //
// Conversion rules: // Conversion rules:
// `RadiusProperty` - stored as is, no conversion performed. // - RadiusProperty - stored as is, no conversion performed.
// `SizeUnit` - stored as is and set all corners to have the same value. // - SizeUnit - stored as is and set all corners to have the same value.
// `BoxRadius` - a new `RadiusProperty` will be created and all corresponding elliptical radius values will be set. // - BoxRadius - a new RadiusProperty will be created and all corresponding elliptical radius values will be set.
// `string` - if one value will be provided then it will be set as a radius for all corners. If two values will be provided divided by (`/`) then x and y radius will be set for all corners. Examples: "1em", "1em/0.5em", "2/4". Values which doesn't have size prefix will use size in pixels by default. // - string - if one value will be provided then it will be set as a radius for all corners. If two values will be provided divided by (/) then x and y radius will be set for all corners. Examples: "1em", "1em/0.5em", "2/4". Values which doesn't have size prefix will use size in pixels by default.
// `float` - values of this type will set radius for all corners in pixels. // - float - values of this type will set radius for all corners in pixels.
// `int` - values of this type will set radius for all corners in pixels. // - int - values of this type will set radius for all corners in pixels.
// //
// Usage in `BackgroundElement`: // Usage in BackgroundElement:
// Same as "radial-gradient-radius". // Same as "radial-gradient-radius".
// //
// Usage in `ClipShape`: // Usage in ClipShape:
// Specifies the radius of the corners or the radius of the cropping area. // Specifies the radius of the corners or the radius of the cropping area.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
Radius PropertyName = "radius" Radius PropertyName = "radius"
// RadiusX is the constant for "radius-x" property tag. // RadiusX is the constant for "radius-x" property tag.
// //
// Used by `View`, `ClipShape`. // Used by View, ClipShape.
// //
// Usage in `View`: // Usage in View:
// Specifies the x-axis corners elliptic rounding radius of an element's outer border edge. // Specifies the x-axis corners elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
// //
// Usage in `ClipShape`: // Usage in ClipShape:
// Specifies the x-axis corners elliptic rounding radius of the elliptic clip shape. // Specifies the x-axis corners elliptic rounding radius of the elliptic clip shape.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusX PropertyName = "radius-x" RadiusX PropertyName = "radius-x"
// RadiusY is the constant for "radius-y" property tag. // RadiusY is the constant for "radius-y" property tag.
// //
// Used by `View`, `ClipShape`. // Used by View, ClipShape.
// //
// Usage in `View`: // Usage in View:
// Specifies the y-axis corners elliptic rounding radius of an element's outer border edge. // Specifies the y-axis corners elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
// //
// Usage in `ClipShape`: // Usage in ClipShape:
// Specifies the y-axis corners elliptic rounding radius of of the elliptic clip shape. // Specifies the y-axis corners elliptic rounding radius of of the elliptic clip shape.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusY PropertyName = "radius-y" RadiusY PropertyName = "radius-y"
// RadiusTopLeft is the constant for "radius-top-left" property tag. // RadiusTopLeft is the constant for "radius-top-left" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the top-left corner rounding radius of an element's outer border edge. // Specifies the top-left corner rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusTopLeft PropertyName = "radius-top-left" RadiusTopLeft PropertyName = "radius-top-left"
// RadiusTopLeftX is the constant for "radius-top-left-x" property tag. // RadiusTopLeftX is the constant for "radius-top-left-x" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the x-axis top-left corner elliptic rounding radius of an element's outer border edge. // Specifies the x-axis top-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusTopLeftX PropertyName = "radius-top-left-x" RadiusTopLeftX PropertyName = "radius-top-left-x"
// RadiusTopLeftY is the constant for "radius-top-left-y" property tag. // RadiusTopLeftY is the constant for "radius-top-left-y" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the y-axis top-left corner elliptic rounding radius of an element's outer border edge. // Specifies the y-axis top-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusTopLeftY PropertyName = "radius-top-left-y" RadiusTopLeftY PropertyName = "radius-top-left-y"
// RadiusTopRight is the constant for "radius-top-right" property tag. // RadiusTopRight is the constant for "radius-top-right" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the top-right corner rounding radius of an element's outer border edge. // Specifies the top-right corner rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusTopRight PropertyName = "radius-top-right" RadiusTopRight PropertyName = "radius-top-right"
// RadiusTopRightX is the constant for "radius-top-right-x" property tag. // RadiusTopRightX is the constant for "radius-top-right-x" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the x-axis top-right corner elliptic rounding radius of an element's outer border edge. // Specifies the x-axis top-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusTopRightX PropertyName = "radius-top-right-x" RadiusTopRightX PropertyName = "radius-top-right-x"
// RadiusTopRightY is the constant for "radius-top-right-y" property tag. // RadiusTopRightY is the constant for "radius-top-right-y" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the y-axis top-right corner elliptic rounding radius of an element's outer border edge. // Specifies the y-axis top-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusTopRightY PropertyName = "radius-top-right-y" RadiusTopRightY PropertyName = "radius-top-right-y"
// RadiusBottomLeft is the constant for "radius-bottom-left" property tag. // RadiusBottomLeft is the constant for "radius-bottom-left" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the bottom-left corner rounding radius of an element's outer border edge. // Specifies the bottom-left corner rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusBottomLeft PropertyName = "radius-bottom-left" RadiusBottomLeft PropertyName = "radius-bottom-left"
// RadiusBottomLeftX is the constant for "radius-bottom-left-x" property tag. // RadiusBottomLeftX is the constant for "radius-bottom-left-x" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the x-axis bottom-left corner elliptic rounding radius of an element's outer border edge. // Specifies the x-axis bottom-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusBottomLeftX PropertyName = "radius-bottom-left-x" RadiusBottomLeftX PropertyName = "radius-bottom-left-x"
// RadiusBottomLeftY is the constant for "radius-bottom-left-y" property tag. // RadiusBottomLeftY is the constant for "radius-bottom-left-y" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the y-axis bottom-left corner elliptic rounding radius of an element's outer border edge. // Specifies the y-axis bottom-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusBottomLeftY PropertyName = "radius-bottom-left-y" RadiusBottomLeftY PropertyName = "radius-bottom-left-y"
// RadiusBottomRight is the constant for "radius-bottom-right" property tag. // RadiusBottomRight is the constant for "radius-bottom-right" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the bottom-right corner rounding radius of an element's outer border edge. // Specifies the bottom-right corner rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusBottomRight PropertyName = "radius-bottom-right" RadiusBottomRight PropertyName = "radius-bottom-right"
// RadiusBottomRightX is the constant for "radius-bottom-right-x" property tag. // RadiusBottomRightX is the constant for "radius-bottom-right-x" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the x-axis bottom-right corner elliptic rounding radius of an element's outer border edge. // Specifies the x-axis bottom-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusBottomRightX PropertyName = "radius-bottom-right-x" RadiusBottomRightX PropertyName = "radius-bottom-right-x"
// RadiusBottomRightY is the constant for "radius-bottom-right-y" property tag. // RadiusBottomRightY is the constant for "radius-bottom-right-y" property tag.
// //
// Used by `View`. // Used by View.
// Specifies the y-axis bottom-right corner elliptic rounding radius of an element's outer border edge. // Specifies the y-axis bottom-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
RadiusBottomRightY PropertyName = "radius-bottom-right-y" RadiusBottomRightY PropertyName = "radius-bottom-right-y"
// X is the constant for "x" property tag. // X is the constant for "x" property tag.
// //
// Used by `ClipShape`, `RadiusProperty`. // Used by ClipShape, RadiusProperty.
// //
// Usage in `ClipShape`: // Usage in ClipShape:
// Specifies x-axis position of the clip shape. // Specifies x-axis position of the clip shape.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
// //
// Usage in `RadiusProperty`: // Usage in RadiusProperty:
// Determines the x-axis elliptic rounding radius of an element's outer border edge. // Determines the x-axis elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
X PropertyName = "x" X PropertyName = "x"
// Y is the constant for "y" property tag. // Y is the constant for "y" property tag.
// //
// Used by `ClipShape`, `RadiusProperty`. // Used by ClipShape, RadiusProperty.
// //
// Usage in `ClipShape`: // Usage in ClipShape:
// Specifies y-axis position of the clip shape. // Specifies y-axis position of the clip shape.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
// //
// Usage in `RadiusProperty`: // Usage in RadiusProperty:
// Determines the y-axis elliptic rounding radius of an element's outer border edge. // Determines the y-axis elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
Y PropertyName = "y" Y PropertyName = "y"
// TopLeft is the constant for "top-left" property tag. // TopLeft is the constant for "top-left" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the top-left corner rounding radius of an element's outer border edge. // Determines the top-left corner rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
TopLeft PropertyName = "top-left" TopLeft PropertyName = "top-left"
// TopLeftX is the constant for "top-left-x" property tag. // TopLeftX is the constant for "top-left-x" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the x-axis top-left corner elliptic rounding radius of an element's outer border edge. // Determines the x-axis top-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
TopLeftX PropertyName = "top-left-x" TopLeftX PropertyName = "top-left-x"
// TopLeftY is the constant for "top-left-y" property tag. // TopLeftY is the constant for "top-left-y" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the y-axis top-left corner elliptic rounding radius of an element's outer border edge. // Determines the y-axis top-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
TopLeftY PropertyName = "top-left-y" TopLeftY PropertyName = "top-left-y"
// TopRight is the constant for "top-right" property tag. // TopRight is the constant for "top-right" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the top-right corner rounding radius of an element's outer border edge. // Determines the top-right corner rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
TopRight PropertyName = "top-right" TopRight PropertyName = "top-right"
// TopRightX is the constant for "top-right-x" property tag. // TopRightX is the constant for "top-right-x" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the x-axis top-right corner elliptic rounding radius of an element's outer border edge. // Determines the x-axis top-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
TopRightX PropertyName = "top-right-x" TopRightX PropertyName = "top-right-x"
// TopRightY is the constant for "top-right-y" property tag. // TopRightY is the constant for "top-right-y" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the y-axis top-right corner elliptic rounding radius of an element's outer border edge. // Determines the y-axis top-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
TopRightY PropertyName = "top-right-y" TopRightY PropertyName = "top-right-y"
// BottomLeft is the constant for "bottom-left" property tag. // BottomLeft is the constant for "bottom-left" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the bottom-left corner rounding radius of an element's outer border edge. // Determines the bottom-left corner rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
BottomLeft PropertyName = "bottom-left" BottomLeft PropertyName = "bottom-left"
// BottomLeftX is the constant for "bottom-left-x" property tag. // BottomLeftX is the constant for "bottom-left-x" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the x-axis bottom-left corner elliptic rounding radius of an element's outer border edge. // Determines the x-axis bottom-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
BottomLeftX PropertyName = "bottom-left-x" BottomLeftX PropertyName = "bottom-left-x"
// BottomLeftY is the constant for "bottom-left-y" property tag. // BottomLeftY is the constant for "bottom-left-y" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the y-axis bottom-left corner elliptic rounding radius of an element's outer border edge. // Determines the y-axis bottom-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
BottomLeftY PropertyName = "bottom-left-y" BottomLeftY PropertyName = "bottom-left-y"
// BottomRight is the constant for "bottom-right" property tag. // BottomRight is the constant for "bottom-right" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the bottom-right corner rounding radius of an element's outer border edge. // Determines the bottom-right corner rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
BottomRight PropertyName = "bottom-right" BottomRight PropertyName = "bottom-right"
// BottomRightX is the constant for "bottom-right-x" property tag. // BottomRightX is the constant for "bottom-right-x" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the x-axis bottom-right corner elliptic rounding radius of an element's outer border edge. // Determines the x-axis bottom-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
BottomRightX PropertyName = "bottom-right-x" BottomRightX PropertyName = "bottom-right-x"
// BottomRightY is the constant for "bottom-right-y" property tag. // BottomRightY is the constant for "bottom-right-y" property tag.
// //
// Used by `RadiusProperty`. // Used by RadiusProperty.
// Determines the y-axis bottom-right corner elliptic rounding radius of an element's outer border edge. // Determines the y-axis bottom-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
BottomRightY PropertyName = "bottom-right-y" BottomRightY PropertyName = "bottom-right-y"
) )
@ -403,35 +403,22 @@ type radiusPropertyData struct {
} }
// NewRadiusProperty creates the new RadiusProperty // NewRadiusProperty creates the new RadiusProperty
//
// The following properties can be used: // The following properties can be used:
// // - "x" (X) - Determines the x-axis elliptic rounding radius of an element's outer border edge.
// "x" (X) - Determines the x-axis elliptic rounding radius of an element's outer border edge. // - "y" (Y) - Determines the y-axis corner elliptic rounding radius of an element's outer border edge.
// // - "top-left" (TopLeft) - Determines the top-left corner rounding radius of an element's outer border edge.
// "y" (Y) - Determines the y-axis corner elliptic rounding radius of an element's outer border edge. // - "top-left-x" (TopLeftX) - Determines the x-axis top-left corner elliptic rounding radius of an element's outer border edge.
// // - "top-left-y" (TopLeftY) - Determines the y-axis top-left corner elliptic rounding radius of an element's outer border edge.
// "top-left" (TopLeft) - Determines the top-left corner rounding radius of an element's outer border edge. // - "top-right" (TopRight) - Determines the top-right corner rounding radius of an element's outer border edge.
// // - "top-right-x" (TopRightX) - Determines the x-axis top-right corner elliptic rounding radius of an element's outer border edge.
// "top-left-x" (TopLeftX) - Determines the x-axis top-left corner elliptic rounding radius of an element's outer border edge. // - "top-right-y" (TopRightY) - Determines the y-axis top-right corner elliptic rounding radius of an element's outer border edge.
// // - "bottom-left" (BottomLeft) - Determines the bottom-left corner rounding radius of an element's outer border edge.
// "top-left-y" (TopLeftY) - Determines the y-axis top-left corner elliptic rounding radius of an element's outer border edge. // - "bottom-left-x" (BottomLeftX) - Determines the x-axis bottom-left corner elliptic rounding radius of an element's outer border edge.
// // - "bottom-left-y" (BottomLeftY) - Determines the y-axis bottom-left corner elliptic rounding radius of an element's outer border edge.
// "top-right" (TopRight) - Determines the top-right corner rounding radius of an element's outer border edge. // - "bottom-right" (BottomRight) - Determines the bottom-right corner rounding radius of an element's outer border edge.
// // - "bottom-right-x" (BottomRightX) - Determines the x-axis bottom-right corner elliptic rounding radius of an element's outer border edge.
// "top-right-x" (TopRightX) - Determines the x-axis top-right corner elliptic rounding radius of an element's outer border edge. // - "bottom-right-y" (BottomRightY) - Determines the y-axis bottom-right corner elliptic rounding radius of an element's outer border edge.
//
// "top-right-y" (TopRightY) - Determines the y-axis top-right corner elliptic rounding radius of an element's outer border edge.
//
// "bottom-left" (BottomLeft) - Determines the bottom-left corner rounding radius of an element's outer border edge.
//
// "bottom-left-x" (BottomLeftX) - Determines the x-axis bottom-left corner elliptic rounding radius of an element's outer border edge.
//
// "bottom-left-y" (BottomLeftY) - Determines the y-axis bottom-left corner elliptic rounding radius of an element's outer border edge.
//
// "bottom-right" (BottomRight) - Determines the bottom-right corner rounding radius of an element's outer border edge.
//
// "bottom-right-x" (BottomRightX) - Determines the x-axis bottom-right corner elliptic rounding radius of an element's outer border edge.
//
// "bottom-right-y" (BottomRightY) - Determines the y-axis bottom-right corner elliptic rounding radius of an element's outer border edge.
func NewRadiusProperty(params Params) RadiusProperty { func NewRadiusProperty(params Params) RadiusProperty {
result := new(radiusPropertyData) result := new(radiusPropertyData)
result.init() result.init()
@ -447,6 +434,7 @@ func NewRadiusProperty(params Params) RadiusProperty {
} }
// NewRadiusProperty creates the new RadiusProperty which having the same elliptical radii for all angles. // NewRadiusProperty creates the new RadiusProperty which having the same elliptical radii for all angles.
//
// Arguments determines the x- and y-axis elliptic rounding radius. if an argument is specified as int or float64, the value is considered to be in pixels // Arguments determines the x- and y-axis elliptic rounding radius. if an argument is specified as int or float64, the value is considered to be in pixels
func NewEllipticRadius[xType SizeUnit | int | float64, yType SizeUnit | int | float64](x xType, y yType) RadiusProperty { func NewEllipticRadius[xType SizeUnit | int | float64, yType SizeUnit | int | float64](x xType, y yType) RadiusProperty {
return NewRadiusProperty(Params{ return NewRadiusProperty(Params{
@ -456,7 +444,9 @@ func NewEllipticRadius[xType SizeUnit | int | float64, yType SizeUnit | int | fl
} }
// NewRadius creates the new RadiusProperty. // NewRadius creates the new RadiusProperty.
//
// The arguments specify the radii in a clockwise direction: "top-right", "bottom-right", "bottom-left", and "top-left". // The arguments specify the radii in a clockwise direction: "top-right", "bottom-right", "bottom-left", and "top-left".
//
// if an argument is specified as int or float64, the value is considered to be in pixels // if an argument is specified as int or float64, the value is considered to be in pixels
func NewRadii[topRightType SizeUnit | int | float64, bottomRightType SizeUnit | int | float64, bottomLeftType SizeUnit | int | float64, topLeftType SizeUnit | int | float64]( func NewRadii[topRightType SizeUnit | int | float64, bottomRightType SizeUnit | int | float64, bottomLeftType SizeUnit | int | float64, topLeftType SizeUnit | int | float64](
topRight topRightType, bottomRight bottomRightType, bottomLeft bottomLeftType, topLeft topLeftType) RadiusProperty { topRight topRightType, bottomRight bottomRightType, bottomLeft bottomLeftType, topLeft topLeftType) RadiusProperty {

View File

@ -10,29 +10,29 @@ import (
const ( const (
// Side is the constant for "side" property tag. // Side is the constant for "side" property tag.
// //
// Used by `Resizable`. // Used by Resizable.
// Determines which side of the container is used to resize. The value of property is an or-combination of values listed. // Determines which side of the container is used to resize. The value of property is an or-combination of values listed.
// Default value is "all". // Default value is "all".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `1`(`TopSide`) or "top" - Top frame side. // - 1 (TopSide) or "top" - Top frame side.
// `2`(`RightSide`) or "right" - Right frame side. // - 2 (RightSide) or "right" - Right frame side.
// `4`(`BottomSide`) or "bottom" - Bottom frame side. // - 4 (BottomSide) or "bottom" - Bottom frame side.
// `8`(`LeftSide`) or "left" - Left frame side. // - 8 (LeftSide) or "left" - Left frame side.
// `15`(`AllSides`) or "all" - All frame sides. // - 15 (AllSides) or "all" - All frame sides.
Side = "side" Side = "side"
// ResizeBorderWidth is the constant for "resize-border-width" property tag. // ResizeBorderWidth is the constant for "resize-border-width" property tag.
// //
// Used by `Resizable`. // Used by Resizable.
// Specifies the width of the resizing border. // Specifies the width of the resizing border.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
ResizeBorderWidth = "resize-border-width" ResizeBorderWidth = "resize-border-width"
) )

View File

@ -2,20 +2,22 @@ package rui
// ResizeEvent is the constant for "resize-event" property tag. // ResizeEvent is the constant for "resize-event" property tag.
// //
// Used by `View`. // Used by View.
// Is fired when the view changes its size. // Is fired when the view changes its size.
// //
// General listener format: // General listener format:
// `func(view rui.View, frame rui.Frame)`. //
// func(view rui.View, frame rui.Frame)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// frame - New offset and size of the view's visible area. // - frame - New offset and size of the view's visible area.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(frame rui.Frame)`, //
// `func(view rui.View)`, // func(frame rui.Frame)
// `func()`. // func(view rui.View)
// func()
const ResizeEvent PropertyName = "resize-event" const ResizeEvent PropertyName = "resize-event"
func (view *viewData) onResize(self View, x, y, width, height float64) { func (view *viewData) onResize(self View, x, y, width, height float64) {

View File

@ -2,20 +2,22 @@ package rui
// ScrollEvent is the constant for "scroll-event" property tag. // ScrollEvent is the constant for "scroll-event" property tag.
// //
// Used by `View`. // Used by View.
// Is fired when the content of the view is scrolled. // Is fired when the content of the view is scrolled.
// //
// General listener format: // General listener format:
// `func(view rui.View, frame rui.Frame)`. //
// func(view rui.View, frame rui.Frame)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// frame - New offset and size of the view's visible area. // - frame - New offset and size of the view's visible area.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(frame rui.Frame)`, //
// `func(view rui.View)`, // func(frame rui.Frame)
// `func()`. // func(view rui.View)
// func()
const ScrollEvent PropertyName = "scroll-event" const ScrollEvent PropertyName = "scroll-event"
func (view *viewData) onScroll(self View, x, y, width, height float64) { func (view *viewData) onScroll(self View, x, y, width, height float64) {

130
shadow.go
View File

@ -9,97 +9,101 @@ import (
const ( const (
// ColorTag is the constant for "color" property tag. // ColorTag is the constant for "color" property tag.
// //
// Used by `ColumnSeparatorProperty`, `BorderProperty`, `OutlineProperty`, `ShadowProperty`. // Used by ColumnSeparatorProperty, BorderProperty, OutlineProperty, ShadowProperty.
//
// # Usage in ColumnSeparatorProperty
// //
// Usage in `ColumnSeparatorProperty`:
// Line color. // Line color.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See Color description for more details.
//
// # Usage in BorderProperty
// //
// Usage in `BorderProperty`:
// Border line color. // Border line color.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See Color description for more details.
//
// # Usage in OutlineProperty
// //
// Usage in `OutlineProperty`:
// Outline line color. // Outline line color.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See Color description for more details.
//
// # Usage in ShadowProperty
// //
// Usage in `ShadowProperty`:
// Color property of the shadow. // Color property of the shadow.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See Color description for more details.
ColorTag PropertyName = "color" ColorTag PropertyName = "color"
// Inset is the constant for "inset" property tag. // Inset is the constant for "inset" property tag.
// //
// Used by `ShadowProperty`. // Used by ShadowProperty.
// Controls whether to draw shadow inside the frame or outside. Inset shadows are drawn inside the border(even transparent // Controls whether to draw shadow inside the frame or outside. Inset shadows are drawn inside the border(even transparent
// ones), above the background, but below content. // ones), above the background, but below content.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - Drop shadow inside the frame(as if the content was depressed inside the box). // - true, 1, "true", "yes", "on", "1" - Drop shadow inside the frame(as if the content was depressed inside the box).
// `false` or `0` or "false", "no", "off", "0" - Shadow is assumed to be a drop shadow(as if the box were raised above the content). // - false, 0, "false", "no", "off", "0" - Shadow is assumed to be a drop shadow(as if the box were raised above the content).
Inset PropertyName = "inset" Inset PropertyName = "inset"
// XOffset is the constant for "x-offset" property tag. // XOffset is the constant for "x-offset" property tag.
// //
// Used by `ShadowProperty`. // Used by ShadowProperty.
// Determines the shadow horizontal offset. Negative values place the shadow to the left of the element. // Determines the shadow horizontal offset. Negative values place the shadow to the left of the element.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
XOffset PropertyName = "x-offset" XOffset PropertyName = "x-offset"
// YOffset is the constant for "y-offset" property tag. // YOffset is the constant for "y-offset" property tag.
// //
// Used by `ShadowProperty`. // Used by ShadowProperty.
// Determines the shadow vertical offset. Negative values place the shadow above the element. // Determines the shadow vertical offset. Negative values place the shadow above the element.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
YOffset PropertyName = "y-offset" YOffset PropertyName = "y-offset"
// BlurRadius is the constant for "blur" property tag. // BlurRadius is the constant for "blur" property tag.
// //
// Used by `ShadowProperty`. // Used by ShadowProperty.
// Determines the radius of the blur effect. The larger this value, the bigger the blur, so the shadow becomes bigger and // Determines the radius of the blur effect. The larger this value, the bigger the blur, so the shadow becomes bigger and
// lighter. Negative values are not allowed. // lighter. Negative values are not allowed.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
BlurRadius PropertyName = "blur" BlurRadius PropertyName = "blur"
// SpreadRadius is the constant for "spread-radius" property tag. // SpreadRadius is the constant for "spread-radius" property tag.
// //
// Used by `ShadowProperty`. // Used by ShadowProperty.
// Positive values will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink. // Positive values will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
SpreadRadius PropertyName = "spread-radius" SpreadRadius PropertyName = "spread-radius"
) )
@ -118,14 +122,10 @@ type shadowPropertyData struct {
} }
// NewShadow create the new shadow property for a view. Arguments: // NewShadow create the new shadow property for a view. Arguments:
// // - offsetX, offsetY is x and y offset of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels);
// offsetX, offsetY is x and y offset of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels); // - blurRadius is the blur radius of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels);
// // - spreadRadius is the spread radius of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels);
// blurRadius is the blur radius of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels); // - color is the color of the shadow.
//
// spreadRadius is the spread radius of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels);
//
// color is the color of the shadow.
func NewShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit | int | float64, blurType SizeUnit | int | float64, spreadType SizeUnit | int | float64]( func NewShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit | int | float64, blurType SizeUnit | int | float64, spreadType SizeUnit | int | float64](
xOffset xOffsetType, yOffset yOffsetType, blurRadius blurType, spreadRadius spreadType, color Color) ShadowProperty { xOffset xOffsetType, yOffset yOffsetType, blurRadius blurType, spreadRadius spreadType, color Color) ShadowProperty {
return NewShadowProperty(Params{ return NewShadowProperty(Params{
@ -138,14 +138,10 @@ func NewShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit | int
} }
// NewInsetShadow create the new inset shadow property for a view. Arguments: // NewInsetShadow create the new inset shadow property for a view. Arguments:
// // - offsetX, offsetY is x and y offset of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels);
// offsetX, offsetY is x and y offset of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels); // - blurRadius is the blur radius of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels);
// // - spreadRadius is the spread radius of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels);
// blurRadius is the blur radius of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels); // - color is the color of the shadow.
//
// spreadRadius is the spread radius of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels);
//
// color is the color of the shadow.
func NewInsetShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit | int | float64, blurType SizeUnit | int | float64, spreadType SizeUnit | int | float64]( func NewInsetShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit | int | float64, blurType SizeUnit | int | float64, spreadType SizeUnit | int | float64](
xOffset xOffsetType, yOffset yOffsetType, blurRadius blurType, spreadRadius spreadType, color Color) ShadowProperty { xOffset xOffsetType, yOffset yOffsetType, blurRadius blurType, spreadRadius spreadType, color Color) ShadowProperty {
return NewShadowProperty(Params{ return NewShadowProperty(Params{
@ -159,12 +155,9 @@ func NewInsetShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit |
} }
// NewTextShadow create the new text shadow property. Arguments: // NewTextShadow create the new text shadow property. Arguments:
// // - offsetX, offsetY is the x- and y-offset of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels);
// offsetX, offsetY is the x- and y-offset of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels); // - blurRadius is the blur radius of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels);
// // - color is the color of the shadow.
// blurRadius is the blur radius of the shadow (if the argument is specified as int or float64, the value is considered to be in pixels);
//
// color is the color of the shadow.
func NewTextShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit | int | float64, blurType SizeUnit | int | float64]( func NewTextShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit | int | float64, blurType SizeUnit | int | float64](
xOffset xOffsetType, yOffset yOffsetType, blurRadius blurType, color Color) ShadowProperty { xOffset xOffsetType, yOffset yOffsetType, blurRadius blurType, color Color) ShadowProperty {
return NewShadowProperty(Params{ return NewShadowProperty(Params{
@ -176,19 +169,14 @@ func NewTextShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit |
} }
// NewShadowProperty create the new shadow property for a view. // NewShadowProperty create the new shadow property for a view.
//
// The following properties can be used: // The following properties can be used:
// // - "color" (ColorTag). Determines the color of the shadow (Color);
// "color" (ColorTag). Determines the color of the shadow (Color); // - "x-offset" (XOffset). Determines the shadow horizontal offset (SizeUnit);
// // - "y-offset" (YOffset). Determines the shadow vertical offset (SizeUnit);
// "x-offset" (XOffset). Determines the shadow horizontal offset (SizeUnit); // - "blur" (BlurRadius). Determines the radius of the blur effect (SizeUnit);
// // - "spread-radius" (SpreadRadius). Positive values (SizeUnit) will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink;
// "y-offset" (YOffset). Determines the shadow vertical offset (SizeUnit); // - "inset" (Inset). Controls (bool) whether to draw shadow inside the frame or outside.
//
// "blur" (BlurRadius). Determines the radius of the blur effect (SizeUnit);
//
// "spread-radius" (SpreadRadius). Positive values (SizeUnit) will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink;
//
// "inset" (Inset). Controls (bool) whether to draw shadow inside the frame or outside.
func NewShadowProperty(params Params) ShadowProperty { func NewShadowProperty(params Params) ShadowProperty {
shadow := new(shadowPropertyData) shadow := new(shadowPropertyData)
shadow.init() shadow.init()

View File

@ -7,7 +7,9 @@ import (
) )
// SizeFunc describes a function that calculates the SizeUnit size. // SizeFunc describes a function that calculates the SizeUnit size.
//
// Used as the value of the SizeUnit properties. // Used as the value of the SizeUnit properties.
//
// "min", "max", "clamp", "sum", "sub", "mul", "div", mod, // "min", "max", "clamp", "sum", "sub", "mul", "div", mod,
// "round", "round-up", "round-down" and "round-to-zero" functions are available. // "round", "round-up", "round-down" and "round-to-zero" functions are available.
type SizeFunc interface { type SizeFunc interface {

View File

@ -9,239 +9,241 @@ import (
const ( const (
// PushTransform is the constant for "push-transform" property tag. // PushTransform is the constant for "push-transform" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// Specify start translation, scale and rotation over x, y and z axes as well as a distortion // Specify start translation, scale and rotation over x, y and z axes as well as a distortion
// for an animated pushing of a child view. // for an animated pushing of a child view.
// //
// Supported types: `TransformProperty`, `string`. // Supported types: TransformProperty, string.
// //
// See `TransformProperty` description for more details. // See TransformProperty description for more details.
// //
// Conversion rules: // Conversion rules:
// `TransformProperty` - stored as is, no conversion performed. // - TransformProperty - stored as is, no conversion performed.
// `string` - string representation of `Transform` interface. Example: "_{translate-x = 10px, scale-y = 1.1}". // - string - string representation of Transform interface. Example: "_{translate-x = 10px, scale-y = 1.1}".
PushTransform = "push-transform" PushTransform = "push-transform"
// PushDuration is the constant for "push-duration" property tag. // PushDuration is the constant for "push-duration" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// Sets the length of time in seconds that an push/pop animation takes to complete. // Sets the length of time in seconds that an push/pop animation takes to complete.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
PushDuration = "push-duration" PushDuration = "push-duration"
// PushTiming is the constant for "push-timing" property tag. // PushTiming is the constant for "push-timing" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// Set how an push/pop animation progresses through the duration of each cycle. // Set how an push/pop animation progresses through the duration of each cycle.
// //
// Supported types: `string`. // Supported types: string.
// //
// Values: // Values:
// "ease"(`EaseTiming`) - Speed increases towards the middle and slows down at the end. // - "ease" (EaseTiming) - Speed increases towards the middle and slows down at the end.
// "ease-in"(`EaseInTiming`) - Speed is slow at first, but increases in the end. // - "ease-in" (EaseInTiming) - Speed is slow at first, but increases in the end.
// "ease-out"(`EaseOutTiming`) - Speed is fast at first, but decreases in the end. // - "ease-out" (EaseOutTiming) - Speed is fast at first, but decreases in the end.
// "ease-in-out"(`EaseInOutTiming`) - Speed is slow at first, but quickly increases and at the end it decreases again. // - "ease-in-out" (EaseInOutTiming) - Speed is slow at first, but quickly increases and at the end it decreases again.
// "linear"(`LinearTiming`) - Constant speed. // - "linear" (LinearTiming) - Constant speed.
// - "step(n)" (StepTiming(n int) function) - Timing function along stepCount stops along the transition, displaying each stop for equal lengths of time.
// - "cubic-bezier(x1, y1, x2, y2)" (CubicBezierTiming(x1, y1, x2, y2 float64) function) - Cubic-Bezier curve timing function. x1 and x2 must be in the range [0, 1].
PushTiming = "push-timing" PushTiming = "push-timing"
// MoveToFrontAnimation is the constant for "move-to-front-animation" property tag. // MoveToFrontAnimation is the constant for "move-to-front-animation" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// Specifies whether animation is used when calling the MoveToFront/MoveToFrontByID method of StackLayout interface. // Specifies whether animation is used when calling the MoveToFront/MoveToFrontByID method of StackLayout interface.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - animation is used (default value). // - true, 1, "true", "yes", "on", "1" - animation is used (default value).
// `false` or `0` or "false", "no", "off", "0" - animation is not used. // - false, 0, "false", "no", "off", "0" - animation is not used.
MoveToFrontAnimation = "move-to-front-animation" MoveToFrontAnimation = "move-to-front-animation"
// PushPerspective is the constant for "push-perspective" property tag. // PushPerspective is the constant for "push-perspective" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "perspective" property of StackLayout "push-transform" property: // Used to access the "perspective" property of StackLayout "push-transform" property:
// Distance between the z-plane and the user in order to give a 3D-positioned element some perspective. Each 3D element // Distance between the z-plane and the user in order to give a 3D-positioned element some perspective. Each 3D element
// with z > 0 becomes larger, each 3D-element with z < 0 becomes smaller. The default value is 0 (no 3D effects). // with z > 0 becomes larger, each 3D-element with z < 0 becomes smaller. The default value is 0 (no 3D effects).
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
PushPerspective PropertyName = "push-perspective" PushPerspective PropertyName = "push-perspective"
// PushTranslateX is the constant for "push-translate-x" property tag. // PushTranslateX is the constant for "push-translate-x" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "translate-x" property of StackLayout "push-transform" property: // Used to access the "translate-x" property of StackLayout "push-transform" property:
// x-axis translation value of a 2D/3D translation. // x-axis translation value of a 2D/3D translation.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
PushTranslateX PropertyName = "push-translate-x" PushTranslateX PropertyName = "push-translate-x"
// PushTranslateY is the constant for "push-translate-y" property tag. // PushTranslateY is the constant for "push-translate-y" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "translate-y" property of StackLayout "push-transform" property: // Used to access the "translate-y" property of StackLayout "push-transform" property:
// y-axis translation value of a 2D/3D translation. // y-axis translation value of a 2D/3D translation.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
PushTranslateY PropertyName = "push-translate-y" PushTranslateY PropertyName = "push-translate-y"
// PushTranslateZ is the constant for "push-translate-z" property tag. // PushTranslateZ is the constant for "push-translate-z" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "translate-z" property of StackLayout "push-transform" property: // Used to access the "translate-z" property of StackLayout "push-transform" property:
// z-axis translation value of a 3D translation. // z-axis translation value of a 3D translation.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
PushTranslateZ PropertyName = "push-translate-z" PushTranslateZ PropertyName = "push-translate-z"
// PushScaleX is the constant for "push-scale-x" property tag. // PushScaleX is the constant for "push-scale-x" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "scale-x" property of StackLayout "push-transform" property: // Used to access the "scale-x" property of StackLayout "push-transform" property:
// x-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original // x-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1. // scale, more than 1 - to increase. The default value is 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
PushScaleX PropertyName = "push-scale-x" PushScaleX PropertyName = "push-scale-x"
// PushScaleY is the constant for "push-scale-y" property tag. // PushScaleY is the constant for "push-scale-y" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "scale-y" property of StackLayout "push-transform" property: // Used to access the "scale-y" property of StackLayout "push-transform" property:
// y-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original // y-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1. // scale, more than 1 - to increase. The default value is 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
PushScaleY PropertyName = "push-scale-y" PushScaleY PropertyName = "push-scale-y"
// PushScaleZ is the constant for "push-scale-z" property tag. // PushScaleZ is the constant for "push-scale-z" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "scale-z" property of StackLayout "push-transform" property: // Used to access the "scale-z" property of StackLayout "push-transform" property:
// z-axis scaling value of a 3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original // z-axis scaling value of a 3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1. // scale, more than 1 - to increase. The default value is 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
PushScaleZ PropertyName = "push-scale-z" PushScaleZ PropertyName = "push-scale-z"
// PushRotate is the constant for "push-rotate" property tag. // PushRotate is the constant for "push-rotate" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "rotate" property of StackLayout "push-transform" property: // Used to access the "rotate" property of StackLayout "push-transform" property:
// Angle of the view rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise. // Angle of the view rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise.
// //
// Supported types: `AngleUnit`, `string`, `float`, `int`. // Supported types: AngleUnit, string, float, int.
// //
// Internal type is `AngleUnit`, other types will be converted to it during assignment. // Internal type is AngleUnit, other types will be converted to it during assignment.
// See `AngleUnit` description for more details. // See AngleUnit description for more details.
// //
// Conversion rules: // Conversion rules:
// `AngleUnit` - stored as is, no conversion performed. // - AngleUnit - stored as is, no conversion performed.
// `string` - must contain string representation of `AngleUnit`. If numeric value will be provided without any suffix then `AngleUnit` with value and `Radian` value type will be created. // - string - must contain string representation of AngleUnit. If numeric value will be provided without any suffix then AngleUnit with value and Radian value type will be created.
// `float` - a new `AngleUnit` value will be created with `Radian` as a type. // - float - a new AngleUnit value will be created with Radian as a type.
// `int` - a new `AngleUnit` value will be created with `Radian` as a type. // - int - a new AngleUnit value will be created with Radian as a type.
PushRotate PropertyName = "push-rotate" PushRotate PropertyName = "push-rotate"
// PushRotateX is the constant for "push-rotate-x" property tag. // PushRotateX is the constant for "push-rotate-x" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "rotate-x" property of StackLayout "push-transform" property: // Used to access the "rotate-x" property of StackLayout "push-transform" property:
// x-coordinate of the vector denoting the axis of rotation in range 0 to 1. // x-coordinate of the vector denoting the axis of rotation in range 0 to 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
PushRotateX PropertyName = "push-rotate-x" PushRotateX PropertyName = "push-rotate-x"
// PushRotateY is the constant for "push-rotate-y" property tag. // PushRotateY is the constant for "push-rotate-y" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "rotate-y" property of StackLayout "push-transform" property: // Used to access the "rotate-y" property of StackLayout "push-transform" property:
// y-coordinate of the vector denoting the axis of rotation in range 0 to 1. // y-coordinate of the vector denoting the axis of rotation in range 0 to 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
PushRotateY PropertyName = "push-rotate-y" PushRotateY PropertyName = "push-rotate-y"
// PushRotateZ is the constant for "push-rotate-z" property tag. // PushRotateZ is the constant for "push-rotate-z" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "rotate-z" property of StackLayout "push-transform" property: // Used to access the "rotate-z" property of StackLayout "push-transform" property:
// z-coordinate of the vector denoting the axis of rotation in range 0 to 1. // z-coordinate of the vector denoting the axis of rotation in range 0 to 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
PushRotateZ PropertyName = "push-rotate-z" PushRotateZ PropertyName = "push-rotate-z"
// PushSkewX is the constant for "push-skew-x" property tag. // PushSkewX is the constant for "push-skew-x" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "skew-x" property of StackLayout "push-transform" property: // Used to access the "skew-x" property of StackLayout "push-transform" property:
// Angle to use to distort the element along the abscissa. The default value is 0. // Angle to use to distort the element along the abscissa. The default value is 0.
// //
// Supported types: `AngleUnit`, `string`, `float`, `int`. // Supported types: AngleUnit, string, float, int.
// //
// Internal type is `AngleUnit`, other types will be converted to it during assignment. // Internal type is AngleUnit, other types will be converted to it during assignment.
// See `AngleUnit` description for more details. // See AngleUnit description for more details.
// //
// Conversion rules: // Conversion rules:
// `AngleUnit` - stored as is, no conversion performed. // - AngleUnit - stored as is, no conversion performed.
// `string` - must contain string representation of `AngleUnit`. If numeric value will be provided without any suffix then `AngleUnit` with value and `Radian` value type will be created. // - string - must contain string representation of AngleUnit. If numeric value will be provided without any suffix then AngleUnit with value and Radian value type will be created.
// `float` - a new `AngleUnit` value will be created with `Radian` as a type. // - float - a new AngleUnit value will be created with Radian as a type.
// `int` - a new `AngleUnit` value will be created with `Radian` as a type. // - int - a new AngleUnit value will be created with Radian as a type.
PushSkewX PropertyName = "push-skew-x" PushSkewX PropertyName = "push-skew-x"
// PushSkewY is the constant for "push-skew-y" property tag. // PushSkewY is the constant for "push-skew-y" property tag.
// //
// Used by `StackLayout`. // Used by StackLayout.
// //
// Used to access the "skew-y" property of StackLayout "push-transform" property: // Used to access the "skew-y" property of StackLayout "push-transform" property:
// Angle to use to distort the element along the ordinate. The default value is 0. // Angle to use to distort the element along the ordinate. The default value is 0.
// //
// Supported types: `AngleUnit`, `string`, `float`, `int`. // Supported types: AngleUnit, string, float, int.
// //
// Internal type is `AngleUnit`, other types will be converted to it during assignment. // Internal type is AngleUnit, other types will be converted to it during assignment.
// See `AngleUnit` description for more details. // See AngleUnit description for more details.
// //
// Conversion rules: // Conversion rules:
// `AngleUnit` - stored as is, no conversion performed. // - AngleUnit - stored as is, no conversion performed.
// `string` - must contain string representation of `AngleUnit`. If numeric value will be provided without any suffix then `AngleUnit` with value and `Radian` value type will be created. // - string - must contain string representation of AngleUnit. If numeric value will be provided without any suffix then AngleUnit with value and Radian value type will be created.
// `float` - a new `AngleUnit` value will be created with `Radian` as a type. // - float - a new AngleUnit value will be created with Radian as a type.
// `int` - a new `AngleUnit` value will be created with `Radian` as a type. // - int - a new AngleUnit value will be created with Radian as a type.
PushSkewY PropertyName = "push-skew-y" PushSkewY PropertyName = "push-skew-y"
) )
@ -256,28 +258,36 @@ type StackLayout interface {
RemovePeek() View RemovePeek() View
// MoveToFront makes the given View current. // MoveToFront makes the given View current.
//
// The second argument is a function called after the move to front animation ends. // The second argument is a function called after the move to front animation ends.
//
// Returns true if successful, false otherwise. // Returns true if successful, false otherwise.
MoveToFront(view View, onShown ...func(View)) bool MoveToFront(view View, onShown ...func(View)) bool
// MoveToFrontByID makes the View current by viewID. // MoveToFrontByID makes the View current by viewID.
//
// The second argument is a function called after the move to front animation ends. // The second argument is a function called after the move to front animation ends.
//
// Returns true if successful, false otherwise. // Returns true if successful, false otherwise.
MoveToFrontByID(viewID string, onShown ...func(View)) bool MoveToFrontByID(viewID string, onShown ...func(View)) bool
// Push adds a new View to the container and makes it current. // Push adds a new View to the container and makes it current.
//
// It is similar to Append, but the addition is done using an animation effect. // It is similar to Append, but the addition is done using an animation effect.
//
// The animation type is specified by the second argument and can take the following values: // The animation type is specified by the second argument and can take the following values:
// * DefaultAnimation (0) - Default animation. For the Push function it is EndToStartAnimation, for Pop - StartToEndAnimation; // - DefaultAnimation (0) - Default animation. For the Push function it is EndToStartAnimation, for Pop - StartToEndAnimation;
// * StartToEndAnimation (1) - Animation from beginning to end. The beginning and the end are determined by the direction of the text output; // - StartToEndAnimation (1) - Animation from beginning to end. The beginning and the end are determined by the direction of the text output;
// * EndToStartAnimation (2) - End-to-Beginning animation; // - EndToStartAnimation (2) - End-to-Beginning animation;
// * TopDownAnimation (3) - Top-down animation; // - TopDownAnimation (3) - Top-down animation;
// * BottomUpAnimation (4) - Bottom up animation. // - BottomUpAnimation (4) - Bottom up animation.
// The second argument `onPushFinished` is the function to be called when the animation ends. // The second argument `onPushFinished` is the function to be called when the animation ends.
Push(view View, onPushFinished ...func()) Push(view View, onPushFinished ...func())
// Pop removes the current View from the container using animation. // Pop removes the current View from the container using animation.
//
// The argument `onPopFinished` is the function to be called when the animation ends. // The argument `onPopFinished` is the function to be called when the animation ends.
//
// The function will return false if the StackLayout is empty and true if the current item has been removed. // The function will return false if the StackLayout is empty and true if the current item has been removed.
Pop(onPopFinished ...func(View)) bool Pop(onPopFinished ...func(View)) bool
} }

View File

@ -9,19 +9,20 @@ type TableAdapter interface {
ColumnCount() int ColumnCount() int
// Cell returns the contents of a table cell. The function can return elements of the following types: // Cell returns the contents of a table cell. The function can return elements of the following types:
// * string // - string
// * rune // - rune
// * float32, float64 // - float32, float64
// * integer values: int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64 // - integer values: int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64
// * bool // - bool
// * rui.Color // - rui.Color
// * rui.View // - rui.View
// * fmt.Stringer // - fmt.Stringer
// * rui.VerticalTableJoin, rui.HorizontalTableJoin // - rui.VerticalTableJoin, rui.HorizontalTableJoin
Cell(row, column int) any Cell(row, column int) any
} }
// TableColumnStyle describes the style of [TableView] columns. // TableColumnStyle describes the style of [TableView] columns.
//
// To set column styles, you must either implement the [TableColumnStyle] interface in the table adapter // To set column styles, you must either implement the [TableColumnStyle] interface in the table adapter
// or assign its separate implementation to the "column-style" property. // or assign its separate implementation to the "column-style" property.
type TableColumnStyle interface { type TableColumnStyle interface {
@ -30,6 +31,7 @@ type TableColumnStyle interface {
} }
// TableRowStyle describes the style of [TableView] rows. // TableRowStyle describes the style of [TableView] rows.
//
// To set row styles, you must either implement the [TableRowStyle] interface in the table adapter // To set row styles, you must either implement the [TableRowStyle] interface in the table adapter
// or assign its separate implementation to the "row-style" property. // or assign its separate implementation to the "row-style" property.
type TableRowStyle interface { type TableRowStyle interface {
@ -38,6 +40,7 @@ type TableRowStyle interface {
} }
// TableCellStyle describes the style of [TableView] cells. // TableCellStyle describes the style of [TableView] cells.
//
// To set row cells, you must either implement the [TableCellStyle] interface in the table adapter // To set row cells, you must either implement the [TableCellStyle] interface in the table adapter
// or assign its separate implementation to the "cell-style" property. // or assign its separate implementation to the "cell-style" property.
type TableCellStyle interface { type TableCellStyle interface {
@ -46,7 +49,9 @@ type TableCellStyle interface {
} }
// TableAllowCellSelection determines whether [TableView] cell selection is allowed. // TableAllowCellSelection determines whether [TableView] cell selection is allowed.
//
// It is only used if the "selection-mode" property is set to CellSelection (1). // It is only used if the "selection-mode" property is set to CellSelection (1).
//
// To set cell selection allowing, you must either implement the TableAllowCellSelection interface // To set cell selection allowing, you must either implement the TableAllowCellSelection interface
// in the table adapter or assign its separate implementation to the "allow-selection" property. // in the table adapter or assign its separate implementation to the "allow-selection" property.
type TableAllowCellSelection interface { type TableAllowCellSelection interface {
@ -55,7 +60,9 @@ type TableAllowCellSelection interface {
} }
// TableAllowRowSelection determines whether [TableView] row selection is allowed. // TableAllowRowSelection determines whether [TableView] row selection is allowed.
//
// It is only used if the "selection-mode" property is set to RowSelection (2). // It is only used if the "selection-mode" property is set to RowSelection (2).
//
// To set row selection allowing, you must either implement the TableAllowRowSelection interface // To set row selection allowing, you must either implement the TableAllowRowSelection interface
// in the table adapter or assign its separate implementation to the "allow-selection" property. // in the table adapter or assign its separate implementation to the "allow-selection" property.
type TableAllowRowSelection interface { type TableAllowRowSelection interface {
@ -65,6 +72,7 @@ type TableAllowRowSelection interface {
// SimpleTableAdapter is implementation of [TableAdapter] where the content // SimpleTableAdapter is implementation of [TableAdapter] where the content
// defines as [][]any. // defines as [][]any.
//
// When you assign [][]any value to the "content" property, it is converted to SimpleTableAdapter // When you assign [][]any value to the "content" property, it is converted to SimpleTableAdapter
type SimpleTableAdapter interface { type SimpleTableAdapter interface {
TableAdapter TableAdapter

View File

@ -10,519 +10,527 @@ import (
const ( const (
// TableVerticalAlign is the constant for "table-vertical-align" property tag. // TableVerticalAlign is the constant for "table-vertical-align" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the vertical alignment of the content inside a table cell. // Set the vertical alignment of the content inside a table cell.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`TopAlign`) or "top" - Top alignment. // - 0 (TopAlign) or "top" - Top alignment.
// `1`(`BottomAlign`) or "bottom" - Bottom alignment. // - 1 (BottomAlign) or "bottom" - Bottom alignment.
// `2`(`CenterAlign`) or "center" - Center alignment. // - 2 (CenterAlign) or "center" - Center alignment.
// `3`(`StretchAlign`) or "stretch" - Work as baseline alignment, see below. // - 3 (StretchAlign) or "stretch" - Work as baseline alignment, see below.
// `4`(`BaselineAlign`) or "baseline" - Baseline alignment. // - 4 (BaselineAlign) or "baseline" - Baseline alignment.
TableVerticalAlign PropertyName = "table-vertical-align" TableVerticalAlign PropertyName = "table-vertical-align"
// HeadHeight is the constant for "head-height" property tag. // HeadHeight is the constant for "head-height" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Sets the number of rows in the table header. The default value is `0` (no header). // Sets the number of rows in the table header. The default value is 0 (no header).
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0` or "0" - No header. // - 0 or "0" - No header.
// > `0` or > "0" - Number of rows act as a header. // - positive value - Number of rows act as a header.
HeadHeight PropertyName = "head-height" HeadHeight PropertyName = "head-height"
// HeadStyle is the constant for "head-style" property tag. // HeadStyle is the constant for "head-style" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the header style name or description of style properties. // Set the header style name or description of style properties.
// //
// Supported types: `string`, `Params`. // Supported types: string, Params.
// //
// Internal type is either `string` or `Params`. // Internal type is either string or Params.
// //
// Conversion rules: // Conversion rules:
// `string` - must contain style name defined in resources. // - string - must contain style name defined in resources.
// `Params` - must contain style properties. // - Params - must contain style properties.
HeadStyle PropertyName = "head-style" HeadStyle PropertyName = "head-style"
// FootHeight is the constant for "foot-height" property tag. // FootHeight is the constant for "foot-height" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Sets the number of rows in the table footer. The default value is `0` (no footer). // Sets the number of rows in the table footer. The default value is 0 (no footer).
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0` or "0" - No footer. // - 0 or "0" - No footer.
// > `0` or > "0" - Number of rows act as a footer. // - positive value - Number of rows act as a footer.
FootHeight PropertyName = "foot-height" FootHeight PropertyName = "foot-height"
// FootStyle is the constant for "foot-style" property tag. // FootStyle is the constant for "foot-style" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the footer style name or description of style properties. // Set the footer style name or description of style properties.
// //
// Supported types: `string`, `Params`. // Supported types: string, Params.
// //
// Internal type is either `string` or `Params`. // Internal type is either string or Params.
// //
// Conversion rules: // Conversion rules:
// `string` - must contain style name defined in resources. // - string - must contain style name defined in resources.
// `Params` - must contain style properties. // - Params - must contain style properties.
FootStyle PropertyName = "foot-style" FootStyle PropertyName = "foot-style"
// RowSpan is the constant for "row-span" property tag. // RowSpan is the constant for "row-span" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the number of table row to span. Used only when specifying cell parameters in the implementation of // Set the number of table row to span. Used only when specifying cell parameters in the implementation of
// `TableCellStyle`. // TableCellStyle.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0` or "0" - No merging will be applied. // - 0 or "0" - No merging will be applied.
// > `0` or > "0" - Number of rows including current one to be merged together. // - positive value - Number of rows including current one to be merged together.
RowSpan PropertyName = "row-span" RowSpan PropertyName = "row-span"
// ColumnSpan is the constant for "column-span" property tag. // ColumnSpan is the constant for "column-span" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Sets the number of table column cells to be merged together. Used only when specifying cell parameters in the // Sets the number of table column cells to be merged together. Used only when specifying cell parameters in the
// implementation of `TableCellStyle`. // implementation of TableCellStyle.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0` or "0" - No merging will be applied. // - 0 or "0" - No merging will be applied.
// > `0` or > "0" - Number of columns including current one to be merged together. // - positive value - Number of columns including current one to be merged together.
ColumnSpan PropertyName = "column-span" ColumnSpan PropertyName = "column-span"
// RowStyle is the constant for "row-style" property tag. // RowStyle is the constant for "row-style" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the adapter which specifies styles of each table row. // Set the adapter which specifies styles of each table row.
// //
// Supported types: `TableRowStyle`, `[]Params`. // Supported types: TableRowStyle, []Params.
// //
// Internal type is `TableRowStyle`, other types converted to it during assignment. // Internal type is TableRowStyle, other types converted to it during assignment.
// See `TableRowStyle` description for more details. // See TableRowStyle description for more details.
RowStyle PropertyName = "row-style" RowStyle PropertyName = "row-style"
// ColumnStyle is the constant for "column-style" property tag. // ColumnStyle is the constant for "column-style" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the adapter which specifies styles of each table column. // Set the adapter which specifies styles of each table column.
// //
// Supported types: `TableColumnStyle`, `[]Params`. // Supported types: TableColumnStyle, []Params.
// //
// Internal type is `TableColumnStyle`, other types converted to it during assignment. // Internal type is TableColumnStyle, other types converted to it during assignment.
// See `TableColumnStyle` description for more details. // See TableColumnStyle description for more details.
ColumnStyle PropertyName = "column-style" ColumnStyle PropertyName = "column-style"
// CellStyle is the constant for "cell-style" property tag. // CellStyle is the constant for "cell-style" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the adapter which specifies styles of each table cell. This property can be assigned only by an implementation of // Set the adapter which specifies styles of each table cell. This property can be assigned only by an implementation of
// `TableCellStyle` interface. // TableCellStyle interface.
// //
// Supported types: `TableCellStyle`. // Supported types: TableCellStyle.
CellStyle PropertyName = "cell-style" CellStyle PropertyName = "cell-style"
// CellPadding is the constant for "cell-padding" property tag. // CellPadding is the constant for "cell-padding" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Sets the padding area on all four sides of a table cell at once. An element's padding area is the space between its // Sets the padding area on all four sides of a table cell at once. An element's padding area is the space between its
// content and its border. // content and its border.
// //
// Supported types: `BoundsProperty`, `Bounds`, `SizeUnit`, `float32`, `float64`, `int`. // Supported types: BoundsProperty, Bounds, SizeUnit, float32, float64, int.
// //
// Internal type is `BoundsProperty`, other types converted to it during assignment. // Internal type is BoundsProperty, other types converted to it during assignment.
// See `BoundsProperty`, `Bounds` and `SizeUnit` description for more details. // See BoundsProperty, Bounds and SizeUnit description for more details.
CellPadding PropertyName = "cell-padding" CellPadding PropertyName = "cell-padding"
// CellPaddingLeft is the constant for "cell-padding-left" property tag. // CellPaddingLeft is the constant for "cell-padding-left" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the width of the padding area to the left of a cell content. An element's padding area is the space between its // Set the width of the padding area to the left of a cell content. An element's padding area is the space between its
// content and its border. // content and its border.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
CellPaddingLeft PropertyName = "cell-padding-left" CellPaddingLeft PropertyName = "cell-padding-left"
// CellPaddingRight is the constant for "cell-padding-right" property tag. // CellPaddingRight is the constant for "cell-padding-right" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the width of the padding area to the left of a cell content. An element's padding area is the space between its // Set the width of the padding area to the left of a cell content. An element's padding area is the space between its
// content and its border. // content and its border.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
CellPaddingRight PropertyName = "cell-padding-right" CellPaddingRight PropertyName = "cell-padding-right"
// CellPaddingTop is the constant for "cell-padding-top" property tag. // CellPaddingTop is the constant for "cell-padding-top" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the height of the padding area to the top of a cell content. An element's padding area is the space between its // Set the height of the padding area to the top of a cell content. An element's padding area is the space between its
// content and its border. // content and its border.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
CellPaddingTop PropertyName = "cell-padding-top" CellPaddingTop PropertyName = "cell-padding-top"
// CellPaddingBottom is the constant for "cell-padding-bottom" property tag. // CellPaddingBottom is the constant for "cell-padding-bottom" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the height of the padding area to the bottom of a cell content. // Set the height of the padding area to the bottom of a cell content.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
CellPaddingBottom PropertyName = "cell-padding-bottom" CellPaddingBottom PropertyName = "cell-padding-bottom"
// CellBorder is the constant for "cell-border" property tag. // CellBorder is the constant for "cell-border" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set a table cell's border. It sets the values of a border width, style, and color. Can also be used when setting // Set a table cell's border. It sets the values of a border width, style, and color. Can also be used when setting
// parameters in properties "row-style", "column-style", "foot-style" and "head-style". // parameters in properties "row-style", "column-style", "foot-style" and "head-style".
// //
// Supported types: `BorderProperty`, `ViewBorder`, `ViewBorders`. // Supported types: BorderProperty, ViewBorder, ViewBorders.
// //
// Internal type is `BorderProperty`, other types converted to it during assignment. // Internal type is BorderProperty, other types converted to it during assignment.
// See `BorderProperty`, `ViewBorder` and `ViewBorders` description for more details. // See BorderProperty, ViewBorder and ViewBorders description for more details.
CellBorder PropertyName = "cell-border" CellBorder PropertyName = "cell-border"
// CellBorderLeft is the constant for "cell-border-left" property tag. // CellBorderLeft is the constant for "cell-border-left" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set a view's left border. It sets the values of a border width, style, and color. This property can be assigned a value // Set a view's left border. It sets the values of a border width, style, and color. This property can be assigned a value
// of `BorderProperty`, `ViewBorder` types or `BorderProperty` text representation. // of BorderProperty, ViewBorder types or BorderProperty text representation.
// //
// Supported types: `ViewBorder`, `BorderProperty`, `string`. // Supported types: ViewBorder, BorderProperty, string.
// //
// Internal type is `BorderProperty`, other types converted to it during assignment. // Internal type is BorderProperty, other types converted to it during assignment.
// See `ViewBorder` and `BorderProperty` description for more details. // See ViewBorder and BorderProperty description for more details.
CellBorderLeft PropertyName = "cell-border-left" CellBorderLeft PropertyName = "cell-border-left"
// CellBorderRight is the constant for "cell-border-right" property tag. // CellBorderRight is the constant for "cell-border-right" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set a view's right border. It sets the values of a border width, style, and color. This property can be assigned a // Set a view's right border. It sets the values of a border width, style, and color. This property can be assigned a
// value of `BorderProperty`, `ViewBorder` types or `BorderProperty` text representation. // value of BorderProperty, ViewBorder types or BorderProperty text representation.
// //
// Supported types: `ViewBorder`, `BorderProperty`, `string`. // Supported types: ViewBorder, BorderProperty, string.
// //
// Internal type is `BorderProperty`, other types converted to it during assignment. // Internal type is BorderProperty, other types converted to it during assignment.
// See `ViewBorder` and `BorderProperty` description for more details. // See ViewBorder and BorderProperty description for more details.
CellBorderRight PropertyName = "cell-border-right" CellBorderRight PropertyName = "cell-border-right"
// CellBorderTop is the constant for "cell-border-top" property tag. // CellBorderTop is the constant for "cell-border-top" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set a view's top border. It sets the values of a border width, style, and color. This property can be assigned a value // Set a view's top border. It sets the values of a border width, style, and color. This property can be assigned a value
// of `BorderProperty`, `ViewBorder` types or `BorderProperty` text representation. // of BorderProperty, ViewBorder types or BorderProperty text representation.
// //
// Supported types: `ViewBorder`, `BorderProperty`, `string`. // Supported types: ViewBorder, BorderProperty, string.
// //
// Internal type is `BorderProperty`, other types converted to it during assignment. // Internal type is BorderProperty, other types converted to it during assignment.
// See `ViewBorder` and `BorderProperty` description for more details. // See ViewBorder and BorderProperty description for more details.
CellBorderTop PropertyName = "cell-border-top" CellBorderTop PropertyName = "cell-border-top"
// CellBorderBottom is the constant for "cell-border-bottom" property tag. // CellBorderBottom is the constant for "cell-border-bottom" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set a view's bottom border. It sets the values of a border width, style, and color. // Set a view's bottom border. It sets the values of a border width, style, and color.
// //
// Supported types: `ViewBorder`, `BorderProperty`, `string`. // Supported types: ViewBorder, BorderProperty, string.
// //
// Internal type is `BorderProperty`, other types converted to it during assignment. // Internal type is BorderProperty, other types converted to it during assignment.
// See `ViewBorder` and `BorderProperty` description for more details. // See ViewBorder and BorderProperty description for more details.
CellBorderBottom PropertyName = "cell-border-bottom" CellBorderBottom PropertyName = "cell-border-bottom"
// CellBorderStyle is the constant for "cell-border-style" property tag. // CellBorderStyle is the constant for "cell-border-style" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line style for all four sides of a table cell's border. Default value is "none". // Set the line style for all four sides of a table cell's border. Default value is "none".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn. // - 0 (NoneLine) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border. // - 1 (SolidLine) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border. // - 2 (DashedLine) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border. // - 3 (DottedLine) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border. // - 4 (DoubleLine) or "double" - Double line as a border.
CellBorderStyle PropertyName = "cell-border-style" CellBorderStyle PropertyName = "cell-border-style"
// CellBorderLeftStyle is the constant for "cell-border-left-style" property tag. // CellBorderLeftStyle is the constant for "cell-border-left-style" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line style of a table cell's left border. Default value is "none". // Set the line style of a table cell's left border. Default value is "none".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn. // - 0 (NoneLine) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border. // - 1 (SolidLine) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border. // - 2 (DashedLine) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border. // - 3 (DottedLine) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border. // - 4 (DoubleLine) or "double" - Double line as a border.
CellBorderLeftStyle PropertyName = "cell-border-left-style" CellBorderLeftStyle PropertyName = "cell-border-left-style"
// CellBorderRightStyle is the constant for "cell-border-right-style" property tag. // CellBorderRightStyle is the constant for "cell-border-right-style" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line style of a table cell's right border. Default value is "none". // Set the line style of a table cell's right border. Default value is "none".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn. // - 0 (NoneLine) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border. // - 1 (SolidLine) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border. // - 2 (DashedLine) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border. // - 3 (DottedLine) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border. // - 4 (DoubleLine) or "double" - Double line as a border.
CellBorderRightStyle PropertyName = "cell-border-right-style" CellBorderRightStyle PropertyName = "cell-border-right-style"
// CellBorderTopStyle is the constant for "cell-border-top-style" property tag. // CellBorderTopStyle is the constant for "cell-border-top-style" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line style of a table cell's top border. Default value is "none". // Set the line style of a table cell's top border. Default value is "none".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn. // - 0 (NoneLine) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border. // - 1 (SolidLine) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border. // - 2 (DashedLine) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border. // - 3 (DottedLine) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border. // - 4 (DoubleLine) or "double" - Double line as a border.
CellBorderTopStyle PropertyName = "cell-border-top-style" CellBorderTopStyle PropertyName = "cell-border-top-style"
// CellBorderBottomStyle is the constant for "cell-border-bottom-style" property tag. // CellBorderBottomStyle is the constant for "cell-border-bottom-style" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Sets the line style of a table cell's bottom border. Default value is "none". // Sets the line style of a table cell's bottom border. Default value is "none".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn. // - 0 (NoneLine) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border. // - 1 (SolidLine) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border. // - 2 (DashedLine) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border. // - 3 (DottedLine) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border. // - 4 (DoubleLine) or "double" - Double line as a border.
CellBorderBottomStyle PropertyName = "cell-border-bottom-style" CellBorderBottomStyle PropertyName = "cell-border-bottom-style"
// CellBorderWidth is the constant for "cell-border-width" property tag. // CellBorderWidth is the constant for "cell-border-width" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line width for all four sides of a table cell's border. // Set the line width for all four sides of a table cell's border.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
CellBorderWidth PropertyName = "cell-border-width" CellBorderWidth PropertyName = "cell-border-width"
// CellBorderLeftWidth is the constant for "cell-border-left-width" property tag. // CellBorderLeftWidth is the constant for "cell-border-left-width" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line width of a table cell's left border. // Set the line width of a table cell's left border.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
CellBorderLeftWidth PropertyName = "cell-border-left-width" CellBorderLeftWidth PropertyName = "cell-border-left-width"
// CellBorderRightWidth is the constant for "cell-border-right-width" property tag. // CellBorderRightWidth is the constant for "cell-border-right-width" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line width of a table cell's right border. // Set the line width of a table cell's right border.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
CellBorderRightWidth PropertyName = "cell-border-right-width" CellBorderRightWidth PropertyName = "cell-border-right-width"
// CellBorderTopWidth is the constant for "cell-border-top-width" property tag. // CellBorderTopWidth is the constant for "cell-border-top-width" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line width of a table cell's top border. // Set the line width of a table cell's top border.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
CellBorderTopWidth PropertyName = "cell-border-top-width" CellBorderTopWidth PropertyName = "cell-border-top-width"
// CellBorderBottomWidth is the constant for "cell-border-bottom-width" property tag. // CellBorderBottomWidth is the constant for "cell-border-bottom-width" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line width of a table cell's bottom border. // Set the line width of a table cell's bottom border.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
CellBorderBottomWidth PropertyName = "cell-border-bottom-width" CellBorderBottomWidth PropertyName = "cell-border-bottom-width"
// CellBorderColor is the constant for "cell-border-color" property tag. // CellBorderColor is the constant for "cell-border-color" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line color for all four sides of a table cell's border. // Set the line color for all four sides of a table cell's border.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See Color description for more details.
CellBorderColor PropertyName = "cell-border-color" CellBorderColor PropertyName = "cell-border-color"
// CellBorderLeftColor is the constant for "cell-border-left-color" property tag. // CellBorderLeftColor is the constant for "cell-border-left-color" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line color of a table cell's left border. // Set the line color of a table cell's left border.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See Color description for more details.
CellBorderLeftColor PropertyName = "cell-border-left-color" CellBorderLeftColor PropertyName = "cell-border-left-color"
// CellBorderRightColor is the constant for "cell-border-right-color" property tag. // CellBorderRightColor is the constant for "cell-border-right-color" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line color of a table cell's right border. // Set the line color of a table cell's right border.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See Color description for more details.
CellBorderRightColor PropertyName = "cell-border-right-color" CellBorderRightColor PropertyName = "cell-border-right-color"
// CellBorderTopColor is the constant for "cell-border-top-color" property tag. // CellBorderTopColor is the constant for "cell-border-top-color" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line color of a table cell's top border. // Set the line color of a table cell's top border.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See Color description for more details.
CellBorderTopColor PropertyName = "cell-border-top-color" CellBorderTopColor PropertyName = "cell-border-top-color"
// CellBorderBottomColor is the constant for "cell-border-bottom-color" property tag. // CellBorderBottomColor is the constant for "cell-border-bottom-color" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the line color of a table cell's bottom border. // Set the line color of a table cell's bottom border.
// //
// Supported types: `Color`, `string`. // Supported types: Color, string.
// //
// Internal type is `Color`, other types converted to it during assignment. // Internal type is Color, other types converted to it during assignment.
// See `Color` description for more details. // See Color description for more details.
CellBorderBottomColor PropertyName = "cell-border-bottom-color" CellBorderBottomColor PropertyName = "cell-border-bottom-color"
// SelectionMode is the constant for "selection-mode" property tag. // SelectionMode is the constant for "selection-mode" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Sets the mode of the table elements selection. Default value is "none". // Sets the mode of the table elements selection. Default value is "none".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`NoneSelection`) or "none" - Table elements are not selectable. The table cannot receive input focus. // - 0 (NoneSelection) or "none" - Table elements are not selectable. The table cannot receive input focus.
// `1`(`CellSelection`) or "cell" - One table cell can be selected(highlighted). The cell is selected interactively using the mouse or keyboard(using the cursor keys). // - 1 (CellSelection) or "cell" - One table cell can be selected(highlighted). The cell is selected interactively using the mouse or keyboard(using the cursor keys).
// `2`(`RowSelection`) or "row" - The entire table row can be selected (highlighted). The row is selected interactively using the mouse or keyboard (using the cursor keys). // - 2 (RowSelection) or "row" - The entire table row can be selected (highlighted). The row is selected interactively using the mouse or keyboard (using the cursor keys).
SelectionMode PropertyName = "selection-mode" SelectionMode PropertyName = "selection-mode"
// TableCellClickedEvent is the constant for "table-cell-clicked" property tag. // TableCellClickedEvent is the constant for "table-cell-clicked" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Occur when the user clicks on a table cell. // Occur when the user clicks on a table cell.
// //
// General listener format: // General listener format:
// `func(table rui.TableView, row, col int)`. //
// func(table rui.TableView, row, col int)
// //
// where: // where:
// table - Interface of a table view which generated this event, // - table - Interface of a table view which generated this event,
// row - Row of the clicked cell, // - row - Row of the clicked cell,
// col - Column of the clicked cell. // - col - Column of the clicked cell.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(row, col int)`. //
// func(row, col int)
TableCellClickedEvent PropertyName = "table-cell-clicked" TableCellClickedEvent PropertyName = "table-cell-clicked"
// TableCellSelectedEvent is the constant for "table-cell-selected" property tag. // TableCellSelectedEvent is the constant for "table-cell-selected" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Occur when a table cell becomes selected. // Occur when a table cell becomes selected.
// //
// General listener format: // General listener format:
// `func(table rui.TableView, row, col int)`. //
// func(table rui.TableView, row, col int)
// //
// where: // where:
// table - Interface of a table view which generated this event, // - table - Interface of a table view which generated this event,
// row - Row of the selected cell, // - row - Row of the selected cell,
// col - Column of the selected cell. // - col - Column of the selected cell.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(row, col int)`. //
// func(row, col int)
TableCellSelectedEvent PropertyName = "table-cell-selected" TableCellSelectedEvent PropertyName = "table-cell-selected"
// TableRowClickedEvent is the constant for "table-row-clicked" property tag. // TableRowClickedEvent is the constant for "table-row-clicked" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Occur when the user clicks on a table row. // Occur when the user clicks on a table row.
// //
// General listener format: // General listener format:
// `func(table rui.TableView, row int)`. //
// func(table rui.TableView, row int)
// //
// where: // where:
// table - Interface of a table view which generated this event, // - table - Interface of a table view which generated this event,
// row - Clicked row. // - row - Clicked row.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(row int)`. //
// func(row int)
TableRowClickedEvent PropertyName = "table-row-clicked" TableRowClickedEvent PropertyName = "table-row-clicked"
// TableRowSelectedEvent is the constant for "table-row-selected" property tag. // TableRowSelectedEvent is the constant for "table-row-selected" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Occur when a table row becomes selected. // Occur when a table row becomes selected.
// //
// General listener format: // General listener format:
// `func(table rui.TableView, row int)`. //
// func(table rui.TableView, row int)
// //
// where: // where:
// table - Interface of a table view which generated this event, // - table - Interface of a table view which generated this event,
// row - Selected row. // - row - Selected row.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(row int)`. //
// func(row int)
TableRowSelectedEvent PropertyName = "table-row-selected" TableRowSelectedEvent PropertyName = "table-row-selected"
// AllowSelection is the constant for "allow-selection" property tag. // AllowSelection is the constant for "allow-selection" property tag.
// //
// Used by `TableView`. // Used by TableView.
// Set the adapter which specifies whether cell/row selection is allowed. This property can be assigned by an // Set the adapter which specifies whether cell/row selection is allowed. This property can be assigned by an
// implementation of `TableAllowCellSelection` or `TableAllowRowSelection` interface. // implementation of TableAllowCellSelection or TableAllowRowSelection interface.
// //
// Supported types: `TableAllowCellSelection`, `TableAllowRowSelection`. // Supported types: TableAllowCellSelection, TableAllowRowSelection.
// //
// Internal type is either `TableAllowCellSelection`, `TableAllowRowSelection`, see their description for more details. // Internal type is either TableAllowCellSelection, TableAllowRowSelection, see their description for more details.
AllowSelection PropertyName = "allow-selection" AllowSelection PropertyName = "allow-selection"
) )

View File

@ -9,104 +9,108 @@ import (
const ( const (
// CurrentTabChangedEvent is the constant for "current-tab-changed" property tag. // CurrentTabChangedEvent is the constant for "current-tab-changed" property tag.
// //
// Used by `TabsLayout`. // Used by TabsLayout.
// Occur when the new tab becomes active. // Occur when the new tab becomes active.
// //
// General listener format: // General listener format:
// `func(tabsLayout rui.TabsLayout, newTab, oldTab int)`. //
// func(tabsLayout rui.TabsLayout, newTab, oldTab int)
// //
// where: // where:
// tabsLayout - Interface of a tabs layout which generated this event, // - tabsLayout - Interface of a tabs layout which generated this event,
// newTab - Index of a new active tab, // - newTab - Index of a new active tab,
// oldTab - Index of an old active tab. // - oldTab - Index of an old active tab.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(tabsLayout rui.TabsLayout, newTab int)`, //
// `func(newTab, oldTab int)`, // func(tabsLayout rui.TabsLayout, newTab int)
// `func(newTab int)`, // func(newTab, oldTab int)
// `func()`. // func(newTab int)
// func()
CurrentTabChangedEvent PropertyName = "current-tab-changed" CurrentTabChangedEvent PropertyName = "current-tab-changed"
// Icon is the constant for "icon" property tag. // Icon is the constant for "icon" property tag.
// //
// Used by `TabsLayout`. // Used by TabsLayout.
// Defines the icon name that is displayed in the tab. The property is set for the child view of `TabsLayout`. // Defines the icon name that is displayed in the tab. The property is set for the child view of TabsLayout.
// //
// Supported types: `string`. // Supported types: string.
Icon = "icon" Icon = "icon"
// TabCloseButton is the constant for "tab-close-button" property tag. // TabCloseButton is the constant for "tab-close-button" property tag.
// //
// Used by `TabsLayout`. // Used by TabsLayout.
// Controls whether to add close button to a tab(s). This property can be set separately for each child view or for tabs // Controls whether to add close button to a tab(s). This property can be set separately for each child view or for tabs
// layout itself. Property set for child view takes precedence over the value set for tabs layout. Default value is // layout itself. Property set for child view takes precedence over the value set for tabs layout. Default value is
// `false`. // false.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - Tab(s) has close button. // - true, 1, "true", "yes", "on", "1" - Tab(s) has close button.
// `false` or `0` or "false", "no", "off", "0" - No close button in tab(s). // - false, 0, "false", "no", "off", "0" - No close button in tab(s).
TabCloseButton PropertyName = "tab-close-button" TabCloseButton PropertyName = "tab-close-button"
// TabCloseEvent is the constant for "tab-close-event" property tag. // TabCloseEvent is the constant for "tab-close-event" property tag.
// //
// Used by `TabsLayout`. // Used by TabsLayout.
// Occurs when the user clicks on the tab close button. // Occurs when the user clicks on the tab close button.
// //
// General listener format: // General listener format:
// `func(tabsLayout rui.TabsLayout, tab int)`. //
// func(tabsLayout rui.TabsLayout, tab int)
// //
// where: // where:
// tabsLayout - Interface of a tabs layout which generated this event, // - tabsLayout - Interface of a tabs layout which generated this event,
// tab - Index of the tab. // - tab - Index of the tab.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(tab int)`, //
// `func(tabsLayout rui.TabsLayout)`, // func(tab int)
// `func()`. // func(tabsLayout rui.TabsLayout)
// func()
TabCloseEvent PropertyName = "tab-close-event" TabCloseEvent PropertyName = "tab-close-event"
// Tabs is the constant for "tabs" property tag. // Tabs is the constant for "tabs" property tag.
// //
// Used by `TabsLayout`. // Used by TabsLayout.
// Sets where the tabs are located. Default value is "top". // Sets where the tabs are located. Default value is "top".
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// `0`(`TopTabs`) or "top" - Tabs on the top. // - 0 (TopTabs) or "top" - Tabs on the top.
// `1`(`BottomTabs`) or "bottom" - Tabs on the bottom. // - 1 (BottomTabs) or "bottom" - Tabs on the bottom.
// `2`(`LeftTabs`) or "left" - Tabs on the left. Each tab is rotated 90° counterclockwise. // - 2 (LeftTabs) or "left" - Tabs on the left. Each tab is rotated 90° counterclockwise.
// `3`(`RightTabs`) or "right" - Tabs located on the right. Each tab is rotated 90° clockwise. // - 3 (RightTabs) or "right" - Tabs located on the right. Each tab is rotated 90° clockwise.
// `4`(`LeftListTabs`) or "left-list" - Tabs on the left. The tabs are displayed as a list. // - 4 (LeftListTabs) or "left-list" - Tabs on the left. The tabs are displayed as a list.
// `5`(`RightListTabs`) or "right-list" - Tabs on the right. The tabs are displayed as a list. // - 5 (RightListTabs) or "right-list" - Tabs on the right. The tabs are displayed as a list.
// `6`(`HiddenTabs`) or "hidden" - Tabs are hidden. // - 6 (HiddenTabs) or "hidden" - Tabs are hidden.
Tabs PropertyName = "tabs" Tabs PropertyName = "tabs"
// TabBarStyle is the constant for "tab-bar-style" property tag. // TabBarStyle is the constant for "tab-bar-style" property tag.
// //
// Used by `TabsLayout`. // Used by TabsLayout.
// Set the style for the display of the tab bar. The default value is "ruiTabBar". // Set the style for the display of the tab bar. The default value is "ruiTabBar".
// //
// Supported types: `string`. // Supported types: string.
TabBarStyle PropertyName = "tab-bar-style" TabBarStyle PropertyName = "tab-bar-style"
// TabStyle is the constant for "tab-style" property tag. // TabStyle is the constant for "tab-style" property tag.
// //
// Used by `TabsLayout`. // Used by TabsLayout.
// Set the style for the display of the tab. The default value is "ruiTab" or "ruiVerticalTab". // Set the style for the display of the tab. The default value is "ruiTab" or "ruiVerticalTab".
// //
// Supported types: `string`. // Supported types: string.
TabStyle PropertyName = "tab-style" TabStyle PropertyName = "tab-style"
// CurrentTabStyle is the constant for "current-tab-style" property tag. // CurrentTabStyle is the constant for "current-tab-style" property tag.
// //
// Used by `TabsLayout`. // Used by TabsLayout.
// Set the style for the display of the current(selected) tab. The default value is "ruiCurrentTab" or // Set the style for the display of the current(selected) tab. The default value is "ruiCurrentTab" or
// "ruiCurrentVerticalTab". // "ruiCurrentVerticalTab".
// //
// Supported types: `string`. // Supported types: string.
CurrentTabStyle PropertyName = "current-tab-style" CurrentTabStyle PropertyName = "current-tab-style"
inactiveTabStyle = "data-inactiveTabStyle" inactiveTabStyle = "data-inactiveTabStyle"

View File

@ -10,85 +10,85 @@ import (
const ( const (
// TimeChangedEvent is the constant for "time-changed" property tag. // TimeChangedEvent is the constant for "time-changed" property tag.
// //
// Used by `TimePicker`. // Used by TimePicker.
// Occur when current time of the time picker has been changed. // Occur when current time of the time picker has been changed.
// //
// General listener format: // General listener format:
// `func(picker rui.TimePicker, newTime, oldTime time.Time)`. // func(picker rui.TimePicker, newTime time.Time, oldTime time.Time).
// //
// where: // where:
// picker - Interface of a time picker which generated this event, // - picker - Interface of a time picker which generated this event,
// newTime - New time value, // - newTime - New time value,
// oldTime - Old time value. // - oldTime - Old time value.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(picker rui.TimePicker, newTime time.Time)`, // func(picker rui.TimePicker, newTime time.Time),
// `func(newTime, oldTime time.Time)`, // func(newTime time.Time, oldTime time.Time),
// `func(newTime time.Time)`, // func(newTime time.Time),
// `func(picker rui.TimePicker)`, // func(picker rui.TimePicker),
// `func()`. // func().
TimeChangedEvent PropertyName = "time-changed" TimeChangedEvent PropertyName = "time-changed"
// TimePickerMin is the constant for "time-picker-min" property tag. // TimePickerMin is the constant for "time-picker-min" property tag.
// //
// Used by `TimePicker`. // Used by TimePicker.
// The minimum value of the time. // The minimum value of the time.
// //
// Supported types: `time.Time`, `string`. // Supported types: time.Time, string.
// //
// Internal type is `time.Time`, other types converted to it during assignment. // Internal type is time.Time, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - values of this type parsed and converted to `time.Time`. The following formats are supported: // string - values of this type parsed and converted to time.Time. The following formats are supported:
// "HH:MM:SS" - "08:15:00". // - "HH:MM:SS" - "08:15:00".
// "HH:MM:SS PM" - "08:15:00 AM". // - "HH:MM:SS PM" - "08:15:00 AM".
// "HH:MM" - "08:15". // - "HH:MM" - "08:15".
// "HH:MM PM" - "08:15 AM". // - "HH:MM PM" - "08:15 AM".
TimePickerMin PropertyName = "time-picker-min" TimePickerMin PropertyName = "time-picker-min"
// TimePickerMax is the constant for "time-picker-max" property tag. // TimePickerMax is the constant for "time-picker-max" property tag.
// //
// Used by `TimePicker`. // Used by TimePicker.
// The maximum value of the time. // The maximum value of the time.
// //
// Supported types: `time.Time`, `string`. // Supported types: time.Time, string.
// //
// Internal type is `time.Time`, other types converted to it during assignment. // Internal type is time.Time, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - values of this type parsed and converted to `time.Time`. The following formats are supported: // string - values of this type parsed and converted to time.Time. The following formats are supported:
// "HH:MM:SS" - "08:15:00". // - "HH:MM:SS" - "08:15:00".
// "HH:MM:SS PM" - "08:15:00 AM". // - "HH:MM:SS PM" - "08:15:00 AM".
// "HH:MM" - "08:15". // - "HH:MM" - "08:15".
// "HH:MM PM" - "08:15 AM". // - "HH:MM PM" - "08:15 AM".
TimePickerMax PropertyName = "time-picker-max" TimePickerMax PropertyName = "time-picker-max"
// TimePickerStep is the constant for "time-picker-step" property tag. // TimePickerStep is the constant for "time-picker-step" property tag.
// //
// Used by `TimePicker`. // Used by TimePicker.
// Time step in seconds. // Time step in seconds.
// //
// Supported types: `int`, `string`. // Supported types: int, string.
// //
// Values: // Values:
// >= `0` or >= "0" - Step value in seconds used to increment or decrement time. // positive value - Step value in seconds used to increment or decrement time.
TimePickerStep PropertyName = "time-picker-step" TimePickerStep PropertyName = "time-picker-step"
// TimePickerValue is the constant for "time-picker-value" property tag. // TimePickerValue is the constant for "time-picker-value" property tag.
// //
// Used by `TimePicker`. // Used by TimePicker.
// Current value. // Current value.
// //
// Supported types: `time.Time`, `string`. // Supported types: time.Time, string.
// //
// Internal type is `time.Time`, other types converted to it during assignment. // Internal type is time.Time, other types converted to it during assignment.
// //
// Conversion rules: // Conversion rules:
// `string` - values of this type parsed and converted to `time.Time`. The following formats are supported: // string - values of this type parsed and converted to time.Time. The following formats are supported:
// "HH:MM:SS" - "08:15:00". // - "HH:MM:SS" - "08:15:00".
// "HH:MM:SS PM" - "08:15:00 AM". // - "HH:MM:SS PM" - "08:15:00 AM".
// "HH:MM" - "08:15". // - "HH:MM" - "08:15".
// "HH:MM PM" - "08:15 AM". // - "HH:MM PM" - "08:15 AM".
TimePickerValue PropertyName = "time-picker-value" TimePickerValue PropertyName = "time-picker-value"
timeFormat = "15:04:05" timeFormat = "15:04:05"

View File

@ -8,75 +8,83 @@ import (
const ( const (
// TouchStart is the constant for "touch-start" property tag. // TouchStart is the constant for "touch-start" property tag.
// //
// Used by `View`. // Used by View.
// Is fired when one or more touch points are placed on the touch surface. // Is fired when one or more touch points are placed on the touch surface.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.TouchEvent)`. //
// func(view rui.View, event rui.TouchEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Touch event. // - event - Touch event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(event rui.TouchEvent)`, //
// `func(view rui.View)`, // func(event rui.TouchEvent)
// `func()`. // func(view rui.View)
// func()
TouchStart PropertyName = "touch-start" TouchStart PropertyName = "touch-start"
// TouchEnd is the constant for "touch-end" property tag. // TouchEnd is the constant for "touch-end" property tag.
// //
// Used by `View`. // Used by View.
// Fired when one or more touch points are removed from the touch surface. // Fired when one or more touch points are removed from the touch surface.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.TouchEvent)`. //
// func(view rui.View, event rui.TouchEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Touch event. // - event - Touch event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(event rui.TouchEvent)`, //
// `func(view rui.View)`, // func(event rui.TouchEvent)
// `func()`. // func(view rui.View)
// func()
TouchEnd PropertyName = "touch-end" TouchEnd PropertyName = "touch-end"
// TouchMove is the constant for "touch-move" property tag. // TouchMove is the constant for "touch-move" property tag.
// //
// Used by `View`. // Used by View.
// Is fired when one or more touch points are moved along the touch surface. // Is fired when one or more touch points are moved along the touch surface.
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.TouchEvent)`. //
// func(view rui.View, event rui.TouchEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Touch event. // - event - Touch event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(event rui.TouchEvent)`, //
// `func(view rui.View)`, // func(event rui.TouchEvent)
// `func()`. // func(view rui.View)
// func()
TouchMove PropertyName = "touch-move" TouchMove PropertyName = "touch-move"
// TouchCancel is the constant for "touch-cancel" property tag. // TouchCancel is the constant for "touch-cancel" property tag.
// //
// Used by `View`. // Used by View.
// Is fired when one or more touch points have been disrupted in an implementation-specific manner (for example, too many // Is fired when one or more touch points have been disrupted in an implementation-specific manner (for example, too many
// touch points are created). // touch points are created).
// //
// General listener format: // General listener format:
// `func(view rui.View, event rui.TouchEvent)`. //
// func(view rui.View, event rui.TouchEvent)
// //
// where: // where:
// view - Interface of a view which generated this event, // - view - Interface of a view which generated this event,
// event - Touch event. // - event - Touch event.
// //
// Allowed listener formats: // Allowed listener formats:
// `func(event rui.TouchEvent)`, //
// `func(view rui.View)`, // func(event rui.TouchEvent)
// `func()`. // func(view rui.View)
// func()
TouchCancel PropertyName = "touch-cancel" TouchCancel PropertyName = "touch-cancel"
) )

View File

@ -10,385 +10,263 @@ import (
const ( const (
// Transform is the constant for "transform" property tag. // Transform is the constant for "transform" property tag.
// //
// Used by `View`. // Used by View.
// Specify translation, scale and rotation over x, y and z axes as well as a distortion of a view along x and y axes. // Specify translation, scale and rotation over x, y and z axes as well as a distortion of a view along x and y axes.
// //
// Supported types: `TransformProperty`, `string`. // Supported types: TransformProperty, string.
// //
// See `TransformProperty` description for more details. // See TransformProperty description for more details.
// //
// Conversion rules: // Conversion rules:
// `TransformProperty` - stored as is, no conversion performed. // - TransformProperty - stored as is, no conversion performed.
// `string` - string representation of `TransformProperty` interface. Example: "_{translate-x = 10px, scale-y = 1.1}". // - string - string representation of TransformProperty interface. Example: "_{translate-x = 10px, scale-y = 1.1}".
Transform PropertyName = "transform" Transform PropertyName = "transform"
// Perspective is the constant for "perspective" property tag. // Perspective is the constant for "perspective" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// Distance between the z-plane and the user in order to give a 3D-positioned element some perspective. Each 3D element // Distance between the z-plane and the user in order to give a 3D-positioned element some perspective. Each 3D element
// with z > 0 becomes larger, each 3D-element with z < 0 becomes smaller. The default value is 0 (no 3D effects). // with z > 0 becomes larger, each 3D-element with z < 0 becomes smaller. The default value is 0 (no 3D effects).
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
Perspective PropertyName = "perspective" Perspective PropertyName = "perspective"
// PerspectiveOriginX is the constant for "perspective-origin-x" property tag. // PerspectiveOriginX is the constant for "perspective-origin-x" property tag.
// //
// Used by `View`. // Used by View.
// x-coordinate of the position at which the viewer is looking. It is used as the vanishing point by the "perspective" // x-coordinate of the position at which the viewer is looking. It is used as the vanishing point by the "perspective"
// property. The default value is 50%. // property. The default value is 50%.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
PerspectiveOriginX PropertyName = "perspective-origin-x" PerspectiveOriginX PropertyName = "perspective-origin-x"
// PerspectiveOriginY is the constant for "perspective-origin-y" property tag. // PerspectiveOriginY is the constant for "perspective-origin-y" property tag.
// //
// Used by `View`. // Used by View.
// y-coordinate of the position at which the viewer is looking. It is used as the vanishing point by the "perspective" // y-coordinate of the position at which the viewer is looking. It is used as the vanishing point by the "perspective"
// property. The default value is 50%. // property. The default value is 50%.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
PerspectiveOriginY PropertyName = "perspective-origin-y" PerspectiveOriginY PropertyName = "perspective-origin-y"
// BackfaceVisible is the constant for "backface-visibility" property tag. // BackfaceVisible is the constant for "backface-visibility" property tag.
// //
// Used by `View`. // Used by View.
// Controls whether the back face of a view is visible when turned towards the user. Default value is `true`. // Controls whether the back face of a view is visible when turned towards the user. Default value is true.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: bool, int, string.
// //
// Values: // Values:
// `true` or `1` or "true", "yes", "on", "1" - Back face is visible when turned towards the user. // - true, 1, "true", "yes", "on", "1" - Back face is visible when turned towards the user.
// `false` or `0` or "false", "no", "off", "0" - Back face is hidden, effectively making the view invisible when turned away from the user. // - false, 0, "false", "no", "off", "0" - Back face is hidden, effectively making the view invisible when turned away from the user.
BackfaceVisible PropertyName = "backface-visibility" BackfaceVisible PropertyName = "backface-visibility"
// TransformOriginX is the constant for "transform-origin-x" property tag. // TransformOriginX is the constant for "transform-origin-x" property tag.
// //
// Used by `View`. // Used by View.
// x-coordinate of the point around which a view transformation is applied. The default value is 50%. // x-coordinate of the point around which a view transformation is applied. The default value is 50%.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
TransformOriginX PropertyName = "transform-origin-x" TransformOriginX PropertyName = "transform-origin-x"
// TransformOriginY is the constant for "transform-origin-y" property tag. // TransformOriginY is the constant for "transform-origin-y" property tag.
// //
// Used by `View`. // Used by View.
// y-coordinate of the point around which a view transformation is applied. The default value is 50%. // y-coordinate of the point around which a view transformation is applied. The default value is 50%.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
TransformOriginY PropertyName = "transform-origin-y" TransformOriginY PropertyName = "transform-origin-y"
// TransformOriginZ is the constant for "transform-origin-z" property tag. // TransformOriginZ is the constant for "transform-origin-z" property tag.
// //
// Used by `View`. // Used by View.
// z-coordinate of the point around which a view transformation is applied. The default value is 50%. // z-coordinate of the point around which a view transformation is applied. The default value is 50%.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
TransformOriginZ PropertyName = "transform-origin-z" TransformOriginZ PropertyName = "transform-origin-z"
// TranslateX is the constant for "translate-x" property tag. // TranslateX is the constant for "translate-x" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// x-axis translation value of a 2D/3D translation. // x-axis translation value of a 2D/3D translation.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
//
// Usage in `TransformProperty`:
// x-axis translation value of a 2D/3D translation.
//
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`.
//
// Internal type is `SizeUnit`, other types converted to it during assignment.
// See `SizeUnit` description for more details.
TranslateX PropertyName = "translate-x" TranslateX PropertyName = "translate-x"
// TranslateY is the constant for "translate-y" property tag. // TranslateY is the constant for "translate-y" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// y-axis translation value of a 2D/3D translation.
//
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`.
//
// Internal type is `SizeUnit`, other types converted to it during assignment.
// See `SizeUnit` description for more details.
//
// Usage in `TransformProperty`:
// x-axis translation value of a 2D/3D translation. // x-axis translation value of a 2D/3D translation.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
TranslateY PropertyName = "translate-y" TranslateY PropertyName = "translate-y"
// TranslateZ is the constant for "translate-z" property tag. // TranslateZ is the constant for "translate-z" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// z-axis translation value of a 3D translation. // z-axis translation value of a 3D translation.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: SizeUnit, SizeFunc, string, float, int.
// //
// Internal type is `SizeUnit`, other types converted to it during assignment. // Internal type is SizeUnit, other types converted to it during assignment.
// See `SizeUnit` description for more details. // See SizeUnit description for more details.
//
// Usage in `TransformProperty`:
// z-axis translation value of a 3D translation.
//
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`.
//
// Internal type is `SizeUnit`, other types converted to it during assignment.
// See `SizeUnit` description for more details.
TranslateZ PropertyName = "translate-z" TranslateZ PropertyName = "translate-z"
// ScaleX is the constant for "scale-x" property tag. // ScaleX is the constant for "scale-x" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// x-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original // x-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1. // scale, more than 1 - to increase. The default value is 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
//
// Usage in `TransformProperty`:
// x-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1.
//
// Supported types: `float`, `int`, `string`.
//
// Internal type is `float`, other types converted to it during assignment.
ScaleX PropertyName = "scale-x" ScaleX PropertyName = "scale-x"
// ScaleY is the constant for "scale-y" property tag. // ScaleY is the constant for "scale-y" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// y-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original // y-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1. // scale, more than 1 - to increase. The default value is 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
//
// Usage in `TransformProperty`:
// y-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1.
//
// Supported types: `float`, `int`, `string`.
//
// Internal type is `float`, other types converted to it during assignment.
ScaleY PropertyName = "scale-y" ScaleY PropertyName = "scale-y"
// ScaleZ is the constant for "scale-z" property tag. // ScaleZ is the constant for "scale-z" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// z-axis scaling value of a 3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original // z-axis scaling value of a 3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1. // scale, more than 1 - to increase. The default value is 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
//
// Usage in `TransformProperty`:
// z-axis scaling value of a 3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1.
//
// Supported types: `float`, `int`, `string`.
//
// Internal type is `float`, other types converted to it during assignment.
ScaleZ PropertyName = "scale-z" ScaleZ PropertyName = "scale-z"
// Rotate is the constant for "rotate" property tag. // Rotate is the constant for "rotate" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// Angle of the view rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise. // Angle of the view rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise.
// //
// Supported types: `AngleUnit`, `string`, `float`, `int`. // Supported types: AngleUnit, string, float, int.
// //
// Internal type is `AngleUnit`, other types will be converted to it during assignment. // Internal type is AngleUnit, other types will be converted to it during assignment.
// See `AngleUnit` description for more details. // See AngleUnit description for more details.
// //
// Conversion rules: // Conversion rules:
// `AngleUnit` - stored as is, no conversion performed. // - AngleUnit - stored as is, no conversion performed.
// `string` - must contain string representation of `AngleUnit`. If numeric value will be provided without any suffix then `AngleUnit` with value and `Radian` value type will be created. // - string - must contain string representation of AngleUnit. If numeric value will be provided without any suffix then AngleUnit with value and Radian value type will be created.
// `float` - a new `AngleUnit` value will be created with `Radian` as a type. // - float - a new AngleUnit value will be created with Radian as a type.
// `int` - a new `AngleUnit` value will be created with `Radian` as a type. // - int - a new AngleUnit value will be created with Radian as a type.
//
// Usage in `TransformProperty`:
// Angle of the view rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise.
//
// Supported types: `AngleUnit`, `string`, `float`, `int`.
//
// Internal type is `AngleUnit`, other types will be converted to it during assignment.
// See `AngleUnit` description for more details.
//
// Conversion rules:
// `AngleUnit` - stored as is, no conversion performed.
// `string` - must contain string representation of `AngleUnit`. If numeric value will be provided without any suffix then `AngleUnit` with value and `Radian` value type will be created.
// `float` - a new `AngleUnit` value will be created with `Radian` as a type.
// `int` - a new `AngleUnit` value will be created with `Radian` as a type.
Rotate PropertyName = "rotate" Rotate PropertyName = "rotate"
// RotateX is the constant for "rotate-x" property tag. // RotateX is the constant for "rotate-x" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// x-coordinate of the vector denoting the axis of rotation in range 0 to 1. // x-coordinate of the vector denoting the axis of rotation in range 0 to 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
//
// Usage in `TransformProperty`:
// x-coordinate of the vector denoting the axis of rotation in range 0 to 1.
//
// Supported types: `float`, `int`, `string`.
//
// Internal type is `float`, other types converted to it during assignment.
RotateX PropertyName = "rotate-x" RotateX PropertyName = "rotate-x"
// RotateY is the constant for "rotate-y" property tag. // RotateY is the constant for "rotate-y" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// y-coordinate of the vector denoting the axis of rotation in range 0 to 1. // y-coordinate of the vector denoting the axis of rotation in range 0 to 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
//
// Usage in `TransformProperty`:
// y-coordinate of the vector denoting the axis of rotation in range 0 to 1.
//
// Supported types: `float`, `int`, `string`.
//
// Internal type is `float`, other types converted to it during assignment.
RotateY PropertyName = "rotate-y" RotateY PropertyName = "rotate-y"
// RotateZ is the constant for "rotate-z" property tag. // RotateZ is the constant for "rotate-z" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// z-coordinate of the vector denoting the axis of rotation in range 0 to 1. // z-coordinate of the vector denoting the axis of rotation in range 0 to 1.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
//
// Usage in `TransformProperty`:
// z-coordinate of the vector denoting the axis of rotation in range 0 to 1.
//
// Supported types: `float`, `int`, `string`.
//
// Internal type is `float`, other types converted to it during assignment.
RotateZ PropertyName = "rotate-z" RotateZ PropertyName = "rotate-z"
// SkewX is the constant for "skew-x" property tag. // SkewX is the constant for "skew-x" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// Angle to use to distort the element along the abscissa. The default value is 0. // Angle to use to distort the element along the abscissa. The default value is 0.
// //
// Supported types: `AngleUnit`, `string`, `float`, `int`. // Supported types: AngleUnit, string, float, int.
// //
// Internal type is `AngleUnit`, other types will be converted to it during assignment. // Internal type is AngleUnit, other types will be converted to it during assignment.
// See `AngleUnit` description for more details. // See AngleUnit description for more details.
// //
// Conversion rules: // Conversion rules:
// `AngleUnit` - stored as is, no conversion performed. // - AngleUnit - stored as is, no conversion performed.
// `string` - must contain string representation of `AngleUnit`. If numeric value will be provided without any suffix then `AngleUnit` with value and `Radian` value type will be created. // - string - must contain string representation of AngleUnit. If numeric value will be provided without any suffix then AngleUnit with value and Radian value type will be created.
// `float` - a new `AngleUnit` value will be created with `Radian` as a type. // - float - a new AngleUnit value will be created with Radian as a type.
// `int` - a new `AngleUnit` value will be created with `Radian` as a type. // - int - a new AngleUnit value will be created with Radian as a type.
//
// Usage in `TransformProperty`:
// Angle to use to distort the element along the abscissa. The default value is 0.
//
// Supported types: `AngleUnit`, `string`, `float`, `int`.
//
// Internal type is `AngleUnit`, other types will be converted to it during assignment.
// See `AngleUnit` description for more details.
//
// Conversion rules:
// `AngleUnit` - stored as is, no conversion performed.
// `string` - must contain string representation of `AngleUnit`. If numeric value will be provided without any suffix then `AngleUnit` with value and `Radian` value type will be created.
// `float` - a new `AngleUnit` value will be created with `Radian` as a type.
// `int` - a new `AngleUnit` value will be created with `Radian` as a type.
SkewX PropertyName = "skew-x" SkewX PropertyName = "skew-x"
// SkewY is the constant for "skew-y" property tag. // SkewY is the constant for "skew-y" property tag.
// //
// Used by `View`, `TransformProperty`. // Used by View, TransformProperty.
// //
// Usage in `View`:
// Angle to use to distort the element along the ordinate. The default value is 0. // Angle to use to distort the element along the ordinate. The default value is 0.
// //
// Supported types: `AngleUnit`, `string`, `float`, `int`. // Supported types: AngleUnit, string, float, int.
// //
// Internal type is `AngleUnit`, other types will be converted to it during assignment. // Internal type is AngleUnit, other types will be converted to it during assignment.
// See `AngleUnit` description for more details. // See AngleUnit description for more details.
// //
// Conversion rules: // Conversion rules:
// `AngleUnit` - stored as is, no conversion performed. // - AngleUnit - stored as is, no conversion performed.
// `string` - must contain string representation of `AngleUnit`. If numeric value will be provided without any suffix then `AngleUnit` with value and `Radian` value type will be created. // - string - must contain string representation of AngleUnit. If numeric value will be provided without any suffix then AngleUnit with value and Radian value type will be created.
// `float` - a new `AngleUnit` value will be created with `Radian` as a type. // - float - a new AngleUnit value will be created with Radian as a type.
// `int` - a new `AngleUnit` value will be created with `Radian` as a type. // - int - a new AngleUnit value will be created with Radian as a type.
//
// Usage in `TransformProperty`:
// Angle to use to distort the element along the ordinate. The default value is 0.
//
// Supported types: `AngleUnit`, `string`, `float`, `int`.
//
// Internal type is `AngleUnit`, other types will be converted to it during assignment.
// See `AngleUnit` description for more details.
//
// Conversion rules:
// `AngleUnit` - stored as is, no conversion performed.
// `string` - must contain string representation of `AngleUnit`. If numeric value will be provided without any suffix then `AngleUnit` with value and `Radian` value type will be created.
// `float` - a new `AngleUnit` value will be created with `Radian` as a type.
// `int` - a new `AngleUnit` value will be created with `Radian` as a type.
SkewY PropertyName = "skew-y" SkewY PropertyName = "skew-y"
) )
// TransformProperty interface specifies view transformation parameters: the x-, y-, and z-axis translation values, // TransformProperty interface specifies view transformation parameters: the x-, y-, and z-axis translation values,
// the x-, y-, and z-axis scaling values, the angle to use to distort the element along the abscissa and ordinate, // the x-, y-, and z-axis scaling values, the angle to use to distort the element along the abscissa and ordinate,
// the angle of the view rotation. // the angle of the view rotation.
//
// Valid property tags: Perspective ("perspective"), TranslateX ("translate-x"), TranslateY ("translate-y"), TranslateZ ("translate-z"), // Valid property tags: Perspective ("perspective"), TranslateX ("translate-x"), TranslateY ("translate-y"), TranslateZ ("translate-z"),
// ScaleX ("scale-x"), ScaleY ("scale-y"), ScaleZ ("scale-z"), Rotate ("rotate"), RotateX ("rotate-x"), // ScaleX ("scale-x"), ScaleY ("scale-y"), ScaleZ ("scale-z"), Rotate ("rotate"), RotateX ("rotate-x"),
// RotateY ("rotate-y"), RotateZ ("rotate-z"), SkewX ("skew-x"), and SkewY ("skew-y") // RotateY ("rotate-y"), RotateZ ("rotate-z"), SkewX ("skew-x"), and SkewY ("skew-y")
@ -406,6 +284,12 @@ type transformPropertyData struct {
} }
// NewTransform creates a new transform property data and return its interface // NewTransform creates a new transform property data and return its interface
//
// The following properties can be used:
//
// Perspective ("perspective"), TranslateX ("translate-x"), TranslateY ("translate-y"), TranslateZ ("translate-z"),
// ScaleX ("scale-x"), ScaleY ("scale-y"), ScaleZ ("scale-z"), Rotate ("rotate"), RotateX ("rotate-x"),
// RotateY ("rotate-y"), RotateZ ("rotate-z"), SkewX ("skew-x"), and SkewY ("skew-y")
func NewTransformProperty(params Params) TransformProperty { func NewTransformProperty(params Params) TransformProperty {
transform := new(transformPropertyData) transform := new(transformPropertyData)
transform.init() transform.init()

View File

@ -8,32 +8,32 @@ import (
const ( const (
// VideoWidth is the constant for "video-width" property tag. // VideoWidth is the constant for "video-width" property tag.
// //
// Used by `VideoPlayer`. // Used by VideoPlayer.
// Defines the width of the video's display area in pixels. // Defines the width of the video's display area in pixels.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Values: // Values:
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
VideoWidth PropertyName = "video-width" VideoWidth PropertyName = "video-width"
// VideoHeight is the constant for "video-height" property tag. // VideoHeight is the constant for "video-height" property tag.
// //
// Used by `VideoPlayer`. // Used by VideoPlayer.
// Defines the height of the video's display area in pixels. // Defines the height of the video's display area in pixels.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
VideoHeight PropertyName = "video-height" VideoHeight PropertyName = "video-height"
// Poster is the constant for "poster" property tag. // Poster is the constant for "poster" property tag.
// //
// Used by `VideoPlayer`. // Used by VideoPlayer.
// Defines an URL for an image to be shown while the video is downloading. If this attribute isn't specified, nothing is // Defines an URL for an image to be shown while the video is downloading. If this attribute isn't specified, nothing is
// displayed until the first frame is available, then the first frame is shown as the poster frame. // displayed until the first frame is available, then the first frame is shown as the poster frame.
// //
// Supported types: `string`. // Supported types: string.
Poster PropertyName = "poster" Poster PropertyName = "poster"
) )

View File

@ -55,8 +55,8 @@ type View interface {
Scroll() Frame Scroll() Frame
// SetParams sets properties with name "tag" of the "rootView" subview. Result: // SetParams sets properties with name "tag" of the "rootView" subview. Result:
// * true - all properties were set successful, // - true - all properties were set successful,
// * false - error (incompatible type or invalid format of a string value, see AppLog). // - false - error (incompatible type or invalid format of a string value, see AppLog).
SetParams(params Params) bool SetParams(params Params) bool
// SetAnimated sets the value (second argument) of the property with name defined by the first argument. // SetAnimated sets the value (second argument) of the property with name defined by the first argument.

View File

@ -31,11 +31,11 @@ type polygonClip struct {
} }
// InsetClip creates a rectangle View clipping area. // InsetClip creates a rectangle View clipping area.
// top - offset from the top border of a View; // - top - offset from the top border of a View;
// right - offset from the right border of a View; // - right - offset from the right border of a View;
// bottom - offset from the bottom border of a View; // - bottom - offset from the bottom border of a View;
// left - offset from the left border of a View; // - left - offset from the left border of a View;
// radius - corner radius, pass nil if you don't need to round corners // - radius - corner radius, pass nil if you don't need to round corners
func InsetClip(top, right, bottom, left SizeUnit, radius RadiusProperty) ClipShape { func InsetClip(top, right, bottom, left SizeUnit, radius RadiusProperty) ClipShape {
clip := new(insetClip) clip := new(insetClip)
clip.init() clip.init()
@ -71,6 +71,7 @@ func EllipseClip(x, y, rx, ry SizeUnit) ClipShape {
} }
// PolygonClip creates a polygon View clipping area. // PolygonClip creates a polygon View clipping area.
//
// The elements of the function argument can be or text constants, // The elements of the function argument can be or text constants,
// or the text representation of SizeUnit, or elements of SizeUnit type. // or the text representation of SizeUnit, or elements of SizeUnit type.
func PolygonClip(points []any) ClipShape { func PolygonClip(points []any) ClipShape {

View File

@ -9,122 +9,122 @@ import (
const ( const (
// Blur is the constant for "blur" property tag. // Blur is the constant for "blur" property tag.
// //
// Used by `ViewFilter`. // Used by ViewFilter.
// Applies a Gaussian blur. The value of radius defines the value of the standard deviation to the Gaussian function, or // Applies a Gaussian blur. The value of radius defines the value of the standard deviation to the Gaussian function, or
// how many pixels on the screen blend into each other, so a larger value will create more blur. The lacuna value for // how many pixels on the screen blend into each other, so a larger value will create more blur. The lacuna value for
// interpolation is 0. The parameter is specified as a length in pixels. // interpolation is 0. The parameter is specified as a length in pixels.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
Blur PropertyName = "blur" Blur PropertyName = "blur"
// Brightness is the constant for "brightness" property tag. // Brightness is the constant for "brightness" property tag.
// //
// Used by `ViewFilter`. // Used by ViewFilter.
// Applies a linear multiplier to input image, making it appear more or less bright. A value of 0% will create an image // Applies a linear multiplier to input image, making it appear more or less bright. A value of 0% will create an image
// that is completely black. A value of 100% leaves the input unchanged. Other values are linear multipliers on the // that is completely black. A value of 100% leaves the input unchanged. Other values are linear multipliers on the
// effect. Values of an amount over 100% are allowed, providing brighter results. // effect. Values of an amount over 100% are allowed, providing brighter results.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
Brightness PropertyName = "brightness" Brightness PropertyName = "brightness"
// Contrast is the constant for "contrast" property tag. // Contrast is the constant for "contrast" property tag.
// //
// Used by `ViewFilter`. // Used by ViewFilter.
// Adjusts the contrast of the input. A value of 0% will create an image that is completely black. A value of 100% leaves // Adjusts the contrast of the input. A value of 0% will create an image that is completely black. A value of 100% leaves
// the input unchanged. Values of amount over 100% are allowed, providing results with less contrast. // the input unchanged. Values of amount over 100% are allowed, providing results with less contrast.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
Contrast PropertyName = "contrast" Contrast PropertyName = "contrast"
// DropShadow is the constant for "drop-shadow" property tag. // DropShadow is the constant for "drop-shadow" property tag.
// //
// Used by `ViewFilter`. // Used by ViewFilter.
// Applies a drop shadow effect to the input image. A drop shadow is effectively a blurred, offset version of the input // Applies a drop shadow effect to the input image. A drop shadow is effectively a blurred, offset version of the input
// image's alpha mask drawn in a particular color, composited below the image. Shadow parameters are set using the // image's alpha mask drawn in a particular color, composited below the image. Shadow parameters are set using the
// `ShadowProperty` interface. // ShadowProperty interface.
// //
// Supported types: `[]ShadowProperty`, `ShadowProperty`, `string`. // Supported types: []ShadowProperty, ShadowProperty, string.
// //
// Internal type is `[]ShadowProperty`, other types converted to it during assignment. // Internal type is []ShadowProperty, other types converted to it during assignment.
// See `ShadowProperty` description for more details. // See ShadowProperty description for more details.
// //
// Conversion rules: // Conversion rules:
// `[]ShadowProperty` - stored as is, no conversion performed. // - []ShadowProperty - stored as is, no conversion performed.
// `ShadowProperty` - converted to `[]ShadowProperty`. // - ShadowProperty - converted to []ShadowProperty.
// `string` - string representation of `ShadowProperty`. Example: "_{blur = 1em, color = black, spread-radius = 0.5em}". // - string - string representation of ShadowProperty. Example: "_{blur = 1em, color = black, spread-radius = 0.5em}".
DropShadow PropertyName = "drop-shadow" DropShadow PropertyName = "drop-shadow"
// Grayscale is the constant for "grayscale" property tag. // Grayscale is the constant for "grayscale" property tag.
// //
// Used by `ViewFilter`. // Used by ViewFilter.
// Converts the input image to grayscale. The value of amount defines the proportion of the conversion. A value of 100% // Converts the input image to grayscale. The value of amount defines the proportion of the conversion. A value of 100%
// is completely grayscale. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on // is completely grayscale. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on
// the effect. // the effect.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
Grayscale PropertyName = "grayscale" Grayscale PropertyName = "grayscale"
// HueRotate is the constant for "hue-rotate" property tag. // HueRotate is the constant for "hue-rotate" property tag.
// //
// Used by `ViewFilter`. // Used by ViewFilter.
// Applies a hue rotation on the input image. The value of angle defines the number of degrees around the color circle // Applies a hue rotation on the input image. The value of angle defines the number of degrees around the color circle
// the input samples will be adjusted. A value of 0deg leaves the input unchanged. If the angle parameter is missing, a // the input samples will be adjusted. A value of 0deg leaves the input unchanged. If the angle parameter is missing, a
// value of 0deg is used. Though there is no maximum value, the effect of values above 360deg wraps around. // value of 0deg is used. Though there is no maximum value, the effect of values above 360deg wraps around.
// //
// Supported types: `AngleUnit`, `string`, `float`, `int`. // Supported types: AngleUnit, string, float, int.
// //
// Internal type is `AngleUnit`, other types will be converted to it during assignment. // Internal type is AngleUnit, other types will be converted to it during assignment.
// See `AngleUnit` description for more details. // See AngleUnit description for more details.
// //
// Conversion rules: // Conversion rules:
// `AngleUnit` - stored as is, no conversion performed. // - AngleUnit - stored as is, no conversion performed.
// `string` - must contain string representation of `AngleUnit`. If numeric value will be provided without any suffix then `AngleUnit` with value and `Radian` value type will be created. // - string - must contain string representation of AngleUnit. If numeric value will be provided without any suffix then AngleUnit with value and Radian value type will be created.
// `float` - a new `AngleUnit` value will be created with `Radian` as a type. // - float - a new AngleUnit value will be created with Radian as a type.
// `int` - a new `AngleUnit` value will be created with `Radian` as a type. // - int - a new AngleUnit value will be created with Radian as a type.
HueRotate PropertyName = "hue-rotate" HueRotate PropertyName = "hue-rotate"
// Invert is the constant for "invert" property tag. // Invert is the constant for "invert" property tag.
// //
// Used by `ViewFilter`. // Used by ViewFilter.
// Inverts the samples in the input image. The value of amount defines the proportion of the conversion. A value of 100% // Inverts the samples in the input image. The value of amount defines the proportion of the conversion. A value of 100%
// is completely inverted. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on // is completely inverted. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on
// the effect. // the effect.
// //
// Supported types: `float64`, `int`, `string`. // Supported types: float64, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
Invert PropertyName = "invert" Invert PropertyName = "invert"
// Saturate is the constant for "saturate" property tag. // Saturate is the constant for "saturate" property tag.
// //
// Used by `ViewFilter`. // Used by ViewFilter.
// Saturates the input image. The value of amount defines the proportion of the conversion. A value of 0% is completely // Saturates the input image. The value of amount defines the proportion of the conversion. A value of 0% is completely
// un-saturated. A value of 100% leaves the input unchanged. Other values are linear multipliers on the effect. Values of // un-saturated. A value of 100% leaves the input unchanged. Other values are linear multipliers on the effect. Values of
// amount over 100% are allowed, providing super-saturated results. // amount over 100% are allowed, providing super-saturated results.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
Saturate PropertyName = "saturate" Saturate PropertyName = "saturate"
// Sepia is the constant for "sepia" property tag. // Sepia is the constant for "sepia" property tag.
// //
// Used by `ViewFilter`. // Used by ViewFilter.
// Converts the input image to sepia. The value of amount defines the proportion of the conversion. A value of 100% is // Converts the input image to sepia. The value of amount defines the proportion of the conversion. A value of 100% is
// completely sepia. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the // completely sepia. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the
// effect. // effect.
// //
// Supported types: `float`, `int`, `string`. // Supported types: float, int, string.
// //
// Internal type is `float`, other types converted to it during assignment. // Internal type is float, other types converted to it during assignment.
Sepia PropertyName = "sepia" Sepia PropertyName = "sepia"
) )

View File

@ -1,7 +1,9 @@
package rui package rui
// Get returns a value of the property with name "tag" of the "rootView" subview with "viewID" id value. // Get returns a value of the property with name "tag" of the "rootView" subview with "viewID" id value.
//
// The type of return value depends on the property. // The type of return value depends on the property.
//
// If the subview don't exists or the property is not set then nil is returned. // If the subview don't exists or the property is not set then nil is returned.
// //
// If the second argument (subviewID) is "" then a listener for the first argument (view) is get // If the second argument (subviewID) is "" then a listener for the first argument (view) is get
@ -19,10 +21,8 @@ func Get(rootView View, viewID string, tag PropertyName) any {
} }
// Set sets the property with name "tag" of the "rootView" subview with "viewID" id by value. Result: // Set sets the property with name "tag" of the "rootView" subview with "viewID" id by value. Result:
// // - true - success,
// true - success, // - false - error (incompatible type or invalid format of a string value, see AppLog).
//
// false - error (incompatible type or invalid format of a string value, see AppLog).
// //
// If the second argument (subviewID) is "" then a listener for the first argument (view) is set // If the second argument (subviewID) is "" then a listener for the first argument (view) is set
func Set(rootView View, viewID string, tag PropertyName, value any) bool { func Set(rootView View, viewID string, tag PropertyName, value any) bool {
@ -39,6 +39,7 @@ func Set(rootView View, viewID string, tag PropertyName, value any) bool {
} }
// SetChangeListener sets a listener for changing a subview property value. // SetChangeListener sets a listener for changing a subview property value.
//
// If the second argument (subviewID) is "" then a listener for the first argument (view) is set // If the second argument (subviewID) is "" then a listener for the first argument (view) is set
func SetChangeListener(view View, viewID string, tag PropertyName, listener func(View, PropertyName)) { func SetChangeListener(view View, viewID string, tag PropertyName, listener func(View, PropertyName)) {
if viewID != "" { if viewID != "" {
@ -50,8 +51,8 @@ func SetChangeListener(view View, viewID string, tag PropertyName, listener func
} }
// SetParams sets properties with name "tag" of the "rootView" subview. Result: // SetParams sets properties with name "tag" of the "rootView" subview. Result:
// true - all properties were set successful, // - true - all properties were set successful,
// false - error (incompatible type or invalid format of a string value, see AppLog). // - false - error (incompatible type or invalid format of a string value, see AppLog).
func SetParams(rootView View, viewID string, params Params) bool { func SetParams(rootView View, viewID string, params Params) bool {
if viewID != "" { if viewID != "" {
rootView = ViewByID(rootView, viewID) rootView = ViewByID(rootView, viewID)