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
FieldsModifier 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 StyleColorSets the background color of the element (not to be confused withcolororbackgroundImageTintColorwhen using images)final StyleImageSets a background image for this elementIf an image is used, this determines how it's scaled inside the element boxfinal StyleColorIf an image is used, this determines the tint color of the image (i.e the color the image gets multipled with)final StyleColorIf a bottom border is used, this determines the color of the borderfinal StyleLengthSets the radius for the bottom-left corner (to create a rounded corner)final StyleLengthSets the radius for the bottom-right corner (to create a rounded corner)final StyleFloatSets the width of an optional border on the bottom edge of the elementfinal StyleColorIf a left border is used, this determines the color of the borderfinal StyleFloatSets the width of an optional border on the left edge of the elementfinal StyleColorIf a right border is used, this determines the color of the borderfinal StyleFloatSets the width of an optional border on the right edge of the elementfinal StyleColorIf a top border is used, this determines the color of the borderfinal StyleLengthSets the radius for the top-left corner (to create a rounded corner)final StyleLengthSets the radius for the top-right corner (to create a rounded corner)final StyleFloatSets the width of an optional border on the top edge of the elementfinal StyleLengthSets the bottom distance of the element to the parent boxfinal StyleColorSets 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 StyleLengthDetermines 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 StyleFloatDetermines how items will grow relative to the rest of flexible items in the same containerfinal StyleFloatDetermines 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 StyleLengthSets the font size (for text / labels)Sets the font style and weight (normal, bold, italic) (for text / labels)final StyleLengthSets a fixed height for the elementDetermines justification of the children on the main axis inside this containerfinal StyleLengthSets the left distance of the element to the parent boxfinal StyleLengthSets the space between characters (for text / labels)final StyleLengthSets reserved space for the bottom edge of the marginfinal StyleLengthSets reserved space for the left edge of the marginfinal StyleLengthSets reserved space for the right edge of the marginfinal StyleLengthSets reserved space for the top edge of the marginfinal StyleLengthSets a maximum height for the elementfinal StyleLengthSets a maximum width for the elementfinal StyleLengthSets a minimum height for the elementfinal StyleLengthSets a minimum width for the elementfinal StyleFloatSets 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 StyleLengthSets reserved space for the bottom edge of the paddingfinal StyleLengthSets reserved space for the left edge of the paddingfinal StyleLengthSets reserved space for the right edge of the paddingfinal StyleLengthSets reserved space for the top edge of the paddingfinal StyleLengthSets the space between paragraphs (for text / labels)Determines if this element should have a relative (default) or absolute positionfinal StyleLengthSets the right distance of the element to the parent boxfinal StyleFloatSets a rotation transformationfinal StyleScaleSets a scale transformationfinal StyleEnum<TextAnchor>Sets the vertical and horizontal text alignment (for text / labels)final StyleColorSets a color for an optional text outlinefinal StyleFloatSets an optional text outline (determines the width)final StyleLengthSets the top distance of the element to the parent boxfinal StyleTransformOriginDetermines the point / pivot around which a transformation is appliedfinal StyleTranslateSets 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 StyleLengthSets a fixed width for the elementfinal StyleLengthSets the space between words (for text / labels) -
Constructor Summary
Constructors -
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 withcolororbackgroundImageTintColorwhen 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
-