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"
)
// 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 {
Properties
fmt.Stringer
@ -257,12 +257,12 @@ func newBorderProperty(value any) BorderProperty {
return border
}
// NewBorder creates the new BorderProperty.
// NewBorder creates the new [BorderProperty].
//
// The following properties can be used:
// - "style" ([Style]). Determines the line style (int). Valid values: 0 ([NoneLine]), 1 ([SolidLine]), 2 ([DashedLine]), 3 ([DottedLine]), or 4 ([DoubleLine]);
// - "color" ([ColorTag]). Determines the line color (Color);
// - "width" ([Width]). Determines the line thickness (SizeUnit).
// - [Style], [LeftStyle], [RightStyle], [TopStyle], and [BottomStyle] - Determines the line style (int). Valid values: 0 ([NoneLine]), 1 ([SolidLine]), 2 ([DashedLine]), 3 ([DottedLine]), or 4 ([DoubleLine]);
// - [ColorTag], [LeftColor], [RightColor], [TopColor], and [BottomColor] - Determines the line color ([Color]);
// - [Width], [LeftWidth], [RightWidth], [TopWidth], and [BottomWidth] - Determines the line thickness ([SizeUnit]).
func NewBorder(params Params) BorderProperty {
border := new(borderProperty)
border.init()

View File

@ -5,7 +5,9 @@ import (
"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 {
Properties
fmt.Stringer
@ -21,7 +23,11 @@ type boundsPropertyData struct {
// NewBoundsProperty creates the new BoundsProperty object.
//
// The following SizeUnit properties can be used: "left" ([Left]), "right" ([Right]), "top" ([Top]), and "bottom" ([Bottom]).
// The following SizeUnit properties can be used:
// - [Left] ("left");
// - [Right] ("right");
// - [Top] ("top");
// - [Bottom] ("bottom").
func NewBoundsProperty(params Params) BoundsProperty {
bounds := new(boundsPropertyData)
bounds.init()

View File

@ -2,7 +2,7 @@ package rui
import "strings"
// Button represent a Button view
// Button represents an interface for working with the Button view.
type Button interface {
ListLayout
}
@ -11,7 +11,7 @@ type buttonData struct {
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 {
if session == 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.
//
// Used by `CanvasView`.
// Used by [CanvasView].
// Property sets the draw function of `CanvasView`.
//
// Supported types: `func(Canvas)`.
// Supported types:
//
// func(Canvas)
const DrawFunction PropertyName = "draw-function"
// CanvasView represents an interface for working with the CanvasView view.

View File

@ -28,7 +28,13 @@ const (
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 {
Properties
fmt.Stringer

View File

@ -4,7 +4,9 @@ import (
"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 {
Properties
fmt.Stringer
@ -81,8 +83,8 @@ func NewColumnSeparatorProperty(params Params) ColumnSeparatorProperty {
// Arguments:
// - style - determines the line style. Valid values: 0 ([NoneLine]), 1 ([SolidLine]), 2 ([DashedLine]), 3 ([DottedLine]), or 4 ([DoubleLine]);
// - color - determines the line color;
// - width - determines the line thickness.
func NewColumnSeparator(style int, color Color, width SizeUnit) ColumnSeparatorProperty {
// - width - determines the line thickness. If the type int or float64 is used, the size is specified in pixels.
func NewColumnSeparator[WidthType SizeUnit | int | float64](style int, color Color, width WidthType) ColumnSeparatorProperty {
return NewColumnSeparatorProperty(Params{
Width: width,
Style: style,

View File

@ -9,7 +9,7 @@ import (
const (
// Summary is the constant for "summary" property tag.
//
// Used by DetailsView.
// Used by [DetailsView].
// The content of this property is used as the label for the disclosure widget.
//
// Supported types:
@ -19,7 +19,7 @@ const (
// 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.
//
// Supported types: bool, int, string.
@ -31,7 +31,7 @@ const (
// 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.
//
// Supported types: bool, int, string.

View File

@ -128,8 +128,19 @@ const (
Sepia PropertyName = "sepia"
)
// FilterProperty defines an applied to a View a graphical effects like blur or color shift.
// Allowable properties are Blur, Brightness, Contrast, DropShadow, Grayscale, HueRotate, Invert, Opacity, Saturate, and Sepia
// 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];
// - [Sepia].
type FilterProperty interface {
Properties
fmt.Stringer
@ -147,7 +158,7 @@ type filterData struct {
// - [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);
// - [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);

View File

@ -5,7 +5,7 @@ import (
"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 {
Properties
stringWriter
@ -23,7 +23,7 @@ type outlinePropertyData struct {
//
// The following properties can be used:
// - [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 {
outline := new(outlinePropertyData)
outline.init()

View File

@ -388,7 +388,11 @@ const (
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 {
Properties
stringWriter
@ -402,7 +406,7 @@ type radiusPropertyData struct {
dataProperty
}
// NewRadiusProperty creates the new RadiusProperty
// NewRadiusProperty creates the new [RadiusProperty] object
//
// The following properties can be used:
// - "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"
)
// 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 {
Properties
fmt.Stringer

View File

@ -551,7 +551,30 @@ type CellIndex struct {
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 {
View
ParentView

View File

@ -148,7 +148,7 @@ const (
// - [TabCloseEvent] ("tab-close-event");
// - [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");
// - [Icon] ("icon");
// - [TabCloseButton] ("tab-close-button").

View File

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