Updated comments

This commit is contained in:
Alexei Anoshenko 2026-11-18 16:44:17 +03:00
parent 581f29e212
commit aa1651fb62
49 changed files with 1129 additions and 451 deletions

View File

@ -2,7 +2,15 @@ package rui
import "strings" import "strings"
// AbsoluteLayout represent an AbsoluteLayout view where child views can be arbitrary positioned // AbsoluteLayout represents an interface for working with the AbsoluteLayout container where child views can be arbitrary.
//
// It extends the [ViewsContainer] interface and supports all its properties.
//
// Elements placed within a AbsoluteLayout container can have additional properties:
// - [Left] ("left");
// - [Top] ("top");
// - [Right] ("right");
// - [Bottom] ("bottom").
type AbsoluteLayout interface { type AbsoluteLayout interface {
ViewsContainer ViewsContainer
} }
@ -11,7 +19,7 @@ type absoluteLayoutData struct {
viewsContainerData viewsContainerData
} }
// NewAbsoluteLayout create new AbsoluteLayout object and return it // NewAbsoluteLayout create a new [AbsoluteLayout] object and return its interface
func NewAbsoluteLayout(session Session, params Params) AbsoluteLayout { func NewAbsoluteLayout(session Session, params Params) AbsoluteLayout {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -12,7 +12,7 @@ import (
const ( const (
// Animation is the constant for "animation" property tag. // Animation is the constant for "animation" property tag.
// //
// Used by View. // Used by [View].
// Sets and starts animations. // Sets and starts animations.
// //
// Supported types: AnimationProperty, []AnimationProperty. // Supported types: AnimationProperty, []AnimationProperty.
@ -35,7 +35,7 @@ const (
// Transition is the constant for "transition" property tag. // Transition is the constant for "transition" property tag.
// //
// Used by View. // Used by [View].
// //
// Sets transition animation of view properties. Each provided property must contain AnimationProperty which describe how // Sets transition animation of view properties. Each provided property must contain AnimationProperty which describe how
// particular property will be animated on property value change. Transition animation can be applied to properties of the // particular property will be animated on property value change. Transition animation can be applied to properties of the
@ -314,11 +314,11 @@ func NewTransitionAnimation(timingFunc string, duration float64, delay float64)
} }
// NewTransitionAnimation creates the animation scenario. // NewTransitionAnimation creates the animation scenario.
// - id - specifies the animation identifier. // - id - specifies the animation identifier;
// - timingFunc - specifies how an animation progresses through the duration of each cycle. If it is "" then "easy" function is used (see [TimingFunction]); // - timingFunc - specifies how an animation progresses through the duration of each cycle. If it is "" then "easy" function is used (see [TimingFunction]);
// - duration - specifies the length of time in seconds that an animation takes to complete one cycle. Must be > 0; // - duration - specifies the length of time in seconds that an animation takes to complete one cycle. Must be > 0;
// - delay - specifies the amount of time in seconds to wait from applying the animation to an element before beginning to perform // - delay - 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. // the animation. The animation can start later, immediately from its beginning or immediately and partway through the animation;
// - direction - specifies whether an animation should play forward, backward, // - direction - specifies whether an animation should play forward, backward,
// or alternate back and forth between playing the sequence forward and backward. Only the following values ​​can be used: // or alternate back and forth between playing the sequence forward and backward. Only the following values ​​can be used:
// 0 (NormalAnimation), 1 (ReverseAnimation), 2 (AlternateAnimation), and 3 (AlternateReverseAnimation); // 0 (NormalAnimation), 1 (ReverseAnimation), 2 (AlternateAnimation), and 3 (AlternateReverseAnimation);

View File

@ -4,7 +4,7 @@ package rui
const ( const (
// TransitionRunEvent is the constant for "transition-run-event" property tag. // TransitionRunEvent is the constant for "transition-run-event" property tag.
// //
// Used by View: // Used by [View]:
// Is fired when a transition is first created, i.e. before any transition delay has begun. // Is fired when a transition is first created, i.e. before any transition delay has begun.
// //
// General listener format: // General listener format:
@ -22,7 +22,7 @@ const (
// TransitionStartEvent is the constant for "transition-start-event" property tag. // TransitionStartEvent is the constant for "transition-start-event" property tag.
// //
// Used by View: // Used by [View]:
// Is fired when a transition has actually started, i.e., after "delay" has ended. // Is fired when a transition has actually started, i.e., after "delay" has ended.
// //
// General listener format: // General listener format:
@ -40,7 +40,7 @@ const (
// TransitionEndEvent is the constant for "transition-end-event" property tag. // TransitionEndEvent is the constant for "transition-end-event" property tag.
// //
// Used by View: // Used by [View]:
// Is fired when a transition has completed. // Is fired when a transition has completed.
// //
// General listener format: // General listener format:
@ -58,7 +58,7 @@ const (
// TransitionCancelEvent is the constant for "transition-cancel-event" property tag. // TransitionCancelEvent is the constant for "transition-cancel-event" property tag.
// //
// Used by View: // Used by [View]:
// Is fired when a transition is cancelled. The transition is cancelled when: // Is fired when a transition is cancelled. The transition is cancelled when:
// - A new property transition has begun. // - A new property transition has begun.
// - The "visibility" property is set to "gone". // - The "visibility" property is set to "gone".
@ -79,7 +79,7 @@ const (
// AnimationStartEvent is the constant for "animation-start-event" property tag. // AnimationStartEvent is the constant for "animation-start-event" property tag.
// //
// Used by View: // Used by [View]:
// Fired when an animation has started. If there is an "animation-delay", this event will fire once the delay period has // Fired when an animation has started. If there is an "animation-delay", this event will fire once the delay period has
// expired. // expired.
// //
@ -98,7 +98,7 @@ const (
// AnimationEndEvent is the constant for "animation-end-event" property tag. // AnimationEndEvent is the constant for "animation-end-event" property tag.
// //
// Used by View: // Used by [View]:
// Fired when an animation has completed. If the animation aborts before reaching completion, such as if the element is // Fired when an animation has completed. If the animation aborts before reaching completion, such as if the element is
// removed or the animation is removed from the element, the "animation-end-event" is not fired. // removed or the animation is removed from the element, the "animation-end-event" is not fired.
// //
@ -117,7 +117,7 @@ const (
// AnimationCancelEvent is the constant for "animation-cancel-event" property tag. // AnimationCancelEvent is the constant for "animation-cancel-event" property tag.
// //
// Used by View: // Used by [View]:
// Fired when an animation unexpectedly aborts. In other words, any time it stops running without sending the // Fired when an animation unexpectedly aborts. In other words, any time it stops running without sending the
// "animation-end-event". This might happen when the animation-name is changed such that the animation is removed, or when // "animation-end-event". This might happen when the animation-name is changed such that the animation is removed, or when
// the animating view is hidden. Therefore, either directly or because any of its containing views are hidden. The event // the animating view is hidden. Therefore, either directly or because any of its containing views are hidden. The event
@ -138,7 +138,7 @@ const (
// AnimationIterationEvent is the constant for "animation-iteration-event" property tag. // AnimationIterationEvent is the constant for "animation-iteration-event" property tag.
// //
// Used by View: // Used by [View]:
// Fired when an iteration of an animation ends, and another one begins. This event does not occur at the same time as the // Fired when an iteration of an animation ends, and another one begins. This event does not occur at the same time as the
// animation end event, and therefore does not occur for animations with an "iteration-count" of one. // animation end event, and therefore does not occur for animations with an "iteration-count" of one.
// //

View File

@ -27,7 +27,11 @@ const (
ContentBox = 2 ContentBox = 2
) )
// BackgroundElement describes the background element // BackgroundElement describes a background element that is created by one of the following functions:
// - [NewBackgroundImage];
// - [NewBackgroundLinearGradient];
// - [NewBackgroundRadialGradient];
// - [NewBackgroundConicGradient].
type BackgroundElement interface { type BackgroundElement interface {
Properties Properties
fmt.Stringer fmt.Stringer

View File

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

View File

@ -71,17 +71,17 @@ type backgroundImage struct {
backgroundElement backgroundElement
} }
// NewBackgroundImage creates the new background image // NewBackgroundImage creates the new background.
// //
// The following properties can be used: // 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. // - [Source] ("src") - 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. // - [Width] ("width") - the width of the image;
// - "height" ([Height]) - the height 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. // - [ImageHorizontalAlign] ("image-horizontal-align") - 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. // - [ImageVerticalAlign] ("image-vertical-align") - the vertical alignment of the image relative to view's bounds;
// - "repeat" ([Repeat]) - the repetition of the image. // - [Repeat] ("repeat") - the repetition of the image;
// - "fit" ([Fit]) - the image scaling parameters. // - [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. // - [Attachment] ("attachment") - defines whether a background image's position is fixed within the viewport or scrolls with its containing block.
func NewBackgroundImage(params Params) BackgroundElement { func NewBackgroundImage(params Params) BackgroundElement {
result := new(backgroundImage) result := new(backgroundImage)
result.init() result.init()

View File

@ -52,9 +52,9 @@ type backgroundLinearGradient struct {
// NewBackgroundLinearGradient creates the new background linear gradient. // NewBackgroundLinearGradient creates the new background linear gradient.
// //
// The following properties can be used: // The following properties can be used:
// - "gradient" ([Gradient]) - Describes gradient stop points. This is a mandatory property while describing background gradients. // - [Gradient] ("gradient") - Describes gradient stop points. This is a mandatory property while describing background gradients;
// - "direction" ([Direction]) - Defines the direction of the gradient line. // - [Direction] ("direction") - Defines the direction of the gradient line;
// - "repeating" ([Repeating]) - Defines whether stop points needs to be repeated after the last one. // - [Repeating] ("repeating") - Defines whether stop points needs to be repeated after the last one;
func NewBackgroundLinearGradient(params Params) BackgroundElement { func NewBackgroundLinearGradient(params Params) BackgroundElement {
result := new(backgroundLinearGradient) result := new(backgroundLinearGradient)
result.init() result.init()

View File

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

View File

@ -10,7 +10,10 @@ import "reflect"
// Supported types: `func(Canvas)`. // Supported types: `func(Canvas)`.
const DrawFunction PropertyName = "draw-function" const DrawFunction PropertyName = "draw-function"
// CanvasView interface of a custom draw view // CanvasView represents an interface for working with the CanvasView view.
//
// It extends the [View] interface and supports all its properties, and also has one additional property:
// - [DrawFunction] ("draw-function").
type CanvasView interface { type CanvasView interface {
View View

View File

@ -24,7 +24,17 @@ import (
// func() // func()
const CheckboxChangedEvent PropertyName = "checkbox-event" const CheckboxChangedEvent PropertyName = "checkbox-event"
// Checkbox represent a Checkbox view // Checkbox represents an interface for working with the NumberPicker view.
//
// It extends the [ViewsContainer] interface and supports all its properties, and also has the following additional properties:
// - [Checked] ("checked");
// - [CheckboxVerticalAlign] ("checkbox-vertical-align");
// - [CheckboxHorizontalAlign] ("checkbox-horizontal-align");
// - [VerticalAlign] ("vertical-align");
// - [HorizontalAlign] ("horizontal-align"");
// - [GridRowGap] ("grid-row-gap");
// - [GridColumnGap] ("grid-column-gap");
// - [CheckboxChangedEvent] ("checkbox-event").
type Checkbox interface { type Checkbox interface {
ViewsContainer ViewsContainer
} }
@ -33,7 +43,7 @@ type checkboxData struct {
viewsContainerData viewsContainerData
} }
// NewCheckbox create new Checkbox object and return it // NewCheckbox creates a new [Checkbox] object and return its interface
func NewCheckbox(session Session, params Params) Checkbox { func NewCheckbox(session Session, params Params) Checkbox {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -39,7 +39,11 @@ const (
ColorPickerValue PropertyName = "color-picker-value" ColorPickerValue PropertyName = "color-picker-value"
) )
// ColorPicker represent a ColorPicker view // ColorPicker represents an interface for working with the ColorPicker view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [ColorPickerValue] ("color-picker-value");
// - [ColorChangedEvent] ("color-changed").
type ColorPicker interface { type ColorPicker interface {
View View
} }
@ -48,7 +52,7 @@ type colorPickerData struct {
viewData viewData
} }
// NewColorPicker create new ColorPicker object and return it // NewColorPicker create a new [ColorPicker] object and return its interface
func NewColorPicker(session Session, params Params) ColorPicker { func NewColorPicker(session Session, params Params) ColorPicker {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -115,7 +115,18 @@ const (
ColumnSpanAll PropertyName = "column-span-all" ColumnSpanAll PropertyName = "column-span-all"
) )
// ColumnLayout represent a ColumnLayout view // ColumnLayout represents an interface for working with the ColumnLayout container.
//
// It extends the [ViewsContainer] interface and supports all its properties, and also has the following additional properties:
// - [ColumnCount] ("column-count");
// - [ColumnWidth] ("column-width");
// - [ColumnGap] ("column-gap");
// - [ColumnSeparator] ("column-separator");
// - [ColumnSeparatorStyle] ("column-separator-style");
// - [ColumnSeparatorWidth] ("column-separator-width");
// - [ColumnSeparatorColor] ("column-separator-color");
// - [ColumnFill] ("column-fill");
// - [ColumnSpanAll] ("column-span-all").
type ColumnLayout interface { type ColumnLayout interface {
ViewsContainer ViewsContainer
} }
@ -124,7 +135,7 @@ type columnLayoutData struct {
viewsContainerData viewsContainerData
} }
// NewColumnLayout create new ColumnLayout object and return it // NewColumnLayout create a new [ColumnLayout] object and return its interface
func NewColumnLayout(session Session, params Params) ColumnLayout { func NewColumnLayout(session Session, params Params) ColumnLayout {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -958,12 +958,18 @@ func reflectValueToDataValue(value reflect.Value) DataValue {
func parseFieldTag(tag string) map[string]string { func parseFieldTag(tag string) map[string]string {
result := map[string]string{} result := map[string]string{}
for line := range strings.SplitSeq(tag, ";") { for line := range strings.SplitSeq(tag, ";") {
pair := strings.SplitN(line, "=", 2) switch index := strings.Index(line, "="); index {
if len(pair) == 2 { case -1:
key := strings.Trim(pair[0], " \t") if key := strings.Trim(line, " \t"); key != "" {
value := strings.Trim(pair[1], " \t") result[key] = ""
if key != "" && value != "" { }
result[key] = value
case 0:
// do nothing
default:
if key := strings.Trim(line[:index], " \t"); key != "" {
result[key] = strings.Trim(line[index+1:], " \t")
} }
} }
} }

View File

@ -112,7 +112,14 @@ const (
dateFormat = "2006-01-02" dateFormat = "2006-01-02"
) )
// DatePicker represent a DatePicker view // DatePicker represents an interface for working with the DatePicker view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [DatePickerMin] ("date-picker-min");
// - [DatePickerMax] ("date-picker-max");
// - [DatePickerStep] ("date-picker-step");
// - [DatePickerValue] ("date-picker-value");
// - [DateChangedEvent] ("date-changed").
type DatePicker interface { type DatePicker interface {
View View
} }
@ -121,7 +128,7 @@ type datePickerData struct {
viewData viewData
} }
// NewDatePicker create new DatePicker object and return it // NewDatePicker creates a new [DatePicker] object and return its interface
func NewDatePicker(session Session, params Params) DatePicker { func NewDatePicker(session Session, params Params) DatePicker {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -42,7 +42,12 @@ const (
HideSummaryMarker PropertyName = "hide-summary-marker" HideSummaryMarker PropertyName = "hide-summary-marker"
) )
// DetailsView represent a DetailsView view, which is a collapsible container of views // DetailsView represents a DetailsView view, which is a collapsible container of views.
//
// It extends the [ViewsContainer] interface and supports all its properties, and also has the following additional properties:
// - [Summary] ("summary");
// - [Expanded] ("expanded");
// - [HideSummaryMarker] ("hide-summary-marker").
type DetailsView interface { type DetailsView interface {
ViewsContainer ViewsContainer
} }
@ -51,7 +56,7 @@ type detailsViewData struct {
viewsContainerData viewsContainerData
} }
// NewDetailsView create new DetailsView object and return it // NewDetailsView create a new [DetailsView] object and return its interface
func NewDetailsView(session Session, params Params) DetailsView { func NewDetailsView(session Session, params Params) DetailsView {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -10,14 +10,14 @@ import (
const ( const (
// DragData is the constant for "drag-data" property tag. // DragData is the constant for "drag-data" property tag.
// //
// Used by View: // Used by [View]:
// //
// Supported types: map[string]string. // Supported types: map[string]string.
DragData PropertyName = "drag-data" DragData PropertyName = "drag-data"
// DragImage is the constant for "drag-image" property tag. // DragImage is the constant for "drag-image" property tag.
// //
// Used by View: // Used by [View]:
// An url of image to use for the drag feedback image. // An url of image to use for the drag feedback image.
// //
// Supported type: string. // Supported type: string.
@ -25,7 +25,7 @@ const (
// DragImageXOffset is the constant for "drag-image-x-offset" property tag. // DragImageXOffset is the constant for "drag-image-x-offset" property tag.
// //
// Used by View: // Used by [View]:
// The horizontal offset in pixels within the drag feedback image. // The horizontal offset in pixels within the drag feedback image.
// //
// Supported types: float, int, string. // Supported types: float, int, string.
@ -33,7 +33,7 @@ const (
// DragImageYOffset is the constant for "drag-image-y-offset" property tag. // DragImageYOffset is the constant for "drag-image-y-offset" property tag.
// //
// Used by View. // Used by [View].
// The vertical offset in pixels within the drag feedback image. // The vertical offset in pixels within the drag feedback image.
// //
// Supported types: float, int, string. // Supported types: float, int, string.
@ -41,7 +41,7 @@ const (
// DropEffect is the constant for "drop-effect" property tag. // DropEffect is the constant for "drop-effect" property tag.
// //
// Used by View. // Used by [View].
// Controls the feedback (typically visual) the user is given during a drag and drop operation. // Controls the feedback (typically visual) the user is given during a drag and drop operation.
// It will affect which cursor is displayed while dragging. For example, when the user hovers over a target drop element, // It will affect which cursor is displayed while dragging. For example, when the user hovers over a target drop element,
// the browser's cursor may indicate which type of operation will occur. // the browser's cursor may indicate which type of operation will occur.
@ -57,7 +57,7 @@ const (
// DropEffectAllowed is the constant for "drop-effect-allowed" property tag. // DropEffectAllowed is the constant for "drop-effect-allowed" property tag.
// //
// Used by View. // Used by [View].
// Specifies the effect that is allowed for a drag operation. // Specifies the effect that is allowed for a drag operation.
// The copy operation is used to indicate that the data being dragged will be copied // The copy operation is used to indicate that the data being dragged will be copied
// from its present location to the drop location. // from its present location to the drop location.
@ -80,7 +80,7 @@ const (
// DragStartEvent is the constant for "drag-start-event" property tag. // DragStartEvent is the constant for "drag-start-event" property tag.
// //
// Used by View. // Used by [View].
// Fired when the user starts dragging an element or text selection. // Fired when the user starts dragging an element or text selection.
// //
// General listener format: // General listener format:
@ -98,7 +98,7 @@ const (
// DragEndEvent is the constant for "drag-end-event" property tag. // DragEndEvent is the constant for "drag-end-event" property tag.
// //
// Used by View. // Used by [View].
// Fired when a drag operation ends (by releasing a mouse button or hitting the escape key). // Fired when a drag operation ends (by releasing a mouse button or hitting the escape key).
// //
// General listener format: // General listener format:
@ -116,7 +116,7 @@ const (
// DragEnterEvent is the constant for "drag-enter-event" property tag. // DragEnterEvent is the constant for "drag-enter-event" property tag.
// //
// Used by View. // Used by [View].
// Fired when a dragged element or text selection enters a valid drop target. // Fired when a dragged element or text selection enters a valid drop target.
// //
// General listener format: // General listener format:
@ -134,7 +134,7 @@ const (
// DragLeaveEvent is the constant for "drag-leave-event" property tag. // DragLeaveEvent is the constant for "drag-leave-event" property tag.
// //
// Used by View. // Used by [View].
// Fired when a dragged element or text selection leaves a valid drop target. // Fired when a dragged element or text selection leaves a valid drop target.
// //
// General listener format: // General listener format:
@ -152,7 +152,7 @@ const (
// DragOverEvent is the constant for "drag-over-event" property tag. // DragOverEvent is the constant for "drag-over-event" property tag.
// //
// Used by View. // Used by [View].
// Fired when an element or text selection is being dragged over a valid drop target (every few hundred milliseconds). // Fired when an element or text selection is being dragged over a valid drop target (every few hundred milliseconds).
// //
// General listener format: // General listener format:
@ -170,7 +170,7 @@ const (
// DropEvent is the constant for "drop-event" property tag. // DropEvent is the constant for "drop-event" property tag.
// //
// Used by View. // Used by [View].
// Fired when an element or text selection is dropped on a valid drop target. // Fired when an element or text selection is dropped on a valid drop target.
// //
// General listener format: // General listener format:

View File

@ -6,6 +6,37 @@ import (
"strings" "strings"
) )
const (
// DisabledItems is the constant for "disabled-items" property tag.
//
// Used by DropDownList.
// An array of disabled(non selectable) items indices.
//
// Supported types: []int, string, []string, []any containing elements of string or int.
//
// Internal type is []int, other types converted to it during assignment.
// Rules of conversion.
// - []int - Array of indices.
// - string - Single index value or multiple index values separated by comma(,).
// - []string - Array of indices in text format.
// - []any - Array of strings or integer values.
DisabledItems PropertyName = "disabled-items"
// ItemSeparators is the constant for "item-separators" property tag.
//
// Used by DropDownList.
// An array of indices of DropDownList items after which a separator should be added.
//
// Supported types: []int, string, []string, []any containing elements of string or int.
//
// Internal type is []int, other types converted to it during assignment.
// Rules of conversion.
// - []int - Array of indices.
// - string - Single index value or multiple index values separated by comma(,).
// - []string - Array of indices in text format.
// - []any - Array of strings or integer values.
ItemSeparators PropertyName = "item-separators"
// DropDownEvent is the constant for "drop-down-event" property tag. // DropDownEvent is the constant for "drop-down-event" property tag.
// //
// Used by DropDownList. // Used by DropDownList.
@ -24,9 +55,17 @@ import (
// func(index int) // func(index int)
// func(list rui.DropDownList) // func(list rui.DropDownList)
// func() // func()
const DropDownEvent PropertyName = "drop-down-event" DropDownEvent PropertyName = "drop-down-event"
)
// DropDownList represent a DropDownList view // DropDownList represents an interface for working with the DropDownList view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [Items] ("items");
// - [DisabledItems] ("disabled-items");
// - [ItemSeparators] ("item-separators");
// - [Current] ("current");
// - [DropDownEvent] ("drop-down-event").
type DropDownList interface { type DropDownList interface {
View View
} }
@ -35,7 +74,7 @@ type dropDownListData struct {
viewData viewData
} }
// NewDropDownList create new DropDownList object and return it // NewDropDownList creates a new [DropDownList] object and return its interface
func NewDropDownList(session Session, params Params) DropDownList { func NewDropDownList(session Session, params Params) DropDownList {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -7,6 +7,63 @@ import (
// Constants for [EditView] specific properties and events // Constants for [EditView] specific properties and events
const ( const (
// Hint is the constant for "hint" property tag.
//
// Used by EditView.
// Sets a hint to the user of what can be entered in the control.
//
// Supported types: string.
Hint PropertyName = "hint"
// MaxLength is the constant for "max-length" property tag.
//
// Used by EditView.
// Sets the maximum number of characters that the user can enter.
//
// Supported types: int, string.
//
// Values:
// - positive value - Maximum number of characters.
// - 0 or negative value - The maximum number of characters is not limited.
MaxLength PropertyName = "max-length"
// EditWrap is the constant for "edit-wrap" property tag.
//
// Used by EditView.
// Controls whether the text will wrap around when edit view border has been reached. Default value is false.
//
// Supported types: bool, int, string.
//
// Values:
// - true, 1, "true", "yes", "on", or "1" - Text wrapped to the next line.
// - false, 0, "false", "no", "off", or "0" - Do not wrap text. Horizontal scrolling will appear if necessary.
EditWrap PropertyName = "edit-wrap"
// CaretColor is the constant for "caret-color" property tag.
//
// Used by EditView.
//
// Sets the color of the insertion caret, the visible marker where the next character typed will be inserted. This is
// sometimes referred to as the text input cursor.
//
// Supported types: Color, ColorPair, string.
//
// Internal type is Color, other types converted to it during assignment.
// See [Color] description for more details.
CaretColor PropertyName = "caret-color"
// ReadOnly is the constant for "readonly" property tag.
//
// Used by EditView.
// Controls whether the user can modify value or not. Default value is false.
//
// Supported types: bool, int, string.
//
// Values:
// - true, 1, "true", "yes", "on", or "1" - User not able to modify the value.
// - false, 0, "false", "no", "off", or "0" - Value can be modified.
ReadOnly PropertyName = "readonly"
// EditTextChangedEvent is the constant for "edit-text-changed" property tag. // EditTextChangedEvent is the constant for "edit-text-changed" property tag.
// //
// Used by EditView. // Used by EditView.
@ -53,6 +110,12 @@ const (
// Supported types: string. // Supported types: string.
EditViewPattern PropertyName = "edit-view-pattern" EditViewPattern PropertyName = "edit-view-pattern"
// Pattern is the constant for "pattern" property tag.
//
// Used by EditView.
// Same as "edit-view-pattern" [EditViewPattern].
Pattern PropertyName = "pattern"
// Spellcheck is the constant for "spellcheck" property tag. // Spellcheck is the constant for "spellcheck" property tag.
// //
// Used by EditView. // Used by EditView.
@ -91,20 +154,32 @@ const (
MultiLineText = 6 MultiLineText = 6
) )
// EditView represent an EditView view // EditView represents an interface for working with the EditView view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [Text] ("text");
// - [Hint] ("hint");
// - [MaxLength] ("maxlength");
// - [ReadOnly] ("readonly");
// - [DataList] ("data-list");
// - [EditViewType] ("edit-view-type");
// - [EditViewPattern] ("edit-view-pattern");
// - [EditWrap] ("edit-wrap");
// - [CaretColor] ("caret-color");
// - [Spellcheck] ("spellcheck");
// - [EditTextChangedEvent] ("edit-text-changed").
type EditView interface { type EditView interface {
View View
// AppendText appends text to the current text of an EditView view // AppendText appends text to the current text of an EditView view
AppendText(text string) AppendText(text string)
textChanged(newText, oldText string)
} }
type editViewData struct { type editViewData struct {
viewData viewData
} }
// NewEditView create new EditView object and return it // NewEditView creates a new [EditView] object and return its interface
func NewEditView(session Session, params Params) EditView { func NewEditView(session Session, params Params) EditView {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -18,8 +18,8 @@ const (
// func(picker rui.FilePicker, files []rui.FileInfo). // func(picker rui.FilePicker, files []rui.FileInfo).
// //
// where: // where:
// picker - Interface of a file picker which generated this event, // - picker - Interface of a file picker which generated this event,
// files - Array of description of selected files. // - files - Array of description of selected files.
// //
// Allowed listener formats: // Allowed listener formats:
// func(picker rui.FilePicker) // func(picker rui.FilePicker)
@ -71,12 +71,19 @@ type FileInfo struct {
data []byte data []byte
} }
// FilePicker represents the FilePicker view // FilePicker represents an interface for working with the FilePicker view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [Accept] ("accept");
// - [Multiple] ("multiple");
// - [FileSelectedEvent] ("file-selected-event").
type FilePicker interface { type FilePicker interface {
View View
// Files returns the list of selected files. // Files returns the list of selected files.
// If there are no files selected then an empty slice is returned (the result is always not nil) // If there are no files selected then an empty slice is returned (the result is always not nil)
Files() []FileInfo Files() []FileInfo
// LoadFile loads the content of the selected file. This function is asynchronous. // LoadFile loads the content of the selected file. This function is asynchronous.
// The "result" function will be called after loading the data. // The "result" function will be called after loading the data.
LoadFile(file FileInfo, result func(FileInfo, []byte)) LoadFile(file FileInfo, result func(FileInfo, []byte))
@ -112,7 +119,7 @@ func (file FileInfo) key() string {
return fmt.Sprintf("%s:%d", file.Name, int(file.Size)) return fmt.Sprintf("%s:%d", file.Name, int(file.Size))
} }
// NewFilePicker create new FilePicker object and return it // NewFilePicker create a new [FilePicker] object and return its interface
func NewFilePicker(session Session, params Params) FilePicker { func NewFilePicker(session Session, params Params) FilePicker {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -144,16 +144,16 @@ type filterData struct {
// NewFilterProperty creates the new FilterProperty // NewFilterProperty creates the new FilterProperty
// //
// The argument lists the effects to apply. The following effects are possible: // The argument lists the effects to apply. The following effects are possible:
// - "blur" ([Blur]) - Gaussian blur in pixels (type: float64, value: 0…10000); // - [Blur] ("blur") - Gaussian blur in pixels (type: float64, value: 0…10000);
// - "brightness" ([Brightness]) - Brightness change in percents (type: float64, value: 0…10000); // - [Brightness] ("brightness") - Brightness change in percents (type: float64, value: 0…10000);
// - "contrast" ([Contrast]) - Contrast change in percents (type: float64, value: 0…10000); // - [Contrast] ("contrast") - Contrast change in percents (type: float64, value: 0…10000);
// - "drop-shadow" ([DropShadow]) - Adding shadow (type: []ShadowProperty); // - [DropShadow] ("drop-shadow") - Adding shadow (type: []ShadowProperty);
// - "grayscale" ([Grayscale]) - Converting to grayscale in percents (type: float64, value: 0…100); // - [Grayscale] ("grayscale") - Converting to grayscale in percents (type: float64, value: 0…100);
// - "hue-rotate" ([HueRotate]) - Hue rotation (type: AngleUnit); // - [HueRotate] ("hue-rotate") - Hue rotation (type: AngleUnit);
// - "invert" ([Invert]) - Invert colors in percents (type: float64, value: 0…100); // - [Invert] ("invert") - Invert colors in percents (type: float64, value: 0…100);
// - "opacity" ([Opacity]) - Changing transparency in percents (type: float64, value: 0…100); // - [Opacity] ("opacity") - Changing transparency in percents (type: float64, value: 0…100);
// - "saturate" ([Saturate]) - Saturation change in percents (type: float64, value: 0…10000); // - [Saturate] ("saturate") - Saturation change in percents (type: float64, value: 0…10000);
// - "sepia" ([Sepia]) - Conversion to sepia in percents (type: float64, value: 0…100). // - [Sepia] ("sepia") - Conversion to sepia in percents (type: float64, value: 0…100).
func NewFilterProperty(params Params) FilterProperty { func NewFilterProperty(params Params) FilterProperty {
if len(params) > 0 { if len(params) > 0 {
filter := new(filterData) filter := new(filterData)

View File

@ -6,7 +6,7 @@ import "strings"
const ( const (
// FocusEvent is the constant for "focus-event" property tag. // FocusEvent is the constant for "focus-event" property tag.
// //
// Used by View. // Used by [View].
// Occur when the view takes input focus. // Occur when the view takes input focus.
// //
// General listener format: // General listener format:
@ -21,7 +21,7 @@ const (
// LostFocusEvent is the constant for "lost-focus-event" property tag. // LostFocusEvent is the constant for "lost-focus-event" property tag.
// //
// Used by View. // Used by [View].
// Occur when the View lost input focus. // Occur when the View lost input focus.
// //
// General listener format: // General listener format:

420
form.go Normal file
View File

@ -0,0 +1,420 @@
package rui
import (
"math"
"reflect"
"strconv"
"strings"
)
type formElement struct {
data any
index int
id string
listener func(string)
}
type formDropDown struct {
formElement
}
type formNumber struct {
formElement
}
type formFlag struct {
formElement
}
type formText struct {
formElement
}
func (element *formElement) fieldValue() reflect.Value {
structValue := reflect.ValueOf(element.data)
if structValue.Kind() == reflect.Pointer {
structValue = structValue.Elem()
}
return structValue.Field(element.index)
}
func (formFlag *formFlag) changed(checkbox Checkbox, checked bool) {
val := formFlag.fieldValue()
if val.Kind() == reflect.Bool && val.Bool() != checked {
val.SetBool(checked)
formFlag.listener(formFlag.id)
}
}
func (text *formText) changed(checkbox EditView, newText, oldText string) {
val := text.fieldValue()
if val.Kind() == reflect.String && val.String() != newText {
val.SetString(newText)
text.listener(text.id)
}
}
func (dropDown *formDropDown) changed(list DropDownList, index int) {
switch val := dropDown.fieldValue(); val.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
newInt := int64(index)
if newInt == val.Int() {
return
}
val.SetInt(newInt)
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
if index < 0 {
return
}
newUint := uint64(index)
if newUint == val.Uint() {
return
}
val.SetUint(newUint)
default:
return
}
if dropDown.listener != nil {
dropDown.listener(dropDown.id)
}
}
func (number *formNumber) changed(picker NumberPicker, newValue float64, oldValue float64) {
switch val := number.fieldValue(); val.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
newInt := int64(newValue)
if newInt == val.Int() {
return
}
val.SetInt(newInt)
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
newUint := uint64(newValue)
if newUint == val.Uint() {
return
}
val.SetUint(newUint)
case reflect.Float32, reflect.Float64:
if newValue == val.Float() {
return
}
val.SetFloat(newValue)
default:
return
}
if number.listener != nil {
number.listener(number.id)
}
}
func createForm(session Session, data any, structValue reflect.Value, listener func(string)) View {
result := NewGridLayout(session, Params{
ColumnWidth: []SizeUnit{AutoSize(), AutoSize()},
ColumnGap: Px(16),
})
lineNumber := 0
params := map[string]string{}
getFloatParam := func(tag string) (float64, bool) {
if value, ok := params[tag]; ok {
n, err := strconv.ParseFloat(value, 64)
if err == nil {
return n, true
}
ErrorLog(err.Error())
}
return 0, false
}
getItems := func() []string {
if value, ok := params["items"]; ok {
if length := len(value); length > 0 && value[0] == '[' && value[length-1] == ']' {
return strings.Split(value[1:length-1], ",")
}
return []string{}
}
return nil
}
createDropDown := func(index int, id string, current int) View {
items := getItems()
if items != nil {
if len(items) > 0 {
dropDown := new(formDropDown)
dropDown.data = data
dropDown.index = index
dropDown.id = id
dropDown.listener = listener
return NewDropDownList(session, Params{
ID: id,
Items: items,
Current: current,
DropDownEvent: dropDown.changed,
})
} else {
ErrorLog("invalid items list")
}
}
return nil
}
createNumberPicker := func(index int, id string, current float64, step int, minValue int, maxValue int) View {
numberType := NumberEditor
if value, ok := params["type"]; ok && strings.ToLower(value) == "slider" {
numberType = NumberSlider
}
numberData := new(formNumber)
numberData.data = data
numberData.index = index
numberData.id = id
numberData.listener = listener
picker := NewNumberPicker(session, Params{
ID: id,
NumberPickerType: numberType,
NumberPickerValue: current,
NumberChangedEvent: numberData.changed,
})
if n, ok := getFloatParam("step"); ok {
picker.Set(NumberPickerStep, n)
} else if step != 0 {
picker.Set(NumberPickerStep, step)
}
if n, ok := getFloatParam("min"); ok {
picker.Set(NumberPickerMin, n)
} else if minValue != -1 {
picker.Set(NumberPickerMin, minValue)
}
if n, ok := getFloatParam("max"); ok {
picker.Set(NumberPickerMax, n)
} else if maxValue != 0 {
picker.Set(NumberPickerMax, maxValue)
}
return picker
}
for i := range structValue.NumField() {
val := structValue.Field(i)
field := structValue.Type().Field(i)
if tag := field.Tag.Get("rui"); tag != "" {
params = parseFieldTag(tag)
} else {
params = map[string]string{}
}
var id string
if name, ok := params["id"]; ok && name != "" {
id = name
} else {
id = field.Name
}
var controlView View = nil
switch val.Kind() {
case reflect.Int, reflect.Int64:
controlView = createDropDown(i, id, int(val.Int()))
if controlView == nil {
controlView = createNumberPicker(i, id, float64(val.Int()), 1, -1, 0)
}
case reflect.Int8:
controlView = createDropDown(i, id, int(val.Int()))
if controlView == nil {
controlView = createNumberPicker(i, id, float64(val.Int()), 1, math.MinInt8, math.MaxInt8)
}
case reflect.Int16:
controlView = createDropDown(i, id, int(val.Int()))
if controlView == nil {
controlView = createNumberPicker(i, id, float64(val.Int()), 1, math.MinInt16, math.MaxInt16)
}
case reflect.Int32:
controlView = createDropDown(i, id, int(val.Int()))
if controlView == nil {
controlView = createNumberPicker(i, id, float64(val.Int()), 1, math.MinInt32, math.MaxInt32)
}
case reflect.Uint, reflect.Uint64:
controlView = createDropDown(i, id, int(val.Int()))
if controlView == nil {
controlView = createNumberPicker(i, id, float64(val.Int()), 1, 0, 0)
}
case reflect.Uint8:
controlView = createDropDown(i, id, int(val.Int()))
if controlView == nil {
controlView = createNumberPicker(i, id, float64(val.Int()), 1, 0, math.MaxUint8)
}
case reflect.Uint16:
controlView = createDropDown(i, id, int(val.Int()))
if controlView == nil {
controlView = createNumberPicker(i, id, float64(val.Int()), 1, 0, math.MaxUint16)
}
case reflect.Uint32:
controlView = createDropDown(i, id, int(val.Int()))
if controlView == nil {
controlView = createNumberPicker(i, id, float64(val.Int()), 1, 0, math.MaxUint32)
}
case reflect.Float32, reflect.Float64:
controlView = createNumberPicker(i, id, val.Float(), 0, -1, 0)
case reflect.Bool:
label := params["label"]
flag := new(formFlag)
flag.data = data
flag.index = i
flag.id = id
flag.listener = listener
result.Append(NewCheckbox(session, Params{
ID: id,
Row: lineNumber,
Column: Range{First: 0, Last: 1},
Content: label,
Checked: val.Bool(),
CheckboxChangedEvent: flag.changed,
}))
lineNumber++
case reflect.String:
textType := ""
if value, ok := params["type"]; ok {
textType = strings.ToLower(value)
}
text := new(formText)
text.data = data
text.index = i
text.id = id
text.listener = listener
//valueColumn := addLabel(id, textType == "multiline")
editor := NewEditView(session, Params{
ID: id,
Text: val.String(),
EditTextChangedEvent: text.changed,
})
if textType != "" {
editor.Set(EditViewType, textType)
}
maxlen := ""
if text, ok := params["max-length"]; ok {
maxlen = text
} else if text, ok := params["maxlength"]; ok {
maxlen = text
} else if text, ok := params["maxlen"]; ok {
maxlen = text
}
if maxlen != "" {
n, err := strconv.Atoi(maxlen)
if err != nil {
ErrorLog(err.Error())
} else if n > 0 {
editor.Set(MaxLength, n)
} else {
ErrorLog(`max-length <= 0`)
}
}
controlView = editor
//case reflect.Struct:
//case reflect.Slice, reflect.Array:
//case reflect.Map:
default:
DebugLog("unsupported element type") // TODO
}
if controlView != nil {
label, hasLabel := params["label"]
if !hasLabel {
controlView.Set(Row, lineNumber)
controlView.Set(Column, Range{First: 0, Last: 1})
result.Append(controlView)
} else {
_, twoLine := params["two-line"]
if twoLine { //} || alwaysTwoLine {
result.Append(NewListLayout(session, Params{
Row: lineNumber,
Column: Range{First: 0, Last: 1},
Orientation: VerticalOrientation,
Content: []View{
NewTextView(session, Params{
ID: id + "-label",
Text: label,
}),
controlView,
},
}))
} else {
result.Append(NewTextView(session, Params{
ID: id + "-label",
Row: lineNumber,
Column: 0,
Text: label,
}))
controlView.Set(Row, lineNumber)
controlView.Set(Column, 1)
result.Append(controlView)
}
}
lineNumber++
}
}
return result
}
func NewForm(session Session, data any, listener func(string)) View {
if session == nil {
ErrorLog(`nil session argument of NewForm function`)
return nil
}
if data == nil {
ErrorLog(`nil data argument of NewForm function`)
return nil
}
value := reflect.ValueOf(data)
if value.Kind() == reflect.Pointer {
value = value.Elem()
}
if value.Kind() != reflect.Struct {
ErrorLog(`An argument to NewForm function can only be a structure or a pointer to a structure`)
return nil
}
return createForm(session, data, value, listener)
}

View File

@ -103,7 +103,23 @@ type GridCellRowSpanAdapter interface {
GridCellRowSpan(row, column int) int GridCellRowSpan(row, column int) int
} }
// GridLayout represents a GridLayout view // GridLayout represents an interface for working with the GridLayout container.
// In a GridLayout container, child elements are positioned within the cells of a rectangular grid.
//
// It extends the [ViewsContainer] interface and supports all its properties, and also has the following additional properties:
// - [CellVerticalAlign] ("cell-vertical-align");
// - [CellHorizontalAlign] ("cell-horizontal-align");
// - [CellWidth] ("cell-width");
// - [CellHeight] ("cell-height");
// - [GridRowGap] ("grid-row-gap");
// - [GridColumnGap] ("grid-column-gap");
// - [GridAutoFlow] ("grid-auto-flow");
//
// Elements placed within a GridLayout container can have additional properties:
// - [Row] ("row");
// - [Column] ("column");
// - [CellVerticalSelfAlign] ("cell-vertical-self-align");
// - [CellHorizontalSelfAlign] ("cell-horizontal-self-align").
type GridLayout interface { type GridLayout interface {
ViewsContainer ViewsContainer
@ -117,7 +133,7 @@ type gridLayoutData struct {
adapter GridAdapter adapter GridAdapter
} }
// NewGridLayout create new GridLayout object and return it // NewGridLayout create a new [GridLayout] object and return its interface
func NewGridLayout(session Session, params Params) GridLayout { func NewGridLayout(session Session, params Params) GridLayout {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -7,16 +7,27 @@ import (
// Constants which represent [ImageView] specific properties and events // Constants which represent [ImageView] specific properties and events
const ( const (
// SrcSet is the constant for "srcset" property tag.
//
// Used by [ImageView].
//
// String which identifies one or more image candidate strings, separated using comma(,) each specifying image resources
// to use under given screen density. This property is only used if building an application for js/wasm platform.
//
// Supported types: string.
SrcSet PropertyName = "srcset"
// LoadedEvent is the constant for "loaded-event" property tag. // LoadedEvent is the constant for "loaded-event" property tag.
// //
// Used by ImageView. // Used by [ImageView].
//
// Occur when the image has been loaded. // Occur when the image has been loaded.
// //
// General listener format: // General listener format:
// func(image rui.ImageView) // func(image rui.ImageView)
// //
// where: // where:
// image - Interface of an image view which generated this event. // - image - Interface of an image view which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// func() // func()
@ -24,14 +35,15 @@ const (
// ErrorEvent is the constant for "error-event" property tag. // ErrorEvent is the constant for "error-event" property tag.
// //
// Used by ImageView. // Used by [ImageView].
//
// Occur when the image loading has been failed. // Occur when the image loading has been failed.
// //
// General listener format: // General listener format:
// func(image rui.ImageView) // func(image rui.ImageView)
// //
// where: // where:
// image - Interface of an image view which generated this event. // - image - Interface of an image view which generated this event.
// //
// Allowed listener formats: // Allowed listener formats:
// func() // func()
@ -61,12 +73,24 @@ const (
ScaleDownFit = 4 ScaleDownFit = 4
) )
// ImageView represents an ImageView view // ImageView represents an interface for working with the ImageView view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [Source] ("src");
// - [SrcSet] ("srcset");
// - [Fit] ("fit");
// - [AltText] ("alt-text");
// - [ImageVerticalAlign] ("image-vertical-align");
// - [ImageHorizontalAlign] ("image-horizontal-align");
// - [LoadedEvent] ("loaded-event");
// - [ErrorEvent] ("error-event").
type ImageView interface { type ImageView interface {
View View
// NaturalSize returns the intrinsic, density-corrected size (width, height) of the image in pixels. // NaturalSize returns the intrinsic, density-corrected size (width, height) of the image in pixels.
// If the image hasn't been loaded yet or an load error has occurred, then (0, 0) is returned. // If the image hasn't been loaded yet or an load error has occurred, then (0, 0) is returned.
NaturalSize() (float64, float64) NaturalSize() (float64, float64)
// CurrentSource() return the full URL of the image currently visible in the ImageView. // CurrentSource() return the full URL of the image currently visible in the ImageView.
// If the image hasn't been loaded yet or an load error has occurred, then "" is returned. // If the image hasn't been loaded yet or an load error has occurred, then "" is returned.
CurrentSource() string CurrentSource() string
@ -79,7 +103,7 @@ type imageViewData struct {
currentSrc string currentSrc string
} }
// NewImageView create new ImageView object and return it // NewImageView create a new [ImageView] object and return its interface
func NewImageView(session Session, params Params) ImageView { func NewImageView(session Session, params Params) ImageView {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -6,7 +6,7 @@ import "strings"
const ( const (
// KeyDownEvent is the constant for "key-down-event" property tag. // KeyDownEvent is the constant for "key-down-event" property tag.
// //
// Used by View. // Used by [View].
// Is fired when a key is pressed. // Is fired when a key is pressed.
// //
// General listener format: // General listener format:
@ -26,7 +26,7 @@ const (
// KeyUpEvent is the constant for "key-up-event" property tag. // KeyUpEvent is the constant for "key-up-event" property tag.
// //
// Used by View. // Used by [View].
// Is fired when a key is released. // Is fired when a key is released.
// //
// General listener format: // General listener format:

View File

@ -31,9 +31,19 @@ const (
ListWrapReverse = 2 ListWrapReverse = 2
) )
// ListLayout represents a ListLayout view // ListLayout represents an interface for working with the ListLayout container.
// In a ListLayout container, child elements are arranged in a vertical or horizontal list.
//
// It extends the [ViewsContainer] interface and supports all its properties, and also has the following additional properties:
// - [Orientation] ("orientation");
// - [VerticalAlign] ("vertical-align");
// - [HorizontalAlign] ("horizontal-align");
// - [ListRowGap] ("list-row-gap");
// - [ListColumnGap] ("list-column-gap");
// - [ListWrap] ("list-wrap").
type ListLayout interface { type ListLayout interface {
ViewsContainer ViewsContainer
// UpdateContent updates child Views if the "content" property value is set to ListAdapter, // UpdateContent updates child Views if the "content" property value is set to ListAdapter,
// otherwise does nothing // otherwise does nothing
UpdateContent() UpdateContent()
@ -44,7 +54,7 @@ type listLayoutData struct {
adapter ListAdapter adapter ListAdapter
} }
// NewListLayout create new ListLayout object and return it // NewListLayout create a new [ListLayout] object and return its interface
func NewListLayout(session Session, params Params) ListLayout { func NewListLayout(session Session, params Params) ListLayout {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -117,7 +117,27 @@ const (
MultipleCheckbox = 2 MultipleCheckbox = 2
) )
// ListView represents a ListView view // ListView represents an interface for working with the ListView view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [Items] ("items");
// - [Current] ("current");
// - [Checked] ("checked");
// - [Orientation] ("orientation");
// - [ListWrap] ("list-wrap");
// - [ListRowGap] ("list-row-gap");
// - [ListColumnGap] ("list-column-gap");
// - [ItemWidth] ("item-width");
// - [ItemHeight] ("item-height");
// - [ItemHorizontalAlign] ("item-horizontal-align");
// - [ItemVerticalAlign] ("item-vertical-align");
// - [ItemCheckbox] ("checkbox");
// - [CheckboxHorizontalAlign] ("checkbox-horizontal-align");
// - [CheckboxVerticalAlign] ("checkbox-vertical-align");
// - [ListItemStyle] ("list-item-style");
// - [CurrentStyle] ("current-style");
// - [CurrentInactiveStyle] ("current-inactive-style");
// - [AccentColor] ("accent-color").
type ListView interface { type ListView interface {
View View
ParentView ParentView
@ -137,7 +157,7 @@ type listViewData struct {
itemFrame []Frame itemFrame []Frame
} }
// NewListView creates the new list view // NewListView creates a new [ListView] object and return its interface
func NewListView(session Session, params Params) ListView { func NewListView(session Session, params Params) ListView {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -9,7 +9,7 @@ import (
const ( const (
// ClickEvent is the constant for "click-event" property tag. // ClickEvent is the constant for "click-event" property tag.
// //
// Used by View. // Used by [View].
// Occur when the user clicks on the view. // Occur when the user clicks on the view.
// //
// General listener format: // General listener format:
@ -29,7 +29,7 @@ const (
// DoubleClickEvent is the constant for "double-click-event" property tag. // DoubleClickEvent is the constant for "double-click-event" property tag.
// //
// Used by View. // Used by [View].
// Occur when the user double clicks on the view. // Occur when the user double clicks on the view.
// //
// General listener format: // General listener format:
@ -49,7 +49,7 @@ const (
// MouseDown is the constant for "mouse-down" property tag. // MouseDown is the constant for "mouse-down" property tag.
// //
// Used by View. // Used by [View].
// Is fired at a View when a pointing device button is pressed while the pointer is inside the view. // Is fired at a View when a pointing device button is pressed while the pointer is inside the view.
// //
// General listener format: // General listener format:
@ -69,7 +69,7 @@ const (
// MouseUp is the constant for "mouse-up" property tag. // MouseUp is the constant for "mouse-up" property tag.
// //
// Used by View. // Used by [View].
// Is fired at a View when a button on a pointing device (such as a mouse or trackpad) is released while the pointer is // Is fired at a View when a button on a pointing device (such as a mouse or trackpad) is released while the pointer is
// located inside it. "mouse-up" events are the counterpoint to "mouse-down" events. // located inside it. "mouse-up" events are the counterpoint to "mouse-down" events.
// //
@ -90,7 +90,7 @@ const (
// MouseMove is the constant for "mouse-move" property tag. // MouseMove is the constant for "mouse-move" property tag.
// //
// Used by View. // Used by [View].
// Is fired at a view when a pointing device(usually a mouse) is moved while the cursor's hotspot is inside it. // Is fired at a view when a pointing device(usually a mouse) is moved while the cursor's hotspot is inside it.
// //
// General listener format: // General listener format:
@ -110,7 +110,7 @@ const (
// MouseOut is the constant for "mouse-out" property tag. // MouseOut is the constant for "mouse-out" property tag.
// //
// Used by View. // Used by [View].
// Is fired at a View when a pointing device (usually a mouse) is used to move the cursor so that it is no longer // Is fired at a View when a pointing device (usually a mouse) is used to move the cursor so that it is no longer
// contained within the view or one of its children. "mouse-out" is also delivered to a view if the cursor enters a child // contained within the view or one of its children. "mouse-out" is also delivered to a view if the cursor enters a child
// view, because the child view obscures the visible area of the view. // view, because the child view obscures the visible area of the view.
@ -132,7 +132,7 @@ const (
// MouseOver is the constant for "mouse-over" property tag. // MouseOver is the constant for "mouse-over" property tag.
// //
// Used by View. // Used by [View].
// Is fired at a View when a pointing device (such as a mouse or trackpad) is used to move the cursor onto the view or one // Is fired at a View when a pointing device (such as a mouse or trackpad) is used to move the cursor onto the view or one
// of its child views. // of its child views.
// //
@ -153,7 +153,7 @@ const (
// ContextMenuEvent is the constant for "context-menu-event" property tag. // ContextMenuEvent is the constant for "context-menu-event" property tag.
// //
// Used by View. // Used by [View].
// Occur when the user calls the context menu by the right mouse clicking. // Occur when the user calls the context menu by the right mouse clicking.
// //
// General listener format: // General listener format:

View File

@ -33,7 +33,7 @@ const (
// NumberPickerType is the constant for "number-picker-type" property tag. // NumberPickerType is the constant for "number-picker-type" property tag.
// //
// Used by NumberPicker. // Used by [NumberPicker].
// Sets the visual representation. // Sets the visual representation.
// //
// Supported types: int, string. // Supported types: int, string.
@ -45,7 +45,7 @@ const (
// NumberPickerMin is the constant for "number-picker-min" property tag. // NumberPickerMin is the constant for "number-picker-min" property tag.
// //
// Used by NumberPicker. // Used by [NumberPicker].
// Set the minimum value. The default value is 0. // Set the minimum value. The default value is 0.
// //
// Supported types: float, int, string. // Supported types: float, int, string.
@ -55,7 +55,7 @@ const (
// NumberPickerMax is the constant for "number-picker-max" property tag. // NumberPickerMax is the constant for "number-picker-max" property tag.
// //
// Used by NumberPicker. // Used by [NumberPicker].
// Set the maximum value. The default value is 1. // Set the maximum value. The default value is 1.
// //
// Supported types: float, int, string. // Supported types: float, int, string.
@ -65,7 +65,7 @@ const (
// NumberPickerStep is the constant for "number-picker-step" property tag. // NumberPickerStep is the constant for "number-picker-step" property tag.
// //
// Used by NumberPicker. // Used by [NumberPicker].
// Set the value change step. // Set the value change step.
// //
// Supported types: float, int, string. // Supported types: float, int, string.
@ -75,7 +75,7 @@ const (
// NumberPickerValue is the constant for "number-picker-value" property tag. // NumberPickerValue is the constant for "number-picker-value" property tag.
// //
// Used by NumberPicker. // Used by [NumberPicker].
// Current value. The default value is 0. // Current value. The default value is 0.
// //
// Supported types: float, int, string. // Supported types: float, int, string.
@ -94,16 +94,25 @@ const (
NumberPickerPrecision PropertyName = "number-picker-precision" NumberPickerPrecision PropertyName = "number-picker-precision"
) )
// Constants which describe values of the "number-picker-type" property of a [NumberPicker] // Constants which describe values of the "number-picker-type" ([NumberPickerType]) property of a [NumberPicker]
const ( const (
// NumberEditor - type of NumberPicker. NumberPicker is presented by editor // NumberEditor is values of the "number-picker-type" ([NumberPickerType]) property. [NumberPicker] is presented by editor.
NumberEditor = 0 NumberEditor = 0
// NumberSlider - type of NumberPicker. NumberPicker is presented by slider // NumberSlider is values of the "number-picker-type" ([NumberPickerType]) property. NumberPicker is presented by slider.
NumberSlider = 1 NumberSlider = 1
) )
// NumberPicker represents a NumberPicker view // NumberPicker represents an interface for working with the NumberPicker view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [NumberPickerType] ("number-picker-type");
// - [NumberPickerMin] ("number-picker-min");
// - [NumberPickerMax] ("number-picker-max");
// - [NumberPickerStep] ("number-picker-step");
// - [NumberPickerValue] ("number-picker-value");
// - [NumberPickerPrecision] ("number-picker-precision");
// - [NumberChangedEvent] ("number-changed").
type NumberPicker interface { type NumberPicker interface {
View View
} }
@ -112,7 +121,7 @@ type numberPickerData struct {
viewData viewData
} }
// NewNumberPicker create new NumberPicker object and return it // NewNumberPicker create new [NumberPicker] object and return it
func NewNumberPicker(session Session, params Params) NumberPicker { func NewNumberPicker(session Session, params Params) NumberPicker {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

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

View File

@ -63,7 +63,7 @@ type pathData struct {
varName any varName any
} }
// NewPath creates a new empty Path // NewPath creates a new empty [Path]
func (canvas *canvasData) NewPath() Path { func (canvas *canvasData) NewPath() Path {
path := new(pathData) path := new(pathData)
path.session = canvas.session path.session = canvas.session

View File

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

View File

@ -1535,7 +1535,30 @@ func (popup *popupData) createLayerView() {
} }
} }
// NewPopup creates a new Popup // NewPopup creates a new [Popup] object and return its interface
//
// You can use all [View] properties, as well as the following properties:
// - [Content] ("content");
// - [Title] ("title");
// - [TitleStyle] ("title-style");
// - [CloseButton] ("close-button");
// - [OutsideClose] ("outside-close");
// - [OutsideColor] ("outside-color");
// - [OutsideFilter] ("outside-filter");
// - [Buttons] ("buttons");
// - [ButtonsAlign] ("buttons-align");
// - [VerticalAlign] ("vertical-align");
// - [HorizontalAlign] ("horizontal-align");
// - [DismissEvent] ("dismiss-event");
// - [Arrow] ("arrow");
// - [ArrowAlign] ("arrow-align");
// - [ArrowSize] ("arrow-size");
// - [ArrowWidth] ("arrow-width");
// - [ArrowOffset] ("arrow-offset");
// - [ShowTransform] ("show-transform");
// - [ShowDuration] ("show-duration");
// - [ShowTiming] ("show-timing");
// - [ShowOpacity] ("show-opacity").
func NewPopup(view View, param Params) Popup { func NewPopup(view View, param Params) Popup {
if view == nil { if view == nil {
ErrorLog(`the View argument cannot be nil`) ErrorLog(`the View argument cannot be nil`)

View File

@ -28,7 +28,11 @@ const (
ProgressBarValue PropertyName = "progress-value" ProgressBarValue PropertyName = "progress-value"
) )
// ProgressBar represents a ProgressBar view // ProgressBar represents an interface for working with the ProgressBar view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [ProgressBarMax] ("progress-max");
// - [ProgressBarValue] ("progress-value").
type ProgressBar interface { type ProgressBar interface {
View View
} }
@ -37,7 +41,7 @@ type progressBarData struct {
viewData viewData
} }
// NewProgressBar create new ProgressBar object and return it // NewProgressBar creates a new [ProgressBar] object and return its interface
func NewProgressBar(session Session, params Params) ProgressBar { func NewProgressBar(session Session, params Params) ProgressBar {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ import (
const ( const (
// Radius is the constant for "radius" property tag. // Radius is the constant for "radius" property tag.
// //
// Used by View, BackgroundElement, ClipShapeProperty. // Used by [View], BackgroundElement, ClipShapeProperty.
// //
// Usage in View: // Usage in View:
// Specifies the corners rounding radius of an element's outer border edge. // Specifies the corners rounding radius of an element's outer border edge.
@ -41,7 +41,7 @@ const (
// RadiusX is the constant for "radius-x" property tag. // RadiusX is the constant for "radius-x" property tag.
// //
// Used by View, ClipShapeProperty. // Used by [View], ClipShapeProperty.
// //
// Usage in View: // Usage in View:
// Specifies the x-axis corners elliptic rounding radius of an element's outer border edge. // Specifies the x-axis corners elliptic rounding radius of an element's outer border edge.
@ -62,7 +62,7 @@ const (
// RadiusY is the constant for "radius-y" property tag. // RadiusY is the constant for "radius-y" property tag.
// //
// Used by View, ClipShapeProperty. // Used by [View], ClipShapeProperty.
// //
// Usage in View: // Usage in View:
// Specifies the y-axis corners elliptic rounding radius of an element's outer border edge. // Specifies the y-axis corners elliptic rounding radius of an element's outer border edge.
@ -83,7 +83,7 @@ const (
// RadiusTopLeft is the constant for "radius-top-left" property tag. // RadiusTopLeft is the constant for "radius-top-left" property tag.
// //
// Used by View. // Used by [View].
// Specifies the top-left corner rounding radius of an element's outer border edge. // Specifies the top-left corner rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -94,7 +94,7 @@ const (
// RadiusTopLeftX is the constant for "radius-top-left-x" property tag. // RadiusTopLeftX is the constant for "radius-top-left-x" property tag.
// //
// Used by View. // Used by [View].
// Specifies the x-axis top-left corner elliptic rounding radius of an element's outer border edge. // Specifies the x-axis top-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -105,7 +105,7 @@ const (
// RadiusTopLeftY is the constant for "radius-top-left-y" property tag. // RadiusTopLeftY is the constant for "radius-top-left-y" property tag.
// //
// Used by View. // Used by [View].
// Specifies the y-axis top-left corner elliptic rounding radius of an element's outer border edge. // Specifies the y-axis top-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -116,7 +116,7 @@ const (
// RadiusTopRight is the constant for "radius-top-right" property tag. // RadiusTopRight is the constant for "radius-top-right" property tag.
// //
// Used by View. // Used by [View].
// Specifies the top-right corner rounding radius of an element's outer border edge. // Specifies the top-right corner rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -127,7 +127,7 @@ const (
// RadiusTopRightX is the constant for "radius-top-right-x" property tag. // RadiusTopRightX is the constant for "radius-top-right-x" property tag.
// //
// Used by View. // Used by [View].
// Specifies the x-axis top-right corner elliptic rounding radius of an element's outer border edge. // Specifies the x-axis top-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -138,7 +138,7 @@ const (
// RadiusTopRightY is the constant for "radius-top-right-y" property tag. // RadiusTopRightY is the constant for "radius-top-right-y" property tag.
// //
// Used by View. // Used by [View].
// Specifies the y-axis top-right corner elliptic rounding radius of an element's outer border edge. // Specifies the y-axis top-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -149,7 +149,7 @@ const (
// RadiusBottomLeft is the constant for "radius-bottom-left" property tag. // RadiusBottomLeft is the constant for "radius-bottom-left" property tag.
// //
// Used by View. // Used by [View].
// Specifies the bottom-left corner rounding radius of an element's outer border edge. // Specifies the bottom-left corner rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -160,7 +160,7 @@ const (
// RadiusBottomLeftX is the constant for "radius-bottom-left-x" property tag. // RadiusBottomLeftX is the constant for "radius-bottom-left-x" property tag.
// //
// Used by View. // Used by [View].
// Specifies the x-axis bottom-left corner elliptic rounding radius of an element's outer border edge. // Specifies the x-axis bottom-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -171,7 +171,7 @@ const (
// RadiusBottomLeftY is the constant for "radius-bottom-left-y" property tag. // RadiusBottomLeftY is the constant for "radius-bottom-left-y" property tag.
// //
// Used by View. // Used by [View].
// Specifies the y-axis bottom-left corner elliptic rounding radius of an element's outer border edge. // Specifies the y-axis bottom-left corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -182,7 +182,7 @@ const (
// RadiusBottomRight is the constant for "radius-bottom-right" property tag. // RadiusBottomRight is the constant for "radius-bottom-right" property tag.
// //
// Used by View. // Used by [View].
// Specifies the bottom-right corner rounding radius of an element's outer border edge. // Specifies the bottom-right corner rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -193,7 +193,7 @@ const (
// RadiusBottomRightX is the constant for "radius-bottom-right-x" property tag. // RadiusBottomRightX is the constant for "radius-bottom-right-x" property tag.
// //
// Used by View. // Used by [View].
// Specifies the x-axis bottom-right corner elliptic rounding radius of an element's outer border edge. // Specifies the x-axis bottom-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -204,7 +204,7 @@ const (
// RadiusBottomRightY is the constant for "radius-bottom-right-y" property tag. // RadiusBottomRightY is the constant for "radius-bottom-right-y" property tag.
// //
// Used by View. // Used by [View].
// Specifies the y-axis bottom-right corner elliptic rounding radius of an element's outer border edge. // Specifies the y-axis bottom-right corner elliptic rounding radius of an element's outer border edge.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -405,19 +405,19 @@ type radiusPropertyData struct {
// NewRadiusProperty creates the new RadiusProperty // NewRadiusProperty creates the new RadiusProperty
// //
// The following properties can be used: // The following properties can be used:
// - "x" (X) - Determines the x-axis elliptic rounding radius of an element's outer border edge. // - "x" (X) - Determines the x-axis elliptic rounding radius of an element's outer border edge;
// - "y" (Y) - Determines the y-axis corner elliptic rounding radius of an element's outer border edge. // - "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" (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-x" (TopLeftX) - Determines the x-axis top-left corner elliptic rounding radius of an element's outer border edge;
// - "top-left-y" (TopLeftY) - Determines the y-axis top-left corner elliptic rounding radius of an element's outer border edge. // - "top-left-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" (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-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. // - "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" (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-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-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" (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-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. // - "bottom-right-y" (BottomRightY) - Determines the y-axis bottom-right corner elliptic rounding radius of an element's outer border edge.
func NewRadiusProperty(params Params) RadiusProperty { func NewRadiusProperty(params Params) RadiusProperty {
result := new(radiusPropertyData) result := new(radiusPropertyData)

View File

@ -55,7 +55,12 @@ const (
AllSides = TopSide | RightSide | BottomSide | LeftSide AllSides = TopSide | RightSide | BottomSide | LeftSide
) )
// Resizable represents a Resizable view // Resizable represents an interface for working with the Resizable container.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [Content] ("content");
// - [Side] ("side");
// - [ResizeBorderWidth] ("resize-border-width").
type Resizable interface { type Resizable interface {
View View
ParentView ParentView
@ -65,7 +70,7 @@ type resizableData struct {
viewData viewData
} }
// NewResizable create new Resizable object and return it // NewResizable create a new [Resizable] object and return it
func NewResizable(session Session, params Params) Resizable { func NewResizable(session Session, params Params) Resizable {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -2,7 +2,7 @@ package rui
// ResizeEvent is the constant for "resize-event" property tag. // ResizeEvent is the constant for "resize-event" property tag.
// //
// Used by View. // Used by [View].
// Is fired when the view changes its size. // Is fired when the view changes its size.
// //
// General listener format: // General listener format:

View File

@ -2,7 +2,7 @@ package rui
// ScrollEvent is the constant for "scroll-event" property tag. // ScrollEvent is the constant for "scroll-event" property tag.
// //
// Used by View. // Used by [View].
// Is fired when the content of the view is scrolled. // Is fired when the content of the view is scrolled.
// //
// General listener format: // General listener format:

View File

@ -171,12 +171,12 @@ func NewTextShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit |
// NewShadowProperty create the new shadow property for a view. // NewShadowProperty create the new shadow property for a view.
// //
// The following properties can be used: // The following properties can be used:
// - "color" ([ColorTag]) - Determines the color of the shadow (Color); // - [ColorTag] ("color") - Determines the color of the shadow (Color);
// - "x-offset" ([XOffset]) - Determines the shadow horizontal offset (SizeUnit); // - [XOffset] ("x-offset") - Determines the shadow horizontal offset (SizeUnit);
// - "y-offset" ([YOffset]) - Determines the shadow vertical offset (SizeUnit); // - [YOffset] ("y-offset") - Determines the shadow vertical offset (SizeUnit);
// - "blur" ([BlurRadius]) - Determines the radius of the blur effect (SizeUnit); // - [BlurRadius] ("blur") - 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; // - [SpreadRadius] ("spread-radius") - 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. // - [Inset] ("inset") - Controls (bool) whether to draw shadow inside the frame or outside.
func NewShadowProperty(params Params) ShadowProperty { func NewShadowProperty(params Params) ShadowProperty {
shadow := new(shadowPropertyData) shadow := new(shadowPropertyData)
shadow.init() shadow.init()

View File

@ -17,27 +17,38 @@ type SizeUnitType uint8
const ( const (
// Auto is the SizeUnit type: default value. // Auto is the SizeUnit type: default value.
Auto SizeUnitType = 0 Auto SizeUnitType = 0
// SizeInPixel is the SizeUnit type: the Value field specifies the size in pixels. // SizeInPixel is the SizeUnit type: the Value field specifies the size in pixels.
SizeInPixel SizeUnitType = 1 SizeInPixel SizeUnitType = 1
// SizeInEM is the SizeUnit type: the Value field specifies the size in em. // SizeInEM is the SizeUnit type: the Value field specifies the size in em.
SizeInEM SizeUnitType = 2 SizeInEM SizeUnitType = 2
// SizeInEX is the SizeUnit type: the Value field specifies the size in em. // SizeInEX is the SizeUnit type: the Value field specifies the size in em.
SizeInEX SizeUnitType = 3 SizeInEX SizeUnitType = 3
// SizeInPercent is the SizeUnit type: the Value field specifies the size in percents of the parent size. // SizeInPercent is the SizeUnit type: the Value field specifies the size in percents of the parent size.
SizeInPercent SizeUnitType = 4 SizeInPercent SizeUnitType = 4
// SizeInPt is the SizeUnit type: the Value field specifies the size in pt (1/72 inch). // SizeInPt is the SizeUnit type: the Value field specifies the size in pt (1/72 inch).
SizeInPt SizeUnitType = 5 SizeInPt SizeUnitType = 5
// SizeInPc is the SizeUnit type: the Value field specifies the size in pc (1pc = 12pt). // SizeInPc is the SizeUnit type: the Value field specifies the size in pc (1pc = 12pt).
SizeInPc SizeUnitType = 6 SizeInPc SizeUnitType = 6
// SizeInInch is the SizeUnit type: the Value field specifies the size in inches. // SizeInInch is the SizeUnit type: the Value field specifies the size in inches.
SizeInInch SizeUnitType = 7 SizeInInch SizeUnitType = 7
// SizeInMM is the SizeUnit type: the Value field specifies the size in millimeters. // SizeInMM is the SizeUnit type: the Value field specifies the size in millimeters.
SizeInMM SizeUnitType = 8 SizeInMM SizeUnitType = 8
// SizeInCM is the SizeUnit type: the Value field specifies the size in centimeters. // SizeInCM is the SizeUnit type: the Value field specifies the size in centimeters.
SizeInCM SizeUnitType = 9 SizeInCM SizeUnitType = 9
// SizeInFraction is the SizeUnit type: the Value field specifies the size in fraction. // SizeInFraction is the SizeUnit type: the Value field specifies the size in fraction.
// Used only for "cell-width" and "cell-height" property. // Used only for "cell-width" and "cell-height" property.
SizeInFraction SizeUnitType = 10 SizeInFraction SizeUnitType = 10
// SizeFunction is the SizeUnit type: the Function field specifies the size function. // SizeFunction is the SizeUnit type: the Function field specifies the size function.
// "min", "max", "clamp", "sum", "sub", "mul", and "div" functions are available. // "min", "max", "clamp", "sum", "sub", "mul", and "div" functions are available.
SizeFunction = 11 SizeFunction = 11

View File

@ -247,7 +247,27 @@ const (
PushSkewY PropertyName = "push-skew-y" PushSkewY PropertyName = "push-skew-y"
) )
// StackLayout represents a StackLayout view // StackLayout represents an interface for working with the StackLayout container.
// In a StackLayout container, child elements are arranged in a stack, and only the top element is accessible.
//
// It extends the [ViewsContainer] interface and supports all its properties, and also has the following additional properties:
// - [MoveToFrontAnimation] ("move-to-front-animation");
// - [PushTransform] ("push-transform");
// - [PushDuration] ("push-duration");
// - [PushTiming] ("push-timing");
// - [PushPerspective] ("push-perspective");
// - [PushTranslateX] ("push-translate-x");
// - [PushTranslateY] ("push-translate-y");
// - [PushTranslateZ] ("push-translate-z");
// - [PushScaleX] ("push-scale-x");
// - [PushScaleY] ("push-scale-y");
// - [PushScaleZ] ("push-scale-z");
// - [PushRotate] ("push-rotate");
// - [PushRotateX] ("push-rotate-x");
// - [PushRotateY] ("push-rotate-y");
// - [PushRotateZ] ("push-rotate-z");
// - [PushSkewX] ("push-skew-x");
// - [PushSkewY] ("push-skew-y").
type StackLayout interface { type StackLayout interface {
ViewsContainer ViewsContainer
@ -309,7 +329,7 @@ type stackLayoutData struct {
onMoveFinished map[string]popFinished onMoveFinished map[string]popFinished
} }
// NewStackLayout create new StackLayout object and return it // NewStackLayout create a new [StackLayout] object and return its interface
func NewStackLayout(session Session, params Params) StackLayout { func NewStackLayout(session Session, params Params) StackLayout {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -7,7 +7,12 @@ import (
"strings" "strings"
) )
// SvgImageView represents an SvgImageView view // SvgImageView represents an interface for working with the SvgImageView view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [Content] ("content");
// - [VerticalAlign] ("vertical-align");
// - [HorizontalAlign] ("horizontal-align").
type SvgImageView interface { type SvgImageView interface {
View View
} }
@ -16,7 +21,7 @@ type svgImageViewData struct {
viewData viewData
} }
// NewSvgImageView create new SvgImageView object and return it // NewSvgImageView create a new [SvgImageView] object and return its interface
func NewSvgImageView(session Session, params Params) SvgImageView { func NewSvgImageView(session Session, params Params) SvgImageView {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -135,7 +135,23 @@ const (
HiddenTabs = 6 HiddenTabs = 6
) )
// TabsLayout represents a TabsLayout view // TabsLayout represents an interface for working with the TabsLayout container.
// In a TabsLayout container, child elements are arranged in a stack, and only the top element is accessible.
// Each element has a tab that is used to bring that element to the foreground.
//
// It extends the [ViewsContainer] interface and supports all its properties, and also has the following additional properties:
// - [Tabs] ("tabs");
// - [TabBarStyle] ("tab-bar-style");
// - [TabStyle] ("tab-style");
// - [CurrentTabStyle] ("current-tab-style");
// - [TabCloseButton] ("tab-close-button");
// - [TabCloseEvent] ("tab-close-event");
// - [CurrentTabChangedEvent] ("current-tab-changed").
//
// Elements placed within a GridLayout container can have additional properties:
// - [Title] ("title");
// - [Icon] ("icon");
// - [TabCloseButton] ("tab-close-button").
type TabsLayout interface { type TabsLayout interface {
ViewsContainer ViewsContainer
ListAdapter ListAdapter
@ -145,7 +161,7 @@ type tabsLayoutData struct {
viewsContainerData viewsContainerData
} }
// NewTabsLayout create new TabsLayout object and return it // NewTabsLayout create a new [TabsLayout] object and return its interface
func NewTabsLayout(session Session, params Params) TabsLayout { func NewTabsLayout(session Session, params Params) TabsLayout {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -5,7 +5,23 @@ import (
"strings" "strings"
) )
// TextView represents a TextView view // TextOverflow is the constant for "text-overflow" property tag.
//
// Used by TextView.
// Sets how hidden overflow content is signaled to users. Default value is "clip".
//
// Supported types: int, string.
//
// Values:
// - 0 (TextOverflowClip) or "clip" - Text is clipped at the border.
// - 1 (TextOverflowEllipsis) or "ellipsis" - At the end of the visible part of the text "…" is displayed.
const TextOverflow PropertyName = "text-overflow"
// TextView represents an interface for working with the TextView view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [Text] ("text");
// - [TextOverflow] ("text-overflow").
type TextView interface { type TextView interface {
View View
} }
@ -14,7 +30,7 @@ type textViewData struct {
viewData viewData
} }
// NewTextView create new TextView object and return it // NewTextView create a interface new [TextView] object and return its interface
func NewTextView(session Session, params Params) TextView { func NewTextView(session Session, params Params) TextView {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -94,7 +94,14 @@ const (
timeFormat = "15:04:05" timeFormat = "15:04:05"
) )
// TimePicker represents a TimePicker view // TimePicker represents an interface for working with the TimePicker view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [TimePickerMin] ("time-picker-min");
// - [TimePickerMax] ("time-picker-max");
// - [TimePickerStep] ("time-picker-step");
// - [TimePickerValue] ("time-picker-value");
// - [TimeChangedEvent] ("time-changed").
type TimePicker interface { type TimePicker interface {
View View
} }
@ -103,7 +110,7 @@ type timePickerData struct {
viewData viewData
} }
// NewTimePicker create new TimePicker object and return it // NewTimePicker create a new [TimePicker] object and return its interface
func NewTimePicker(session Session, params Params) TimePicker { func NewTimePicker(session Session, params Params) TimePicker {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -8,7 +8,7 @@ import (
const ( const (
// TouchStart is the constant for "touch-start" property tag. // TouchStart is the constant for "touch-start" property tag.
// //
// Used by View. // Used by [View].
// Is fired when one or more touch points are placed on the touch surface. // Is fired when one or more touch points are placed on the touch surface.
// //
// General listener format: // General listener format:
@ -28,7 +28,7 @@ const (
// TouchEnd is the constant for "touch-end" property tag. // TouchEnd is the constant for "touch-end" property tag.
// //
// Used by View. // Used by [View].
// Fired when one or more touch points are removed from the touch surface. // Fired when one or more touch points are removed from the touch surface.
// //
// General listener format: // General listener format:
@ -48,7 +48,7 @@ const (
// TouchMove is the constant for "touch-move" property tag. // TouchMove is the constant for "touch-move" property tag.
// //
// Used by View. // Used by [View].
// Is fired when one or more touch points are moved along the touch surface. // Is fired when one or more touch points are moved along the touch surface.
// //
// General listener format: // General listener format:
@ -68,7 +68,7 @@ const (
// TouchCancel is the constant for "touch-cancel" property tag. // TouchCancel is the constant for "touch-cancel" property tag.
// //
// Used by View. // Used by [View].
// Is fired when one or more touch points have been disrupted in an implementation-specific manner (for example, too many // Is fired when one or more touch points have been disrupted in an implementation-specific manner (for example, too many
// touch points are created). // touch points are created).
// //

View File

@ -10,7 +10,7 @@ import (
const ( const (
// Transform is the constant for "transform" property tag. // Transform is the constant for "transform" property tag.
// //
// Used by View. // Used by [View].
// Specify translation, scale and rotation over x, y and z axes as well as a distortion of a view along x and y axes. // Specify translation, scale and rotation over x, y and z axes as well as a distortion of a view along x and y axes.
// //
// Supported types: TransformProperty, string. // Supported types: TransformProperty, string.
@ -24,7 +24,7 @@ const (
// Perspective is the constant for "perspective" property tag. // Perspective is the constant for "perspective" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// Distance between the z-plane and the user in order to give a 3D-positioned element some perspective. Each 3D element // Distance between the z-plane and the user in order to give a 3D-positioned element some perspective. Each 3D element
// with z > 0 becomes larger, each 3D-element with z < 0 becomes smaller. The default value is 0 (no 3D effects). // with z > 0 becomes larger, each 3D-element with z < 0 becomes smaller. The default value is 0 (no 3D effects).
// //
@ -36,7 +36,7 @@ const (
// PerspectiveOriginX is the constant for "perspective-origin-x" property tag. // PerspectiveOriginX is the constant for "perspective-origin-x" property tag.
// //
// Used by View. // Used by [View].
// x-coordinate of the position at which the viewer is looking. It is used as the vanishing point by the "perspective" // x-coordinate of the position at which the viewer is looking. It is used as the vanishing point by the "perspective"
// property. The default value is 50%. // property. The default value is 50%.
// //
@ -48,7 +48,7 @@ const (
// PerspectiveOriginY is the constant for "perspective-origin-y" property tag. // PerspectiveOriginY is the constant for "perspective-origin-y" property tag.
// //
// Used by View. // Used by [View].
// y-coordinate of the position at which the viewer is looking. It is used as the vanishing point by the "perspective" // y-coordinate of the position at which the viewer is looking. It is used as the vanishing point by the "perspective"
// property. The default value is 50%. // property. The default value is 50%.
// //
@ -60,7 +60,7 @@ const (
// BackfaceVisible is the constant for "backface-visibility" property tag. // BackfaceVisible is the constant for "backface-visibility" property tag.
// //
// Used by View. // Used by [View].
// Controls whether the back face of a view is visible when turned towards the user. Default value is true. // Controls whether the back face of a view is visible when turned towards the user. Default value is true.
// //
// Supported types: bool, int, string. // Supported types: bool, int, string.
@ -72,7 +72,7 @@ const (
// TransformOriginX is the constant for "transform-origin-x" property tag. // TransformOriginX is the constant for "transform-origin-x" property tag.
// //
// Used by View. // Used by [View].
// x-coordinate of the point around which a view transformation is applied. The default value is 50%. // x-coordinate of the point around which a view transformation is applied. The default value is 50%.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -83,7 +83,7 @@ const (
// TransformOriginY is the constant for "transform-origin-y" property tag. // TransformOriginY is the constant for "transform-origin-y" property tag.
// //
// Used by View. // Used by [View].
// y-coordinate of the point around which a view transformation is applied. The default value is 50%. // y-coordinate of the point around which a view transformation is applied. The default value is 50%.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -94,7 +94,7 @@ const (
// TransformOriginZ is the constant for "transform-origin-z" property tag. // TransformOriginZ is the constant for "transform-origin-z" property tag.
// //
// Used by View. // Used by [View].
// z-coordinate of the point around which a view transformation is applied. The default value is 50%. // z-coordinate of the point around which a view transformation is applied. The default value is 50%.
// //
// Supported types: SizeUnit, SizeFunc, string, float, int. // Supported types: SizeUnit, SizeFunc, string, float, int.
@ -105,7 +105,7 @@ const (
// TranslateX is the constant for "translate-x" property tag. // TranslateX is the constant for "translate-x" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// x-axis translation value of a 2D/3D translation. // x-axis translation value of a 2D/3D translation.
// //
@ -117,7 +117,7 @@ const (
// TranslateY is the constant for "translate-y" property tag. // TranslateY is the constant for "translate-y" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// x-axis translation value of a 2D/3D translation. // x-axis translation value of a 2D/3D translation.
// //
@ -129,7 +129,7 @@ const (
// TranslateZ is the constant for "translate-z" property tag. // TranslateZ is the constant for "translate-z" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// z-axis translation value of a 3D translation. // z-axis translation value of a 3D translation.
// //
@ -141,7 +141,7 @@ const (
// ScaleX is the constant for "scale-x" property tag. // ScaleX is the constant for "scale-x" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// x-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original // x-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1. // scale, more than 1 - to increase. The default value is 1.
@ -153,7 +153,7 @@ const (
// ScaleY is the constant for "scale-y" property tag. // ScaleY is the constant for "scale-y" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// y-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original // y-axis scaling value of a 2D/3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1. // scale, more than 1 - to increase. The default value is 1.
@ -165,7 +165,7 @@ const (
// ScaleZ is the constant for "scale-z" property tag. // ScaleZ is the constant for "scale-z" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// z-axis scaling value of a 3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original // z-axis scaling value of a 3D scale. The original scale is 1. Values between 0 and 1 are used to decrease original
// scale, more than 1 - to increase. The default value is 1. // scale, more than 1 - to increase. The default value is 1.
@ -177,7 +177,7 @@ const (
// Rotate is the constant for "rotate" property tag. // Rotate is the constant for "rotate" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// Angle of the view rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise. // Angle of the view rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise.
// //
@ -195,7 +195,7 @@ const (
// RotateX is the constant for "rotate-x" property tag. // RotateX is the constant for "rotate-x" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// x-coordinate of the vector denoting the axis of rotation in range 0 to 1. // x-coordinate of the vector denoting the axis of rotation in range 0 to 1.
// //
@ -206,7 +206,7 @@ const (
// RotateY is the constant for "rotate-y" property tag. // RotateY is the constant for "rotate-y" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// y-coordinate of the vector denoting the axis of rotation in range 0 to 1. // y-coordinate of the vector denoting the axis of rotation in range 0 to 1.
// //
@ -217,7 +217,7 @@ const (
// RotateZ is the constant for "rotate-z" property tag. // RotateZ is the constant for "rotate-z" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// z-coordinate of the vector denoting the axis of rotation in range 0 to 1. // z-coordinate of the vector denoting the axis of rotation in range 0 to 1.
// //
@ -228,7 +228,7 @@ const (
// SkewX is the constant for "skew-x" property tag. // SkewX is the constant for "skew-x" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// Angle to use to distort the element along the abscissa. The default value is 0. // Angle to use to distort the element along the abscissa. The default value is 0.
// //
@ -246,7 +246,7 @@ const (
// SkewY is the constant for "skew-y" property tag. // SkewY is the constant for "skew-y" property tag.
// //
// Used by View, TransformProperty. // Used by [View], TransformProperty.
// //
// Angle to use to distort the element along the ordinate. The default value is 0. // Angle to use to distort the element along the ordinate. The default value is 0.
// //

View File

@ -18,7 +18,14 @@ type ParentView interface {
ViewCount() int ViewCount() int
} }
// ViewsContainer represent a mutable list-container of views // ViewsContainer represents an interface for working with the ViewsContainer view.
//
// You cannot create a View of this type. This interface serves as the base for all View containers:
//
// [ListLayout], [GridLayout], [ColumnLayout], [StackLayout], [AbsoluteLayout], [TabsLayout], [Checkbox].
//
// It extends the [View] interface and supports all its properties, and also has one additional property:
// - [Content] ("content").
type ViewsContainer interface { type ViewsContainer interface {
View View
ParentView ParentView