Class ToolBar
Separators…) on a rounded Theme.surface background. Lays its
items out from the leading edge, vertically centered, with a configurable gap. Purely
a styled container: the items handle their own input.
The strip follows its resolved LayoutDirection: reading left to right the first
item added is the leftmost, reading right to left it is the rightmost, and the order in
between is the order it was added in either way. Only the placed coordinate moves — the
padding, the gap and the measured width are the same numbers in both directions, so a bar
cannot change size by changing side.
Sizes follow the ControlSize resolved on this widget: the padding on all four
edges, the default gap and the inset of the separators addSeparator() builds come
from the SizeTokens row; the border weight comes from Strokes and is the
same at every step, which is what makes a bar and the buttons inside it read as one object.
The bar has no height table of its own: its height stays
tallestChild + 2 * toolBarPad. Giving it one would let a bar full of MEDIUM buttons
disagree with itself about how tall those buttons are, depending only on the bar's own step.
Items added through addItem(limn.scene.Widget) are children, so they inherit the bar's step: that
propagation is the whole point of setting a step on a toolbar.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an item to the end of the bar.Adds a vertical divider between items, inset per the bar's step.gap(float newGap) Overrides the gap between items, in points.protected voidonLayout()Containers position children here (measure +Widget.layoutBox(float, float, float, float)per child).protected SizeonMeasure(Constraints constraints) Reports the size this widget wants withinconstraints.protected voidWidget's own background/content, in local coordinates.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, 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
-
ToolBar
public ToolBar()
-
-
Method Details
-
addItem
Adds an item to the end of the bar. -
addSeparator
Adds a vertical divider between items, inset per the bar's step. -
gap
Overrides the gap between items, in points. Latches: the value survives every laterControlSizechange. Leave it alone to follow the step'stoolBarGap. -
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. -
onLayout
protected void onLayout()Description copied from class:WidgetContainers position children here (measure +Widget.layoutBox(float, float, float, float)per child). -
onPaint
Description copied from class:WidgetWidget's own background/content, in local coordinates.
-