From 99f218316e53ac3f157fbac57b7195e86c692b69 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Mon, 9 Sep 2024 21:41:37 +0200 Subject: [PATCH] Update root package GoDoc to include internal links --- animation.go | 2 +- app.go | 12 ++++++------ canvas.go | 4 ++-- canvasobject.go | 18 ++++++++--------- cloud.go | 2 +- container.go | 40 +++++++++++++++++++------------------- driver.go | 6 +++--- event.go | 4 ++-- geometry.go | 34 ++++++++++++++++---------------- layout.go | 6 +++--- menu.go | 4 ++-- notification.go | 2 +- overlay_stack.go | 2 +- resource.go | 8 ++++---- settings.go | 2 +- shortcut.go | 50 ++++++++++++++++++++++++------------------------ text.go | 4 ++-- uri.go | 16 ++++++++-------- widget.go | 16 ++++++++-------- window.go | 2 +- 20 files changed, 118 insertions(+), 116 deletions(-) diff --git a/animation.go b/animation.go index a8aeba12fb..2883774390 100644 --- a/animation.go +++ b/animation.go @@ -45,7 +45,7 @@ type Animation struct { } // NewAnimation creates a very basic animation where the callback function will be called for every -// rendered frame between time.Now() and the specified duration. The callback values start at 0.0 and +// rendered frame between [time.Now] and the specified duration. The callback values start at 0.0 and // will be 1.0 when the animation completes. // // Since: 2.0 diff --git a/app.go b/app.go index 74ac0bf89a..e2f6c28e46 100644 --- a/app.go +++ b/app.go @@ -7,9 +7,9 @@ import ( // An App is the definition of a graphical application. // Apps can have multiple windows, by default they will exit when all windows -// have been closed. This can be modified using SetMaster() or SetCloseIntercept(). -// To start an application you need to call Run() somewhere in your main() function. -// Alternatively use the window.ShowAndRun() function for your main window. +// have been closed. This can be modified using SetMaster or SetCloseIntercept. +// To start an application you need to call Run somewhere in your main function. +// Alternatively use the [fyne.io/fyne/v2.Window.ShowAndRun] function for your main window. type App interface { // Create a new window for the application. // The first window to open is considered the "master" and when closed @@ -27,7 +27,7 @@ type App interface { // SetIcon sets the icon resource used for this application instance. SetIcon(Resource) - // Run the application - this starts the event loop and waits until Quit() + // Run the application - this starts the event loop and waits until [App.Quit] // is called or the last window closes. // This should be called near the end of a main() function as it will block. Run() @@ -43,7 +43,7 @@ type App interface { Driver() Driver // UniqueID returns the application unique identifier, if set. - // This must be set for use of the Preferences() functions... see NewWithId(string) + // This must be set for use of the [App.Preferences]. see [NewWithID]. UniqueID() string // SendNotification sends a system notification that will be displayed in the operating system's notification area. @@ -75,7 +75,7 @@ type App interface { CloudProvider() CloudProvider // get the (if any) configured provider // SetCloudProvider allows developers to specify how this application should integrate with cloud services. - // See `fyne.io/cloud` package for implementation details. + // See [fyne.io/cloud] package for implementation details. // // Since: 2.3 SetCloudProvider(CloudProvider) // configure cloud for this app diff --git a/canvas.go b/canvas.go index 8869af25a0..8fd97d74cb 100644 --- a/canvas.go +++ b/canvas.go @@ -2,7 +2,7 @@ package fyne import "image" -// Canvas defines a graphical canvas to which a CanvasObject or Container can be added. +// Canvas defines a graphical canvas to which a [CanvasObject] or Container can be added. // Each canvas has a scale which is automatically applied during the render process. type Canvas interface { Content() CanvasObject @@ -31,7 +31,7 @@ type Canvas interface { // Size returns the current size of this canvas Size() Size // Scale returns the current scale (multiplication factor) this canvas uses to render - // The pixel size of a CanvasObject can be found by multiplying by this value. + // The pixel size of a [CanvasObject] can be found by multiplying by this value. Scale() float32 // Overlays returns the overlay stack. diff --git a/canvasobject.go b/canvasobject.go index 05ab7716e8..0566627285 100644 --- a/canvasobject.go +++ b/canvasobject.go @@ -36,7 +36,7 @@ type CanvasObject interface { Refresh() } -// Disableable describes any CanvasObject that can be disabled. +// Disableable describes any [CanvasObject] that can be disabled. // This is primarily used with objects that also implement the Tappable interface. type Disableable interface { Enable() @@ -44,19 +44,19 @@ type Disableable interface { Disabled() bool } -// DoubleTappable describes any CanvasObject that can also be double tapped. +// DoubleTappable describes any [CanvasObject] that can also be double tapped. type DoubleTappable interface { DoubleTapped(*PointEvent) } -// Draggable indicates that a CanvasObject can be dragged. +// Draggable indicates that a [CanvasObject] can be dragged. // This is used for any item that the user has indicated should be moved across the screen. type Draggable interface { Dragged(*DragEvent) DragEnd() } -// Focusable describes any CanvasObject that can respond to being focused. +// Focusable describes any [CanvasObject] that can respond to being focused. // It will receive the FocusGained and FocusLost events appropriately. // When focused it will also have TypedRune called as text is input and // TypedKey called when other keys are pressed. @@ -75,18 +75,18 @@ type Focusable interface { TypedKey(*KeyEvent) } -// Scrollable describes any CanvasObject that can also be scrolled. +// Scrollable describes any [CanvasObject] that can also be scrolled. // This is mostly used to implement the widget.ScrollContainer. type Scrollable interface { Scrolled(*ScrollEvent) } -// SecondaryTappable describes a CanvasObject that can be right-clicked or long-tapped. +// SecondaryTappable describes a [CanvasObject] that can be right-clicked or long-tapped. type SecondaryTappable interface { TappedSecondary(*PointEvent) } -// Shortcutable describes any CanvasObject that can respond to shortcut commands (quit, cut, copy, and paste). +// Shortcutable describes any [CanvasObject] that can respond to shortcut commands (quit, cut, copy, and paste). type Shortcutable interface { TypedShortcut(Shortcut) } @@ -95,12 +95,12 @@ type Shortcutable interface { // // Since: 2.1 type Tabbable interface { - // AcceptsTab() is a hook called by the key press handling logic. + // AcceptsTab is a hook called by the key press handling logic. // If it returns true then the Tab key events will be sent using TypedKey. AcceptsTab() bool } -// Tappable describes any CanvasObject that can also be tapped. +// Tappable describes any [CanvasObject] that can also be tapped. // This should be implemented by buttons etc that wish to handle pointer interactions. type Tappable interface { Tapped(*PointEvent) diff --git a/cloud.go b/cloud.go index c44e53c514..2e815bb4b9 100644 --- a/cloud.go +++ b/cloud.go @@ -1,7 +1,7 @@ package fyne // CloudProvider specifies the identifying information of a cloud provider. -// This information is mostly used by the `fyne.io/cloud ShowSettings' user flow. +// This information is mostly used by the [fyne.io/cloud.ShowSettings] user flow. // // Since: 2.3 type CloudProvider interface { diff --git a/container.go b/container.go index 6d7efc8cbd..a9357591cf 100644 --- a/container.go +++ b/container.go @@ -2,32 +2,32 @@ package fyne import "sync" -// Declare conformity to CanvasObject +// Declare conformity to [CanvasObject] var _ CanvasObject = (*Container)(nil) -// Container is a CanvasObject that contains a collection of child objects. +// Container is a [CanvasObject] that contains a collection of child objects. // The layout of the children is set by the specified Layout. type Container struct { size Size // The current size of the Container position Position // The current position of the Container Hidden bool // Is this Container hidden - Layout Layout // The Layout algorithm for arranging child CanvasObjects + Layout Layout // The Layout algorithm for arranging child [CanvasObject]s lock sync.Mutex - Objects []CanvasObject // The set of CanvasObjects this container holds + Objects []CanvasObject // The set of [CanvasObject]s this container holds } -// NewContainer returns a new Container instance holding the specified CanvasObjects. +// NewContainer returns a new [Container] instance holding the specified [CanvasObject]s. // -// Deprecated: Use container.NewWithoutLayout() to create a container that uses manual layout. +// Deprecated: Use [fyne.io/fyne/v2/container.NewWithoutLayout] to create a container that uses manual layout. func NewContainer(objects ...CanvasObject) *Container { return NewContainerWithoutLayout(objects...) } -// NewContainerWithoutLayout returns a new Container instance holding the specified -// CanvasObjects that are manually arranged. +// NewContainerWithoutLayout returns a new [Container] instance holding the specified +// [CanvasObject]s that are manually arranged. // -// Deprecated: Use container.NewWithoutLayout() instead +// Deprecated: Use [fyne.io/fyne/v2/container.NewWithoutLayout] instead. func NewContainerWithoutLayout(objects ...CanvasObject) *Container { ret := &Container{ Objects: objects, @@ -37,10 +37,10 @@ func NewContainerWithoutLayout(objects ...CanvasObject) *Container { return ret } -// NewContainerWithLayout returns a new Container instance holding the specified -// CanvasObjects which will be laid out according to the specified Layout. +// NewContainerWithLayout returns a new [Container] instance holding the specified +// [CanvasObject]s which will be laid out according to the specified Layout. // -// Deprecated: Use container.New() instead +// Deprecated: Use [fyne.io/fyne/v2/container.New] instead. func NewContainerWithLayout(layout Layout, objects ...CanvasObject) *Container { ret := &Container{ Objects: objects, @@ -66,9 +66,9 @@ func (c *Container) Add(add CanvasObject) { c.layout() } -// AddObject adds another CanvasObject to the set this Container holds. +// AddObject adds another [CanvasObject] to the set this Container holds. // -// Deprecated: Use replacement Add() function +// Deprecated: Use [Container.Add] instead. func (c *Container) AddObject(o CanvasObject) { c.Add(o) } @@ -83,8 +83,8 @@ func (c *Container) Hide() { repaint(c) } -// MinSize calculates the minimum size of a Container. -// This is delegated to the Layout, if specified, otherwise it will mimic MaxLayout. +// MinSize calculates the minimum size of c. +// This is delegated to the [Container.Layout], if specified, otherwise it will be calculated. func (c *Container) MinSize() Size { if c.Layout != nil { return c.Layout.MinSize(c.Objects) @@ -104,7 +104,7 @@ func (c *Container) Move(pos Position) { repaint(c) } -// Position gets the current position of this Container, relative to its parent. +// Position gets the current position of c relative to its parent. func (c *Container) Position() Position { return c.position } @@ -127,7 +127,7 @@ func (c *Container) Refresh() { // Remove updates the contents of this container to no longer include the specified object. // This method is not intended to be used inside a loop, to remove all the elements. -// It is much more efficient to call RemoveAll() instead. +// It is much more efficient to call [Container.RemoveAll) instead. func (c *Container) Remove(rem CanvasObject) { c.lock.Lock() defer c.lock.Unlock() @@ -158,7 +158,7 @@ func (c *Container) RemoveAll() { c.layout() } -// Resize sets a new size for the Container. +// Resize sets a new size for c. func (c *Container) Resize(size Size) { if c.size == size { return @@ -177,7 +177,7 @@ func (c *Container) Show() { c.Hidden = false } -// Size returns the current size of this container. +// Size returns the current size c. func (c *Container) Size() Size { return c.size } diff --git a/driver.go b/driver.go index 21c4906fb5..cfeb6b123d 100644 --- a/driver.go +++ b/driver.go @@ -15,9 +15,9 @@ type Driver interface { // If the source is specified it will be used, otherwise the current theme will be asked for the font. RenderedTextSize(text string, fontSize float32, style TextStyle, source Resource) (size Size, baseline float32) - // CanvasForObject returns the canvas that is associated with a given CanvasObject. + // CanvasForObject returns the canvas that is associated with a given [CanvasObject]. CanvasForObject(CanvasObject) Canvas - // AbsolutePositionForObject returns the position of a given CanvasObject relative to the top/left of a canvas. + // AbsolutePositionForObject returns the position of a given [CanvasObject] relative to the top/left of a canvas. AbsolutePositionForObject(CanvasObject) Position // Device returns the device that the application is currently running on. @@ -34,7 +34,7 @@ type Driver interface { StopAnimation(*Animation) // DoubleTapDelay returns the maximum duration where a second tap after a first one - // will be considered a DoubleTap instead of two distinct Tap events. + // will be considered a [DoubleTap] instead of two distinct [Tap] events. // // Since: 2.5 DoubleTapDelay() time.Duration diff --git a/event.go b/event.go index 6646e653ec..0f006056fd 100644 --- a/event.go +++ b/event.go @@ -1,7 +1,7 @@ package fyne // HardwareKey contains information associated with physical key events -// Most applications should use KeyName for cross-platform compatibility. +// Most applications should use [KeyName] for cross-platform compatibility. type HardwareKey struct { // ScanCode represents a hardware ID for (normally desktop) keyboard events. ScanCode int @@ -16,7 +16,7 @@ type KeyEvent struct { } // PointEvent describes a pointer input event. The position is relative to the -// top-left of the CanvasObject this is triggered on. +// top-left of the [CanvasObject] this is triggered on. type PointEvent struct { AbsolutePosition Position // The absolute position of the event Position Position // The relative position of the event diff --git a/geometry.go b/geometry.go index e28fd867b7..e0dec55f75 100644 --- a/geometry.go +++ b/geometry.go @@ -1,8 +1,10 @@ package fyne -var _ Vector2 = (*Delta)(nil) -var _ Vector2 = (*Position)(nil) -var _ Vector2 = (*Size)(nil) +var ( + _ Vector2 = (*Delta)(nil) + _ Vector2 = (*Position)(nil) + _ Vector2 = (*Size)(nil) +) // Vector2 marks geometry types that can operate as a coordinate vector. type Vector2 interface { @@ -15,12 +17,12 @@ type Delta struct { DX, DY float32 } -// NewDelta returns a newly allocated Delta representing a movement in the X and Y axis. +// NewDelta returns a newly allocated [Delta] representing a movement in the X and Y axis. func NewDelta(dx float32, dy float32) Delta { return Delta{DX: dx, DY: dy} } -// Components returns the X and Y elements of this Delta. +// Components returns the X and Y elements of v. func (v Delta) Components() (float32, float32) { return v.DX, v.DY } @@ -30,26 +32,26 @@ func (v Delta) IsZero() bool { return v.DX == 0.0 && v.DY == 0.0 } -// Position describes a generic X, Y coordinate relative to a parent Canvas -// or CanvasObject. +// Position describes a generic X, Y coordinate relative to a parent [Canvas] +// or [CanvasObject]. type Position struct { X float32 // The position from the parent's left edge Y float32 // The position from the parent's top edge } -// NewPos returns a newly allocated Position representing the specified coordinates. +// NewPos returns a newly allocated [Position] representing the specified coordinates. func NewPos(x float32, y float32) Position { return Position{x, y} } -// NewSquareOffsetPos returns a newly allocated Position with the same x and y position. +// NewSquareOffsetPos returns a newly allocated [Position] with the same x and y position. // // Since: 2.4 func NewSquareOffsetPos(length float32) Position { return Position{length, length} } -// Add returns a new Position that is the result of offsetting the current +// Add returns a new [Position] that is the result of offsetting the current // position by p2 X and Y. func (p Position) Add(v Vector2) Position { // NOTE: Do not simplify to `return p.AddXY(v.Components())`, it prevents inlining. @@ -57,12 +59,12 @@ func (p Position) Add(v Vector2) Position { return Position{p.X + x, p.Y + y} } -// AddXY returns a new Position by adding x and y to the current one. +// AddXY returns a new [Position] by adding x and y to the current one. func (p Position) AddXY(x, y float32) Position { return Position{p.X + x, p.Y + y} } -// Components returns the X and Y elements of this Position +// Components returns the X and Y elements of p. func (p Position) Components() (float32, float32) { return p.X, p.Y } @@ -72,7 +74,7 @@ func (p Position) IsZero() bool { return p.X == 0.0 && p.Y == 0.0 } -// Subtract returns a new Position that is the result of offsetting the current +// Subtract returns a new [Position] that is the result of offsetting the current // position by p2 -X and -Y. func (p Position) Subtract(v Vector2) Position { // NOTE: Do not simplify to `return p.SubtractXY(v.Components())`, it prevents inlining. @@ -80,7 +82,7 @@ func (p Position) Subtract(v Vector2) Position { return Position{p.X - x, p.Y - y} } -// SubtractXY returns a new Position by subtracting x and y from the current one. +// SubtractXY returns a new [Position] by subtracting x and y from the current one. func (p Position) SubtractXY(x, y float32) Position { return Position{p.X - x, p.Y - y} } @@ -121,7 +123,7 @@ func (s Size) IsZero() bool { return s.Width == 0.0 && s.Height == 0.0 } -// Max returns a new Size that is the maximum of the current Size and s2. +// Max returns a new [Size] that is the maximum of the current Size and s2. func (s Size) Max(v Vector2) Size { x, y := v.Components() @@ -131,7 +133,7 @@ func (s Size) Max(v Vector2) Size { return NewSize(maxW, maxH) } -// Min returns a new Size that is the minimum of the current Size and s2. +// Min returns a new [Size] that is the minimum of s and v. func (s Size) Min(v Vector2) Size { x, y := v.Components() diff --git a/layout.go b/layout.go index f00b4a0cd8..8a3d8047ef 100644 --- a/layout.go +++ b/layout.go @@ -1,11 +1,11 @@ package fyne -// Layout defines how CanvasObjects may be laid out in a specified Size. +// Layout defines how [CanvasObject]s may be laid out in a specified Size. type Layout interface { - // Layout will manipulate the listed CanvasObjects Size and Position + // Layout will manipulate the listed [CanvasObject]s Size and Position // to fit within the specified size. Layout([]CanvasObject, Size) // MinSize calculates the smallest size that will fit the listed - // CanvasObjects using this Layout algorithm. + // [CanvasObject]s using this Layout algorithm. MinSize(objects []CanvasObject) Size } diff --git a/menu.go b/menu.go index e88215c36b..7a3c54736b 100644 --- a/menu.go +++ b/menu.go @@ -7,13 +7,13 @@ type systemTrayDriver interface { } // Menu stores the information required for a standard menu. -// A menu can pop down from a MainMenu or could be a pop out menu. +// A menu can pop down from a [MainMenu] or could be a pop out menu. type Menu struct { Label string Items []*MenuItem } -// NewMenu creates a new menu given the specified label (to show in a MainMenu) and list of items to display. +// NewMenu creates a new menu given the specified label (to show in a [MainMenu]) and list of items to display. func NewMenu(label string, items ...*MenuItem) *Menu { return &Menu{Label: label, Items: items} } diff --git a/notification.go b/notification.go index 340173de4f..a068623d85 100644 --- a/notification.go +++ b/notification.go @@ -5,7 +5,7 @@ type Notification struct { Title, Content string } -// NewNotification creates a notification that can be passed to App.SendNotification. +// NewNotification creates a notification that can be passed to [App.SendNotification]. func NewNotification(title, content string) *Notification { return &Notification{Title: title, Content: content} } diff --git a/overlay_stack.go b/overlay_stack.go index 69be64e472..eb7c9c7658 100644 --- a/overlay_stack.go +++ b/overlay_stack.go @@ -1,6 +1,6 @@ package fyne -// OverlayStack is a stack of CanvasObjects intended to be used as overlays of a Canvas. +// OverlayStack is a stack of [CanvasObject]s intended to be used as overlays of a [Canvas]. type OverlayStack interface { // Add adds an overlay on the top of the overlay stack. Add(overlay CanvasObject) diff --git a/resource.go b/resource.go index d2d3bb67d9..95e32370dd 100644 --- a/resource.go +++ b/resource.go @@ -16,8 +16,8 @@ type Resource interface { Content() []byte } -// ThemedResource is a version of a resource that can be updated to match a certain theme colour. -// The `ThemeColorName` will be used to look up the color for the current theme and colorize the resource. +// ThemedResource is a version of a resource that can be updated to match a certain theme color. +// The [ThemeColorName] will be used to look up the color for the current theme and colorize the resource. // // Since: 2.5 type ThemedResource interface { @@ -55,7 +55,7 @@ func NewStaticResource(name string, content []byte) *StaticResource { } } -// LoadResourceFromPath creates a new StaticResource in memory using the contents of the specified file. +// LoadResourceFromPath creates a new [StaticResource] in memory using the contents of the specified file. func LoadResourceFromPath(path string) (Resource, error) { bytes, err := os.ReadFile(filepath.Clean(path)) if err != nil { @@ -66,7 +66,7 @@ func LoadResourceFromPath(path string) (Resource, error) { return NewStaticResource(name, bytes), nil } -// LoadResourceFromURLString creates a new StaticResource in memory using the body of the specified URL. +// LoadResourceFromURLString creates a new [StaticResource] in memory using the body of the specified URL. func LoadResourceFromURLString(urlStr string) (Resource, error) { res, err := http.Get(urlStr) if err != nil { diff --git a/settings.go b/settings.go index b6ad42c144..9475d0cc3e 100644 --- a/settings.go +++ b/settings.go @@ -8,7 +8,7 @@ const ( BuildStandard BuildType = iota // BuildDebug is used when a developer would like more information and visual output for app debugging. BuildDebug - // BuildRelease is a final production build, it is like BuildStandard but will use distribution certificates. + // BuildRelease is a final production build, it is like [BuildStandard] but will use distribution certificates. // A release build is typically going to connect to live services and is not usually used during development. BuildRelease ) diff --git a/shortcut.go b/shortcut.go index ebe33ea0e3..4fcef3cae0 100644 --- a/shortcut.go +++ b/shortcut.go @@ -5,7 +5,7 @@ import ( ) // ShortcutHandler is a default implementation of the shortcut handler -// for the canvasObject +// for [CanvasObject]. type ShortcutHandler struct { entry sync.Map // map[string]func(Shortcut) } @@ -50,16 +50,16 @@ type ShortcutPaste struct { var _ KeyboardShortcut = (*ShortcutPaste)(nil) -// Key returns the KeyName for this shortcut. +// Key returns the [KeyName] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutPaste) Key() KeyName { return KeyV } -// Mod returns the KeyModifier for this shortcut. +// Mod returns the [KeyModifier] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutPaste) Mod() KeyModifier { return KeyModifierShortcutDefault } @@ -76,16 +76,16 @@ type ShortcutCopy struct { var _ KeyboardShortcut = (*ShortcutCopy)(nil) -// Key returns the KeyName for this shortcut. +// Key returns the [KeyName] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutCopy) Key() KeyName { return KeyC } -// Mod returns the KeyModifier for this shortcut. +// Mod returns the [KeyModifier] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutCopy) Mod() KeyModifier { return KeyModifierShortcutDefault } @@ -102,16 +102,16 @@ type ShortcutCut struct { var _ KeyboardShortcut = (*ShortcutCut)(nil) -// Key returns the KeyName for this shortcut. +// Key returns the [KeyName] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutCut) Key() KeyName { return KeyX } -// Mod returns the KeyModifier for this shortcut. +// Mod returns the [KeyModifier] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutCut) Mod() KeyModifier { return KeyModifierShortcutDefault } @@ -126,16 +126,16 @@ type ShortcutSelectAll struct{} var _ KeyboardShortcut = (*ShortcutSelectAll)(nil) -// Key returns the KeyName for this shortcut. +// Key returns the [KeyName] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutSelectAll) Key() KeyName { return KeyA } -// Mod returns the KeyModifier for this shortcut. +// Mod returns the [KeyModifier] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutSelectAll) Mod() KeyModifier { return KeyModifierShortcutDefault } @@ -152,16 +152,16 @@ type ShortcutUndo struct{} var _ KeyboardShortcut = (*ShortcutUndo)(nil) -// Key returns the KeyName for this shortcut. +// Key returns the [KeyName] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutUndo) Key() KeyName { return KeyZ } -// Mod returns the KeyModifier for this shortcut. +// Mod returns the [KeyModifier] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutUndo) Mod() KeyModifier { return KeyModifierShortcutDefault } @@ -178,16 +178,16 @@ type ShortcutRedo struct{} var _ KeyboardShortcut = (*ShortcutRedo)(nil) -// Key returns the KeyName for this shortcut. +// Key returns the [KeyName] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutRedo) Key() KeyName { return KeyY } -// Mod returns the KeyModifier for this shortcut. +// Mod returns the [KeyModifier] for this shortcut. // -// Implements: KeyboardShortcut +// Implements: [KeyboardShortcut] func (se *ShortcutRedo) Mod() KeyModifier { return KeyModifierShortcutDefault } diff --git a/text.go b/text.go index 3c8b6df12f..a300811184 100644 --- a/text.go +++ b/text.go @@ -41,7 +41,7 @@ const ( // TextTruncate trims the text to the widget's width, no wrapping is applied. // If an entry is asked to truncate it will provide scrolling capabilities. // - // Deprecated: Use `TextTruncateClip` value of the widget `Truncation` field instead + // Deprecated: Use [TextTruncateClip] value of the widget `Truncation` field instead TextTruncate // TextWrapBreak trims the line of characters to the widget's width adding the excess as new line. // An Entry with text wrapping will scroll vertically if there is not enough space for all the text. @@ -62,7 +62,7 @@ type TextStyle struct { // Since: 2.1 TabWidth int // Width of tabs in spaces // Since: 2.5 - // Currently only supported by the TextGrid widget. + // Currently only supported by [fyne.io/fyne/v2/widget.TextGrid]. Underline bool // Should text be underlined. } diff --git a/uri.go b/uri.go index 4cde1a1e04..a4228306d2 100644 --- a/uri.go +++ b/uri.go @@ -26,9 +26,9 @@ type URIWriteCloser interface { // system. // // In general, it is expected that URI implementations follow IETF RFC3896. -// Implementations are highly recommended to utilize net/url to implement URI -// parsing methods, especially Scheme(), AUthority(), Path(), Query(), and -// Fragment(). +// Implementations are highly recommended to utilize [net/url] to implement URI +// parsing methods, especially [net/url/url.Scheme], [net/url/url.Authority], +// [net/url/url.Path], [net/url/url.Query], and [net/url/url.Fragment]. type URI interface { fmt.Stringer @@ -39,7 +39,7 @@ type URI interface { Extension() string // Name should return the base name of the item referenced by the URI. - // For example, the Name() of 'file://foo/bar.baz' is 'bar.baz'. + // For example, the name of 'file://foo/bar.baz' is 'bar.baz'. Name() string // MimeType should return the content type of the resource referenced @@ -57,8 +57,8 @@ type URI interface { // Authority should return the URI authority, as defined by IETF // RFC3986. // - // NOTE: the RFC3986 can be obtained by combining the User and Host - // Fields of net/url's URL structure. Consult IETF RFC3986, section + // NOTE: the RFC3986 can be obtained by combining the [net/url.URL.User] + // and [net/url.URL.Host]. Consult IETF RFC3986, section // 3.2, pp. 17. // // Since: 2.0 @@ -81,7 +81,7 @@ type URI interface { Fragment() string } -// ListableURI represents a URI that can have child items, most commonly a +// ListableURI represents a [URI] that can have child items, most commonly a // directory on disk in the native filesystem. // // Since: 1.4 @@ -92,7 +92,7 @@ type ListableURI interface { List() ([]URI, error) } -// URIWithIcon describes a URI that should be rendered with a certain icon in file browsers. +// URIWithIcon describes a [URI] that should be rendered with a certain icon in file browsers. // // Since: 2.5 type URIWithIcon interface { diff --git a/widget.go b/widget.go index 07741aa976..644a7a456c 100644 --- a/widget.go +++ b/widget.go @@ -1,33 +1,33 @@ package fyne -// Widget defines the standard behaviours of any widget. This extends the -// CanvasObject - a widget behaves in the same basic way but will encapsulate +// Widget defines the standard behaviours of any widget. This extends +// [CanvasObject]. A widget behaves in the same basic way but will encapsulate // many child objects to create the rendered widget. type Widget interface { CanvasObject - // CreateRenderer returns a new WidgetRenderer for this widget. + // CreateRenderer returns a new [WidgetRenderer] for this widget. // This should not be called by regular code, it is used internally to render a widget. CreateRenderer() WidgetRenderer } // WidgetRenderer defines the behaviour of a widget's implementation. -// This is returned from a widget's declarative object through the CreateRenderer() -// function and should be exactly one instance per widget in memory. +// This is returned from a widget's declarative object through [Widget.CreateRenderer] +// and should be exactly one instance per widget in memory. type WidgetRenderer interface { // Destroy is a hook that is called when the renderer is being destroyed. // This happens at some time after the widget is no longer visible, and - // once destroyed a renderer will not be reused. + // once destroyed, a renderer will not be reused. // Renderers should dispose and clean up any related resources, if necessary. Destroy() // Layout is a hook that is called if the widget needs to be laid out. - // This should never call Refresh. + // This should never call [Refresh]. Layout(Size) // MinSize returns the minimum size of the widget that is rendered by this renderer. MinSize() Size // Objects returns all objects that should be drawn. Objects() []CanvasObject // Refresh is a hook that is called if the widget has updated and needs to be redrawn. - // This might trigger a Layout. + // This might trigger a [Layout]. Refresh() } diff --git a/window.go b/window.go index 3e366acb96..e47bf778dc 100644 --- a/window.go +++ b/window.go @@ -65,7 +65,7 @@ type Window interface { SetOnClosed(func()) // SetCloseIntercept sets a function that runs instead of closing if defined. - // Close() should be called explicitly in the interceptor to close the window. + // [Window.Close] should be called explicitly in the interceptor to close the window. // // Since: 1.4 SetCloseIntercept(func())