diff --git a/absoluteLayout.go b/absoluteLayout.go index d54f8b4..a079211 100644 --- a/absoluteLayout.go +++ b/absoluteLayout.go @@ -2,7 +2,15 @@ package rui 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 { ViewsContainer } @@ -11,7 +19,7 @@ type absoluteLayoutData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/animation.go b/animation.go index 87f6778..d2db785 100644 --- a/animation.go +++ b/animation.go @@ -12,7 +12,7 @@ import ( const ( // Animation is the constant for "animation" property tag. // - // Used by View. + // Used by [View]. // Sets and starts animations. // // Supported types: AnimationProperty, []AnimationProperty. @@ -35,7 +35,7 @@ const ( // 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 // 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. -// - 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]); // - 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 -// 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, // 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); diff --git a/animationEvents.go b/animationEvents.go index 82bc8cc..e1d5c52 100644 --- a/animationEvents.go +++ b/animationEvents.go @@ -4,7 +4,7 @@ package rui const ( // TransitionRunEvent is the constant for "transition-run-event" property tag. // - // Used by View: + // Used by [View]: // Is fired when a transition is first created, i.e. before any transition delay has begun. // // General listener format: @@ -22,7 +22,7 @@ const ( // TransitionStartEvent is the constant for "transition-start-event" property tag. // - // Used by View: + // Used by [View]: // Is fired when a transition has actually started, i.e., after "delay" has ended. // // General listener format: @@ -40,7 +40,7 @@ const ( // TransitionEndEvent is the constant for "transition-end-event" property tag. // - // Used by View: + // Used by [View]: // Is fired when a transition has completed. // // General listener format: @@ -58,7 +58,7 @@ const ( // TransitionCancelEvent is the constant for "transition-cancel-event" property tag. // - // Used by View: + // Used by [View]: // Is fired when a transition is cancelled. The transition is cancelled when: // - A new property transition has begun. // - The "visibility" property is set to "gone". @@ -79,7 +79,7 @@ const ( // AnimationStartEvent is the constant for "animation-start-event" property tag. // - // Used by View: + // Used by [View]: // Fired when an animation has started. If there is an "animation-delay", this event will fire once the delay period has // expired. // @@ -98,7 +98,7 @@ const ( // AnimationEndEvent is the constant for "animation-end-event" property tag. // - // Used by View: + // Used by [View]: // Fired when an animation has completed. If the animation aborts before reaching completion, such as if the element is // removed or the animation is removed from the element, the "animation-end-event" is not fired. // @@ -117,7 +117,7 @@ const ( // AnimationCancelEvent is the constant for "animation-cancel-event" property tag. // - // Used by View: + // Used by [View]: // Fired when an animation unexpectedly aborts. In other words, any time it stops running without sending the // "animation-end-event". This might happen when the animation-name is changed such that the animation is removed, or when // the animating view is hidden. Therefore, either directly or because any of its containing views are hidden. The event @@ -138,7 +138,7 @@ const ( // AnimationIterationEvent is the constant for "animation-iteration-event" property tag. // - // Used by View: + // Used by [View]: // Fired when an iteration of an animation ends, and another one begins. This event does not occur at the same time as the // animation end event, and therefore does not occur for animations with an "iteration-count" of one. // diff --git a/background.go b/background.go index 1e01eb3..24c64a5 100644 --- a/background.go +++ b/background.go @@ -27,7 +27,11 @@ const ( 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 { Properties fmt.Stringer diff --git a/backgroundConicGradient.go b/backgroundConicGradient.go index ea26701..531be26 100644 --- a/backgroundConicGradient.go +++ b/backgroundConicGradient.go @@ -21,11 +21,11 @@ type BackgroundGradientAngle struct { // NewBackgroundConicGradient creates the new background conic gradient // // The following properties can be used: -// - "gradient" ([Gradient]) - Describes gradient stop points. This is a mandatory property while describing background gradients. -// - "center-x" ([CenterX]) - center X point of the gradient. -// - "center-y" ([CenterY]) - center Y point of the gradient. -// - "from" ([From]) - start angle position of the gradient. -// - "repeating" ([Repeating]) - Defines whether stop points needs to be repeated after the last one. +// - [Gradient] ("gradient") - Describes gradient stop points. This is a mandatory property while describing background gradients; +// - [CenterX] ("center-x") - center X point of the gradient; +// - [CenterY] ("center-y") - center Y point of the gradient; +// - [From] ("from") - start angle position of the gradient; +// - [Repeating] ("repeating") - Defines whether stop points needs to be repeated after the last one. func NewBackgroundConicGradient(params Params) BackgroundElement { result := new(backgroundConicGradient) result.init() diff --git a/backgroundImage.go b/backgroundImage.go index db3198c..b644240 100644 --- a/backgroundImage.go +++ b/backgroundImage.go @@ -71,17 +71,17 @@ type backgroundImage struct { backgroundElement } -// NewBackgroundImage creates the new background image +// NewBackgroundImage creates the new background. // // The following properties can be used: -// - "src" ([Source]) - the name of the image in the "images" folder of the resources, or the URL of the image or inline-image. -// - "width" ([Width]) - the width of the image. -// - "height" ([Height]) - the height of the image. -// - "image-horizontal-align" ([ImageHorizontalAlign]) - the horizontal alignment of the image relative to view's bounds. -// - "image-vertical-align" ([ImageVerticalAlign]) - the vertical alignment of the image relative to view's bounds. -// - "repeat" ([Repeat]) - the repetition of the image. -// - "fit" ([Fit]) - the image scaling parameters. -// - "attachment" ([Attachment]) - defines whether a background image's position is fixed within the viewport or scrolls with its containing block. +// - [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; +// - [Height] ("height") - the height of the image; +// - [ImageHorizontalAlign] ("image-horizontal-align") - the horizontal 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; +// - [Fit] ("fit") - the image scaling parameters; +// - [Attachment] ("attachment") - defines whether a background image's position is fixed within the viewport or scrolls with its containing block. func NewBackgroundImage(params Params) BackgroundElement { result := new(backgroundImage) result.init() diff --git a/backgroundLinearGradient.go b/backgroundLinearGradient.go index 1c97c67..b67a87a 100644 --- a/backgroundLinearGradient.go +++ b/backgroundLinearGradient.go @@ -52,9 +52,9 @@ type backgroundLinearGradient struct { // NewBackgroundLinearGradient creates the new background linear gradient. // // The following properties can be used: -// - "gradient" ([Gradient]) - Describes gradient stop points. This is a mandatory property while describing background gradients. -// - "direction" ([Direction]) - Defines the direction of the gradient line. -// - "repeating" ([Repeating]) - Defines whether stop points needs to be repeated after the last one. +// - [Gradient] ("gradient") - Describes gradient stop points. This is a mandatory property while describing background gradients; +// - [Direction] ("direction") - Defines the direction of the gradient line; +// - [Repeating] ("repeating") - Defines whether stop points needs to be repeated after the last one; func NewBackgroundLinearGradient(params Params) BackgroundElement { result := new(backgroundLinearGradient) result.init() diff --git a/backgroundRadialGradient.go b/backgroundRadialGradient.go index 68345c1..08f7ce5 100644 --- a/backgroundRadialGradient.go +++ b/backgroundRadialGradient.go @@ -42,11 +42,11 @@ type backgroundRadialGradient struct { // NewBackgroundRadialGradient creates the new background radial gradient. // // The following properties can be used: -// - "gradient" ([Gradient]) - Describes gradient stop points. This is a mandatory property while describing background gradients. -// - "center-x" ([CenterX]), "center-y" ([CenterY]) - Defines the gradient center point coordinates. -// - "radial-gradient-radius" ([RadialGradientRadius]) - Defines radius of the radial gradient. -// - "radial-gradient-shape" ([RadialGradientShape]) - Defines shape of the radial gradient. -// - "repeating" ([Repeating]) - Defines whether stop points needs to be repeated after the last one. +// - [Gradient] ("gradient") - Describes gradient stop points. This is a mandatory property while describing background gradients; +// - [CenterX] ("center-x"), [CenterY] ("center-y") - Defines the gradient center point coordinates; +// - [RadialGradientRadius] ("radial-gradient-radius") - Defines radius 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. func NewBackgroundRadialGradient(params Params) BackgroundElement { result := new(backgroundRadialGradient) result.init() diff --git a/canvasView.go b/canvasView.go index 5675316..77a8652 100644 --- a/canvasView.go +++ b/canvasView.go @@ -10,7 +10,10 @@ import "reflect" // Supported types: `func(Canvas)`. 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 { View diff --git a/checkbox.go b/checkbox.go index 0f80c32..85d5c2b 100644 --- a/checkbox.go +++ b/checkbox.go @@ -24,7 +24,17 @@ import ( // func() 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 { ViewsContainer } @@ -33,7 +43,7 @@ type checkboxData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/colorPicker.go b/colorPicker.go index 24dcb5c..975358d 100644 --- a/colorPicker.go +++ b/colorPicker.go @@ -39,7 +39,11 @@ const ( 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 { View } @@ -48,7 +52,7 @@ type colorPickerData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/columnLayout.go b/columnLayout.go index 9f4e47e..4b86d33 100644 --- a/columnLayout.go +++ b/columnLayout.go @@ -115,7 +115,18 @@ const ( 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 { ViewsContainer } @@ -124,7 +135,7 @@ type columnLayoutData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/dataObject.go b/dataObject.go index 7f3558b..70cdc09 100644 --- a/dataObject.go +++ b/dataObject.go @@ -958,12 +958,18 @@ func reflectValueToDataValue(value reflect.Value) DataValue { func parseFieldTag(tag string) map[string]string { result := map[string]string{} for line := range strings.SplitSeq(tag, ";") { - pair := strings.SplitN(line, "=", 2) - if len(pair) == 2 { - key := strings.Trim(pair[0], " \t") - value := strings.Trim(pair[1], " \t") - if key != "" && value != "" { - result[key] = value + switch index := strings.Index(line, "="); index { + case -1: + if key := strings.Trim(line, " \t"); key != "" { + result[key] = "" + } + + case 0: + // do nothing + + default: + if key := strings.Trim(line[:index], " \t"); key != "" { + result[key] = strings.Trim(line[index+1:], " \t") } } } diff --git a/datePicker.go b/datePicker.go index afdac39..ef5745a 100644 --- a/datePicker.go +++ b/datePicker.go @@ -112,7 +112,14 @@ const ( 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 { View } @@ -121,7 +128,7 @@ type datePickerData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/detailsView.go b/detailsView.go index aec112e..d3b8669 100644 --- a/detailsView.go +++ b/detailsView.go @@ -42,7 +42,12 @@ const ( 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 { ViewsContainer } @@ -51,7 +56,7 @@ type detailsViewData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/dragAndDrop.go b/dragAndDrop.go index 44223d4..55cd624 100644 --- a/dragAndDrop.go +++ b/dragAndDrop.go @@ -10,14 +10,14 @@ import ( const ( // DragData is the constant for "drag-data" property tag. // - // Used by View: + // Used by [View]: // // Supported types: map[string]string. DragData PropertyName = "drag-data" // 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. // // Supported type: string. @@ -25,7 +25,7 @@ const ( // 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. // // Supported types: float, int, string. @@ -33,7 +33,7 @@ const ( // 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. // // Supported types: float, int, string. @@ -41,7 +41,7 @@ const ( // 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. // 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. @@ -57,7 +57,7 @@ const ( // 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. // The copy operation is used to indicate that the data being dragged will be copied // from its present location to the drop location. @@ -80,7 +80,7 @@ const ( // 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. // // General listener format: @@ -98,7 +98,7 @@ const ( // 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). // // General listener format: @@ -116,7 +116,7 @@ const ( // 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. // // General listener format: @@ -134,7 +134,7 @@ const ( // 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. // // General listener format: @@ -152,7 +152,7 @@ const ( // 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). // // General listener format: @@ -170,7 +170,7 @@ const ( // 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. // // General listener format: diff --git a/dropDownList.go b/dropDownList.go index 21ccce0..db6bcd8 100644 --- a/dropDownList.go +++ b/dropDownList.go @@ -6,27 +6,66 @@ import ( "strings" ) -// DropDownEvent is the constant for "drop-down-event" property tag. -// -// Used by DropDownList. -// Occur when a list item becomes selected. -// -// General listener format: -// -// func(list rui.DropDownList, index int) -// -// where: -// - list - Interface of a drop down list which generated this event, -// - index - Index of a newly selected item. -// -// Allowed listener formats: -// -// func(index int) -// func(list rui.DropDownList) -// func() -const DropDownEvent PropertyName = "drop-down-event" +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" -// DropDownList represent a DropDownList view + // 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. + // + // Used by DropDownList. + // Occur when a list item becomes selected. + // + // General listener format: + // + // func(list rui.DropDownList, index int) + // + // where: + // - list - Interface of a drop down list which generated this event, + // - index - Index of a newly selected item. + // + // Allowed listener formats: + // + // func(index int) + // func(list rui.DropDownList) + // func() + DropDownEvent PropertyName = "drop-down-event" +) + +// 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 { View } @@ -35,7 +74,7 @@ type dropDownListData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/editView.go b/editView.go index 64b29a7..69345a6 100644 --- a/editView.go +++ b/editView.go @@ -7,6 +7,63 @@ import ( // Constants for [EditView] specific properties and events 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. // // Used by EditView. @@ -53,6 +110,12 @@ const ( // Supported types: string. 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. // // Used by EditView. @@ -91,20 +154,32 @@ const ( 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 { View // AppendText appends text to the current text of an EditView view AppendText(text string) - textChanged(newText, oldText string) } type editViewData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/filePicker.go b/filePicker.go index 125fcd0..a9f22e8 100644 --- a/filePicker.go +++ b/filePicker.go @@ -18,8 +18,8 @@ const ( // func(picker rui.FilePicker, files []rui.FileInfo). // // where: - // picker - Interface of a file picker which generated this event, - // files - Array of description of selected files. + // - picker - Interface of a file picker which generated this event, + // - files - Array of description of selected files. // // Allowed listener formats: // func(picker rui.FilePicker) @@ -71,12 +71,19 @@ type FileInfo struct { 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 { View + // 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) Files() []FileInfo + // LoadFile loads the content of the selected file. This function is asynchronous. // The "result" function will be called after loading the data. 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)) } -// 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/filter.go b/filter.go index ea093ec..40f0620 100644 --- a/filter.go +++ b/filter.go @@ -144,16 +144,16 @@ type filterData struct { // NewFilterProperty creates the new FilterProperty // // The argument lists the effects to apply. The following effects are possible: -// - "blur" ([Blur]) - Gaussian blur in pixels (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); -// - "drop-shadow" ([DropShadow]) - Adding shadow (type: []ShadowProperty); -// - "grayscale" ([Grayscale]) - Converting to grayscale in percents (type: float64, value: 0…100); -// - "hue-rotate" ([HueRotate]) - Hue rotation (type: AngleUnit); -// - "invert" ([Invert]) - Invert colors 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); -// - "sepia" ([Sepia]) - Conversion to sepia in percents (type: float64, value: 0…100). +// - [Blur] ("blur") - Gaussian blur in pixels (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); +// - [DropShadow] ("drop-shadow") - Adding shadow (type: []ShadowProperty); +// - [Grayscale] ("grayscale") - Converting to grayscale in percents (type: float64, value: 0…100); +// - [HueRotate] ("hue-rotate") - Hue rotation (type: AngleUnit); +// - [Invert] ("invert") - Invert colors 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); +// - [Sepia] ("sepia") - Conversion to sepia in percents (type: float64, value: 0…100). func NewFilterProperty(params Params) FilterProperty { if len(params) > 0 { filter := new(filterData) diff --git a/focusEvents.go b/focusEvents.go index 58cc169..b2d1876 100644 --- a/focusEvents.go +++ b/focusEvents.go @@ -6,7 +6,7 @@ import "strings" const ( // FocusEvent is the constant for "focus-event" property tag. // - // Used by View. + // Used by [View]. // Occur when the view takes input focus. // // General listener format: @@ -21,7 +21,7 @@ const ( // LostFocusEvent is the constant for "lost-focus-event" property tag. // - // Used by View. + // Used by [View]. // Occur when the View lost input focus. // // General listener format: diff --git a/form.go b/form.go new file mode 100644 index 0000000..685db66 --- /dev/null +++ b/form.go @@ -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) +} diff --git a/gridLayout.go b/gridLayout.go index 2e03b93..19c9724 100644 --- a/gridLayout.go +++ b/gridLayout.go @@ -103,7 +103,23 @@ type GridCellRowSpanAdapter interface { 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 { ViewsContainer @@ -117,7 +133,7 @@ type gridLayoutData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/imageView.go b/imageView.go index 8cfaf35..c62b192 100644 --- a/imageView.go +++ b/imageView.go @@ -7,16 +7,27 @@ import ( // Constants which represent [ImageView] specific properties and events 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. // - // Used by ImageView. + // Used by [ImageView]. + // // Occur when the image has been loaded. // // General listener format: // func(image rui.ImageView) // // where: - // image - Interface of an image view which generated this event. + // - image - Interface of an image view which generated this event. // // Allowed listener formats: // func() @@ -24,14 +35,15 @@ const ( // ErrorEvent is the constant for "error-event" property tag. // - // Used by ImageView. + // Used by [ImageView]. + // // Occur when the image loading has been failed. // // General listener format: // func(image rui.ImageView) // // where: - // image - Interface of an image view which generated this event. + // - image - Interface of an image view which generated this event. // // Allowed listener formats: // func() @@ -61,12 +73,24 @@ const ( 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 { View + // 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. NaturalSize() (float64, float64) + // 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. CurrentSource() string @@ -79,7 +103,7 @@ type imageViewData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/keyEvents.go b/keyEvents.go index c803f13..6433977 100644 --- a/keyEvents.go +++ b/keyEvents.go @@ -6,7 +6,7 @@ import "strings" const ( // KeyDownEvent is the constant for "key-down-event" property tag. // - // Used by View. + // Used by [View]. // Is fired when a key is pressed. // // General listener format: @@ -26,7 +26,7 @@ const ( // KeyUpEvent is the constant for "key-up-event" property tag. // - // Used by View. + // Used by [View]. // Is fired when a key is released. // // General listener format: diff --git a/listLayout.go b/listLayout.go index eda4e70..281b828 100644 --- a/listLayout.go +++ b/listLayout.go @@ -31,9 +31,19 @@ const ( 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 { ViewsContainer + // UpdateContent updates child Views if the "content" property value is set to ListAdapter, // otherwise does nothing UpdateContent() @@ -44,7 +54,7 @@ type listLayoutData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/listView.go b/listView.go index 6869b0f..2fe5180 100644 --- a/listView.go +++ b/listView.go @@ -117,7 +117,27 @@ const ( 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 { View ParentView @@ -137,7 +157,7 @@ type listViewData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/mouseEvents.go b/mouseEvents.go index e9a9b1a..30fd297 100644 --- a/mouseEvents.go +++ b/mouseEvents.go @@ -9,7 +9,7 @@ import ( const ( // ClickEvent is the constant for "click-event" property tag. // - // Used by View. + // Used by [View]. // Occur when the user clicks on the view. // // General listener format: @@ -29,7 +29,7 @@ const ( // DoubleClickEvent is the constant for "double-click-event" property tag. // - // Used by View. + // Used by [View]. // Occur when the user double clicks on the view. // // General listener format: @@ -49,7 +49,7 @@ const ( // MouseDown is the constant for "mouse-down" property tag. // - // Used by View. + // Used by [View]. // Is fired at a View when a pointing device button is pressed while the pointer is inside the view. // // General listener format: @@ -69,7 +69,7 @@ const ( // MouseUp is the constant for "mouse-up" property tag. // - // Used by View. + // Used by [View]. // Is fired at a View when a button on a pointing device (such as a mouse or trackpad) is released while the pointer is // located inside it. "mouse-up" events are the counterpoint to "mouse-down" events. // @@ -90,7 +90,7 @@ const ( // MouseMove is the constant for "mouse-move" property tag. // - // Used by View. + // Used by [View]. // Is fired at a view when a pointing device(usually a mouse) is moved while the cursor's hotspot is inside it. // // General listener format: @@ -110,7 +110,7 @@ const ( // MouseOut is the constant for "mouse-out" property tag. // - // Used by View. + // Used by [View]. // Is fired at a View when a pointing device (usually a mouse) is used to move the cursor so that it is no longer // contained within the view or one of its children. "mouse-out" is also delivered to a view if the cursor enters a child // view, because the child view obscures the visible area of the view. @@ -132,7 +132,7 @@ const ( // MouseOver is the constant for "mouse-over" property tag. // - // Used by View. + // Used by [View]. // Is fired at a View when a pointing device (such as a mouse or trackpad) is used to move the cursor onto the view or one // of its child views. // @@ -153,7 +153,7 @@ const ( // ContextMenuEvent is the constant for "context-menu-event" property tag. // - // Used by View. + // Used by [View]. // Occur when the user calls the context menu by the right mouse clicking. // // General listener format: diff --git a/numberPicker.go b/numberPicker.go index 84f365d..c2bf84b 100644 --- a/numberPicker.go +++ b/numberPicker.go @@ -33,7 +33,7 @@ const ( // NumberPickerType is the constant for "number-picker-type" property tag. // - // Used by NumberPicker. + // Used by [NumberPicker]. // Sets the visual representation. // // Supported types: int, string. @@ -45,7 +45,7 @@ const ( // NumberPickerMin is the constant for "number-picker-min" property tag. // - // Used by NumberPicker. + // Used by [NumberPicker]. // Set the minimum value. The default value is 0. // // Supported types: float, int, string. @@ -55,7 +55,7 @@ const ( // NumberPickerMax is the constant for "number-picker-max" property tag. // - // Used by NumberPicker. + // Used by [NumberPicker]. // Set the maximum value. The default value is 1. // // Supported types: float, int, string. @@ -65,7 +65,7 @@ const ( // NumberPickerStep is the constant for "number-picker-step" property tag. // - // Used by NumberPicker. + // Used by [NumberPicker]. // Set the value change step. // // Supported types: float, int, string. @@ -75,7 +75,7 @@ const ( // NumberPickerValue is the constant for "number-picker-value" property tag. // - // Used by NumberPicker. + // Used by [NumberPicker]. // Current value. The default value is 0. // // Supported types: float, int, string. @@ -94,16 +94,25 @@ const ( 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 ( - // 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 - // 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 ) -// 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 { View } @@ -112,7 +121,7 @@ type numberPickerData struct { viewData } -// NewNumberPicker create new NumberPicker object and return it +// NewNumberPicker create new [NumberPicker] object and return it func NewNumberPicker(session Session, params Params) NumberPicker { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/outline.go b/outline.go index 2066f76..0657d43 100644 --- a/outline.go +++ b/outline.go @@ -22,8 +22,8 @@ type outlinePropertyData struct { // NewOutlineProperty creates the new OutlineProperty. // // The following properties can be used: -// - "color" ([ColorTag]) - Determines the line color (Color); -// - "width" ([Width]) - Determines the line thickness (SizeUnit). +// - [ColorTag] ("color") - Determines the line color (Color); +// - [Width] ("width") - Determines the line thickness (SizeUnit). func NewOutlineProperty(params Params) OutlineProperty { outline := new(outlinePropertyData) outline.init() diff --git a/path.go b/path.go index 5e08d82..2576c3f 100644 --- a/path.go +++ b/path.go @@ -63,7 +63,7 @@ type pathData struct { varName any } -// NewPath creates a new empty Path +// NewPath creates a new empty [Path] func (canvas *canvasData) NewPath() Path { path := new(pathData) path.session = canvas.session diff --git a/pointerEvents.go b/pointerEvents.go index ceb9c19..483d04c 100644 --- a/pointerEvents.go +++ b/pointerEvents.go @@ -4,7 +4,7 @@ package rui const ( // PointerDown is the constant for "pointer-down" property tag. // - // Used by View. + // Used by [View]. // Fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons depressed to at // least one button depressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is // fired when the stylus makes physical contact with the digitizer. @@ -26,7 +26,7 @@ const ( // PointerUp is the constant for "pointer-up" property tag. // - // Used by View. + // Used by [View]. // Is fired when a pointer is no longer active. // // General listener format: @@ -46,7 +46,7 @@ const ( // PointerMove is the constant for "pointer-move" property tag. // - // Used by View. + // Used by [View]. // Is fired when a pointer changes coordinates. // // General listener format: @@ -66,7 +66,7 @@ const ( // PointerCancel is the constant for "pointer-cancel" property tag. // - // Used by View. + // Used by [View]. // Is fired if the pointer will no longer be able to generate events (for example the related device is deactivated). // // General listener format: @@ -86,7 +86,7 @@ const ( // PointerOut is the constant for "pointer-out" property tag. // - // Used by View. + // Used by [View]. // Is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing // the "pointer-up" event for a device that does not support hover (see "pointer-up"); after firing the "pointer-cancel" // event (see "pointer-cancel"); when a pen stylus leaves the hover range detectable by the digitizer. @@ -108,7 +108,7 @@ const ( // PointerOver is the constant for "pointer-over" property tag. // - // Used by View. + // Used by [View]. // Is fired when a pointing device is moved into an view's hit test boundaries. // // General listener format: diff --git a/popup.go b/popup.go index ed44699..1dba473 100644 --- a/popup.go +++ b/popup.go @@ -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 { if view == nil { ErrorLog(`the View argument cannot be nil`) diff --git a/progressBar.go b/progressBar.go index 68d9633..a69d574 100644 --- a/progressBar.go +++ b/progressBar.go @@ -28,7 +28,11 @@ const ( 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 { View } @@ -37,7 +41,7 @@ type progressBarData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/propertyNames.go b/propertyNames.go index 182c01c..b57d098 100644 --- a/propertyNames.go +++ b/propertyNames.go @@ -73,7 +73,7 @@ const ( // Disabled is the constant for "disabled" property tag. // - // Used by ViewsContainer. + // Used by [View]sContainer. // Controls whether the view can receive focus and which style to use. Default value is false. // // Supported types: bool, int, string. @@ -85,7 +85,7 @@ const ( // Focusable is the constant for "focusable" property tag. // - // Used by View. + // Used by [View]. // Controls whether view can receive focus. // // Supported types: bool, int, string. @@ -97,7 +97,7 @@ const ( // Semantics is the constant for "semantics" property tag. // - // Used by View. + // Used by [View]. // Defines the semantic meaning of the view. This property may have no visible effect, but it allows search engines to // understand the structure of your application. It also helps to voice the interface to systems for people with // disabilities. @@ -129,7 +129,7 @@ const ( // Visibility is the constant for "visibility" property tag. // - // Used by View. + // Used by [View]. // Specifies the visibility of the view. // // Supported types: int, string. @@ -142,7 +142,7 @@ const ( // ZIndex is the constant for "z-index" property tag. // - // Used by View. + // Used by [View]. // Sets the z-order of a positioned view. Overlapping views with a larger z-index cover those with a smaller one. // // Supported types: int, string. @@ -154,7 +154,7 @@ const ( // Opacity is the constant for "opacity" property tag. // - // Used by View, FilterProperty. + // Used by [View], FilterProperty. // // # Usage in View: // @@ -177,7 +177,7 @@ const ( // Overflow is the constant for "overflow" property tag. // - // Used by View. + // Used by [View]. // Set the desired behavior for an element's overflow i.e. when an element's content is too big to fit in its block // formatting context in both directions. // @@ -192,7 +192,7 @@ const ( // Row is the constant for "row" property tag. // - // Used by View. + // Used by [View]. // Row of the view inside the container like GridLayout. // // Supported types: Range, int, string. @@ -206,7 +206,7 @@ const ( // Column is the constant for "column" property tag. // - // Used by View. + // Used by [View]. // Column of the view inside the container like GridLayout. // // Supported types: Range, int, string. @@ -220,7 +220,7 @@ const ( // Left is the constant for "left" property tag. // - // Used by View, BoundsProperty, ClipShapeProperty. + // Used by [View], BoundsProperty, ClipShapeProperty. // // # Usage in View: // @@ -252,7 +252,7 @@ const ( // Right is the constant for "right" property tag. // - // Used by View, BoundsProperty, ClipShapeProperty. + // Used by [View], BoundsProperty, ClipShapeProperty. // // # Usage in View: // @@ -284,7 +284,7 @@ const ( // Top is the constant for "top" property tag. // - // Used by View, BoundsProperty, ClipShapeProperty. + // Used by [View], BoundsProperty, ClipShapeProperty. // // # Usage in View: // @@ -316,7 +316,7 @@ const ( // Bottom is the constant for "bottom" property tag. // - // Used by View, BoundsProperty, ClipShapeProperty. + // Used by [View], BoundsProperty, ClipShapeProperty. // // # Usage in View: // @@ -389,7 +389,7 @@ const ( // Height is the constant for "height" property tag. // - // Used by View. + // Used by [View]. // Set a view's height. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -400,7 +400,7 @@ const ( // MinWidth is the constant for "min-width" property tag. // - // Used by View. + // Used by [View]. // Set a view's minimal width. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -411,7 +411,7 @@ const ( // MinHeight is the constant for "min-height" property tag. // - // Used by View. + // Used by [View]. // Set a view's minimal height. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -422,7 +422,7 @@ const ( // MaxWidth is the constant for "max-width" property tag. // - // Used by View. + // Used by [View]. // Set a view's maximal width. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -433,7 +433,7 @@ const ( // MaxHeight is the constant for "max-height" property tag. // - // Used by View. + // Used by [View]. // Set a view's maximal height. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -444,7 +444,7 @@ const ( // Margin is the constant for "margin" property tag. // - // Used by View. + // Used by [View]. // Set the margin area on all four sides of an element. // // Supported types: BoundsProperty, Bounds, SizeUnit, float32, float64, int, string. @@ -463,7 +463,7 @@ const ( // MarginLeft is the constant for "margin-left" property tag. // - // Used by View. + // Used by [View]. // Set the margin area on the left of a view. A positive value places it farther from its neighbors, while a negative // value places it closer. // @@ -475,7 +475,7 @@ const ( // MarginRight is the constant for "margin-right" property tag. // - // Used by View. + // Used by [View]. // Set the margin area on the right of a view. A positive value places it farther from its neighbors, while a negative // value places it closer. // @@ -487,7 +487,7 @@ const ( // MarginTop is the constant for "margin-top" property tag. // - // Used by View. + // Used by [View]. // Set the margin area on the top of a view. A positive value places it farther from its neighbors, while a negative value // places it closer. // @@ -499,7 +499,7 @@ const ( // MarginBottom is the constant for "margin-bottom" property tag. // - // Used by View. + // Used by [View]. // Set the margin area on the bottom of a view. A positive value places it farther from its neighbors, while a negative // value places it closer. // @@ -511,7 +511,7 @@ const ( // Padding is the constant for "padding" property tag. // - // Used by View. + // Used by [View]. // Sets the padding area on all four sides of a view at once. An element's padding area is the space between its content // and its border. // @@ -531,7 +531,7 @@ const ( // PaddingLeft is the constant for "padding-left" property tag. // - // Used by View. + // Used by [View]. // Set the width of the padding area to the left of a view. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -542,7 +542,7 @@ const ( // PaddingRight is the constant for "padding-right" property tag. // - // Used by View. + // Used by [View]. // Set the width of the padding area to the right of a view. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -553,7 +553,7 @@ const ( // PaddingTop is the constant for "padding-top" property tag. // - // Used by View. + // Used by [View]. // Set the height of the padding area to the top of a view. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -564,7 +564,7 @@ const ( // PaddingBottom is the constant for "padding-bottom" property tag. // - // Used by View. + // Used by [View]. // Set the height of the padding area to the bottom of a view. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -575,7 +575,7 @@ const ( // AccentColor is the constant for "accent-color" property tag. // - // Used by View. + // Used by [View]. // Sets the accent color for UI controls generated by some elements. // // Supported types: Color, ColorPair, string. @@ -586,7 +586,7 @@ const ( // BackgroundColor is the constant for "background-color" property tag. // - // Used by View. + // Used by [View]. // Set the background color of a view. // // Supported types: Color, ColorPair, string. @@ -597,7 +597,7 @@ const ( // Background is the constant for "background" property tag. // - // Used by View. + // Used by [View]. // Set one or more background images and/or gradients for the view. // // Supported types: BackgroundElement, []BackgroundElement, string. @@ -611,7 +611,7 @@ const ( // Mask is the constant for "mask" property tag. // - // Used by View. + // Used by [View]. // Set one or more images and/or gradients as the view mask. // As mask is used only alpha channel of images and/or gradients. // @@ -626,7 +626,7 @@ const ( // Cursor is the constant for "cursor" property tag. // - // Used by View. + // Used by [View]. // Sets the type of mouse cursor, if any, to show when the mouse pointer is over the view. // // Supported types: int, string. @@ -672,7 +672,7 @@ const ( // Border is the constant for "border" property tag. // - // Used by View. + // Used by [View]. // Set a view's border. It sets the values of a border width, style, and color. // // Supported types: BorderProperty, ViewBorder, ViewBorders. @@ -687,7 +687,7 @@ const ( // BorderLeft is the constant for "border-left" property tag. // - // Used by View. + // Used by [View]. // Set a view's left border. It sets the values of a border width, style, and color. // // Supported types: ViewBorder, BorderProperty, string. @@ -698,7 +698,7 @@ const ( // BorderRight is the constant for "border-right" property tag. // - // Used by View. + // Used by [View]. // Set a view's right border. It sets the values of a border width, style, and color. // // Supported types: ViewBorder, BorderProperty, string. @@ -709,7 +709,7 @@ const ( // BorderTop is the constant for "border-top" property tag. // - // Used by View. + // Used by [View]. // Set a view's top border. It sets the values of a border width, style, and color. // // Supported types: ViewBorder, BorderProperty, string. @@ -720,7 +720,7 @@ const ( // BorderBottom is the constant for "border-bottom" property tag. // - // Used by View. + // Used by [View]. // Set a view's bottom border. It sets the values of a border width, style, and color. // // Supported types: ViewBorder, BorderProperty, string. @@ -731,7 +731,7 @@ const ( // BorderStyle is the constant for "border-style" property tag. // - // Used by View. + // Used by [View]. // Set the line style for all four sides of a view's border. // // Supported types: int, string. @@ -746,7 +746,7 @@ const ( // BorderLeftStyle is the constant for "border-left-style" property tag. // - // Used by View. + // Used by [View]. // Set the line style of a view's left border. // // Supported types: int, string. @@ -761,7 +761,7 @@ const ( // BorderRightStyle is the constant for "border-right-style" property tag. // - // Used by View. + // Used by [View]. // Set the line style of a view's right border. // // Supported types: int, string. @@ -776,7 +776,7 @@ const ( // BorderTopStyle is the constant for "border-top-style" property tag. // - // Used by View. + // Used by [View]. // Set the line style of a view's top border. // // Supported types: int, string. @@ -791,7 +791,7 @@ const ( // BorderBottomStyle is the constant for "border-bottom-style" property tag. // - // Used by View. + // Used by [View]. // Sets the line style of a view's bottom border. // // Supported types: int, string. @@ -806,7 +806,7 @@ const ( // BorderWidth is the constant for "border-width" property tag. // - // Used by View. + // Used by [View]. // Set the line width for all four sides of a view's border. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -817,7 +817,7 @@ const ( // BorderLeftWidth is the constant for "border-left-width" property tag. // - // Used by View. + // Used by [View]. // Set the line width of a view's left border. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -828,7 +828,7 @@ const ( // BorderRightWidth is the constant for "border-right-width" property tag. // - // Used by View. + // Used by [View]. // Set the line width of a view's right border. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -839,7 +839,7 @@ const ( // BorderTopWidth is the constant for "border-top-width" property tag. // - // Used by View. + // Used by [View]. // Set the line width of a view's top border. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -850,7 +850,7 @@ const ( // BorderBottomWidth is the constant for "border-bottom-width" property tag. // - // Used by View. + // Used by [View]. // Set the line width of a view's bottom border. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -861,7 +861,7 @@ const ( // BorderColor is the constant for "border-color" property tag. // - // Used by View. + // Used by [View]. // Set the line color for all four sides of a view's border. // // Supported types: Color, ColorPair, string. @@ -872,7 +872,7 @@ const ( // BorderLeftColor is the constant for "border-left-color" property tag. // - // Used by View. + // Used by [View]. // Set the line color of a view's left border. // // Supported types: Color, ColorPair, string. @@ -883,7 +883,7 @@ const ( // BorderRightColor is the constant for "border-right-color" property tag. // - // Used by View. + // Used by [View]. // Set the line color of a view's right border. // // Supported types: Color, ColorPair, string. @@ -894,7 +894,7 @@ const ( // BorderTopColor is the constant for "border-top-color" property tag. // - // Used by View. + // Used by [View]. // Set the line color of a view's top border. // // Supported types: Color, ColorPair, string. @@ -905,7 +905,7 @@ const ( // BorderBottomColor is the constant for "border-bottom-color" property tag. // - // Used by View. + // Used by [View]. // Set the line color of a view's bottom border. // // Supported types: Color, ColorPair, string. @@ -916,7 +916,7 @@ const ( // Outline is the constant for "outline" property tag. // - // Used by View. + // Used by [View]. // Set a view's outline. It sets the values of an outline width, style, and color. // // Supported types: OutlineProperty, ViewOutline, ViewBorder. @@ -927,7 +927,7 @@ const ( // OutlineStyle is the constant for "outline-style" property tag. // - // Used by View. + // Used by [View]. // Set the style of an view's outline. // // Supported types: int, string. @@ -942,7 +942,7 @@ const ( // OutlineColor is the constant for "outline-color" property tag. // - // Used by View. + // Used by [View]. // Set the color of an view's outline. // // Supported types: Color, ColorPair, string. @@ -953,7 +953,7 @@ const ( // OutlineWidth is the constant for "outline-width" property tag. // - // Used by View. + // Used by [View]. // Set the width of an view's outline. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -964,7 +964,7 @@ const ( // OutlineOffset is the constant for "outline-offset" property tag. // - // Used by View. + // Used by [View]. // Set the amount of space between an outline and the edge or border of a view. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -975,7 +975,7 @@ const ( // Shadow is the constant for "shadow" property tag. // - // Used by View. + // Used by [View]. // Adds shadow effects around a view's frame. A shadow is described by X and Y offsets relative to the element, blur, // spread radius and color. // @@ -992,7 +992,7 @@ const ( // FontName is the constant for "font-name" property tag. // - // Used by View. + // Used by [View]. // Specifies a prioritized list of one or more font family names and/or generic family names for the view. Values are // separated by commas to indicate that they are alternatives. This is an inherited property, i.e. if it is not defined, // then the value of the parent view is used. @@ -1002,7 +1002,7 @@ const ( // TextColor is the constant for "text-color" property tag. // - // Used by View. + // Used by [View]. // Set the foreground color value of a view's text and text decorations. This is an inherited property, i.e. if it is not // defined, then the value of the parent view is used. // @@ -1014,7 +1014,7 @@ const ( // TextSize is the constant for "text-size" property tag. // - // Used by View. + // Used by [View]. // Set the size of the font. This is an inherited property, i.e. if it is not defined, then the value of the parent view // is used. // @@ -1026,7 +1026,7 @@ const ( // Italic is the constant for "italic" property tag. // - // Used by View. + // Used by [View]. // Controls whether the text is displayed in italics. This is an inherited property, i.e. if it is not defined, then the // value of the parent view is used. Default value is false. // @@ -1039,7 +1039,7 @@ const ( // SmallCaps is the constant for "small-caps" property tag. // - // Used by View. + // Used by [View]. // Controls whether to use small caps characters while displaying the text. This is an inherited property, i.e. if it is // not defined, then the value of the parent view is used. Default value is false. // @@ -1052,7 +1052,7 @@ const ( // Strikethrough is the constant for "strikethrough" property tag. // - // Used by View. + // Used by [View]. // Controls whether to draw line over the text. This is an inherited property, i.e. if it is not defined, then the value // of the parent view is used. Default value is false. // @@ -1065,7 +1065,7 @@ const ( // Overline is the constant for "overline" property tag. // - // Used by View. + // Used by [View]. // Controls whether the line needs to be displayed on top of the text. This is an inherited property, i.e. if it is not // defined, then the value of the parent view is used. Default value is false. // @@ -1078,7 +1078,7 @@ const ( // Underline is the constant for "underline" property tag. // - // Used by View. + // Used by [View]. // Controls whether to draw line below the text, This is an inherited property, i.e. if it is not defined, then the value // of the parent view is used. Default value is false. // @@ -1091,7 +1091,7 @@ const ( // TextLineThickness is the constant for "text-line-thickness" property tag. // - // Used by View. + // Used by [View]. // Set the stroke thickness of the decoration line that is used on text in an element, such as a strikethrough, underline, // or overline. This is an inherited property, i.e. if it is not defined, then the value of the parent view is used. // @@ -1103,7 +1103,7 @@ const ( // TextLineStyle is the constant for "text-line-style" property tag. // - // Used by View. + // Used by [View]. // Set the style of the lines specified by "strikethrough", "overline" and "underline" properties. This is an inherited // property, i.e. if it is not defined, then the value of the parent view is used. // @@ -1119,7 +1119,7 @@ const ( // TextLineColor is the constant for "text-line-color" property tag. // - // Used by View. + // Used by [View]. // Sets the color of the lines specified by "strikethrough", "overline" and "underline" properties. This is an inherited // property, i.e. if it is not defined, then the value of the parent view is used. // @@ -1131,7 +1131,7 @@ const ( // TextWeight is the constant for "text-weight" property tag. // - // Used by View. + // Used by [View]. // Sets weight of the text. // // Supported types: int, string. @@ -1178,7 +1178,7 @@ const ( // TextIndent is the constant for "text-indent" property tag. // - // Used by View. + // Used by [View]. // Determines the size of the indent(empty space) before the first line of text. This is an inherited property, i.e. if it // is not defined, then the value of the parent view is used. // @@ -1190,7 +1190,7 @@ const ( // TextShadow is the constant for "text-shadow" property tag. // - // Used by View. + // Used by [View]. // Specify shadow for the text. // // Supported types: ShadowProperty, []ShadowProperty, string. @@ -1206,7 +1206,7 @@ const ( // TextWrap is the constant for "text-wrap" property tag. // - // Used by View. + // Used by [View]. // Controls how text inside the view is wrapped. Default value is "wrap". // // Supported types: int, string. @@ -1219,7 +1219,7 @@ const ( // TabSize is the constant for "tab-size" property tag. // - // Used by View. + // Used by [View]. // Set the width of tab characters (U+0009) in spaces. This is an inherited property, i.e. if it is not defined, then the // value of the parent view is used. Default value is 8. // @@ -1232,7 +1232,7 @@ const ( // LetterSpacing is the constant for "letter-spacing" property tag. // - // Used by View. + // Used by [View]. // Set the horizontal spacing behavior between text characters. This value is added to the natural spacing between // characters while rendering the text. Positive values of letter-spacing causes characters to spread farther apart, while // negative values of letter-spacing bring characters closer together. This is an inherited property, i.e. if it is not @@ -1246,7 +1246,7 @@ const ( // WordSpacing is the constant for "word-spacing" property tag. // - // Used by View. + // Used by [View]. // Set the length of space between words and between tags. This is an inherited property, i.e. if it is not defined, then // the value of the parent view is used. // @@ -1258,7 +1258,7 @@ const ( // LineHeight is the constant for "line-height" property tag. // - // Used by View. + // Used by [View]. // Set the height of a line box. It's commonly used to set the distance between lines of text. This is an inherited // property, i.e. if it is not defined, then the value of the parent view is used. // @@ -1270,7 +1270,7 @@ const ( // WhiteSpace is the constant for "white-space" property tag. // - // Used by View. + // Used by [View]. // Sets how white space inside an element is handled. This is an inherited property, i.e. if it is not defined, then the // value of the parent view is used. // @@ -1295,7 +1295,7 @@ const ( // WordBreak is the constant for "word-break" property tag. // - // Used by View. + // Used by [View]. // Set whether line breaks appear wherever the text would otherwise overflow its content box. This is an inherited // property, i.e. if it is not defined, then the value of the parent view is used. Default value is "normal". // @@ -1310,7 +1310,7 @@ const ( // TextTransform is the constant for "text-transform" property tag. // - // Used by View. + // Used by [View]. // Specifies how to capitalize an element's text. It can be used to make text appear in all-uppercase or all-lowercase, or // with each word capitalized. This is an inherited property, i.e. if it is not defined, then the value of the parent view // is used. @@ -1326,7 +1326,7 @@ const ( // TextDirection is the constant for "text-direction" property tag. // - // Used by View. + // Used by [View]. // Sets the direction of text, table columns, and horizontal overflow. This is an inherited property, i.e. if it is not // defined, then the value of the parent view is used. Default value is "system". // @@ -1340,7 +1340,7 @@ const ( // WritingMode is the constant for "writing-mode" property tag. // - // Used by View. + // Used by [View]. // Set whether lines of text are laid out horizontally or vertically, as well as the direction in which blocks progress. // This is an inherited property, i.e. if it is not defined, then the value of the parent view is used. Default value is // "horizontal-top-to-bottom". @@ -1356,7 +1356,7 @@ const ( // VerticalTextOrientation is the constant for "vertical-text-orientation" property tag. // - // Used by View. + // Used by [View]. // Set the orientation of the text characters in a line. It only affects text in vertical mode ("writing-mode" property). // This is an inherited property, i.e. if it is not defined, then the value of the parent view is used. // @@ -1367,53 +1367,9 @@ const ( // - 1 (UprightTextOrientation) or "upright" - Symbols are arranged normally(vertically). VerticalTextOrientation PropertyName = "vertical-text-orientation" - // 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. - TextOverflow PropertyName = "text-overflow" - - // 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" - - // 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" - // Content is the constant for "content" property tag. // - // Used by ViewsContainer, GridLayout, ListLayout, Resizable, StackLayout, SvgImageView, TableView. + // Used by [View]sContainer, GridLayout, ListLayout, Resizable, StackLayout, SvgImageView, TableView. // // # Usage in ViewsContainer: // @@ -1542,36 +1498,6 @@ const ( // Internal type is ListAdapter internal implementation, other types converted to it during assignment. Items PropertyName = "items" - // 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" - // Current is the constant for "current" property tag. // // Used by DropDownList, ListView, TableView, TabsLayout. @@ -1631,12 +1557,6 @@ const ( // Same as "number-picker-type" [NumberPickerType]. Type PropertyName = "type" - // Pattern is the constant for "pattern" property tag. - // - // Used by EditView. - // Same as "edit-view-pattern" [EditViewPattern]. - Pattern PropertyName = "pattern" - // GridAutoFlow is the constant for "grid-auto-flow" property tag. // // Used by GridLayout. @@ -1675,7 +1595,7 @@ const ( // CellHeight is the constant for "cell-height" property tag. // - // Used by GridLayout: + // Used by GridLayout, Checkbox: // Set a fixed height of GridLayout cells regardless of the size of the child elements. Each element in the array // determines the size of the corresponding row. By default, the sizes of the cells are calculated based on the sizes of // the child views placed in them. @@ -1697,7 +1617,7 @@ const ( // GridRowGap is the constant for "grid-row-gap" property tag. // - // Used by GridLayout. + // Used by GridLayout, Checkbox. // Space between rows. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -1708,7 +1628,7 @@ const ( // GridColumnGap is the constant for "grid-column-gap" property tag. // - // Used by GridLayout. + // Used by GridLayout, Checkbox. // Space between columns. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -1749,18 +1669,9 @@ const ( // Internal type is []MediaSource, other types converted to it during assignment. Source PropertyName = "src" - // 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" - // Fit is the constant for "fit" property tag. // - // Used by ImageView, BackgroundElement. + // Used by [ImageView], [BackgroundElement]. // // # Usage in ImageView // @@ -1790,7 +1701,7 @@ const ( // Repeat is the constant for "repeat" property tag. // - // Used by BackgroundElement. + // Used by [BackgroundElement]. // Used for image background only. Specifying the repetition of the image. Default value is "no-repeat". // // Supported types: int, string. @@ -1820,7 +1731,7 @@ const ( // BackgroundClip is the constant for "background-clip" property tag. // - // Used by View. + // Used by [View]. // Determines how the background color and/or background image will be displayed below the box borders. // // Supported types: int, string. @@ -1833,7 +1744,7 @@ const ( // BackgroundOrigin is the constant for "background-origin" property tag. // - // Used by View. + // Used by [View]. // Determines the background's origin: from the border start, inside the border, or inside the padding. // // Supported types: int, string. @@ -1846,7 +1757,7 @@ const ( // MaskClip is the constant for "mask-clip" property tag. // - // Used by View. + // Used by [View]. // Determines how image/gradient masks will be used below the box borders. // // Supported types: int, string. @@ -1859,7 +1770,7 @@ const ( // MaskOrigin is the constant for "mask-origin" property tag. // - // Used by View. + // Used by [View]. // Determines the mask's origin: from the border start, inside the border, or inside the padding. // // Supported types: int, string. @@ -1899,13 +1810,13 @@ const ( // See AngleUnit description for more details. // // Values: - // - 0 (ToTopGradient) or "to-top" - Line goes from bottom to top. - // - 1 (ToRightTopGradient) or "to-right-top" - From bottom left to top right. - // - 2 (ToRightGradient) or "to-right" - From left to right. - // - 3 (ToRightBottomGradient) or "to-right-bottom" - From top left to bottom right. - // - 4 (ToBottomGradient) or "to-bottom" - From top to bottom. - // - 5 (ToLeftBottomGradient) or "to-left-bottom" - From the upper right corner to the lower left. - // - 6 (ToLeftGradient) or "to-left" - From right to left. + // - 0 (ToTopGradient) or "to-top" - Line goes from bottom to top; + // - 1 (ToRightTopGradient) or "to-right-top" - From bottom left to top right; + // - 2 (ToRightGradient) or "to-right" - From left to right; + // - 3 (ToRightBottomGradient) or "to-right-bottom" - From top left to bottom right; + // - 4 (ToBottomGradient) or "to-bottom" - From top to bottom; + // - 5 (ToLeftBottomGradient) or "to-left-bottom" - From the upper right corner to the lower left; + // - 6 (ToLeftGradient) or "to-left" - From right to left; // - 7 (ToLeftTopGradient) or "to-left-top" - From the bottom right corner to the top left. Direction PropertyName = "direction" @@ -2052,31 +1963,6 @@ const ( // - 2 (ListWrapReverse) or "reverse" - Starts a new column or row of elements as necessary. The new column is positioned towards the beginning. ListWrap PropertyName = "list-wrap" - // 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" - // Min is the constant for "min" property tag. // // Used by DatePicker, NumberPicker, TimePicker. @@ -2494,7 +2380,7 @@ const ( // Filter is the constant for "filter" property tag. // - // Used by View. + // Used by [View]. // Applies graphical effects to a view, such as blurring, color shifting, changing brightness/contrast, etc. // // Supported types: FilterProperty. @@ -2504,7 +2390,7 @@ const ( // BackdropFilter is the constant for "backdrop-filter" property tag. // - // Used by View. + // Used by [View]. // Applies graphical effects to the area behind a view, such as blurring, color shifting, changing brightness/contrast, // etc. // @@ -2515,7 +2401,7 @@ const ( // Clip is the constant for "clip" property tag. // - // Used by View. + // Used by [View]. // Creates a clipping region that sets what part of a view should be shown. // // Supported types: ClipShapeProperty, string. @@ -2534,7 +2420,7 @@ const ( // ShapeOutside is the constant for "shape-outside" property tag. // - // Used by View. + // Used by [View]. // __WARNING__ Currently not supported. Property defines a shape(which may be non-rectangular) around which adjacent // inline content should wrap. By default, inline content wraps around its margin box. Property provides a way to // customize this wrapping, making it possible to wrap text around complex objects rather than simple boxes. @@ -2547,7 +2433,7 @@ const ( // Float is the constant for "float" property tag. // - // Used by View. + // Used by [View]. // Places a view on the left or right side of its container, allowing text and inline views to wrap around it. // // Supported types: int, string. @@ -2560,7 +2446,7 @@ const ( // UserData is the constant for "user-data" property tag. // - // Used by View. + // Used by [View]. // Can contain any user data. // // Supported types: any. @@ -2568,7 +2454,7 @@ const ( // Resize is the constant for "resize" property tag. // - // Used by View. + // Used by [View]. // Sets whether view is resizable, and if so, in which directions. Default value is "none". // // Supported types: int, string. @@ -2582,7 +2468,7 @@ const ( // UserSelect is the constant for "user-select" property tag. // - // Used by View. + // Used by [View]. // Controls whether the user can select the text. This is an inherited property, i.e. if it is not defined, then the value // of the parent view is used. Default value is false. // @@ -2595,7 +2481,7 @@ const ( // Order is the constant for "Order" property tag. // - // Used by View. + // Used by [View]. // // Set the order to layout an item in a ViewsContainer container. Items in a container are sorted by // ascending order value and then by their addition to container order. @@ -2609,7 +2495,7 @@ const ( // BackgroundBlendMode is the constant for "background-blend-mode" property tag. // - // Used by View. + // Used by [View]. // Sets how view's background images should blend with each other and with the view's background color. // // Supported types: int, string. @@ -2652,7 +2538,7 @@ const ( // MixBlendMode is the constant for "mix-blend-mode" property tag. // - // Used by View. + // Used by [View]. // Sets how view's content should blend with the content of the view's parent and the view's background. // // Supported types: int, string. @@ -2695,7 +2581,7 @@ const ( // TabIndex is the constant for "tabindex" property tag. // - // Used by View. + // Used by [View]. // Indicates that view can be focused, and where it participates in sequential keyboard navigation(usually with the Tab // key). // @@ -2709,7 +2595,7 @@ const ( // Tooltip is the constant for "tooltip" property tag. // - // Used by View. + // Used by [View]. // Specifies the tooltip text. Tooltip pops up when hovering the mouse cursor over the view. HTML tags are supported when // formatting tooltip text. // diff --git a/radius.go b/radius.go index 27dddb6..fb3487e 100644 --- a/radius.go +++ b/radius.go @@ -9,7 +9,7 @@ import ( const ( // Radius is the constant for "radius" property tag. // - // Used by View, BackgroundElement, ClipShapeProperty. + // Used by [View], BackgroundElement, ClipShapeProperty. // // Usage in View: // 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. // - // Used by View, ClipShapeProperty. + // Used by [View], ClipShapeProperty. // // Usage in View: // 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. // - // Used by View, ClipShapeProperty. + // Used by [View], ClipShapeProperty. // // Usage in View: // 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. // - // Used by View. + // Used by [View]. // Specifies the top-left corner rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -94,7 +94,7 @@ const ( // RadiusTopLeftX is the constant for "radius-top-left-x" property tag. // - // Used by View. + // Used by [View]. // Specifies the x-axis top-left corner elliptic rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -105,7 +105,7 @@ const ( // RadiusTopLeftY is the constant for "radius-top-left-y" property tag. // - // Used by View. + // Used by [View]. // Specifies the y-axis top-left corner elliptic rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -116,7 +116,7 @@ const ( // RadiusTopRight is the constant for "radius-top-right" property tag. // - // Used by View. + // Used by [View]. // Specifies the top-right corner rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -127,7 +127,7 @@ const ( // RadiusTopRightX is the constant for "radius-top-right-x" property tag. // - // Used by View. + // Used by [View]. // Specifies the x-axis top-right corner elliptic rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -138,7 +138,7 @@ const ( // RadiusTopRightY is the constant for "radius-top-right-y" property tag. // - // Used by View. + // Used by [View]. // Specifies the y-axis top-right corner elliptic rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -149,7 +149,7 @@ const ( // RadiusBottomLeft is the constant for "radius-bottom-left" property tag. // - // Used by View. + // Used by [View]. // Specifies the bottom-left corner rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -160,7 +160,7 @@ const ( // RadiusBottomLeftX is the constant for "radius-bottom-left-x" property tag. // - // Used by View. + // Used by [View]. // Specifies the x-axis bottom-left corner elliptic rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -171,7 +171,7 @@ const ( // RadiusBottomLeftY is the constant for "radius-bottom-left-y" property tag. // - // Used by View. + // Used by [View]. // Specifies the y-axis bottom-left corner elliptic rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -182,7 +182,7 @@ const ( // RadiusBottomRight is the constant for "radius-bottom-right" property tag. // - // Used by View. + // Used by [View]. // Specifies the bottom-right corner rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -193,7 +193,7 @@ const ( // RadiusBottomRightX is the constant for "radius-bottom-right-x" property tag. // - // Used by View. + // Used by [View]. // Specifies the x-axis bottom-right corner elliptic rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -204,7 +204,7 @@ const ( // RadiusBottomRightY is the constant for "radius-bottom-right-y" property tag. // - // Used by View. + // Used by [View]. // Specifies the y-axis bottom-right corner elliptic rounding radius of an element's outer border edge. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -405,19 +405,19 @@ type radiusPropertyData struct { // NewRadiusProperty creates the new RadiusProperty // // The following properties can be used: -// - "x" (X) - Determines the x-axis elliptic rounding radius of an element's outer border edge. -// - "y" (Y) - Determines the y-axis corner elliptic rounding radius of an element's outer border edge. -// - "top-left" (TopLeft) - Determines the top-left corner rounding radius of an element's outer border edge. -// - "top-left-x" (TopLeftX) - Determines the x-axis top-left corner elliptic rounding radius of an element's outer border edge. -// - "top-left-y" (TopLeftY) - Determines the y-axis top-left corner elliptic rounding radius of an element's outer border edge. -// - "top-right" (TopRight) - Determines the top-right corner rounding radius of an element's outer border edge. -// - "top-right-x" (TopRightX) - Determines the x-axis top-right corner elliptic rounding radius of an element's outer border edge. -// - "top-right-y" (TopRightY) - Determines the y-axis top-right corner elliptic rounding radius of an element's outer border edge. -// - "bottom-left" (BottomLeft) - Determines the bottom-left corner rounding radius of an element's outer border edge. -// - "bottom-left-x" (BottomLeftX) - Determines the x-axis bottom-left corner elliptic rounding radius of an element's outer border edge. -// - "bottom-left-y" (BottomLeftY) - Determines the y-axis bottom-left corner elliptic rounding radius of an element's outer border edge. -// - "bottom-right" (BottomRight) - Determines the bottom-right corner rounding radius of an element's outer border edge. -// - "bottom-right-x" (BottomRightX) - Determines the x-axis bottom-right corner elliptic rounding radius of an element's outer border edge. +// - "x" (X) - Determines the x-axis elliptic rounding radius of an element's outer border edge; +// - "y" (Y) - Determines the y-axis corner elliptic rounding radius of an element's outer border edge; +// - "top-left" (TopLeft) - Determines the top-left corner rounding radius of an element's outer border edge; +// - "top-left-x" (TopLeftX) - Determines the x-axis top-left corner elliptic rounding radius of an element's outer border edge; +// - "top-left-y" (TopLeftY) - Determines the y-axis top-left corner elliptic rounding radius of an element's outer border edge; +// - "top-right" (TopRight) - Determines the top-right corner rounding radius of an element's outer border edge; +// - "top-right-x" (TopRightX) - Determines the x-axis top-right corner elliptic rounding radius of an element's outer border edge; +// - "top-right-y" (TopRightY) - Determines the y-axis top-right corner elliptic rounding radius of an element's outer border edge; +// - "bottom-left" (BottomLeft) - Determines the bottom-left corner rounding radius of an element's outer border edge; +// - "bottom-left-x" (BottomLeftX) - Determines the x-axis bottom-left corner elliptic rounding radius of an element's outer border edge; +// - "bottom-left-y" (BottomLeftY) - Determines the y-axis bottom-left corner elliptic rounding radius of an element's outer border edge; +// - "bottom-right" (BottomRight) - Determines the bottom-right corner rounding radius of an element's outer border edge; +// - "bottom-right-x" (BottomRightX) - Determines the x-axis bottom-right corner elliptic rounding radius of an element's outer border edge; // - "bottom-right-y" (BottomRightY) - Determines the y-axis bottom-right corner elliptic rounding radius of an element's outer border edge. func NewRadiusProperty(params Params) RadiusProperty { result := new(radiusPropertyData) diff --git a/resizable.go b/resizable.go index d1c0463..c054cb8 100644 --- a/resizable.go +++ b/resizable.go @@ -55,7 +55,12 @@ const ( 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 { View ParentView @@ -65,7 +70,7 @@ type resizableData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/resizeEvent.go b/resizeEvent.go index f102b84..c08d65d 100644 --- a/resizeEvent.go +++ b/resizeEvent.go @@ -2,7 +2,7 @@ package rui // ResizeEvent is the constant for "resize-event" property tag. // -// Used by View. +// Used by [View]. // Is fired when the view changes its size. // // General listener format: diff --git a/scrollEvent.go b/scrollEvent.go index 10e302a..c763c2f 100644 --- a/scrollEvent.go +++ b/scrollEvent.go @@ -2,7 +2,7 @@ package rui // ScrollEvent is the constant for "scroll-event" property tag. // -// Used by View. +// Used by [View]. // Is fired when the content of the view is scrolled. // // General listener format: diff --git a/shadow.go b/shadow.go index 0a4965a..71ca83d 100644 --- a/shadow.go +++ b/shadow.go @@ -171,12 +171,12 @@ func NewTextShadow[xOffsetType SizeUnit | int | float64, yOffsetType SizeUnit | // NewShadowProperty create the new shadow property for a view. // // The following properties can be used: -// - "color" ([ColorTag]) - Determines the color of the shadow (Color); -// - "x-offset" ([XOffset]) - Determines the shadow horizontal offset (SizeUnit); -// - "y-offset" ([YOffset]) - Determines the shadow vertical offset (SizeUnit); -// - "blur" ([BlurRadius]) - Determines the radius of the blur effect (SizeUnit); -// - "spread-radius" ([SpreadRadius]) - Positive values (SizeUnit) will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink; -// - "inset" ([Inset]) - Controls (bool) whether to draw shadow inside the frame or outside. +// - [ColorTag] ("color") - Determines the color of the shadow (Color); +// - [XOffset] ("x-offset") - Determines the shadow horizontal offset (SizeUnit); +// - [YOffset] ("y-offset") - Determines the shadow vertical offset (SizeUnit); +// - [BlurRadius] ("blur") - Determines the radius of the blur effect (SizeUnit); +// - [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. func NewShadowProperty(params Params) ShadowProperty { shadow := new(shadowPropertyData) shadow.init() diff --git a/sizeUnit.go b/sizeUnit.go index 2ea8f8c..f4fd2a4 100644 --- a/sizeUnit.go +++ b/sizeUnit.go @@ -17,27 +17,38 @@ type SizeUnitType uint8 const ( // Auto is the SizeUnit type: default value. Auto SizeUnitType = 0 + // SizeInPixel is the SizeUnit type: the Value field specifies the size in pixels. SizeInPixel SizeUnitType = 1 + // SizeInEM is the SizeUnit type: the Value field specifies the size in em. SizeInEM SizeUnitType = 2 + // SizeInEX is the SizeUnit type: the Value field specifies the size in em. SizeInEX SizeUnitType = 3 + // SizeInPercent is the SizeUnit type: the Value field specifies the size in percents of the parent size. SizeInPercent SizeUnitType = 4 + // SizeInPt is the SizeUnit type: the Value field specifies the size in pt (1/72 inch). SizeInPt SizeUnitType = 5 + // SizeInPc is the SizeUnit type: the Value field specifies the size in pc (1pc = 12pt). SizeInPc SizeUnitType = 6 + // SizeInInch is the SizeUnit type: the Value field specifies the size in inches. SizeInInch SizeUnitType = 7 + // SizeInMM is the SizeUnit type: the Value field specifies the size in millimeters. SizeInMM SizeUnitType = 8 + // SizeInCM is the SizeUnit type: the Value field specifies the size in centimeters. SizeInCM SizeUnitType = 9 + // SizeInFraction is the SizeUnit type: the Value field specifies the size in fraction. // Used only for "cell-width" and "cell-height" property. SizeInFraction SizeUnitType = 10 + // SizeFunction is the SizeUnit type: the Function field specifies the size function. // "min", "max", "clamp", "sum", "sub", "mul", and "div" functions are available. SizeFunction = 11 diff --git a/stackLayout.go b/stackLayout.go index d21ced6..acc1d13 100644 --- a/stackLayout.go +++ b/stackLayout.go @@ -247,7 +247,27 @@ const ( 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 { ViewsContainer @@ -309,7 +329,7 @@ type stackLayoutData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/svgImageView.go b/svgImageView.go index 06792bf..d8a57b1 100644 --- a/svgImageView.go +++ b/svgImageView.go @@ -7,7 +7,12 @@ import ( "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 { View } @@ -16,7 +21,7 @@ type svgImageViewData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/tabsLayout.go b/tabsLayout.go index 446d4fc..ebf64fe 100644 --- a/tabsLayout.go +++ b/tabsLayout.go @@ -135,7 +135,23 @@ const ( 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 { ViewsContainer ListAdapter @@ -145,7 +161,7 @@ type tabsLayoutData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/textView.go b/textView.go index 6fc4c6b..b0beecd 100644 --- a/textView.go +++ b/textView.go @@ -5,7 +5,23 @@ import ( "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 { View } @@ -14,7 +30,7 @@ type textViewData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/timePicker.go b/timePicker.go index e11cc7c..5626169 100644 --- a/timePicker.go +++ b/timePicker.go @@ -94,7 +94,14 @@ const ( 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 { View } @@ -103,7 +110,7 @@ type timePickerData struct { 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 { if session == nil { ErrorLog(`the Session argument cannot be nil`) diff --git a/touchEvents.go b/touchEvents.go index 6e07687..f7a9533 100644 --- a/touchEvents.go +++ b/touchEvents.go @@ -8,7 +8,7 @@ import ( const ( // TouchStart is the constant for "touch-start" property tag. // - // Used by View. + // Used by [View]. // Is fired when one or more touch points are placed on the touch surface. // // General listener format: @@ -28,7 +28,7 @@ const ( // TouchEnd is the constant for "touch-end" property tag. // - // Used by View. + // Used by [View]. // Fired when one or more touch points are removed from the touch surface. // // General listener format: @@ -48,7 +48,7 @@ const ( // TouchMove is the constant for "touch-move" property tag. // - // Used by View. + // Used by [View]. // Is fired when one or more touch points are moved along the touch surface. // // General listener format: @@ -68,7 +68,7 @@ const ( // TouchCancel is the constant for "touch-cancel" property tag. // - // Used by View. + // Used by [View]. // Is fired when one or more touch points have been disrupted in an implementation-specific manner (for example, too many // touch points are created). // diff --git a/transform.go b/transform.go index b2e9466..1a9390b 100644 --- a/transform.go +++ b/transform.go @@ -10,7 +10,7 @@ import ( const ( // Transform is the constant for "transform" property tag. // - // Used by View. + // Used by [View]. // Specify translation, scale and rotation over x, y and z axes as well as a distortion of a view along x and y axes. // // Supported types: TransformProperty, string. @@ -24,7 +24,7 @@ const ( // Perspective is the constant for "perspective" property tag. // - // Used by View, TransformProperty. + // Used by [View], TransformProperty. // Distance between the z-plane and the user in order to give a 3D-positioned element some perspective. Each 3D element // with z > 0 becomes larger, each 3D-element with z < 0 becomes smaller. The default value is 0 (no 3D effects). // @@ -36,7 +36,7 @@ const ( // PerspectiveOriginX is the constant for "perspective-origin-x" property tag. // - // Used by View. + // Used by [View]. // x-coordinate of the position at which the viewer is looking. It is used as the vanishing point by the "perspective" // property. The default value is 50%. // @@ -48,7 +48,7 @@ const ( // PerspectiveOriginY is the constant for "perspective-origin-y" property tag. // - // Used by View. + // Used by [View]. // y-coordinate of the position at which the viewer is looking. It is used as the vanishing point by the "perspective" // property. The default value is 50%. // @@ -60,7 +60,7 @@ const ( // 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. // // Supported types: bool, int, string. @@ -72,7 +72,7 @@ const ( // TransformOriginX is the constant for "transform-origin-x" property tag. // - // Used by View. + // Used by [View]. // x-coordinate of the point around which a view transformation is applied. The default value is 50%. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -83,7 +83,7 @@ const ( // TransformOriginY is the constant for "transform-origin-y" property tag. // - // Used by View. + // Used by [View]. // y-coordinate of the point around which a view transformation is applied. The default value is 50%. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -94,7 +94,7 @@ const ( // TransformOriginZ is the constant for "transform-origin-z" property tag. // - // Used by View. + // Used by [View]. // z-coordinate of the point around which a view transformation is applied. The default value is 50%. // // Supported types: SizeUnit, SizeFunc, string, float, int. @@ -105,7 +105,7 @@ const ( // 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. // @@ -117,7 +117,7 @@ const ( // 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. // @@ -129,7 +129,7 @@ const ( // 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. // @@ -141,7 +141,7 @@ const ( // 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 // 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. // - // 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 // 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. // - // 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 // scale, more than 1 - to increase. The default value is 1. @@ -177,7 +177,7 @@ const ( // 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. // @@ -195,7 +195,7 @@ const ( // 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. // @@ -206,7 +206,7 @@ const ( // 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. // @@ -217,7 +217,7 @@ const ( // 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. // @@ -228,7 +228,7 @@ const ( // 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. // @@ -246,7 +246,7 @@ const ( // 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. // diff --git a/viewsContainer.go b/viewsContainer.go index c3afb4e..1f81e2c 100644 --- a/viewsContainer.go +++ b/viewsContainer.go @@ -18,7 +18,14 @@ type ParentView interface { 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 { View ParentView