Updated comments

This commit is contained in:
Alexei Anoshenko 2026-11-18 17:52:02 +03:00
parent aa1651fb62
commit 013fcbbbe8
14 changed files with 91 additions and 32 deletions

View File

@ -174,7 +174,7 @@ const (
BottomColor PropertyName = "bottom-color" BottomColor PropertyName = "bottom-color"
) )
// BorderProperty is the interface of a view border data // BorderProperty is the interface of a view border data. It is created by the [NewBorder] function.
type BorderProperty interface { type BorderProperty interface {
Properties Properties
fmt.Stringer fmt.Stringer
@ -257,12 +257,12 @@ func newBorderProperty(value any) BorderProperty {
return border return border
} }
// NewBorder creates the new BorderProperty. // NewBorder creates the new [BorderProperty].
// //
// The following properties can be used: // The following properties can be used:
// - "style" ([Style]). Determines the line style (int). Valid values: 0 ([NoneLine]), 1 ([SolidLine]), 2 ([DashedLine]), 3 ([DottedLine]), or 4 ([DoubleLine]); // - [Style], [LeftStyle], [RightStyle], [TopStyle], and [BottomStyle] - Determines the line style (int). Valid values: 0 ([NoneLine]), 1 ([SolidLine]), 2 ([DashedLine]), 3 ([DottedLine]), or 4 ([DoubleLine]);
// - "color" ([ColorTag]). Determines the line color (Color); // - [ColorTag], [LeftColor], [RightColor], [TopColor], and [BottomColor] - Determines the line color ([Color]);
// - "width" ([Width]). Determines the line thickness (SizeUnit). // - [Width], [LeftWidth], [RightWidth], [TopWidth], and [BottomWidth] - Determines the line thickness ([SizeUnit]).
func NewBorder(params Params) BorderProperty { func NewBorder(params Params) BorderProperty {
border := new(borderProperty) border := new(borderProperty)
border.init() border.init()

View File

@ -5,7 +5,9 @@ import (
"strings" "strings"
) )
// BorderProperty is an interface of a bounds property data // BorderProperty is an interface of a bounds property data. It is created by one of the following functions:
// - [NewBoundsProperty];
// - [NewBounds].
type BoundsProperty interface { type BoundsProperty interface {
Properties Properties
fmt.Stringer fmt.Stringer
@ -21,7 +23,11 @@ type boundsPropertyData struct {
// NewBoundsProperty creates the new BoundsProperty object. // NewBoundsProperty creates the new BoundsProperty object.
// //
// The following SizeUnit properties can be used: "left" ([Left]), "right" ([Right]), "top" ([Top]), and "bottom" ([Bottom]). // The following SizeUnit properties can be used:
// - [Left] ("left");
// - [Right] ("right");
// - [Top] ("top");
// - [Bottom] ("bottom").
func NewBoundsProperty(params Params) BoundsProperty { func NewBoundsProperty(params Params) BoundsProperty {
bounds := new(boundsPropertyData) bounds := new(boundsPropertyData)
bounds.init() bounds.init()

View File

@ -2,7 +2,7 @@ package rui
import "strings" import "strings"
// Button represent a Button view // Button represents an interface for working with the Button view.
type Button interface { type Button interface {
ListLayout ListLayout
} }
@ -11,7 +11,7 @@ type buttonData struct {
listLayoutData listLayoutData
} }
// NewButton create new Button object and return it // NewButton create new [Button] object and return its interface
func NewButton(session Session, params Params) Button { func NewButton(session Session, params Params) Button {
if session == nil { if session == nil {
ErrorLog(`the Session argument cannot be nil`) ErrorLog(`the Session argument cannot be nil`)

View File

@ -4,10 +4,12 @@ import "reflect"
// DrawFunction is the constant for "draw-function" property tag. // DrawFunction is the constant for "draw-function" property tag.
// //
// Used by `CanvasView`. // Used by [CanvasView].
// Property sets the draw function of `CanvasView`. // Property sets the draw function of `CanvasView`.
// //
// Supported types: `func(Canvas)`. // Supported types:
//
// func(Canvas)
const DrawFunction PropertyName = "draw-function" const DrawFunction PropertyName = "draw-function"
// CanvasView represents an interface for working with the CanvasView view. // CanvasView represents an interface for working with the CanvasView view.

View File

@ -28,7 +28,13 @@ const (
PolygonClip ClipShape = "polygon" PolygonClip ClipShape = "polygon"
) )
// ClipShapeProperty defines a View clipping area // ClipShapeProperty defines a View clipping area. It is created by one of the following functions:
// - [NewClipShapeProperty];
// - [NewInsetClip];
// - [NewCircleClip];
// - [NewEllipseClip];
// - [NewPolygonClip];
// - [NewPolygonPointsClip].
type ClipShapeProperty interface { type ClipShapeProperty interface {
Properties Properties
fmt.Stringer fmt.Stringer

View File

@ -4,7 +4,9 @@ import (
"fmt" "fmt"
) )
// ColumnSeparatorProperty is the interface of a view separator data // ColumnSeparatorProperty is the interface of a view separator data It is created by one of the following functions:
// - [NewColumnSeparatorProperty];
// - [NewColumnSeparator];
type ColumnSeparatorProperty interface { type ColumnSeparatorProperty interface {
Properties Properties
fmt.Stringer fmt.Stringer
@ -81,8 +83,8 @@ func NewColumnSeparatorProperty(params Params) ColumnSeparatorProperty {
// Arguments: // Arguments:
// - style - determines the line style. Valid values: 0 ([NoneLine]), 1 ([SolidLine]), 2 ([DashedLine]), 3 ([DottedLine]), or 4 ([DoubleLine]); // - style - determines the line style. Valid values: 0 ([NoneLine]), 1 ([SolidLine]), 2 ([DashedLine]), 3 ([DottedLine]), or 4 ([DoubleLine]);
// - color - determines the line color; // - color - determines the line color;
// - width - determines the line thickness. // - width - determines the line thickness. If the type int or float64 is used, the size is specified in pixels.
func NewColumnSeparator(style int, color Color, width SizeUnit) ColumnSeparatorProperty { func NewColumnSeparator[WidthType SizeUnit | int | float64](style int, color Color, width WidthType) ColumnSeparatorProperty {
return NewColumnSeparatorProperty(Params{ return NewColumnSeparatorProperty(Params{
Width: width, Width: width,
Style: style, Style: style,

View File

@ -9,7 +9,7 @@ import (
const ( const (
// Summary is the constant for "summary" property tag. // Summary is the constant for "summary" property tag.
// //
// Used by DetailsView. // Used by [DetailsView].
// The content of this property is used as the label for the disclosure widget. // The content of this property is used as the label for the disclosure widget.
// //
// Supported types: // Supported types:
@ -19,7 +19,7 @@ const (
// Expanded is the constant for "expanded" property tag. // Expanded is the constant for "expanded" property tag.
// //
// Used by DetailsView. // Used by [DetailsView].
// Controls the content expanded state of the details view. Default value is false. // Controls the content expanded state of the details view. Default value is false.
// //
// Supported types: bool, int, string. // Supported types: bool, int, string.
@ -31,7 +31,7 @@ const (
// HideSummaryMarker is the constant for "hide-summary-marker" property tag. // HideSummaryMarker is the constant for "hide-summary-marker" property tag.
// //
// Used by DetailsView. // Used by [DetailsView].
// Allows you to hide the summary marker (▶︎). Default value is false. // Allows you to hide the summary marker (▶︎). Default value is false.
// //
// Supported types: bool, int, string. // Supported types: bool, int, string.

View File

@ -128,8 +128,19 @@ const (
Sepia PropertyName = "sepia" Sepia PropertyName = "sepia"
) )
// FilterProperty defines an applied to a View a graphical effects like blur or color shift. // FilterProperty defines an applied to a View a graphical effects like blur or color shift. It is created by the [NewFilterProperty] function.
// Allowable properties are Blur, Brightness, Contrast, DropShadow, Grayscale, HueRotate, Invert, Opacity, Saturate, and Sepia //
// Allowable properties are
// - [Blur];
// - [Brightness];
// - [Contrast];
// - [DropShadow];
// - [Grayscale];
// - [HueRotate];
// - [Invert];
// - [Opacity];
// - [Saturate];
// - [Sepia].
type FilterProperty interface { type FilterProperty interface {
Properties Properties
fmt.Stringer fmt.Stringer
@ -147,7 +158,7 @@ type filterData struct {
// - [Blur] ("blur") - Gaussian blur in pixels (type: float64, value: 0…10000); // - [Blur] ("blur") - Gaussian blur in pixels (type: float64, value: 0…10000);
// - [Brightness] ("brightness") - Brightness change in percents (type: float64, value: 0…10000); // - [Brightness] ("brightness") - Brightness change in percents (type: float64, value: 0…10000);
// - [Contrast] ("contrast") - Contrast change in percents (type: float64, value: 0…10000); // - [Contrast] ("contrast") - Contrast change in percents (type: float64, value: 0…10000);
// - [DropShadow] ("drop-shadow") - Adding shadow (type: []ShadowProperty); // - [DropShadow] ("drop-shadow") - Adding shadow (type: [][ShadowProperty]);
// - [Grayscale] ("grayscale") - Converting to grayscale in percents (type: float64, value: 0…100); // - [Grayscale] ("grayscale") - Converting to grayscale in percents (type: float64, value: 0…100);
// - [HueRotate] ("hue-rotate") - Hue rotation (type: AngleUnit); // - [HueRotate] ("hue-rotate") - Hue rotation (type: AngleUnit);
// - [Invert] ("invert") - Invert colors in percents (type: float64, value: 0…100); // - [Invert] ("invert") - Invert colors in percents (type: float64, value: 0…100);

View File

@ -5,7 +5,7 @@ import (
"strings" "strings"
) )
// OutlineProperty defines a view's outside border // OutlineProperty defines a view's outside border. It is created by the [NewOutlineProperty] function.
type OutlineProperty interface { type OutlineProperty interface {
Properties Properties
stringWriter stringWriter
@ -23,7 +23,7 @@ type outlinePropertyData struct {
// //
// The following properties can be used: // The following properties can be used:
// - [ColorTag] ("color") - Determines the line color (Color); // - [ColorTag] ("color") - Determines the line color (Color);
// - [Width] ("width") - Determines the line thickness (SizeUnit). // - [Width] ("width") - Determines the line thickness ([SizeUnit]).
func NewOutlineProperty(params Params) OutlineProperty { func NewOutlineProperty(params Params) OutlineProperty {
outline := new(outlinePropertyData) outline := new(outlinePropertyData)
outline.init() outline.init()

View File

@ -388,7 +388,11 @@ const (
BottomRightY PropertyName = "bottom-right-y" BottomRightY PropertyName = "bottom-right-y"
) )
// RadiusProperty is a description of the [View] (shape) elliptical corner radius. // RadiusProperty is a description of the [View] (shape) elliptical corner radius.. It is created by one of the following functions:
// - [NewRadiusProperty];
// - [NewEllipticRadius];
// - [NewRadii];
// - [];
type RadiusProperty interface { type RadiusProperty interface {
Properties Properties
stringWriter stringWriter
@ -402,7 +406,7 @@ type radiusPropertyData struct {
dataProperty dataProperty
} }
// NewRadiusProperty creates the new RadiusProperty // NewRadiusProperty creates the new [RadiusProperty] object
// //
// The following properties can be used: // The following properties can be used:
// - "x" (X) - Determines the x-axis elliptic rounding radius of an element's outer border edge; // - "x" (X) - Determines the x-axis elliptic rounding radius of an element's outer border edge;

View File

@ -107,7 +107,11 @@ const (
SpreadRadius PropertyName = "spread-radius" SpreadRadius PropertyName = "spread-radius"
) )
// ShadowProperty contains attributes of the view shadow // ShadowProperty contains attributes of the view shadow. It is created by one of the following functions:
// - [NewShadowProperty];
// - [NewShadow];
// - [NewInsetShadow];
// - [NewTextShadow].
type ShadowProperty interface { type ShadowProperty interface {
Properties Properties
fmt.Stringer fmt.Stringer

View File

@ -551,7 +551,30 @@ type CellIndex struct {
Row, Column int Row, Column int
} }
// TableView represents a TableView view // TableView represents an interface for working with the TableView view.
//
// It extends the [View] interface and supports all its properties, and also has the following additional properties:
// - [TableVerticalAlign];
// - [HeadHeight];
// - [HeadStyle];
// - [FootHeight];
// - [FootStyle];
// - [RowSpan];
// - [ColumnSpan];
// - [RowStyle];
// - [ColumnStyle];
// - [CellStyle];
// - [CellPadding], [CellPaddingLeft], [CellPaddingRight], [CellPaddingTop], [CellPaddingBottom];
// - [CellBorder], [CellBorderLeft], [CellBorderRight], [CellBorderTop], [CellBorderBottom];
// - [CellBorderStyle], [CellBorderLeftStyle], [CellBorderRightStyle], [CellBorderTopStyle], [CellBorderBottomStyle];
// - [CellBorderWidth], [CellBorderLeftWidth], [CellBorderRightWidth], [CellBorderTopWidth], [CellBorderBottomWidth];
// - [CellBorderColor], [CellBorderLeftColor], [CellBorderRightColor], [CellBorderTopColor], [CellBorderBottomColor];
// - [SelectionMode];
// - [TableCellClickedEvent];
// - [TableCellSelectedEvent];
// - [TableRowClickedEvent];
// - [TableRowSelectedEvent];
// - [AllowSelection].
type TableView interface { type TableView interface {
View View
ParentView ParentView

View File

@ -148,7 +148,7 @@ const (
// - [TabCloseEvent] ("tab-close-event"); // - [TabCloseEvent] ("tab-close-event");
// - [CurrentTabChangedEvent] ("current-tab-changed"). // - [CurrentTabChangedEvent] ("current-tab-changed").
// //
// Elements placed within a GridLayout container can have additional properties: // Elements placed within a TabsLayout container can have additional properties:
// - [Title] ("title"); // - [Title] ("title");
// - [Icon] ("icon"); // - [Icon] ("icon");
// - [TabCloseButton] ("tab-close-button"). // - [TabCloseButton] ("tab-close-button").

View File

@ -286,10 +286,11 @@ type transformPropertyData struct {
// NewTransform creates a new transform property data and return its interface // NewTransform creates a new transform property data and return its interface
// //
// The following properties can be used: // The following properties can be used:
// // - [Perspective] ("perspective");
// [Perspective] ("perspective"), [TranslateX] ("translate-x"), [TranslateY] ("translate-y"), [TranslateZ] ("translate-z"), // - [TranslateX] ("translate-x"), [TranslateY] ("translate-y"), [TranslateZ] ("translate-z");
// [ScaleX] ("scale-x"), [ScaleY] ("scale-y"), [ScaleZ] ("scale-z"), [Rotate] ("rotate"), [RotateX] ("rotate-x"), // - [ScaleX] ("scale-x"), [ScaleY] ("scale-y"), [ScaleZ] ("scale-z"),
// [RotateY] ("rotate-y"), [RotateZ] ("rotate-z"), [SkewX] ("skew-x"), and [SkewY] ("skew-y") // - [Rotate] ("rotate"), [RotateX] ("rotate-x"), [RotateY] ("rotate-y"), [RotateZ] ("rotate-z");
// - [SkewX] ("skew-x"), and [SkewY] ("skew-y").
func NewTransformProperty(params Params) TransformProperty { func NewTransformProperty(params Params) TransformProperty {
transform := new(transformPropertyData) transform := new(transformPropertyData)
transform.init() transform.init()