Klasse Style

java.lang.Object
net.risingworld.api.ui.style.Style

public class Style extends Object
Represents the style of an UIElement. The style describes the visual appearance and transformation of the UI element.

It is mostly based on Unitys IStyle: https://docs.unity3d.com/ScriptReference/UIElements.IStyle.html
  • Felddetails

    • display

      public final StyleEnum<DisplayStyle> display
      Changes the visibility of the element, but also affects the layout. If set to DisplayStyle.None, it acts like the element was removed from the hierarchy
    • visibility

      public final StyleEnum<Visibility> visibility
      Changes the visibility of the element without affecting the layout
    • left

      public final StyleLength left
      Sets the left distance of the element to the parent box
    • top

      public final StyleLength top
      Sets the top distance of the element to the parent box
    • bottom

      public final StyleLength bottom
      Sets the bottom distance of the element to the parent box
    • marginLeft

      public final StyleLength marginLeft
      Sets reserved space for the left edge of the margin
    • marginRight

      public final StyleLength marginRight
      Sets reserved space for the right edge of the margin
    • marginTop

      public final StyleLength marginTop
      Sets reserved space for the top edge of the margin
    • marginBottom

      public final StyleLength marginBottom
      Sets reserved space for the bottom edge of the margin
    • paddingLeft

      public final StyleLength paddingLeft
      Sets reserved space for the left edge of the padding
    • paddingRight

      public final StyleLength paddingRight
      Sets reserved space for the right edge of the padding
    • paddingTop

      public final StyleLength paddingTop
      Sets reserved space for the top edge of the padding
    • paddingBottom

      public final StyleLength paddingBottom
      Sets reserved space for the bottom edge of the padding
    • width

      public final StyleLength width
      Sets a fixed width for the element
    • height

      public final StyleLength height
      Sets a fixed height for the element
    • minWidth

      public final StyleLength minWidth
      Sets a minimum width for the element
    • minHeight

      public final StyleLength minHeight
      Sets a minimum height for the element
    • maxWidth

      public final StyleLength maxWidth
      Sets a maximum width for the element
    • maxHeight

      public final StyleLength maxHeight
      Sets a maximum height for the element
    • borderLeftWidth

      public final StyleFloat borderLeftWidth
      Sets the width of an optional border on the left edge of the element
    • borderRightWidth

      public final StyleFloat borderRightWidth
      Sets the width of an optional border on the right edge of the element
    • borderTopWidth

      public final StyleFloat borderTopWidth
      Sets the width of an optional border on the top edge of the element
    • borderBottomWidth

      public final StyleFloat borderBottomWidth
      Sets the width of an optional border on the bottom edge of the element
    • borderLeftColor

      public final StyleColor borderLeftColor
      If a left border is used, this determines the color of the border
    • borderRightColor

      public final StyleColor borderRightColor
      If a right border is used, this determines the color of the border
    • borderTopColor

      public final StyleColor borderTopColor
      If a top border is used, this determines the color of the border
    • borderBottomColor

      public final StyleColor borderBottomColor
      If a bottom border is used, this determines the color of the border
    • borderTopLeftRadius

      public final StyleLength borderTopLeftRadius
      Sets the radius for the top-left corner (to create a rounded corner)
    • borderTopRightRadius

      public final StyleLength borderTopRightRadius
      Sets the radius for the top-right corner (to create a rounded corner)
    • borderBottomLeftRadius

      public final StyleLength borderBottomLeftRadius
      Sets the radius for the bottom-left corner (to create a rounded corner)
    • borderBottomRightRadius

      public final StyleLength borderBottomRightRadius
      Sets the radius for the bottom-right corner (to create a rounded corner)
    • color

      public final StyleColor color
      Sets the color of the element (not to be confused with backgroundColor)
    • backgroundColor

      public final StyleColor backgroundColor
      Sets the background color of the element (not to be confused with color or backgroundImageTintColor when using images)
    • opacity

      public final StyleFloat opacity
      Sets the opacity / alpha value of the element
    • overflow

      public final StyleEnum<Overflow> overflow
      Determines how a container behaves if its content overflows its own box
    • overflowClipBox

      public final StyleEnum<OverflowClipBox> overflowClipBox
      Determines which box the element content is clipped against
    • rotate

      public final StyleFloat rotate
      Sets a rotation transformation
    • translate

      public final StyleTranslate translate
      Sets a translate transformation
    • scale

      public final StyleScale scale
      Sets a scale transformation
    • transformOrigin

      public final StyleTransformOrigin transformOrigin
      Determines the point / pivot around which a transformation is applied
    • position

      public final StyleEnum<Position> position
      Determines if this element should have a relative (default) or absolute position
    • flexBasis

      public final StyleLength flexBasis
      Determines the initial main size of a flexible item on the main axis / direction
    • flexDirection

      public final StyleEnum<FlexDirection> flexDirection
      Determines the main axis for the children layout in this container
    • flexGrow

      public final StyleFloat flexGrow
      Determines how items will grow relative to the rest of flexible items in the same container
    • flexShrink

      public final StyleFloat flexShrink
      Determines how items will shrink relative to the rest of flexible items in the same container
    • flexWrap

      public final StyleEnum<Wrap> flexWrap
      Determines placement of children over multiple lines if there is not enough space in this container
    • justifyContent

      public final StyleEnum<Justify> justifyContent
      Determines justification of the children on the main axis inside this container
    • alignContent

      public final StyleEnum<Align> alignContent
      Determines the alignment of the content on the cross axis if they spawn over multiple lines
    • alignItems

      public final StyleEnum<Align> alignItems
      Determines the alignment of the children on the cross axis
    • alignSelf

      public final StyleEnum<Align> alignSelf
      Similar to alignItems, but only for this specific element
    • font

      public final StyleEnum<Font> font
      Sets the font (for texts / labels)
    • fontSize

      public final StyleLength fontSize
      Sets the font size (for text / labels)
    • fontStyleAndWeight

      public final StyleEnum<FontStyle> fontStyleAndWeight
      Sets the font style and weight (normal, bold, italic) (for text / labels)
    • paragraphSpacing

      public final StyleLength paragraphSpacing
      Sets the space between paragraphs (for text / labels)
    • letterSpacing

      public final StyleLength letterSpacing
      Sets the space between characters (for text / labels)
    • whiteSpace

      public final StyleEnum<WhiteSpace> whiteSpace
      Determines word wrap over multiple lines if there is not enough space to display the text
    • textAlign

      public final StyleEnum<TextAnchor> textAlign
      Sets the vertical and horizontal text alignment (for text / labels)
    • textOutlineColor

      public final StyleColor textOutlineColor
      Sets a color for an optional text outline
    • textOutlineWidth

      public final StyleFloat textOutlineWidth
      Sets an optional text outline (determines the width)
    • wordSpacing

      public final StyleLength wordSpacing
      Sets the space between words (for text / labels)
    • backgroundImageTintColor

      public final StyleColor backgroundImageTintColor
      If an image is used, this determines the tint color of the image (i.e the color the image gets multipled with)
    • backgroundImageScaleMode

      public final StyleEnum<ScaleMode> backgroundImageScaleMode
      If an image is used, this determines how it's scaled inside the element box
    • backgroundImage

      public final StyleImage backgroundImage
      Sets a background image for this element
  • Konstruktordetails

    • Style

      public Style()
      Creates a new, empty style.
    • Style

      public Style(Style copyFrom)
      Creates a new style which copies all properties from an existing style.
      Parameter:
      copyFrom - the other style you want to copy the properties from.
  • Methodendetails

    • copy

      public void copy(Style source)
      Copies all style properties from another style to this style
      Parameter:
      source - the style you want to copy the properties from.
    • reset

      public void reset()
      Resets all style properties