Package net.risingworld.api.ui.style
Class Style
java.lang.Object
net.risingworld.api.ui.style.Style
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
It is mostly based on Unitys IStyle: https://docs.unity3d.com/ScriptReference/UIElements.IStyle.html
-
Field Summary
Modifier and TypeFieldDescriptionDetermines the alignment of the content on the cross axis if they spawn over multiple linesDetermines the alignment of the children on the cross axisSimilar toalignItems
, but only for this specific elementfinal StyleColor
Sets the background color of the element (not to be confused withcolor
orbackgroundImageTintColor
when using images)final StyleImage
Sets a background image for this elementIf an image is used, this determines how it's scaled inside the element boxfinal StyleColor
If an image is used, this determines the tint color of the image (i.e the color the image gets multipled with)final StyleColor
If a bottom border is used, this determines the color of the borderfinal StyleLength
Sets the radius for the bottom-left corner (to create a rounded corner)final StyleLength
Sets the radius for the bottom-right corner (to create a rounded corner)final StyleFloat
Sets the width of an optional border on the bottom edge of the elementfinal StyleColor
If a left border is used, this determines the color of the borderfinal StyleFloat
Sets the width of an optional border on the left edge of the elementfinal StyleColor
If a right border is used, this determines the color of the borderfinal StyleFloat
Sets the width of an optional border on the right edge of the elementfinal StyleColor
If a top border is used, this determines the color of the borderfinal StyleLength
Sets the radius for the top-left corner (to create a rounded corner)final StyleLength
Sets the radius for the top-right corner (to create a rounded corner)final StyleFloat
Sets the width of an optional border on the top edge of the elementfinal StyleLength
Sets the bottom distance of the element to the parent boxfinal StyleColor
Sets the color of the element (not to be confused withbackgroundColor
)final StyleEnum<DisplayStyle>
Changes the visibility of the element, but also affects the layout.final StyleLength
Determines the initial main size of a flexible item on the main axis / directionfinal StyleEnum<FlexDirection>
Determines the main axis for the children layout in this containerfinal StyleFloat
Determines how items will grow relative to the rest of flexible items in the same containerfinal StyleFloat
Determines how items will shrink relative to the rest of flexible items in the same containerDetermines placement of children over multiple lines if there is not enough space in this containerSets the font (for texts / labels)final StyleLength
Sets the font size (for text / labels)Sets the font style and weight (normal, bold, italic) (for text / labels)final StyleLength
Sets a fixed height for the elementDetermines justification of the children on the main axis inside this containerfinal StyleLength
Sets the left distance of the element to the parent boxfinal StyleLength
Sets the space between characters (for text / labels)final StyleLength
Sets reserved space for the bottom edge of the marginfinal StyleLength
Sets reserved space for the left edge of the marginfinal StyleLength
Sets reserved space for the right edge of the marginfinal StyleLength
Sets reserved space for the top edge of the marginfinal StyleLength
Sets a maximum height for the elementfinal StyleLength
Sets a maximum width for the elementfinal StyleLength
Sets a minimum height for the elementfinal StyleLength
Sets a minimum width for the elementfinal StyleFloat
Sets the opacity / alpha value of the elementDetermines how a container behaves if its content overflows its own boxfinal StyleEnum<OverflowClipBox>
Determines which box the element content is clipped againstfinal StyleLength
Sets reserved space for the bottom edge of the paddingfinal StyleLength
Sets reserved space for the left edge of the paddingfinal StyleLength
Sets reserved space for the right edge of the paddingfinal StyleLength
Sets reserved space for the top edge of the paddingfinal StyleLength
Sets the space between paragraphs (for text / labels)Determines if this element should have a relative (default) or absolute positionfinal StyleLength
Sets the right distance of the element to the parent boxfinal StyleFloat
Sets a rotation transformationfinal StyleScale
Sets a scale transformationfinal StyleEnum<TextAnchor>
Sets the vertical and horizontal text alignment (for text / labels)final StyleColor
Sets a color for an optional text outlinefinal StyleFloat
Sets an optional text outline (determines the width)final StyleLength
Sets the top distance of the element to the parent boxfinal StyleTransformOrigin
Determines the point / pivot around which a transformation is appliedfinal StyleTranslate
Sets a translate transformationfinal StyleEnum<Visibility>
Changes the visibility of the element without affecting the layoutfinal StyleEnum<WhiteSpace>
Determines word wrap over multiple lines if there is not enough space to display the textfinal StyleLength
Sets a fixed width for the elementfinal StyleLength
Sets the space between words (for text / labels) -
Constructor Summary
-
Method Summary
-
Field Details
-
display
Changes the visibility of the element, but also affects the layout. If set toDisplayStyle.None
, it acts like the element was removed from the hierarchy -
visibility
Changes the visibility of the element without affecting the layout -
left
Sets the left distance of the element to the parent box -
right
Sets the right distance of the element to the parent box -
top
Sets the top distance of the element to the parent box -
bottom
Sets the bottom distance of the element to the parent box -
marginLeft
Sets reserved space for the left edge of the margin -
marginRight
Sets reserved space for the right edge of the margin -
marginTop
Sets reserved space for the top edge of the margin -
marginBottom
Sets reserved space for the bottom edge of the margin -
paddingLeft
Sets reserved space for the left edge of the padding -
paddingRight
Sets reserved space for the right edge of the padding -
paddingTop
Sets reserved space for the top edge of the padding -
paddingBottom
Sets reserved space for the bottom edge of the padding -
width
Sets a fixed width for the element -
height
Sets a fixed height for the element -
minWidth
Sets a minimum width for the element -
minHeight
Sets a minimum height for the element -
maxWidth
Sets a maximum width for the element -
maxHeight
Sets a maximum height for the element -
borderLeftWidth
Sets the width of an optional border on the left edge of the element -
borderRightWidth
Sets the width of an optional border on the right edge of the element -
borderTopWidth
Sets the width of an optional border on the top edge of the element -
borderBottomWidth
Sets the width of an optional border on the bottom edge of the element -
borderLeftColor
If a left border is used, this determines the color of the border -
borderRightColor
If a right border is used, this determines the color of the border -
borderTopColor
If a top border is used, this determines the color of the border -
borderBottomColor
If a bottom border is used, this determines the color of the border -
borderTopLeftRadius
Sets the radius for the top-left corner (to create a rounded corner) -
borderTopRightRadius
Sets the radius for the top-right corner (to create a rounded corner) -
borderBottomLeftRadius
Sets the radius for the bottom-left corner (to create a rounded corner) -
borderBottomRightRadius
Sets the radius for the bottom-right corner (to create a rounded corner) -
color
Sets the color of the element (not to be confused withbackgroundColor
) -
backgroundColor
Sets the background color of the element (not to be confused withcolor
orbackgroundImageTintColor
when using images) -
opacity
Sets the opacity / alpha value of the element -
overflow
Determines how a container behaves if its content overflows its own box -
overflowClipBox
Determines which box the element content is clipped against -
rotate
Sets a rotation transformation -
translate
Sets a translate transformation -
scale
Sets a scale transformation -
transformOrigin
Determines the point / pivot around which a transformation is applied -
position
Determines if this element should have a relative (default) or absolute position -
flexBasis
Determines the initial main size of a flexible item on the main axis / direction -
flexDirection
Determines the main axis for the children layout in this container -
flexGrow
Determines how items will grow relative to the rest of flexible items in the same container -
flexShrink
Determines how items will shrink relative to the rest of flexible items in the same container -
flexWrap
Determines placement of children over multiple lines if there is not enough space in this container -
justifyContent
Determines justification of the children on the main axis inside this container -
alignContent
Determines the alignment of the content on the cross axis if they spawn over multiple lines -
alignItems
Determines the alignment of the children on the cross axis -
alignSelf
Similar toalignItems
, but only for this specific element -
font
Sets the font (for texts / labels) -
fontSize
Sets the font size (for text / labels) -
fontStyleAndWeight
Sets the font style and weight (normal, bold, italic) (for text / labels) -
paragraphSpacing
Sets the space between paragraphs (for text / labels) -
letterSpacing
Sets the space between characters (for text / labels) -
whiteSpace
Determines word wrap over multiple lines if there is not enough space to display the text -
textAlign
Sets the vertical and horizontal text alignment (for text / labels) -
textOutlineColor
Sets a color for an optional text outline -
textOutlineWidth
Sets an optional text outline (determines the width) -
wordSpacing
Sets the space between words (for text / labels) -
backgroundImageTintColor
If an image is used, this determines the tint color of the image (i.e the color the image gets multipled with) -
backgroundImageScaleMode
If an image is used, this determines how it's scaled inside the element box -
backgroundImage
Sets a background image for this element
-
-
Constructor Details
-
Style
public Style()Creates a new, empty style. -
Style
Creates a new style which copies all properties from an existing style.- Parameters:
copyFrom
- the other style you want to copy the properties from.
-
-
Method Details
-
copy
Copies all style properties from another style to this style- Parameters:
source
- the style you want to copy the properties from.
-
reset
public void reset()Resets all style properties
-