Class ThemePreview
That is the whole point of it, and the reason it draws itself instead of holding real
widgets. Every widget in this toolkit reads Theme.current() as it paints, so a
preview built out of a Button and a Label would show whichever palette
the application is wearing, which is either the one being edited (in which case the
preview says nothing the surrounding window does not) or the wrong one entirely.
It also shows what a running application does not: the hover and pressed states of the accent, a disabled control, a popover above a card, and all four semantic tones, all at once and without having to be interacted with. Those are the tones a palette author cannot see while choosing them, and they are where a hand-built palette goes wrong.
Not a rendering of the toolkit's real chrome, and it does not try to be: it is a swatch board with the shapes of a window, held deliberately simple so that a change to a component's paint cannot silently make the preview a lie.
-
Constructor Summary
ConstructorsConstructorDescriptionThemePreview(Theme theme) A preview oftheme, which is never read fromTheme.current(). -
Method Summary
Modifier and TypeMethodDescriptionprotected SizeonMeasure(Constraints constraints) Reports the size this widget wants withinconstraints.protected voidWidget's own background/content, in local coordinates.Shows another palette.theme()The palette being previewed.Methods inherited from class limn.scene.Widget
acceptsTextInput, add, baselineOffset, baselineOffsetOf, caretRect, children, clipboard, clipsChildren, controlSize, cursor, declaredControlSize, declaredLayoutDirection, declaredLocale, focusArrivedByTraversal, height, hitTest, imageCursor, invalidate, invalidate, isEnabled, isFocusable, isFocused, isShowing, isVisible, layoutBox, layoutDirection, locale, localToSceneX, localToSceneY, markNeedsContainedLayout, markNeedsLayout, measure, moveChild, neutralBase, onAttached, onCharTyped, onDetached, onFileDrop, onFocusGained, onFocusLost, onKeyEvent, onLayout, onMouseEvent, onPaintOverlay, onPreedit, overlayPassesPointer, paintChildren, paintOutset, paintWidget, parent, remove, requestFocus, revealInView, scene, sceneToLocalX, sceneToLocalY, setControlSize, setCursor, setEnabled, setFocusable, setImageCursor, setInheritanceHost, setLayoutDirection, setLocale, setTooltip, setTooltip, setVisible, shapeText, textRuler, tooltip, width, x, y
-
Constructor Details
-
ThemePreview
A preview oftheme, which is never read fromTheme.current().
-
-
Method Details
-
theme
The palette being previewed. -
setTheme
Shows another palette. Repaints; never re-lays out, since the geometry is fixed. -
onMeasure
Description copied from class:WidgetReports the size this widget wants withinconstraints. Called once per layout pass, and the result is cached against the constraints and the resolved axes (size step, layout direction, locale), so it must be a pure function of them and of this widget's own state.Resolve the
ControlSizeand theLayoutDirectiononce each here and thread them down; never read either in a constructor. The locale needs no threading: it is in scope, andI18n.locale()answers it wherever text is resolved. -
onPaint
Description copied from class:WidgetWidget's own background/content, in local coordinates.
-