Back to Serenity

Widget

Base/usr/share/man/man5/GML/Widget.md

latest7.2 KB
Original Source

Widget

Defines a GUI widget.

gml
@GUI::Widget {
  min_width: 200
  preferred_width: "opportunistic_grow"
  fixed_height: 215
  fill_with_background_color: true
  layout: @GUI::VerticalBoxLayout {

  }
}

Registered Properties

PropertyTypePossible valuesDescription
xintx offset relative to parent
yinty offset relative to parent
visibleboolWhether widget and children are drawn
focusedboolWhether widget should be tab-focused on start
focus_policyenumClickFocus, NoFocus, TabFocus, StrongFocusHow the widget can receive focus
enabledboolWhether this widget is enabled for interactive purposes, e.g. can be clicked
tooltipstringMouse tooltip to show when hovering over this widget
min_sizeui_size{Regular, Shrink}²Minimum size this widget wants to occupy (Shrink is equivalent to 0)
max_sizeui_size{Regular, Grow}²Maximum size this widget wants to occupy
preferred_sizeui_size{Regular, Shrink, Fit, OpportunisticGrow, Grow}²Preferred size this widget wants to occupy, if not otherwise constrained (Shrink means min_size)
widthintWidth of the widget, independent of its layout size calculation
heightintHeight of the widget, independent of its layout size calculation
min_widthui_dimensionRegular, ShrinkMinimum width this widget wants to occupy (Shrink is equivalent to 0)
min_heightui_dimensionRegular, ShrinkMinimum height this widget wants to occupy (Shrink is equivalent to 0
max_widthui_dimensionRegular, GrowMaximum width this widget wants to occupy
max_heightui_dimensionRegular, GrowMaximum height this widget wants to occupy
preferred_widthui_dimensionRegular, Shrink, Fit, OpportunisticGrow, GrowPreferred width this widget wants to occupy, if not otherwise constrained (Shrink means min_size)
preferred_heightui_dimensionRegular, Shrink, Fit, OpportunisticGrow, GrowPreferred height this widget wants to occupy, if not otherwise constrained (Shrink means min_size)
fixed_widthui_dimensionRegular (currently only integer values ≥0 allowed)Both maximum and minimum width; widget is fixed-width
fixed_heightui_dimensionRegular (currently only integer values ≥0 allowed)Both maximum and minimum height; widget is fixed-height
fixed_sizeui_size{Regular}²Both maximum and minimum size; widget is fixed-size
shrink_to_fitboolWhether the widget shrinks as much as possible while still respecting its children's minimum sizes
fontstringAny system-known fontFont family
font_sizeintFont size that is available on this familyFont size
font_weightfont_weightFont weight that is available on this family and sizeFont weight
font_typeenumFixedWidth, NormalFont type
foreground_colorcolorColor of foreground elements such as text
foreground_rolestringAny theme palette color role namePalette color role (depends on system theme) for the foreground elements
background_colorcolorColor of the widget background
background_rolestringAny theme palette color role namePalette color role (depends on system theme) for the widget background
fill_width_background_colorboolWhether to fill the widget's background with the background color
layoutlayout objectLayout object for layouting this widget's children
relative_rectrectRectangle for relatively positioning the widget to the parent