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
NewInsetViewShadow function -> NewInsetShadow
NewShadowWithParams function -> NewShadowProperty
NewColumnSeparator function -> NewColumnSeparatorProperty
* Added functions: NewBounds, NewEllipticRadius, NewRadii, NewLinearGradient, NewCircleRadialGradient,
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.

View File

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

View File

@ -11,132 +11,146 @@ import (
const (
// AnimationTag is the constant for "animation" property tag.
//
// Used by `View`.
// Used by View.
// Sets and starts animations.
//
// Supported types: `Animation`, `[]Animation`.
// Supported types: Animation, []Animation.
//
// Internal type is `[]Animation`, other types converted to it during assignment.
// See `Animation` description for more details.
// Internal type is []Animation, other types converted to it during assignment.
// See Animation description for more details.
AnimationTag PropertyName = "animation"
// AnimationPaused is the constant for "animation-paused" property tag.
//
// Used by `Animation`.
// Used by Animation.
// Controls whether the animation is running or paused.
//
// Supported types: `bool`, `int`, `string`.
// Supported types: bool, int, string.
//
// Values:
// `true` or `1` or "true", "yes", "on", "1" - Animation is paused.
// `false` or `0` or "false", "no", "off", "0" - Animation is playing.
// - true, 1, "true", "yes", "on", or "1" - Animation is paused.
// - false, 0, "false", "no", "off", or "0" - Animation is playing.
AnimationPaused PropertyName = "animation-paused"
// Transition is the constant for "transition" property tag.
//
// Used by `View`.
// Sets transition animation of view properties. Each provided property must contain `Animation` which describe how
// Used by View.
//
// 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
// 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
// `string` no error will occur, simply there will be no animation.
// 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
// 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"
// PropertyTag is the constant for "property" property tag.
//
// Used by `Animation`.
// Describes a scenario for changing a `View`'s property. Used only for animation script.
// Used by Animation.
//
// 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.
// See `AnimatedProperty` description for more details.
// Supported types: []AnimatedProperty, AnimatedProperty.
//
// Internal type is []AnimatedProperty, other types converted to it during assignment.
// See AnimatedProperty description for more details.
PropertyTag PropertyName = "property"
// 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.
//
// 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"
// 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
// the animation. The animation can start later, immediately from its beginning or immediately and partway through the
// 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"
// 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.
//
// Supported types: `string`.
// Supported types: string.
//
// Values:
// "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-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.
// "linear"(`LinearTiming`) - Constant speed.
// - "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-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.
// - "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"
// 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.
//
// 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"
// 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
// and backward. Used only for animation script.
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// 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.
// `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.
// `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.
// - 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.
// - 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.
AnimationDirection PropertyName = "animation-direction"
// NormalAnimation is value of the "animation-direction" property.
//
// 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.
NormalAnimation = 0
// ReverseAnimation is value of the "animation-direction" property.
//
// 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
// backwards, and timing functions are also reversed.
//
// For example, an "ease-in" timing function becomes "ease-out".
ReverseAnimation = 1
// AlternateAnimation is value of the "animation-direction" property.
//
// 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.
AlternateAnimation = 2
// AlternateReverseAnimation is value of the "animation-direction" property.
//
// 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.
AlternateReverseAnimation = 3
@ -200,6 +214,7 @@ type animationData struct {
}
// Animation interface is used to set animation parameters. Used properties:
//
// "property", "id", "duration", "delay", "timing-function", "iteration-count", and "animation-direction"
type Animation interface {
Properties

View File

@ -4,154 +4,155 @@ package rui
const (
// 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.
//
// General listener format:
// `func(view rui.View, propertyName string)`.
// func(view rui.View, propertyName rui.PropertyName).
//
// where:
// view - Interface of a view which generated this event,
// propertyName - Name of the property.
// - view - Interface of a view which generated this event,
// - propertyName - Name of the property.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(propertyName string)`,
// `func()`.
// func(view rui.View),
// func(propertyName rui.PropertyName)
// func().
TransitionRunEvent PropertyName = "transition-run-event"
// 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.
//
// General listener format:
// `func(view rui.View, propertyName string)`.
// func(view rui.View, propertyName rui.PropertyName).
//
// where:
// view - Interface of a view which generated this event,
// propertyName - Name of the property.
// - view - Interface of a view which generated this event,
// - propertyName - Name of the property.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(propertyName string)`,
// `func()`.
// func(view rui.View)
// func(propertyName rui.PropertyName)
// func()
TransitionStartEvent PropertyName = "transition-start-event"
// TransitionEndEvent is the constant for "transition-end-event" property tag.
//
// Used by `View`.
// Used by View:
// Is fired when a transition has completed.
//
// General listener format:
// `func(view rui.View, propertyName string)`.
// func(view rui.View, propertyName rui.PropertyName).
//
// where:
// view - Interface of a view which generated this event,
// propertyName - Name of the property.
// - view - Interface of a view which generated this event,
// - propertyName - Name of the property.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(propertyName string)`,
// `func()`.
// func(view rui.View)
// func(propertyName rui.PropertyName)
// func()
TransitionEndEvent PropertyName = "transition-end-event"
// TransitionCancelEvent is the constant for "transition-cancel-event" property tag.
//
// Used by `View`.
// Is fired when a transition is cancelled. The transition is cancelled when: * A new property transition has begun. * 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.
// Used by View:
// Is fired when a transition is cancelled. The transition is cancelled when:
// - A new property transition has begun.
// - 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:
// `func(view rui.View, propertyName string)`.
// func(view rui.View, propertyName rui.PropertyName).
//
// where:
// view - Interface of a view which generated this event,
// propertyName - Name of the property.
// - view - Interface of a view which generated this event,
// - propertyName - Name of the property.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(propertyName string)`,
// `func()`.
// func(view rui.View)
// func(propertyName rui.PropertyName)
// func()
TransitionCancelEvent PropertyName = "transition-cancel-event"
// 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
// expired.
//
// General listener format:
// `func(view rui.View, animationId string)`.
// func(view rui.View, animationId string).
//
// where:
// view - Interface of a view which generated this event,
// animationId - Id of the animation.
// - view - Interface of a view which generated this event,
// - animationId - Id of the animation.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(animationId string)`,
// `func()`.
// func(view rui.View)
// func(animationId string)
// func()
AnimationStartEvent PropertyName = "animation-start-event"
// 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
// removed or the animation is removed from the element, the "animation-end-event" is not fired.
//
// General listener format:
// `func(view rui.View, animationId string)`.
// func(view rui.View, animationId string).
//
// where:
// view - Interface of a view which generated this event,
// animationId - Id of the animation.
// - view - Interface of a view which generated this event,
// - animationId - Id of the animation.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(animationId string)`,
// `func()`.
// func(view rui.View)
// func(animationId string)
// func()
AnimationEndEvent PropertyName = "animation-end-event"
// 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
// "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
// is not supported by all browsers.
//
// General listener format:
// `func(view rui.View, animationId string)`.
// func(view rui.View, animationId string).
//
// where:
// view - Interface of a view which generated this event,
// animationId - Id of the animation.
// - view - Interface of a view which generated this event,
// - animationId - Id of the animation.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(animationId string)`,
// `func()`.
// func(view rui.View)
// func(animationId string)
// func()
AnimationCancelEvent PropertyName = "animation-cancel-event"
// 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
// animation end event, and therefore does not occur for animations with an "iteration-count" of one.
//
// General listener format:
// `func(view rui.View, animationId string)`.
// func(view rui.View, animationId string).
//
// where:
// view - Interface of a view which generated this event,
// animationId - Id of the animation.
// - view - Interface of a view which generated this event,
// - animationId - Id of the animation.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(animationId string)`,
// `func()`.
// func(view rui.View)
// func(animationId string)
// func()
AnimationIterationEvent PropertyName = "animation-iteration-event"
)

View File

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

View File

@ -6,36 +6,24 @@ import (
const (
// 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).
//
// * BackgroundOrigin - The background 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.
// - 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.
// - MaskOrigin - The mask is positioned relative to the border box.
BorderBox = 0
// 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.
//
// * BackgroundOrigin - The background 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.
// - 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.
// - MaskOrigin - The mask is positioned relative to the padding box.
PaddingBox = 1
// ContentBox is value of the BackgroundClip and MaskClip property:
//
// * 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.
//
// * MaskOrigin - The mask is positioned relative 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.
// - MaskOrigin - The mask is positioned relative to the content box.
ContentBox = 2
)
@ -58,7 +46,6 @@ type backgroundElement struct {
dataProperty
}
// NewBackgroundImage creates the new background image
func createBackground(obj DataObject) BackgroundElement {
var result BackgroundElement = nil
@ -280,12 +267,14 @@ func backgroundStyledPropery(view View, subviewID []string, tag PropertyName) []
}
// 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.
func GetBackground(view View, subviewID ...string) []BackgroundElement {
return backgroundStyledPropery(view, subviewID, Background)
}
// 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.
func GetMask(view View, subviewID ...string) []BackgroundElement {
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:
//
// 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.
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:
//
// 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.
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:
//
// 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.
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:
//
// 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.
func GetMaskOrigin(view View, subviewID ...string) int {

View File

@ -19,6 +19,13 @@ type BackgroundGradientAngle struct {
}
// 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 {
result := new(backgroundConicGradient)
result.init()

View File

@ -7,50 +7,59 @@ import (
// Constants related to view's background description
const (
// NoRepeat is value of the Repeat property of an background image:
//
// The image is not repeated (and hence the background image painting area
// will not necessarily be entirely covered). The position of the non-repeated
// background image is defined by the background-position CSS property.
NoRepeat = 0
// RepeatXY is value of the Repeat property of an background image:
//
// 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.
RepeatXY = 1
// RepeatX is value of the Repeat property of an background image:
//
// 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 last image will be clipped if it doesn't fit.
RepeatX = 2
// RepeatY is value of the Repeat property of an background image:
//
// 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 last image will be clipped if it doesn't fit.
RepeatY = 3
// 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)
// 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.
RepeatRound = 4
// 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
// are pinned to either side of the element, and whitespace is distributed evenly between the images.
RepeatSpace = 5
// 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.
// (It is effectively attached to the element's border.)
ScrollAttachment = 0
// FixedAttachment is value of the Attachment property of an background image:
//
// The background is fixed relative to the viewport. Even if an element has
// a scrolling mechanism, the background doesn't move with the element.
FixedAttachment = 1
// 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 scrolls with the element's contents, and the background painting area
// 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
//
// 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 {
result := new(backgroundImage)
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)
Color any
// 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
}
@ -50,13 +50,11 @@ type backgroundLinearGradient struct {
}
// NewBackgroundLinearGradient creates the new background linear gradient.
//
// The following properties can be used:
//
// "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.
// - "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.
func NewBackgroundLinearGradient(params Params) BackgroundElement {
result := new(backgroundLinearGradient)
result.init()

View File

@ -40,17 +40,13 @@ type backgroundRadialGradient struct {
}
// NewBackgroundRadialGradient creates the new background radial 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-y" (CenterY) - Defines the gradient center point cooordinates.
//
// "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.
// - "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.
// - "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 {
result := new(backgroundRadialGradient)
result.init()

120
border.go
View File

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

View File

@ -20,6 +20,7 @@ type boundsPropertyData struct {
}
// NewBoundsProperty creates the new BoundsProperty object.
//
// The following SizeUnit properties can be used: "left" (Left), "right" (Right), "top" (Top), and "bottom" (Bottom).
func NewBoundsProperty(params Params) BoundsProperty {
bounds := new(boundsPropertyData)
@ -36,7 +37,9 @@ func NewBoundsProperty(params Params) BoundsProperty {
}
// NewBounds creates the new BoundsProperty object.
//
// 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.
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 {

106
canvas.go
View File

@ -129,15 +129,15 @@ type Canvas interface {
ClipPath(path Path)
// 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;
// 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.
SetScale(x, y float64)
// 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;
// y - distance to move in the vertical direction. Positive values are down, and negative are up.
// * 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.
SetTranslation(x, y float64)
// 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
// of this method. This lets you scale, rotate, translate (move), and skew the context.
// The transformation matrix is described by:
// ⎡ xScale xSkew dx ⎤
// ⎢ ySkew yScale dy ⎥
// ⎣ 0 0 1 ⎦
// xScale, yScale - horizontal and vertical scaling. A value of 1 results in no scaling;
// xSkew, ySkew - horizontal and vertical skewing;
// dx, dy - horizontal and vertical translation (moving).
// ⎡ xScale xSkew dx ⎤
// ⎢ ySkew yScale dy ⎥
// ⎣ 0 0 1 ⎦
// where
// * xScale, yScale - horizontal and vertical scaling. A value of 1 results in no scaling;
// * xSkew, ySkew - horizontal and vertical skewing;
// * dx, dy - horizontal and vertical translation (moving).
SetTransformation(xScale, yScale, xSkew, ySkew, dx, dy float64)
// ResetTransformation resets the current transform to the identity matrix
@ -165,63 +166,64 @@ type Canvas interface {
SetSolidColorStrokeStyle(color Color)
// SetLinearGradientFillStyle sets a gradient along the line connecting two given coordinates to use inside shapes
// x0, y0 - coordinates of the start point;
// x1, y1 - coordinates of the end point;
// startColor, endColor - the start and end color
// stopPoints - the array of stop points
// * x0, y0 - coordinates of the start point;
// * x1, y1 - coordinates of the end point;
// * startColor, endColor - the start and end color
// * stopPoints - the array of stop points
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
// x0, y0 - coordinates of the start point;
// x1, y1 - coordinates of the end point;
// color0, color1 - the start and end color
// stopPoints - the array of stop points
// * x0, y0 - coordinates of the start point;
// * x1, y1 - coordinates of the end point;
// * color0, color1 - the start and end color
// * stopPoints - the array of stop points
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
// to use inside shapes
// x0, y0 - coordinates of the center of the start circle;
// r0 - the radius of the start circle;
// x1, y1 - coordinates the center of the end circle;
// r1 - the radius of the end circle;
// color0, color1 - the start and end color
// stopPoints - the array of stop points
// * x0, y0 - coordinates of the center of the start circle;
// * r0 - the radius of the start circle;
// * x1, y1 - coordinates the center of the end circle;
// * r1 - the radius of the end circle;
// * color0, color1 - the start and end color
// * stopPoints - the array of stop points
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
// to use for the strokes (outlines) around shapes
// x0, y0 - coordinates of the center of the start circle;
// r0 - the radius of the start circle;
// x1, y1 - coordinates the center of the end circle;
// r1 - the radius of the end circle;
// color0, color1 - the start and end color
// stopPoints - the array of stop points
// * x0, y0 - coordinates of the center of the start circle;
// * r0 - the radius of the start circle;
// * x1, y1 - coordinates the center of the end circle;
// * r1 - the radius of the end circle;
// * color0, color1 - the start and end color
// * stopPoints - the array of stop points
SetRadialGradientStrokeStyle(x0, y0, r0 float64, color0 Color, x1, y1, r1 float64, color1 Color, stopPoints []GradientPoint)
// SetConicGradientFillStyle sets a conic gradient around a point
// to use inside shapes
// 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.
// startColor - the start 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.
// * 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.
// * startColor - the start 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.
SetConicGradientFillStyle(x, y, startAngle float64, startColor, endColor Color, stopPoints []GradientPoint)
// SetConicGradientFillStyle sets a conic gradient around a point
// to use inside shapes
// 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.
// startColor - the start 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.
// * 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.
// * startColor - the start 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.
SetConicGradientStrokeStyle(x, y, startAngle float64, startColor, endColor Color, stopPoints []GradientPoint)
// SetImageFillStyle set the image as the filling pattern.
// repeat - indicating how to repeat the pattern's image. Possible values are:
// NoRepeat (0) - neither direction,
// RepeatXY (1) - both directions,
// RepeatX (2) - horizontal only,
// RepeatY (3) - vertical only.
//
// repeat - indicating how to repeat the pattern's image. Possible values are:
// * NoRepeat (0) - neither direction,
// * RepeatXY (1) - both directions,
// * RepeatX (2) - horizontal only,
// * RepeatY (3) - vertical only.
SetImageFillStyle(image Image, repeat int)
// 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)
// SetShadow sets shadow parameters:
// offsetX, offsetY - the distance that shadows will be offset horizontally and vertically;
// blur - the amount of blur applied to shadows. Must be non-negative;
// color - the color of shadows.
// * offsetX, offsetY - the distance that shadows will be offset horizontally and vertically;
// * blur - the amount of blur applied to shadows. Must be non-negative;
// * color - the color of shadows.
SetShadow(offsetX, offsetY, blur float64, color Color)
// ResetShadow sets shadow parameters to default values (invisible shadow)
@ -292,10 +294,10 @@ type Canvas interface {
FillAndStrokeRoundedRect(x, y, width, height, r float64)
// FillEllipse draws a ellipse that is filled according to the current FillStyle.
// x, y - coordinates of the ellipse's center;
// radiusX - the ellipse's major-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.
// * x, y - coordinates of the ellipse's center;
// * radiusX - the ellipse's major-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.
FillEllipse(x, y, radiusX, radiusY, rotation float64)
// StrokeRoundedRect draws a ellipse that is stroked (outlined) according

View File

@ -10,16 +10,18 @@ import (
// Event occurs when the checkbox becomes checked/unchecked.
//
// General listener format:
// `func(checkbox rui.Checkbox, checked bool)`.
//
// func(checkbox rui.Checkbox, checked bool)
//
// where:
// checkbox - Interface of a checkbox which generated this event,
// checked - Checkbox state.
// - checkbox - Interface of a checkbox which generated this event,
// - checked - Checkbox state.
//
// Allowed listener formats:
// `func(checkbox rui.Checkbox)`,
// `func(checked bool)`,
// `func()`.
//
// func(checkbox rui.Checkbox)
// func(checked bool)
// func()
const CheckboxChangedEvent PropertyName = "checkbox-event"
// 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)
}
// 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
func (color Color) ARGB() (uint8, uint8, uint8, uint8) {
return uint8(color >> 24),

View File

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

View File

@ -8,110 +8,110 @@ import (
const (
// 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
// 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:
// `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.
// - 0 or "0" - Use "column-width" to control how many columns will be created.
// - positive value - Тhe number of columns into which the content is divided.
ColumnCount PropertyName = "column-count"
// ColumnWidth is the constant for "column-width" property tag.
//
// Used by `ColumnLayout`.
// Used by ColumnLayout.
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See [SizeUnit] description for more details.
ColumnWidth PropertyName = "column-width"
// ColumnGap is the constant for "column-gap" property tag.
//
// Used by `ColumnLayout`.
// Used by ColumnLayout.
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See [SizeUnit] description for more details.
ColumnGap PropertyName = "column-gap"
// 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.
//
// Supported types: `ColumnSeparatorProperty`, `ViewBorder`.
// Supported types: ColumnSeparatorProperty, ViewBorder.
//
// Internal type is `ColumnSeparatorProperty`, other types converted to it during assignment.
// See `ColumnSeparatorProperty` and `ViewBorder` description for more details.
// Internal type is ColumnSeparatorProperty, other types converted to it during assignment.
// See [ColumnSeparatorProperty] and [ViewBorder] description for more details.
ColumnSeparator PropertyName = "column-separator"
// 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.
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`NoneLine`) or "none" - The separator will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a separator.
// `2`(`DashedLine`) or "dashed" - Dashed line as a separator.
// `3`(`DottedLine`) or "dotted" - Dotted line as a separator.
// `4`(`DoubleLine`) or "double" - Double line as a separator.
// - 0 (NoneLine) or "none" - The separator will not be drawn.
// - 1 (SolidLine) or "solid" - Solid line as a separator.
// - 2 (DashedLine) or "dashed" - Dashed line as a separator.
// - 3 (DottedLine) or "dotted" - Dotted line as a separator.
// - 4 (DoubleLine) or "double" - Double line as a separator.
ColumnSeparatorStyle PropertyName = "column-separator-style"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
ColumnSeparatorWidth PropertyName = "column-separator-width"
// 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.
//
// Supported types: `Color`, `string`.
// Supported types: Color, string.
//
// Internal type is `Color`, other types converted to it during assignment.
// See `Color` description for more details.
// Internal type is Color, other types converted to it during assignment.
// See Color description for more details.
ColumnSeparatorColor PropertyName = "column-separator-color"
// ColumnFill is the constant for "column-fill" property tag.
//
// Used by `ColumnLayout`.
// Controls how a `ColumnLayout`'s content is balanced when broken into columns. Default value is "balance".
// Used by ColumnLayout.
// 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:
// `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.
// - 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.
ColumnFill PropertyName = "column-fill"
// 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
// columns. Default value is `false`.
// columns. Default value is false.
//
// Supported types: `bool`, `int`, `string`.
// Supported types: bool, int, string.
//
// Values:
// `true` or `1` or "true", "yes", "on", "1" - View will span across all columns.
// `false` or `0` or "false", "no", "off", "0" - View will be a part of a column.
// - true, 1, "true", "yes", "on", or "1" - View will span across all columns.
// - false, 0, "false", "no", "off", or "0" - View will be a part of a column.
ColumnSpanAll PropertyName = "column-span-all"
)

View File

@ -58,15 +58,13 @@ func newColumnSeparatorProperty(value any) ColumnSeparatorProperty {
return nil
}
// NewColumnSeparator creates the new ColumnSeparatorProperty.
// NewColumnSeparatorProperty creates the new ColumnSeparatorProperty.
//
// The following properties can be used:
//
// "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 (Color);
//
// "width" (Width). Determines the line thickness (SizeUnit).
func NewColumnSeparator(params Params) ColumnSeparatorProperty {
// - "style" (Style) - Determines the line style (type is 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]).
func NewColumnSeparatorProperty(params Params) ColumnSeparatorProperty {
separator := new(columnSeparatorProperty)
separator.init()
if params != nil {
@ -79,6 +77,20 @@ func NewColumnSeparator(params Params) ColumnSeparatorProperty {
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() {
separator.dataProperty.init()
separator.normalize = normalizeVolumnSeparatorTag

View File

@ -10,99 +10,88 @@ import (
const (
// 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.
//
// Supported types: `[]string`, `string`, `[]fmt.Stringer`, `[]Color`, `[]SizeUnit`, `[]AngleUnit`, `[]any` containing
// elements of `string`, `fmt.Stringer`, `bool`, `rune`, `float32`, `float64`, `int`, `int8` … `int64`, `uint`, `uint8` …
// `uint64`.
// Supported types: []string, string, []fmt.Stringer, []Color, []any containing
// elements of string, fmt.Stringer, 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:
// `string` - contain single item.
// `[]string` - an array of items.
// `[]fmt.Stringer` - an array of objects convertible to a string.
// `[]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.
// - string - contain single item.
// - []string - an array of items.
// - []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.
//
// # 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.
// 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".
//
// Supported types: `[]string`, `string`, `[]fmt.Stringer`, `[]Color`, `[]SizeUnit`, `[]AngleUnit`, `[]any` containing
// elements of `string`, `fmt.Stringer`, `bool`, `rune`, `float32`, `float64`, `int`, `int8` … `int64`, `uint`, `uint8` …
// `uint64`.
// Supported types: []string, string, []fmt.Stringer, []time.Time, []any containing elements of string, fmt.Stringer, time.Time.
//
// Internal type is `[]string`, other types converted to it during assignment.
// Internal type is []string, other types converted to it during assignment.
//
// Conversion rules:
// `string` - contain single item.
// `[]string` - an array of items.
// `[]fmt.Stringer` - an array of objects convertible to a string.
// `[]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.
// - string - contain single item.
// - []string - an array of items.
// - []fmt.Stringer - an array of objects convertible to a string.
// - []time.Time - an array of Time values which will be converted to a string array.
// - []any - this array must contain only types which were listed in Types section.
//
// # Usage in EditView
//
// Usage in `EditView`:
// Array of recommended values.
//
// Supported types: `[]string`, `string`, `[]fmt.Stringer`, `[]Color`, `[]SizeUnit`, `[]AngleUnit`, `[]any` containing
// elements of `string`, `fmt.Stringer`, `bool`, `rune`, `float32`, `float64`, `int`, `int8` … `int64`, `uint`, `uint8` …
// `uint64`.
// Supported types: []string, string, []fmt.Stringer, and []any containing
// 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:
// `string` - contain single item.
// `[]string` - an array of items.
// `[]fmt.Stringer` - an array of objects convertible to a string.
// `[]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.
// - string - contain single item.
// - []string - an array of items.
// - []fmt.Stringer - an array of objects convertible to a string.
// - []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.
//
// Supported types: `[]string`, `string`, `[]fmt.Stringer`, `[]Color`, `[]SizeUnit`, `[]AngleUnit`, `[]float`, `[]int`,
// `[]bool`, `[]any` containing elements of `string`, `fmt.Stringer`, `bool`, `rune`, `float32`, `float64`, `int`, `int8`
// … `int64`, `uint`, `uint8` … `uint64`.
// Supported types: []string, string, []fmt.Stringer, []float, []int, []bool, []any containing elements
// of string, fmt.Stringer, 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:
// `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.
// `[]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`.
// `[]SizeUnit` - an array of size unit, converted to `[]string`.
// `[]AngleUnit` - an array of angle unit, converted to `[]string`.
// `[]float` - converted to `[]string`.
// `[]int` - converted to `[]string`.
// `[]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.
// - 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.
// - []fmt.Stringer - object which implement this interface must contain integer or floating point numbers, converted to a []string.
// - []float - converted to []string.
// - []int - 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
//
// 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
// "HH:MM".
//
// Supported types: `[]string`, `string`, `[]fmt.Stringer`, `[]Color`, `[]SizeUnit`, `[]AngleUnit`, `[]any` containing
// elements of `string`, `fmt.Stringer`, `bool`, `rune`, `float32`, `float64`, `int`, `int8` … `int64`, `uint`, `uint8` …
// `uint64`.
// Supported types: []string, string, []fmt.Stringer, []time.Time, []any containing elements of string, fmt.Stringer, time.Time.
//
// Internal type is `[]string`, other types converted to it during assignment.
// Internal type is []string, other types converted to it during assignment.
//
// Conversion rules:
// `string` - contain single item.
// `[]string` - an array of items.
// `[]fmt.Stringer` - an array of objects convertible to a string.
// `[]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.
// - string - contain single item.
// - []string - an array of items.
// - []fmt.Stringer - an array of objects convertible to a string.
// - []time.Time - An array of Time values which will be converted to a string array.
// - []any - this array must contain only types which were listed in Types section.
DataList PropertyName = "data-list"
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,32 +9,32 @@ import (
const (
// LoadedEvent is the constant for "loaded-event" property tag.
//
// Used by `ImageView`.
// Used by ImageView.
// Occur when the image has been loaded.
//
// General listener format:
// `func(image rui.ImageView)`.
// func(image rui.ImageView)
//
// where:
// image - Interface of an image view which generated this event.
//
// Allowed listener formats:
// `func()`.
// func()
LoadedEvent PropertyName = "loaded-event"
// ErrorEvent is the constant for "error-event" property tag.
//
// Used by `ImageView`.
// Used by ImageView.
// Occur when the image loading has been failed.
//
// General listener format:
// `func(image rui.ImageView)`.
// func(image rui.ImageView)
//
// where:
// image - Interface of an image view which generated this event.
//
// Allowed listener formats:
// `func()`.
// func()
ErrorEvent PropertyName = "error-event"
// 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 (
// KeyDownEvent is the constant for "key-down-event" property tag.
//
// Used by `View`.
// Used by View.
// Is fired when a key is pressed.
//
// General listener format:
// `func(view rui.View, event rui.KeyEvent)`.
//
// func(view rui.View, event rui.KeyEvent).
//
// where:
// view - Interface of a view which generated this event,
// event - Key event.
// - view - Interface of a view which generated this event,
// - event - Key event.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(event rui.KeyEvent)`,
// `func()`.
//
// func(view rui.View)
// func(event rui.KeyEvent)
// func()
KeyDownEvent PropertyName = "key-down-event"
// KeyUpEvent is the constant for "key-up-event" property tag.
//
// Used by `View`.
// Used by View.
// Is fired when a key is released.
//
// General listener format:
// `func(view rui.View, event rui.KeyEvent)`.
//
// func(view rui.View, event rui.KeyEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Key event.
// - view - Interface of a view which generated this event,
// - event - Key event.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(event rui.KeyEvent)`,
// `func()`.
//
// func(view rui.View)
// func(event rui.KeyEvent)
// func()
KeyUpEvent PropertyName = "key-up-event"
)

View File

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

View File

@ -11,815 +11,496 @@ import (
const (
// 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
// 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:
// `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.
// `false` or `0` or "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.
// - 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, 0, "false", "no", "off", "0" - No controls will be visible to the end user.
Controls PropertyName = "controls"
// 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:
// `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.
// `false` or `0` or "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.
// - true, 1, "true", "yes", "on", "1" - The audio player will automatically seek back to the start upon reaching the end of the audio.
// - false, 0, "false", "no", "off", "0" - Audio player will stop playing when the end of the media file has been reached.
Loop PropertyName = "loop"
// 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:
// `true` or `1` or "true", "yes", "on", "1" - Audio will be muted.
// `false` or `0` or "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.
// - true, 1, "true", "yes", "on", "1" - Audio will be muted.
// - false, 0, "false", "no", "off", "0" - Audio playing normally.
Muted PropertyName = "muted"
// 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
// experience. Default value is different for each browser.
//
// Supported types: `int`, `string`.
// 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.
//
// 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.
// - 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"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
AbortEvent PropertyName = "abort-event"
// 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
// its end without having to stop for further buffering of content.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
CanPlayEvent PropertyName = "can-play-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
CanPlayThroughEvent PropertyName = "can-play-through-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
CompleteEvent PropertyName = "complete-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer, duration float64)`.
//
// func(player rui.MediaPlayer, duration float64).
//
// where:
// player - Interface of a player which generated this event,
// duration - Current duration.
// - player - Interface of a player which generated this event,
// - duration - Current duration.
//
// Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(duration float64)`,
// `func()`.
//
// Usage in `VideoPlayer`:
// Occur when the duration attribute has been updated.
//
// 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()`.
// func(player rui.MediaPlayer),
// func(duration float64),
// func()
DurationChangedEvent PropertyName = "duration-changed-event"
// 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
// partially loaded), and the HTMLMediaElement.load method is called to reload it.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
EmptiedEvent PropertyName = "emptied-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
EndedEvent PropertyName = "ended-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
LoadedDataEvent PropertyName = "loaded-data-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
LoadedMetadataEvent PropertyName = "loaded-metadata-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
LoadStartEvent PropertyName = "load-start-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
PauseEvent PropertyName = "pause-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
PlayEvent PropertyName = "play-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
PlayingEvent PropertyName = "playing-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
ProgressEvent PropertyName = "progress-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer, rate float64)`.
//
// func(player rui.MediaPlayer, rate float64).
//
// where:
// player - Interface of a player which generated this event,
// rate - Playback rate.
// - player - Interface of a player which generated this event,
// - rate - Playback rate.
//
// Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(rate float64)`,
// `func()`.
//
// Usage in `VideoPlayer`:
// Occur when the playback rate has changed.
//
// 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()`.
// func(player rui.MediaPlayer),
// func(rate float64),
// func()
RateChangedEvent PropertyName = "rate-changed-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
SeekedEvent PropertyName = "seeked-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
SeekingEvent PropertyName = "seeking-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
StalledEvent PropertyName = "stalled-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
SuspendEvent PropertyName = "suspend-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer, time float64)`.
//
// func(player rui.MediaPlayer, time float64).
//
// where:
// player - Interface of a player which generated this event,
// time - Current time.
// - player - Interface of a player which generated this event,
// - time - Current time.
//
// Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(time float64)`,
// `func()`.
//
// Usage in `VideoPlayer`:
// Occur when the time indicated by the currentTime attribute has been updated.
//
// 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()`.
// func(player rui.MediaPlayer),
// func(time float64),
// func()
TimeUpdateEvent PropertyName = "time-update-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer, volume float64)`.
//
// func(player rui.MediaPlayer, volume float64).
//
// where:
// player - Interface of a player which generated this event,
// volume - New volume level.
// - player - Interface of a player which generated this event,
// - volume - New volume level.
//
// Allowed listener formats:
// `func(player rui.MediaPlayer)`,
// `func(volume float64)`,
// `func()`.
//
// Usage in `VideoPlayer`:
// Occur when the volume has changed.
//
// 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()`.
// func(player rui.MediaPlayer),
// func(volume float64),
// func()
VolumeChangedEvent PropertyName = "volume-changed-event"
// 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.
//
// General listener format:
// `func(player rui.MediaPlayer)`.
//
// func(player rui.MediaPlayer)
//
// where:
// player - Interface of a player which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// Usage in `VideoPlayer`:
// 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()`.
// func()
WaitingEvent PropertyName = "waiting-event"
// 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).
//
// General listener format:
// `func(player rui.MediaPlayer, code int, message string)`.
//
// 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,
// - 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.
// - 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()`.
//
// Usage in `VideoPlayer`:
// Fired when the resource could not be loaded due to an error(for example, a network connectivity problem).
//
// 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()`.
// func(code int, message string),
// func(player rui.MediaPlayer),
// func()
PlayerErrorEvent PropertyName = "player-error-event"
// PreloadNone - value of the view "preload" property: indicates that the audio/video should not be preloaded.

View File

@ -9,150 +9,166 @@ import (
const (
// ClickEvent is the constant for "click-event" property tag.
//
// Used by `View`.
// Used by View.
// Occur when the user clicks on the view.
//
// General listener format:
// `func(view rui.View, event rui.MouseEvent)`.
//
// func(view rui.View, event rui.MouseEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Mouse event.
// - view - Interface of a view which generated this event,
// - event - Mouse event.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(event rui.MouseEvent)`,
// `func()`.
//
// func(view rui.View)
// func(event rui.MouseEvent)
// func()
ClickEvent PropertyName = "click-event"
// 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.
//
// General listener format:
// `func(view rui.View, event rui.MouseEvent)`.
//
// func(view rui.View, event rui.MouseEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Mouse event.
// - view - Interface of a view which generated this event,
// - event - Mouse event.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(event rui.MouseEvent)`,
// `func()`.
//
// func(view rui.View)
// func(event rui.MouseEvent)
// func()
DoubleClickEvent PropertyName = "double-click-event"
// 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.
//
// General listener format:
// `func(view rui.View, event rui.MouseEvent)`.
//
// func(view rui.View, event rui.MouseEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Mouse event.
// - view - Interface of a view which generated this event,
// - event - Mouse event.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(event rui.MouseEvent)`,
// `func()`.
//
// func(view rui.View)
// func(event rui.MouseEvent)
// func()
MouseDown PropertyName = "mouse-down"
// 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
// located inside it. "mouse-up" events are the counterpoint to "mouse-down" events.
//
// General listener format:
// `func(view rui.View, event rui.MouseEvent)`.
//
// func(view rui.View, event rui.MouseEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Mouse event.
// - view - Interface of a view which generated this event,
// - event - Mouse event.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(event rui.MouseEvent)`,
// `func()`.
//
// func(view rui.View)
// func(event rui.MouseEvent)
// func()
MouseUp PropertyName = "mouse-up"
// 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.
//
// General listener format:
// `func(view rui.View, event rui.MouseEvent)`.
//
// func(view rui.View, event rui.MouseEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Mouse event.
// - view - Interface of a view which generated this event,
// - event - Mouse event.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(event rui.MouseEvent)`,
// `func()`.
//
// func(view rui.View)
// func(event rui.MouseEvent)
// func()
MouseMove PropertyName = "mouse-move"
// 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
// 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.
//
// General listener format:
// `func(view rui.View, event rui.MouseEvent)`.
//
// func(view rui.View, event rui.MouseEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Mouse event.
// - view - Interface of a view which generated this event,
// - event - Mouse event.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(event rui.MouseEvent)`,
// `func()`.
//
// func(view rui.View)
// func(event rui.MouseEvent)
// func()
MouseOut PropertyName = "mouse-out"
// 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
// of its child views.
//
// General listener format:
// `func(view rui.View, event rui.MouseEvent)`.
//
// func(view rui.View, event rui.MouseEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Mouse event.
// - view - Interface of a view which generated this event,
// - event - Mouse event.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(event rui.MouseEvent)`,
// `func()`.
//
// func(view rui.View)
// func(event rui.MouseEvent)
// func()
MouseOver PropertyName = "mouse-over"
// 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.
//
// General listener format:
// `func(view rui.View, event rui.MouseEvent)`.
//
// func(view rui.View, event rui.MouseEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Mouse event.
// - view - Interface of a view which generated this event,
// - event - Mouse event.
//
// Allowed listener formats:
// `func(view rui.View)`,
// `func(event rui.MouseEvent)`,
// `func()`.
//
// func(view rui.View)
// func(event rui.MouseEvent)
// func()
ContextMenuEvent PropertyName = "context-menu-event"
// 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 (
// 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.
//
// General listener format:
// `func(picker rui.NumberPicker, newValue, oldValue float64)`.
//
// func(picker rui.NumberPicker, newValue float64, oldValue float64)
//
// where:
// picker - Interface of a number picker which generated this event,
// newValue - New value,
// oldValue - Old Value.
// - picker - Interface of a number picker which generated this event,
// - newValue - New value,
// - oldValue - Old Value.
//
// Allowed listener formats:
// `func(picker rui.NumberPicker, newValue float64)`,
// `func(newValue, oldValue float64)`,
// `func(newValue float64)`,
// `func()`.
//
// func(picker rui.NumberPicker, newValue float64)
// func(newValue float64, oldValue float64)
// func(newValue float64)
// func()
NumberChangedEvent PropertyName = "number-changed"
// NumberPickerType is the constant for "number-picker-type" property tag.
//
// Used by `NumberPicker`.
// Used by NumberPicker.
// Sets the visual representation.
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`NumberEditor`) or "editor" - Displayed as an editor.
// `1`(`NumberSlider`) or "slider" - Displayed as a slider.
// - 0 (NumberEditor) or "editor" - Displayed as an editor.
// - 1 (NumberSlider) or "slider" - Displayed as a slider.
NumberPickerType PropertyName = "number-picker-type"
// 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.
//
// 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"
// 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.
//
// 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"
// NumberPickerStep is the constant for "number-picker-step" property tag.
//
// Used by `NumberPicker`.
// Used by NumberPicker.
// 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"
// NumberPickerValue is the constant for "number-picker-value" property tag.
//
// Used by `NumberPicker`.
// Used by NumberPicker.
// 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 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).
//
// 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"
)

View File

@ -20,11 +20,10 @@ type outlinePropertyData struct {
}
// NewOutlineProperty creates the new OutlineProperty.
//
// The following properties can be used:
//
// "color" (ColorTag). Determines the line color (Color);
//
// "width" (Width). Determines the line thickness (SizeUnit).
// - "color" (ColorTag) - Determines the line color (Color);
// - "width" (Width) - Determines the line thickness (SizeUnit).
func NewOutlineProperty(params Params) OutlineProperty {
outline := new(outlinePropertyData)
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.
// 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;
// x1, y1 - coordinates of the second control point;
// radius - the arc's radius. Must be non-negative.
// - x0, y0 - coordinates of the first control point;
// - x1, y1 - coordinates of the second control point;
// - radius - the arc's radius. Must be non-negative.
ArcTo(x0, y0, x1, y1, radius float64)
// Arc adds a circular arc to the current sub-path.
// x, y - coordinates of the arc's center;
// radius - the arc's radius. Must be non-negative;
// startAngle - the angle at which the arc starts, measured clockwise from the positive
// - x, y - coordinates of the arc's center;
// - radius - the arc's radius. Must be non-negative;
// - startAngle - the angle at which the arc starts, measured clockwise from the positive
// 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.
// 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
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
// the latest point in the current path.
// cp0x, cp0y - coordinates of the first control point;
// cp1x, cp1y - coordinates of the second control point;
// x, y - coordinates of the end point.
// - cp0x, cp0y - coordinates of the first control point;
// - cp1x, cp1y - coordinates of the second control point;
// - x, y - coordinates of the end point.
BezierCurveTo(cp0x, cp0y, cp1x, cp1y, x, y float64)
// QuadraticCurveTo adds a quadratic Bézier curve to the current sub-path.
// cpx, cpy - coordinates of the control point;
// x, y - coordinates of the end point.
// - cpx, cpy - coordinates of the control point;
// - x, y - coordinates of the end point.
QuadraticCurveTo(cpx, cpy, x, y float64)
// Ellipse adds an elliptical arc to the current sub-path
// x, y - coordinates of the ellipse's center;
// radiusX - the ellipse's major-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;
// startAngle - the angle at which the ellipse starts, measured clockwise
// - x, y - coordinates of the ellipse's center;
// - radiusX - the ellipse's major-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;
// - startAngle - the angle at which the ellipse starts, measured clockwise
// 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.
// 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)
// 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 (
// 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
// 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.
//
// General listener format:
// `func(view rui.View, event rui.PointerEvent)`.
//
// func(view rui.View, event rui.PointerEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Pointer event.
// - view - Interface of a view which generated this event,
// - event - Pointer event.
//
// Allowed listener formats:
// `func(event rui.PointerEvent)`,
// `func(view rui.View)`,
// `func()`.
//
// func(event rui.PointerEvent)
// func(view rui.View)
// func()
PointerDown PropertyName = "pointer-down"
// PointerUp is the constant for "pointer-up" property tag.
//
// Used by `View`.
// Used by View.
// Is fired when a pointer is no longer active.
//
// General listener format:
// `func(view rui.View, event rui.PointerEvent)`.
//
// func(view rui.View, event rui.PointerEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Pointer event.
// - view - Interface of a view which generated this event,
// - event - Pointer event.
//
// Allowed listener formats:
// `func(event rui.PointerEvent)`,
// `func(view rui.View)`,
// `func()`.
//
// func(event rui.PointerEvent)
// func(view rui.View)
// func()
PointerUp PropertyName = "pointer-up"
// PointerMove is the constant for "pointer-move" property tag.
//
// Used by `View`.
// Used by View.
// Is fired when a pointer changes coordinates.
//
// General listener format:
// `func(view rui.View, event rui.PointerEvent)`.
//
// func(view rui.View, event rui.PointerEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Pointer event.
// - view - Interface of a view which generated this event,
// - event - Pointer event.
//
// Allowed listener formats:
// `func(event rui.PointerEvent)`,
// `func(view rui.View)`,
// `func()`.
//
// func(event rui.PointerEvent)
// func(view rui.View)
// func()
PointerMove PropertyName = "pointer-move"
// 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).
//
// General listener format:
// `func(view rui.View, event rui.PointerEvent)`.
//
// func(view rui.View, event rui.PointerEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Pointer event.
// - view - Interface of a view which generated this event,
// - event - Pointer event.
//
// Allowed listener formats:
// `func(event rui.PointerEvent)`,
// `func(view rui.View)`,
// `func()`.
//
// func(event rui.PointerEvent)
// func(view rui.View)
// func()
PointerCancel PropertyName = "pointer-cancel"
// 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
// 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.
//
// General listener format:
// `func(view rui.View, event rui.PointerEvent)`.
//
// func(view rui.View, event rui.PointerEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Pointer event.
// - view - Interface of a view which generated this event,
// - event - Pointer event.
//
// Allowed listener formats:
// `func(event rui.PointerEvent)`,
// `func(view rui.View)`,
// `func()`.
//
// func(event rui.PointerEvent)
// func(view rui.View)
// func()
PointerOut PropertyName = "pointer-out"
// 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.
//
// General listener format:
// `func(view rui.View, event rui.PointerEvent)`.
//
// func(view rui.View, event rui.PointerEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Pointer event.
// - view - Interface of a view which generated this event,
// - event - Pointer event.
//
// Allowed listener formats:
// `func(event rui.PointerEvent)`,
// `func(view rui.View)`,
// `func()`.
//
// func(event rui.PointerEvent)
// func(view rui.View)
// func()
PointerOver PropertyName = "pointer-over"
)

154
popup.go
View File

@ -9,201 +9,207 @@ import (
const (
// 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.
//
// Supported types: `string`.
// Supported types: string.
//
// Usage in `TabsLayout`:
// Set the title of the tab. The property is set for the child view of `TabsLayout`.
// Usage in 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"
// TitleStyle is the constant for "title-style" property tag.
//
// Used by `Popup`.
// Used by Popup.
// Set popup title style. Default title style is "ruiPopupTitle".
//
// Supported types: `string`.
// Supported types: string.
TitleStyle PropertyName = "title-style"
// CloseButton is the constant for "close-button" property tag.
//
// Used by `Popup`.
// Controls whether a close button can be added to the popup. Default value is `false`.
// Used by Popup.
// 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:
// `true` or `1` or "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.
// - true, 1, "true", "yes", "on", "1" - Close button will be added to a title bar of a window.
// - false, 0, "false", "no", "off", "0" - Popup without a close button.
CloseButton PropertyName = "close-button"
// OutsideClose is the constant for "outside-close" property tag.
//
// Used by `Popup`.
// Controls whether popup can be closed by clicking outside of the window. Default value is `false`.
// Used by Popup.
// 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:
// `true` or `1` or "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.
// - true, 1, "true", "yes", "on", "1" - Clicking outside the popup window will automatically call the Dismiss() method.
// - false, 0, "false", "no", "off", "0" - Clicking outside the popup window has no effect.
OutsideClose PropertyName = "outside-close"
// 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.
//
// Supported types: `PopupButton`, `[]PopupButton`.
// Supported types: PopupButton, []PopupButton.
//
// Internal type is `[]PopupButton`, other types converted to it during assignment.
// See `PopupButton` description for more details.
// Internal type is []PopupButton, other types converted to it during assignment.
// See PopupButton description for more details.
Buttons PropertyName = "buttons"
// ButtonsAlign is the constant for "buttons-align" property tag.
//
// Used by `Popup`.
// Used by Popup.
// Set the horizontal alignment of popup buttons.
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`LeftAlign`) or "left" - Left alignment.
// `1`(`RightAlign`) or "right" - Right alignment.
// `2`(`CenterAlign`) or "center" - Center alignment.
// `3`(`StretchAlign`) or "stretch" - Width alignment.
// - 0 (LeftAlign) or "left" - Left alignment.
// - 1 (RightAlign) or "right" - Right alignment.
// - 2 (CenterAlign) or "center" - Center alignment.
// - 3 (StretchAlign) or "stretch" - Width alignment.
ButtonsAlign PropertyName = "buttons-align"
// DismissEvent is the constant for "dismiss-event" property tag.
//
// Used by `Popup`.
// Used to track the closing state of the `Popup`. It occurs after the `Popup` disappears from the screen.
// Used by Popup.
// Used to track the closing state of the Popup. It occurs after the Popup disappears from the screen.
//
// General listener format:
// `func(popup rui.Popup)`.
//
// func(popup rui.Popup)
//
// where:
// popup - Interface of a popup which generated this event.
//
// Allowed listener formats:
// `func()`.
//
// func()
DismissEvent PropertyName = "dismiss-event"
// Arrow is the constant for "arrow" property tag.
//
// Used by `Popup`.
// Used by Popup.
// Add an arrow to popup. Default value is "none".
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`NoneArrow`) or "none" - No arrow.
// `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.
// `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.
// - 0 (NoneArrow) or "none" - No arrow.
// - 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.
// - 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.
Arrow PropertyName = "arrow"
// 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".
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`TopAlign`/`LeftAlign`) or "top" - Top/left alignment.
// `1`(`BottomAlign`/`RightAlign`) or "bottom" - Bottom/right alignment.
// `2`(`CenterAlign`) or "center" - Center alignment.
// - 0 (TopAlign/LeftAlign) or "top" - Top/left alignment.
// - 1 (BottomAlign/RightAlign) or "bottom" - Bottom/right alignment.
// - 2 (CenterAlign) or "center" - Center alignment.
ArrowAlign PropertyName = "arrow-align"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
ArrowSize PropertyName = "arrow-size"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
ArrowWidth PropertyName = "arrow-width"
// 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
// 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:
// `TransformProperty` - stored as is, no conversion performed.
// `string` - string representation of `Transform` interface. Example: "_{translate-x = 10px, scale-y = 1.1}".
// - TransformProperty - stored as is, no conversion performed.
// - string - string representation of Transform interface. Example:
//
// "_{ translate-x = 10px, scale-y = 1.1}"
ShowTransform = "show-transform"
// 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.
//
// 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"
// 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.
//
// Supported types: `string`.
// Supported types: string.
//
// Values:
// "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-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.
// "linear"(`LinearTiming`) - Constant speed.
// - "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-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.
// - "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"
// 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).
// 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"
// ArrowOffset is the constant for "arrow-offset" property tag.
//
// Used by `Popup`.
// Used by Popup.
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
ArrowOffset PropertyName = "arrow-offset"
// 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".
//
// 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).
func ShowQuestion(title, text string, session Session, onYes func(), onNo func()) {
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".
//
// 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.
func ShowCancellableQuestion(title, text string, session Session, onYes func(), onNo func(), onCancel func()) {

View File

@ -9,22 +9,22 @@ import (
const (
// ProgressBarMax is the constant for "progress-max" property tag.
//
// Used by `ProgressBar`.
// Used by ProgressBar.
// 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"
// ProgressBarValue is the constant for "progress-value" property tag.
//
// Used by `ProgressBar`.
// Used by ProgressBar.
// 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"
)

File diff suppressed because it is too large Load Diff

View File

@ -149,9 +149,9 @@ const (
WhiteSpacePreLine = 4
// 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.
// * 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).
// - 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.
// - 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
// WordBreakNormal - use the default line break rule.

342
radius.go
View File

@ -9,382 +9,382 @@ import (
const (
// 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.
//
// 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.
// See `RadiusProperty`, `SizeUnit`, `SizeFunc` and `BoxRadius` description for more details.
// Internal type is either RadiusProperty or SizeUnit, other types converted to them during assignment.
// See RadiusProperty, SizeUnit, SizeFunc and BoxRadius description for more details.
//
// Conversion rules:
// `RadiusProperty` - stored as is, no conversion performed.
// `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.
// `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.
// `int` - values of this type will set radius for all corners in pixels.
// - RadiusProperty - stored as is, no conversion performed.
// - 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.
// - 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.
// - int - values of this type will set radius for all corners in pixels.
//
// Usage in `BackgroundElement`:
// Usage in BackgroundElement:
// Same as "radial-gradient-radius".
//
// Usage in `ClipShape`:
// Usage in ClipShape:
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
Radius PropertyName = "radius"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusX PropertyName = "radius-x"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusY PropertyName = "radius-y"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusTopLeft PropertyName = "radius-top-left"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusTopLeftX PropertyName = "radius-top-left-x"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusTopLeftY PropertyName = "radius-top-left-y"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusTopRight PropertyName = "radius-top-right"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusTopRightX PropertyName = "radius-top-right-x"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusTopRightY PropertyName = "radius-top-right-y"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusBottomLeft PropertyName = "radius-bottom-left"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusBottomLeftX PropertyName = "radius-bottom-left-x"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusBottomLeftY PropertyName = "radius-bottom-left-y"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusBottomRight PropertyName = "radius-bottom-right"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusBottomRightX PropertyName = "radius-bottom-right-x"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
RadiusBottomRightY PropertyName = "radius-bottom-right-y"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
X PropertyName = "x"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
Y PropertyName = "y"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TopLeft PropertyName = "top-left"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TopLeftX PropertyName = "top-left-x"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TopLeftY PropertyName = "top-left-y"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TopRight PropertyName = "top-right"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TopRightX PropertyName = "top-right-x"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TopRightY PropertyName = "top-right-y"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
BottomLeft PropertyName = "bottom-left"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
BottomLeftX PropertyName = "bottom-left-x"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
BottomLeftY PropertyName = "bottom-left-y"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
BottomRight PropertyName = "bottom-right"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
BottomRightX PropertyName = "bottom-right-x"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
BottomRightY PropertyName = "bottom-right-y"
)
@ -403,35 +403,22 @@ type radiusPropertyData struct {
}
// NewRadiusProperty creates the new RadiusProperty
//
// The following properties can be used:
//
// "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.
//
// "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-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-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.
// - "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.
// - "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-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-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 {
result := new(radiusPropertyData)
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.
//
// 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 {
return NewRadiusProperty(Params{
@ -456,7 +444,9 @@ func NewEllipticRadius[xType SizeUnit | int | float64, yType SizeUnit | int | fl
}
// NewRadius creates the new RadiusProperty.
//
// 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
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 {

View File

@ -10,29 +10,29 @@ import (
const (
// 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.
// Default value is "all".
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `1`(`TopSide`) or "top" - Top frame side.
// `2`(`RightSide`) or "right" - Right frame side.
// `4`(`BottomSide`) or "bottom" - Bottom frame side.
// `8`(`LeftSide`) or "left" - Left frame side.
// `15`(`AllSides`) or "all" - All frame sides.
// - 1 (TopSide) or "top" - Top frame side.
// - 2 (RightSide) or "right" - Right frame side.
// - 4 (BottomSide) or "bottom" - Bottom frame side.
// - 8 (LeftSide) or "left" - Left frame side.
// - 15 (AllSides) or "all" - All frame sides.
Side = "side"
// ResizeBorderWidth is the constant for "resize-border-width" property tag.
//
// Used by `Resizable`.
// Used by Resizable.
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
ResizeBorderWidth = "resize-border-width"
)

View File

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

130
shadow.go
View File

@ -9,97 +9,101 @@ import (
const (
// 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.
//
// Supported types: `Color`, `string`.
// Supported types: Color, string.
//
// Internal type is `Color`, other types converted to it during assignment.
// See `Color` description for more details.
// Internal type is Color, other types converted to it during assignment.
// See Color description for more details.
//
// # Usage in BorderProperty
//
// Usage in `BorderProperty`:
// Border line color.
//
// Supported types: `Color`, `string`.
// Supported types: Color, string.
//
// Internal type is `Color`, other types converted to it during assignment.
// See `Color` description for more details.
// Internal type is Color, other types converted to it during assignment.
// See Color description for more details.
//
// # Usage in OutlineProperty
//
// Usage in `OutlineProperty`:
// Outline line color.
//
// Supported types: `Color`, `string`.
// Supported types: Color, string.
//
// Internal type is `Color`, other types converted to it during assignment.
// See `Color` description for more details.
// Internal type is Color, other types converted to it during assignment.
// See Color description for more details.
//
// # Usage in ShadowProperty
//
// Usage in `ShadowProperty`:
// Color property of the shadow.
//
// Supported types: `Color`, `string`.
// Supported types: Color, string.
//
// Internal type is `Color`, other types converted to it during assignment.
// See `Color` description for more details.
// Internal type is Color, other types converted to it during assignment.
// See Color description for more details.
ColorTag PropertyName = "color"
// 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
// ones), above the background, but below content.
//
// Supported types: `bool`, `int`, `string`.
// Supported types: bool, int, string.
//
// Values:
// `true` or `1` or "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).
// - true, 1, "true", "yes", "on", "1" - Drop shadow inside the frame(as if the content was depressed inside the box).
// - 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"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
XOffset PropertyName = "x-offset"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
YOffset PropertyName = "y-offset"
// 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
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
BlurRadius PropertyName = "blur"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
SpreadRadius PropertyName = "spread-radius"
)
@ -118,14 +122,10 @@ type shadowPropertyData struct {
}
// 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);
//
// 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);
//
// color is the color of the shadow.
// - 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);
// - 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](
xOffset xOffsetType, yOffset yOffsetType, blurRadius blurType, spreadRadius spreadType, color Color) ShadowProperty {
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:
//
// 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);
//
// color is the color of the shadow.
// - 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);
// - 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](
xOffset xOffsetType, yOffset yOffsetType, blurRadius blurType, spreadRadius spreadType, color Color) ShadowProperty {
return NewShadowProperty(Params{
@ -159,12 +155,9 @@ func NewInsetShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit |
}
// 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);
//
// 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.
// - 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.
func NewTextShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit | int | float64, blurType SizeUnit | int | float64](
xOffset xOffsetType, yOffset yOffsetType, blurRadius blurType, color Color) ShadowProperty {
return NewShadowProperty(Params{
@ -176,19 +169,14 @@ func NewTextShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit |
}
// NewShadowProperty create the new shadow property for a view.
//
// The following properties can be used:
//
// "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);
//
// "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.
// - "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);
// - "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 {
shadow := new(shadowPropertyData)
shadow.init()

View File

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

View File

@ -9,239 +9,241 @@ import (
const (
// 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
// 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:
// `TransformProperty` - stored as is, no conversion performed.
// `string` - string representation of `Transform` interface. Example: "_{translate-x = 10px, scale-y = 1.1}".
// - TransformProperty - stored as is, no conversion performed.
// - string - string representation of Transform interface. Example: "_{translate-x = 10px, scale-y = 1.1}".
PushTransform = "push-transform"
// 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.
//
// 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"
// 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.
//
// Supported types: `string`.
// Supported types: string.
//
// Values:
// "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-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.
// "linear"(`LinearTiming`) - Constant speed.
// - "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-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.
// - "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"
// 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.
//
// Supported types: `bool`, `int`, `string`.
// Supported types: bool, int, string.
//
// Values:
// `true` or `1` or "true", "yes", "on", "1" - animation is used (default value).
// `false` or `0` or "false", "no", "off", "0" - animation is not used.
// - true, 1, "true", "yes", "on", "1" - animation is used (default value).
// - false, 0, "false", "no", "off", "0" - animation is not used.
MoveToFrontAnimation = "move-to-front-animation"
// 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:
// 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).
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
PushPerspective PropertyName = "push-perspective"
// 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:
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
PushTranslateX PropertyName = "push-translate-x"
// 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:
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
PushTranslateY PropertyName = "push-translate-y"
// 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:
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
PushTranslateZ PropertyName = "push-translate-z"
// 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:
// 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`.
// 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"
// 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:
// 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`.
// 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"
// 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:
// 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`.
// 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"
// 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:
// 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.
// See `AngleUnit` description for more details.
// 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.
// - 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.
PushRotate PropertyName = "push-rotate"
// 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:
// 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"
// 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:
// 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"
// 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:
// 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"
// 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:
// 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.
// See `AngleUnit` description for more details.
// 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.
// - 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.
PushSkewX PropertyName = "push-skew-x"
// 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:
// 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.
// See `AngleUnit` description for more details.
// 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.
// - 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.
PushSkewY PropertyName = "push-skew-y"
)
@ -256,28 +258,36 @@ type StackLayout interface {
RemovePeek() View
// MoveToFront makes the given View current.
//
// The second argument is a function called after the move to front animation ends.
//
// Returns true if successful, false otherwise.
MoveToFront(view View, onShown ...func(View)) bool
// MoveToFrontByID makes the View current by viewID.
//
// The second argument is a function called after the move to front animation ends.
//
// Returns true if successful, false otherwise.
MoveToFrontByID(viewID string, onShown ...func(View)) bool
// 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.
//
// 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;
// * 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;
// * TopDownAnimation (3) - Top-down animation;
// * BottomUpAnimation (4) - Bottom up animation.
// - 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;
// - EndToStartAnimation (2) - End-to-Beginning animation;
// - TopDownAnimation (3) - Top-down animation;
// - BottomUpAnimation (4) - Bottom up animation.
// The second argument `onPushFinished` is the function to be called when the animation ends.
Push(view View, onPushFinished ...func())
// Pop removes the current View from the container using animation.
//
// 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.
Pop(onPopFinished ...func(View)) bool
}

View File

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

View File

@ -10,519 +10,527 @@ import (
const (
// 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.
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`TopAlign`) or "top" - Top alignment.
// `1`(`BottomAlign`) or "bottom" - Bottom alignment.
// `2`(`CenterAlign`) or "center" - Center alignment.
// `3`(`StretchAlign`) or "stretch" - Work as baseline alignment, see below.
// `4`(`BaselineAlign`) or "baseline" - Baseline alignment.
// - 0 (TopAlign) or "top" - Top alignment.
// - 1 (BottomAlign) or "bottom" - Bottom alignment.
// - 2 (CenterAlign) or "center" - Center alignment.
// - 3 (StretchAlign) or "stretch" - Work as baseline alignment, see below.
// - 4 (BaselineAlign) or "baseline" - Baseline alignment.
TableVerticalAlign PropertyName = "table-vertical-align"
// HeadHeight is the constant for "head-height" property tag.
//
// Used by `TableView`.
// Sets the number of rows in the table header. The default value is `0` (no header).
// Used by TableView.
// 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:
// `0` or "0" - No header.
// > `0` or > "0" - Number of rows act as a header.
// - 0 or "0" - No header.
// - positive value - Number of rows act as a header.
HeadHeight PropertyName = "head-height"
// 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.
//
// Supported types: `string`, `Params`.
// Supported types: string, Params.
//
// Internal type is either `string` or `Params`.
// Internal type is either string or Params.
//
// Conversion rules:
// `string` - must contain style name defined in resources.
// `Params` - must contain style properties.
// - string - must contain style name defined in resources.
// - Params - must contain style properties.
HeadStyle PropertyName = "head-style"
// FootHeight is the constant for "foot-height" property tag.
//
// Used by `TableView`.
// Sets the number of rows in the table footer. The default value is `0` (no footer).
// Used by TableView.
// 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:
// `0` or "0" - No footer.
// > `0` or > "0" - Number of rows act as a footer.
// - 0 or "0" - No footer.
// - positive value - Number of rows act as a footer.
FootHeight PropertyName = "foot-height"
// 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.
//
// Supported types: `string`, `Params`.
// Supported types: string, Params.
//
// Internal type is either `string` or `Params`.
// Internal type is either string or Params.
//
// Conversion rules:
// `string` - must contain style name defined in resources.
// `Params` - must contain style properties.
// - string - must contain style name defined in resources.
// - Params - must contain style properties.
FootStyle PropertyName = "foot-style"
// 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
// `TableCellStyle`.
// TableCellStyle.
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0` or "0" - No merging will be applied.
// > `0` or > "0" - Number of rows including current one to be merged together.
// - 0 or "0" - No merging will be applied.
// - positive value - Number of rows including current one to be merged together.
RowSpan PropertyName = "row-span"
// 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
// implementation of `TableCellStyle`.
// implementation of TableCellStyle.
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0` or "0" - No merging will be applied.
// > `0` or > "0" - Number of columns including current one to be merged together.
// - 0 or "0" - No merging will be applied.
// - positive value - Number of columns including current one to be merged together.
ColumnSpan PropertyName = "column-span"
// 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.
//
// Supported types: `TableRowStyle`, `[]Params`.
// Supported types: TableRowStyle, []Params.
//
// Internal type is `TableRowStyle`, other types converted to it during assignment.
// See `TableRowStyle` description for more details.
// Internal type is TableRowStyle, other types converted to it during assignment.
// See TableRowStyle description for more details.
RowStyle PropertyName = "row-style"
// 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.
//
// Supported types: `TableColumnStyle`, `[]Params`.
// Supported types: TableColumnStyle, []Params.
//
// Internal type is `TableColumnStyle`, other types converted to it during assignment.
// See `TableColumnStyle` description for more details.
// Internal type is TableColumnStyle, other types converted to it during assignment.
// See TableColumnStyle description for more details.
ColumnStyle PropertyName = "column-style"
// 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
// `TableCellStyle` interface.
// TableCellStyle interface.
//
// Supported types: `TableCellStyle`.
// Supported types: TableCellStyle.
CellStyle PropertyName = "cell-style"
// 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
// 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.
// See `BoundsProperty`, `Bounds` and `SizeUnit` description for more details.
// Internal type is BoundsProperty, other types converted to it during assignment.
// See BoundsProperty, Bounds and SizeUnit description for more details.
CellPadding PropertyName = "cell-padding"
// 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
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
CellPaddingLeft PropertyName = "cell-padding-left"
// 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
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
CellPaddingRight PropertyName = "cell-padding-right"
// 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
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
CellPaddingTop PropertyName = "cell-padding-top"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
CellPaddingBottom PropertyName = "cell-padding-bottom"
// 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
// 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.
// See `BorderProperty`, `ViewBorder` and `ViewBorders` description for more details.
// Internal type is BorderProperty, other types converted to it during assignment.
// See BorderProperty, ViewBorder and ViewBorders description for more details.
CellBorder PropertyName = "cell-border"
// 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
// 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.
// See `ViewBorder` and `BorderProperty` description for more details.
// Internal type is BorderProperty, other types converted to it during assignment.
// See ViewBorder and BorderProperty description for more details.
CellBorderLeft PropertyName = "cell-border-left"
// 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
// 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.
// See `ViewBorder` and `BorderProperty` description for more details.
// Internal type is BorderProperty, other types converted to it during assignment.
// See ViewBorder and BorderProperty description for more details.
CellBorderRight PropertyName = "cell-border-right"
// 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
// 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.
// See `ViewBorder` and `BorderProperty` description for more details.
// Internal type is BorderProperty, other types converted to it during assignment.
// See ViewBorder and BorderProperty description for more details.
CellBorderTop PropertyName = "cell-border-top"
// 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.
//
// Supported types: `ViewBorder`, `BorderProperty`, `string`.
// Supported types: ViewBorder, BorderProperty, string.
//
// Internal type is `BorderProperty`, other types converted to it during assignment.
// See `ViewBorder` and `BorderProperty` description for more details.
// Internal type is BorderProperty, other types converted to it during assignment.
// See ViewBorder and BorderProperty description for more details.
CellBorderBottom PropertyName = "cell-border-bottom"
// 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".
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border.
// - 0 (NoneLine) or "none" - The border will not be drawn.
// - 1 (SolidLine) or "solid" - Solid line as a border.
// - 2 (DashedLine) or "dashed" - Dashed line as a border.
// - 3 (DottedLine) or "dotted" - Dotted line as a border.
// - 4 (DoubleLine) or "double" - Double line as a border.
CellBorderStyle PropertyName = "cell-border-style"
// 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".
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border.
// - 0 (NoneLine) or "none" - The border will not be drawn.
// - 1 (SolidLine) or "solid" - Solid line as a border.
// - 2 (DashedLine) or "dashed" - Dashed line as a border.
// - 3 (DottedLine) or "dotted" - Dotted line as a border.
// - 4 (DoubleLine) or "double" - Double line as a border.
CellBorderLeftStyle PropertyName = "cell-border-left-style"
// 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".
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border.
// - 0 (NoneLine) or "none" - The border will not be drawn.
// - 1 (SolidLine) or "solid" - Solid line as a border.
// - 2 (DashedLine) or "dashed" - Dashed line as a border.
// - 3 (DottedLine) or "dotted" - Dotted line as a border.
// - 4 (DoubleLine) or "double" - Double line as a border.
CellBorderRightStyle PropertyName = "cell-border-right-style"
// 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".
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border.
// - 0 (NoneLine) or "none" - The border will not be drawn.
// - 1 (SolidLine) or "solid" - Solid line as a border.
// - 2 (DashedLine) or "dashed" - Dashed line as a border.
// - 3 (DottedLine) or "dotted" - Dotted line as a border.
// - 4 (DoubleLine) or "double" - Double line as a border.
CellBorderTopStyle PropertyName = "cell-border-top-style"
// 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".
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`NoneLine`) or "none" - The border will not be drawn.
// `1`(`SolidLine`) or "solid" - Solid line as a border.
// `2`(`DashedLine`) or "dashed" - Dashed line as a border.
// `3`(`DottedLine`) or "dotted" - Dotted line as a border.
// `4`(`DoubleLine`) or "double" - Double line as a border.
// - 0 (NoneLine) or "none" - The border will not be drawn.
// - 1 (SolidLine) or "solid" - Solid line as a border.
// - 2 (DashedLine) or "dashed" - Dashed line as a border.
// - 3 (DottedLine) or "dotted" - Dotted line as a border.
// - 4 (DoubleLine) or "double" - Double line as a border.
CellBorderBottomStyle PropertyName = "cell-border-bottom-style"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
CellBorderWidth PropertyName = "cell-border-width"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
CellBorderLeftWidth PropertyName = "cell-border-left-width"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
CellBorderRightWidth PropertyName = "cell-border-right-width"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
CellBorderTopWidth PropertyName = "cell-border-top-width"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
CellBorderBottomWidth PropertyName = "cell-border-bottom-width"
// 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.
//
// Supported types: `Color`, `string`.
// Supported types: Color, string.
//
// Internal type is `Color`, other types converted to it during assignment.
// See `Color` description for more details.
// Internal type is Color, other types converted to it during assignment.
// See Color description for more details.
CellBorderColor PropertyName = "cell-border-color"
// 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.
//
// Supported types: `Color`, `string`.
// Supported types: Color, string.
//
// Internal type is `Color`, other types converted to it during assignment.
// See `Color` description for more details.
// Internal type is Color, other types converted to it during assignment.
// See Color description for more details.
CellBorderLeftColor PropertyName = "cell-border-left-color"
// 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.
//
// Supported types: `Color`, `string`.
// Supported types: Color, string.
//
// Internal type is `Color`, other types converted to it during assignment.
// See `Color` description for more details.
// Internal type is Color, other types converted to it during assignment.
// See Color description for more details.
CellBorderRightColor PropertyName = "cell-border-right-color"
// 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.
//
// Supported types: `Color`, `string`.
// Supported types: Color, string.
//
// Internal type is `Color`, other types converted to it during assignment.
// See `Color` description for more details.
// Internal type is Color, other types converted to it during assignment.
// See Color description for more details.
CellBorderTopColor PropertyName = "cell-border-top-color"
// 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.
//
// Supported types: `Color`, `string`.
// Supported types: Color, string.
//
// Internal type is `Color`, other types converted to it during assignment.
// See `Color` description for more details.
// Internal type is Color, other types converted to it during assignment.
// See Color description for more details.
CellBorderBottomColor PropertyName = "cell-border-bottom-color"
// 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".
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `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).
// `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).
// - 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).
// - 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"
// 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.
//
// General listener format:
// `func(table rui.TableView, row, col int)`.
//
// func(table rui.TableView, row, col int)
//
// where:
// table - Interface of a table view which generated this event,
// row - Row of the clicked cell,
// col - Column of the clicked cell.
// - table - Interface of a table view which generated this event,
// - row - Row of the clicked cell,
// - col - Column of the clicked cell.
//
// Allowed listener formats:
// `func(row, col int)`.
//
// func(row, col int)
TableCellClickedEvent PropertyName = "table-cell-clicked"
// TableCellSelectedEvent is the constant for "table-cell-selected" property tag.
//
// Used by `TableView`.
// Used by TableView.
// Occur when a table cell becomes selected.
//
// General listener format:
// `func(table rui.TableView, row, col int)`.
//
// func(table rui.TableView, row, col int)
//
// where:
// table - Interface of a table view which generated this event,
// row - Row of the selected cell,
// col - Column of the selected cell.
// - table - Interface of a table view which generated this event,
// - row - Row of the selected cell,
// - col - Column of the selected cell.
//
// Allowed listener formats:
// `func(row, col int)`.
//
// func(row, col int)
TableCellSelectedEvent PropertyName = "table-cell-selected"
// 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.
//
// General listener format:
// `func(table rui.TableView, row int)`.
//
// func(table rui.TableView, row int)
//
// where:
// table - Interface of a table view which generated this event,
// row - Clicked row.
// - table - Interface of a table view which generated this event,
// - row - Clicked row.
//
// Allowed listener formats:
// `func(row int)`.
//
// func(row int)
TableRowClickedEvent PropertyName = "table-row-clicked"
// TableRowSelectedEvent is the constant for "table-row-selected" property tag.
//
// Used by `TableView`.
// Used by TableView.
// Occur when a table row becomes selected.
//
// General listener format:
// `func(table rui.TableView, row int)`.
//
// func(table rui.TableView, row int)
//
// where:
// table - Interface of a table view which generated this event,
// row - Selected row.
// - table - Interface of a table view which generated this event,
// - row - Selected row.
//
// Allowed listener formats:
// `func(row int)`.
//
// func(row int)
TableRowSelectedEvent PropertyName = "table-row-selected"
// 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
// 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"
)

View File

@ -9,104 +9,108 @@ import (
const (
// CurrentTabChangedEvent is the constant for "current-tab-changed" property tag.
//
// Used by `TabsLayout`.
// Used by TabsLayout.
// Occur when the new tab becomes active.
//
// General listener format:
// `func(tabsLayout rui.TabsLayout, newTab, oldTab int)`.
//
// func(tabsLayout rui.TabsLayout, newTab, oldTab int)
//
// where:
// tabsLayout - Interface of a tabs layout which generated this event,
// newTab - Index of a new active tab,
// oldTab - Index of an old active tab.
// - tabsLayout - Interface of a tabs layout which generated this event,
// - newTab - Index of a new active tab,
// - oldTab - Index of an old active tab.
//
// Allowed listener formats:
// `func(tabsLayout rui.TabsLayout, newTab int)`,
// `func(newTab, oldTab int)`,
// `func(newTab int)`,
// `func()`.
//
// func(tabsLayout rui.TabsLayout, newTab int)
// func(newTab, oldTab int)
// func(newTab int)
// func()
CurrentTabChangedEvent PropertyName = "current-tab-changed"
// Icon is the constant for "icon" property tag.
//
// Used by `TabsLayout`.
// Defines the icon name that is displayed in the tab. The property is set for the child view of `TabsLayout`.
// Used by 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"
// 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
// 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:
// `true` or `1` or "true", "yes", "on", "1" - Tab(s) has close button.
// `false` or `0` or "false", "no", "off", "0" - No close button in tab(s).
// - true, 1, "true", "yes", "on", "1" - Tab(s) has close button.
// - false, 0, "false", "no", "off", "0" - No close button in tab(s).
TabCloseButton PropertyName = "tab-close-button"
// 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.
//
// General listener format:
// `func(tabsLayout rui.TabsLayout, tab int)`.
//
// func(tabsLayout rui.TabsLayout, tab int)
//
// where:
// tabsLayout - Interface of a tabs layout which generated this event,
// tab - Index of the tab.
// - tabsLayout - Interface of a tabs layout which generated this event,
// - tab - Index of the tab.
//
// Allowed listener formats:
// `func(tab int)`,
// `func(tabsLayout rui.TabsLayout)`,
// `func()`.
//
// func(tab int)
// func(tabsLayout rui.TabsLayout)
// func()
TabCloseEvent PropertyName = "tab-close-event"
// Tabs is the constant for "tabs" property tag.
//
// Used by `TabsLayout`.
// Used by TabsLayout.
// Sets where the tabs are located. Default value is "top".
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// Values:
// `0`(`TopTabs`) or "top" - Tabs on the top.
// `1`(`BottomTabs`) or "bottom" - Tabs on the bottom.
// `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.
// `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.
// `6`(`HiddenTabs`) or "hidden" - Tabs are hidden.
// - 0 (TopTabs) or "top" - Tabs on the top.
// - 1 (BottomTabs) or "bottom" - Tabs on the bottom.
// - 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.
// - 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.
// - 6 (HiddenTabs) or "hidden" - Tabs are hidden.
Tabs PropertyName = "tabs"
// 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".
//
// Supported types: `string`.
// Supported types: string.
TabBarStyle PropertyName = "tab-bar-style"
// 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".
//
// Supported types: `string`.
// Supported types: string.
TabStyle PropertyName = "tab-style"
// 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
// "ruiCurrentVerticalTab".
//
// Supported types: `string`.
// Supported types: string.
CurrentTabStyle PropertyName = "current-tab-style"
inactiveTabStyle = "data-inactiveTabStyle"

View File

@ -10,85 +10,85 @@ import (
const (
// 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.
//
// General listener format:
// `func(picker rui.TimePicker, newTime, oldTime time.Time)`.
// func(picker rui.TimePicker, newTime time.Time, oldTime time.Time).
//
// where:
// picker - Interface of a time picker which generated this event,
// newTime - New time value,
// oldTime - Old time value.
// - picker - Interface of a time picker which generated this event,
// - newTime - New time value,
// - oldTime - Old time value.
//
// Allowed listener formats:
// `func(picker rui.TimePicker, newTime time.Time)`,
// `func(newTime, oldTime time.Time)`,
// `func(newTime time.Time)`,
// `func(picker rui.TimePicker)`,
// `func()`.
// func(picker rui.TimePicker, newTime time.Time),
// func(newTime time.Time, oldTime time.Time),
// func(newTime time.Time),
// func(picker rui.TimePicker),
// func().
TimeChangedEvent PropertyName = "time-changed"
// TimePickerMin is the constant for "time-picker-min" property tag.
//
// Used by `TimePicker`.
// Used by TimePicker.
// 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:
// `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 PM" - "08:15:00 AM".
// "HH:MM" - "08:15".
// "HH:MM PM" - "08:15 AM".
// 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 PM" - "08:15:00 AM".
// - "HH:MM" - "08:15".
// - "HH:MM PM" - "08:15 AM".
TimePickerMin PropertyName = "time-picker-min"
// TimePickerMax is the constant for "time-picker-max" property tag.
//
// Used by `TimePicker`.
// Used by TimePicker.
// 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:
// `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 PM" - "08:15:00 AM".
// "HH:MM" - "08:15".
// "HH:MM PM" - "08:15 AM".
// 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 PM" - "08:15:00 AM".
// - "HH:MM" - "08:15".
// - "HH:MM PM" - "08:15 AM".
TimePickerMax PropertyName = "time-picker-max"
// TimePickerStep is the constant for "time-picker-step" property tag.
//
// Used by `TimePicker`.
// Used by TimePicker.
// Time step in seconds.
//
// Supported types: `int`, `string`.
// Supported types: int, string.
//
// 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"
// TimePickerValue is the constant for "time-picker-value" property tag.
//
// Used by `TimePicker`.
// Used by TimePicker.
// 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:
// `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 PM" - "08:15:00 AM".
// "HH:MM" - "08:15".
// "HH:MM PM" - "08:15 AM".
// 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 PM" - "08:15:00 AM".
// - "HH:MM" - "08:15".
// - "HH:MM PM" - "08:15 AM".
TimePickerValue PropertyName = "time-picker-value"
timeFormat = "15:04:05"

View File

@ -8,75 +8,83 @@ import (
const (
// 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.
//
// General listener format:
// `func(view rui.View, event rui.TouchEvent)`.
//
// func(view rui.View, event rui.TouchEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Touch event.
// - view - Interface of a view which generated this event,
// - event - Touch event.
//
// Allowed listener formats:
// `func(event rui.TouchEvent)`,
// `func(view rui.View)`,
// `func()`.
//
// func(event rui.TouchEvent)
// func(view rui.View)
// func()
TouchStart PropertyName = "touch-start"
// 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.
//
// General listener format:
// `func(view rui.View, event rui.TouchEvent)`.
//
// func(view rui.View, event rui.TouchEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Touch event.
// - view - Interface of a view which generated this event,
// - event - Touch event.
//
// Allowed listener formats:
// `func(event rui.TouchEvent)`,
// `func(view rui.View)`,
// `func()`.
//
// func(event rui.TouchEvent)
// func(view rui.View)
// func()
TouchEnd PropertyName = "touch-end"
// 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.
//
// General listener format:
// `func(view rui.View, event rui.TouchEvent)`.
//
// func(view rui.View, event rui.TouchEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Touch event.
// - view - Interface of a view which generated this event,
// - event - Touch event.
//
// Allowed listener formats:
// `func(event rui.TouchEvent)`,
// `func(view rui.View)`,
// `func()`.
//
// func(event rui.TouchEvent)
// func(view rui.View)
// func()
TouchMove PropertyName = "touch-move"
// 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
// touch points are created).
//
// General listener format:
// `func(view rui.View, event rui.TouchEvent)`.
//
// func(view rui.View, event rui.TouchEvent)
//
// where:
// view - Interface of a view which generated this event,
// event - Touch event.
// - view - Interface of a view which generated this event,
// - event - Touch event.
//
// Allowed listener formats:
// `func(event rui.TouchEvent)`,
// `func(view rui.View)`,
// `func()`.
//
// func(event rui.TouchEvent)
// func(view rui.View)
// func()
TouchCancel PropertyName = "touch-cancel"
)

View File

@ -10,385 +10,263 @@ import (
const (
// 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.
//
// Supported types: `TransformProperty`, `string`.
// Supported types: TransformProperty, string.
//
// See `TransformProperty` description for more details.
// See TransformProperty description for more details.
//
// Conversion rules:
// `TransformProperty` - stored as is, no conversion performed.
// `string` - string representation of `TransformProperty` interface. Example: "_{translate-x = 10px, scale-y = 1.1}".
// - TransformProperty - stored as is, no conversion performed.
// - string - string representation of TransformProperty interface. Example: "_{translate-x = 10px, scale-y = 1.1}".
Transform PropertyName = "transform"
// 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
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
Perspective PropertyName = "perspective"
// 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"
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
PerspectiveOriginX PropertyName = "perspective-origin-x"
// 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"
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
PerspectiveOriginY PropertyName = "perspective-origin-y"
// BackfaceVisible is the constant for "backface-visibility" property tag.
//
// Used by `View`.
// Controls whether the back face of a view is visible when turned towards the user. Default value is `true`.
// Used by View.
// 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:
// `true` or `1` or "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.
// - true, 1, "true", "yes", "on", "1" - Back face is visible when turned towards 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"
// 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%.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TransformOriginX PropertyName = "transform-origin-x"
// 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%.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TransformOriginY PropertyName = "transform-origin-y"
// 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%.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TransformOriginZ PropertyName = "transform-origin-z"
// 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.
//
// 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.
// 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.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TranslateX PropertyName = "translate-x"
// 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.
//
// 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.
// See `SizeUnit` description for more details.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TranslateY PropertyName = "translate-y"
// 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.
//
// 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.
// 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.
// Internal type is SizeUnit, other types converted to it during assignment.
// See SizeUnit description for more details.
TranslateZ PropertyName = "translate-z"
// 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
// 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.
//
// 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.
// Internal type is float, other types converted to it during assignment.
ScaleX PropertyName = "scale-x"
// 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
// 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.
//
// 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.
// Internal type is float, other types converted to it during assignment.
ScaleY PropertyName = "scale-y"
// 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
// 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.
//
// 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.
// Internal type is float, other types converted to it during assignment.
ScaleZ PropertyName = "scale-z"
// 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.
//
// 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.
// See `AngleUnit` description for more details.
// 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.
//
// 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.
// - 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"
// 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.
//
// Supported types: `float`, `int`, `string`.
// Supported types: float, int, string.
//
// 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.
// Internal type is float, other types converted to it during assignment.
RotateX PropertyName = "rotate-x"
// 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.
//
// Supported types: `float`, `int`, `string`.
// Supported types: float, int, string.
//
// 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.
// Internal type is float, other types converted to it during assignment.
RotateY PropertyName = "rotate-y"
// 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.
//
// Supported types: `float`, `int`, `string`.
// Supported types: float, int, string.
//
// 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.
// Internal type is float, other types converted to it during assignment.
RotateZ PropertyName = "rotate-z"
// 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.
//
// 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.
// See `AngleUnit` description for more details.
// 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.
//
// 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.
// - 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"
// 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.
//
// 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.
// See `AngleUnit` description for more details.
// 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.
//
// 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.
// - 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"
)
// 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 angle of the view rotation.
//
// 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"),
// 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
//
// 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 {
transform := new(transformPropertyData)
transform.init()

View File

@ -8,32 +8,32 @@ import (
const (
// 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.
//
// Supported types: `float`, `int`, `string`.
// Supported types: float, int, string.
//
// 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"
// 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.
//
// 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"
// 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
// 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"
)

View File

@ -55,8 +55,8 @@ type View interface {
Scroll() Frame
// SetParams sets properties with name "tag" of the "rootView" subview. Result:
// * true - all properties were set successful,
// * false - error (incompatible type or invalid format of a string value, see AppLog).
// - true - all properties were set successful,
// - false - error (incompatible type or invalid format of a string value, see AppLog).
SetParams(params Params) bool
// 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.
// top - offset from the top border of a View;
// right - offset from the right border of a View;
// bottom - offset from the bottom 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
// - top - offset from the top border of a View;
// - right - offset from the right border of a View;
// - bottom - offset from the bottom 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
func InsetClip(top, right, bottom, left SizeUnit, radius RadiusProperty) ClipShape {
clip := new(insetClip)
clip.init()
@ -71,6 +71,7 @@ func EllipseClip(x, y, rx, ry SizeUnit) ClipShape {
}
// PolygonClip creates a polygon View clipping area.
//
// The elements of the function argument can be or text constants,
// or the text representation of SizeUnit, or elements of SizeUnit type.
func PolygonClip(points []any) ClipShape {

View File

@ -9,122 +9,122 @@ import (
const (
// 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
// 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.
//
// 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"
// 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
// 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.
//
// 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"
// 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
// 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"
// 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
// 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.
// See `ShadowProperty` description for more details.
// Internal type is []ShadowProperty, other types converted to it during assignment.
// See ShadowProperty description for more details.
//
// Conversion rules:
// `[]ShadowProperty` - stored as is, no conversion performed.
// `ShadowProperty` - converted to `[]ShadowProperty`.
// `string` - string representation of `ShadowProperty`. Example: "_{blur = 1em, color = black, spread-radius = 0.5em}".
// - []ShadowProperty - stored as is, no conversion performed.
// - ShadowProperty - converted to []ShadowProperty.
// - string - string representation of ShadowProperty. Example: "_{blur = 1em, color = black, spread-radius = 0.5em}".
DropShadow PropertyName = "drop-shadow"
// 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%
// is completely grayscale. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on
// 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"
// 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
// 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.
//
// 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.
// See `AngleUnit` description for more details.
// 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.
// - 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.
HueRotate PropertyName = "hue-rotate"
// 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%
// is completely inverted. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on
// 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"
// 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
// 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.
//
// 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"
// 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
// completely sepia. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on 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.
Sepia PropertyName = "sepia"
)

View File

@ -1,7 +1,9 @@
package rui
// 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.
//
// 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
@ -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:
//
// true - success,
//
// false - error (incompatible type or invalid format of a string value, see AppLog).
// - true - success,
// - 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
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.
//
// 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)) {
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:
// true - all properties were set successful,
// false - error (incompatible type or invalid format of a string value, see AppLog).
// - true - all properties were set successful,
// - false - error (incompatible type or invalid format of a string value, see AppLog).
func SetParams(rootView View, viewID string, params Params) bool {
if viewID != "" {
rootView = ViewByID(rootView, viewID)