From 013fcbbbe88e9d00d9bb5343275c2ba7e9ef8a6e Mon Sep 17 00:00:00 2001 From: Alexei Anoshenko <2277098+anoshenko@users.noreply.github.com> Date: Wed, 18 Nov 2026 17:52:02 +0300 Subject: [PATCH] Updated comments --- border.go | 10 +++++----- bounds.go | 10 ++++++++-- button.go | 4 ++-- canvasView.go | 6 ++++-- clipShape.go | 8 +++++++- columnSeparator.go | 8 +++++--- detailsView.go | 6 +++--- filter.go | 17 ++++++++++++++--- outline.go | 4 ++-- radius.go | 8 ++++++-- shadow.go | 6 +++++- tableView.go | 25 ++++++++++++++++++++++++- tabsLayout.go | 2 +- transform.go | 9 +++++---- 14 files changed, 91 insertions(+), 32 deletions(-) diff --git a/border.go b/border.go index ba5e7f4..ec0439c 100644 --- a/border.go +++ b/border.go @@ -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() diff --git a/bounds.go b/bounds.go index 2fe5b38..368beb4 100644 --- a/bounds.go +++ b/bounds.go @@ -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() diff --git a/button.go b/button.go index ce716f5..369fcae 100644 --- a/button.go +++ b/button.go @@ -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`) diff --git a/canvasView.go b/canvasView.go index 77a8652..ef373d0 100644 --- a/canvasView.go +++ b/canvasView.go @@ -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. diff --git a/clipShape.go b/clipShape.go index 409c7d0..601cf92 100644 --- a/clipShape.go +++ b/clipShape.go @@ -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 diff --git a/columnSeparator.go b/columnSeparator.go index a1b9a1a..cdbf9f3 100644 --- a/columnSeparator.go +++ b/columnSeparator.go @@ -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, diff --git a/detailsView.go b/detailsView.go index d3b8669..3594f66 100644 --- a/detailsView.go +++ b/detailsView.go @@ -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. diff --git a/filter.go b/filter.go index 40f0620..6fd1ea9 100644 --- a/filter.go +++ b/filter.go @@ -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); diff --git a/outline.go b/outline.go index 0657d43..2090296 100644 --- a/outline.go +++ b/outline.go @@ -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() diff --git a/radius.go b/radius.go index fb3487e..c81375f 100644 --- a/radius.go +++ b/radius.go @@ -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; diff --git a/shadow.go b/shadow.go index 71ca83d..4cc97f0 100644 --- a/shadow.go +++ b/shadow.go @@ -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 diff --git a/tableView.go b/tableView.go index b20b94d..4ba292f 100644 --- a/tableView.go +++ b/tableView.go @@ -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 diff --git a/tabsLayout.go b/tabsLayout.go index ebf64fe..0c449eb 100644 --- a/tabsLayout.go +++ b/tabsLayout.go @@ -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"). diff --git a/transform.go b/transform.go index 1a9390b..da9d784 100644 --- a/transform.go +++ b/transform.go @@ -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()