fluent

package
v0.15.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: EPL-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Rendered for windows/amd64

Overview

Package fluent gives native Win32 controls the Windows 11 (WinUI 3) look: text boxes, flat borders, subtle and standard buttons, a rounded input surface and the Explorer selection of tables. The controls stay SWT widgets; the frame is painted in their non-client area from a window subclass.

Index

Constants

View Source
const Capsule = -1

Capsule is the radius that makes the shorter side a half circle, as look.Capsule.

View Source
const (

	// SpinnerExtra is the width in dips the framed field needs beyond the native Spinner.
	SpinnerExtra = 24
)

Variables

This section is empty.

Functions

func Background

func Background(c *swt.Composite)

Background gives the window the Fluent background; labels, groups and tab pages inherit it, inputs and tables keep their own. Windows 11 has no system colour for it, GetSysColor still answers F0F0F0.

func Button

func Button(b *swt.Button, subtle, circle, border bool)

Button repaints a push or toggle button in the WinUI 3 style; a toggle that is on has the accent fill of a checked ToggleButton. Each flag adds to what an earlier call set.

func ButtonKind

func ButtonKind(b *swt.Button, primary, destructive bool)

ButtonKind gives a push button the solid fill of a WinUI accent button (primary). A destructive one stays a standard button, as on macOS, unless it is primary too: that is the critical fill.

func ButtonOf

func ButtonOf(c *swt.Control) *swt.Button

ButtonOf returns c as a push button, or nil.

func Chevron

func Chevron(b *swt.Button)

Chevron paints an ARROW button as the chevron of a WinUI Expander: no fill until the pointer is over it, pointing down for the DOWN alignment and right otherwise.

func ComboHeight

func ComboHeight(c *swt.Combo, dips int)

ComboHeight sizes the closed combo through its selection field: SWT spends the layout height on the drop-down list. The themed box is 6 px taller than the field; a font change resets the field, so a Resize listener sets it again.

func ExtraHeight

func ExtraHeight(t *swt.Text) int

ExtraHeight is the height in points the frame takes from the client area of a multi-line Text.

func FlatBorder

func FlatBorder(c *swt.Control)

FlatBorder replaces the 3D edge (WS_EX_CLIENTEDGE) by a flat 1 px hairline with square corners.

func Glass

func Glass(c *swt.Composite, on bool)

Glass turns the surface on or off; on, the Text fields inside c lose their frame and take the fill.

func GlassBorder

func GlassBorder(c *swt.Control, on bool)

GlassBorder sets the hairline of the surface of c, a container or a push button.

func GlassFocusRing

func GlassFocusRing(ctl *swt.Control, on bool)

func GlassRadius

func GlassRadius(c *swt.Composite, r float64)

func List

func List(l *swt.List, rowDips int)

List gives l the Windows 11 rows; rowDips is the row height, 0 keeps the native one.

func Progress

func Progress(b *swt.ProgressBar)

Progress gives a horizontal ProgressBar the Windows 11 look, with its own animation for the indeterminate bar; the native control keeps the value, range and state.

func Scale

func Scale(s *swt.Scale)

Scale gives a horizontal Scale the Windows 11 look.

func Segment

func Segment(b *swt.Button, i, n int)

Segment paints toggle button b as segment i of n of one WinUI segmented control: the segments share a rounded frame on a subtle fill, and the one that is on is a raised card with an accent pill under its content. The buttons must touch, with no gap between them.

func SetAffix

func SetAffix(t *swt.Text, a Affix) (width int)

SetAffix shows a in the non-client area of a Text framed by Text, in its font and the WinUI secondary text colour; the client area, where the edit draws the value, keeps clear of it. It returns the dips the affixes take, which SWT's preferred width of the edit leaves out.

func SetFieldFill

func SetFieldFill(t *swt.Text, radius int)

SetFieldFill makes the frame of a single-line Text the rounded fill of the control's background colour, without the hairline; radius is in dips. The caret, the focus accent and the affixes stay.

func SetFieldInset

func SetFieldInset(t *swt.Text, x int)

SetFieldInset widens the padding between the frame of a Text and its text by x dips.

func SetFieldStroke

func SetFieldStroke(t *swt.Text, r, g, b, a uint8)

SetFieldStroke draws a border of the RGBA colour around the frame of a single-line Text; the colour is blended over the fill, as the frame paints in plain RGB.

func Shell

func Shell(s *swt.Shell)

Shell hides the focus rectangles of a window until the keyboard is used, as Windows 11 apps do: a click on a Link, Button, check box, Table or Tree leaves no dotted rectangle. The rule is one display filter, not a change of each widget: a mouse press sets UISF_HIDEFOCUS on the window of the control, Tab, an arrow key or Space clears it.

func SidebarList

func SidebarList(l *swt.List)

SidebarList makes l a sidebar list: the window background, a pill that spans the List and text sidebarIconPad inside it. Call it after List.

func SidebarTable

func SidebarTable(t *swt.Table, rowDips int)

SidebarTable makes t a sidebar list: it takes the window background instead of the white of an input surface, rows are rowDips high (0 keeps the native height), and the icon and text of the first column are drawn with the sidebar insets. Call it after Table.

func SidebarTree

func SidebarTree(t *swt.Tree, rowDips int)

SidebarTree makes t a sidebar tree: the window background instead of the white of an input surface, and a pill that spans the Tree, the pane giving the side margin. Call it after Tree.

func Spinner

func Spinner(s *swt.Spinner)

Spinner gives s the WinUI 3 NumberBox look with compact spin buttons. The edit and the up-down control stay native; only the frame and the buttons are painted.

func Table

func Table(t *swt.Table, rowDips int)

Table hooks EraseItem so SWT paints the Explorer selection once per row, not per cell (the seams between columns), drops the dotted focus rectangle until a key is used, and draws images of right and centre columns aligned. rowDips is the row height, 0 keeps the native one.

func Text

func Text(t *swt.Text)

Text gives t the WinUI 3 TextBox look: 4 px radius, hairline, strong bottom edge, accent line while focused. The native border goes; the frame is painted in the non-client area.

func Tree

func Tree(t *swt.Tree, rowDips int)

Tree gives the rows of a Tree the pill selection of Table; rowDips is the row height, 0 keeps the native one.

func Unframe

func Unframe(c *swt.Control, s *surface)

Unframe leaves the frame of a Text made by Text to the surface s around it; the text keeps clear of the rounded corners of s.

Types

type Affix

type Affix struct {
	Prefix, Suffix string
	Image          *swt.Image // drawn instead of Prefix
	// Drag makes the prefix a scrub handle: a drag reports each horizontal move in points, a click
	// without a move focuses the Text with its text selected.
	Drag func(dx float64, shift bool)
}

Affix is what SetAffix shows inside the frame of a single-line Text around its value.

type Palette

type Palette struct {
	Dark     bool
	Accent   RGB
	OnAccent RGB
	Text     RGB
	Disabled RGB
	Fill     RGB // input surface
	Black    RGB // the colour that tints light surfaces: black on light, white on dark
}

Palette holds the WinUI 3 colours of the light or the dark theme and the system accent.

func Current

func Current(d *swt.Display) Palette

Current returns the palette for the content of d: dark when look.SetDarkContent turned it on.

func (Palette) Card

func (p Palette) Card() RGB

Card is the fill of a card on the window background: white at 70% in the light theme, white at 5% in the dark one (CardBackgroundFillColorDefault).

func (Palette) Layer

func (p Palette) Layer() RGB

Layer is the colour of the window background in WinUI 3: F3F3F3 light, 202020 dark.

func (Palette) Stroke

func (p Palette) Stroke(bg RGB) RGB

Stroke is the hairline of a surface: 12% of the tint over bg.

func (Palette) StrongStroke

func (p Palette) StrongStroke(bg RGB) RGB

StrongStroke is the bottom edge of an input at rest, WinUI's ControlStrongStroke.

type RGB

type RGB struct{ R, G, B uint8 }

RGB is an opaque colour.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL