Documentation
¶
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
- func Background(c *swt.Composite)
- func Button(b *swt.Button, subtle, circle, border bool)
- func ButtonKind(b *swt.Button, primary, destructive bool)
- func ButtonOf(c *swt.Control) *swt.Button
- func ComboHeight(c *swt.Combo, dips int)
- func ExtraHeight(t *swt.Text) int
- func FlatBorder(c *swt.Control)
- func Glass(c *swt.Composite, on bool)
- func GlassBorder(c *swt.Control, on bool)
- func GlassFocusRing(ctl *swt.Control, on bool)
- func GlassRadius(c *swt.Composite, r float64)
- func List(l *swt.List, rowDips int)
- func Progress(b *swt.ProgressBar)
- func Scale(s *swt.Scale)
- func Shell(s *swt.Shell)
- func SidebarList(l *swt.List)
- func SidebarTable(t *swt.Table, rowDips int)
- func SidebarTree(t *swt.Tree, rowDips int)
- func Spinner(s *swt.Spinner)
- func Table(t *swt.Table, rowDips int)
- func Text(t *swt.Text)
- func Tree(t *swt.Tree, rowDips int)
- func Unframe(c *swt.Control, s *surface)
- type Palette
- type RGB
Constants ¶
const Capsule = -1
Capsule is the radius that makes the shorter side a half circle, as look.Capsule.
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 ¶
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 ¶
Button repaints a push button in the WinUI 3 style. Each flag adds to what an earlier call set.
func ButtonKind ¶
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 ComboHeight ¶
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 ¶
ExtraHeight is the height in points the frame takes from the client area of a multi-line Text.
func FlatBorder ¶
FlatBorder replaces the 3D edge (WS_EX_CLIENTEDGE) by a flat 1 px hairline with square corners.
func Glass ¶
Glass turns the surface on or off; on, the Text fields inside c lose their frame and take the fill.
func GlassBorder ¶
GlassBorder sets the hairline of the surface of c, a container or a push button.
func GlassFocusRing ¶
func GlassRadius ¶
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 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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.
Types ¶
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 ¶
Current returns the palette for the content of d: dark when look.SetDarkContent turned it on.
func (Palette) Card ¶
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 ¶
Layer is the colour of the window background in WinUI 3: F3F3F3 light, 202020 dark.
func (Palette) StrongStroke ¶
StrongStroke is the bottom edge of an input at rest, WinUI's ControlStrongStroke.