Package tripleplay.ui

Class Style<V>

java.lang.Object
tripleplay.ui.Style<V>
Direct Known Subclasses:
Style.Flag, Style.GradientTypeStyle, Style.HAlignStyle, Style.PosStyle, Style.TextEffectStyle, Style.VAlignStyle

public abstract class Style<V> extends Object
Defines style properties for interface elements. Some style properties are inherited, such that a property not specified in a leaf element will be inherited by the nearest parent for which the property is specified. Other style properties are not inherited, and a default value will be used in cases where a leaf element lacks a property. The documentation for each style property indicates whether or not it is inherited.
  • Field Details

    • COLOR

      public static final Style<Integer> COLOR
      The foreground color for an element. Inherited.
    • HIGHLIGHT

      public static final Style<Integer> HIGHLIGHT
      The highlight color for an element. Inherited.
    • SHADOW

      public static final Style<Integer> SHADOW
      The shadow color for an element. Inherited.
    • SHADOW_X

      public static final Style<Float> SHADOW_X
      The shadow offset in pixels. Inherited.
    • SHADOW_Y

      public static final Style<Float> SHADOW_Y
      The shadow offset in pixels. Inherited.
    • GRADIENT_COLOR

      public static final Style<Integer> GRADIENT_COLOR
      The color of the gradient. Inherited.
    • GRADIENT_TYPE

      public static final Style.GradientTypeStyle GRADIENT_TYPE
      The type of gradient. Inherited.
    • OUTLINE_WIDTH

      public static final Style<Float> OUTLINE_WIDTH
      The stroke width of the outline, when using a vector outline.
    • OUTLINE_CAP

      public static final Style<Canvas.LineCap> OUTLINE_CAP
      The line cap for the outline, when using a vector outline.
    • OUTLINE_JOIN

      public static final Style<Canvas.LineJoin> OUTLINE_JOIN
      The line join for the outline, when using a vector outline.
    • HALIGN

      public static final Style.HAlignStyle HALIGN
      The horizontal alignment of an element. Not inherited.
    • VALIGN

      public static final Style.VAlignStyle VALIGN
      The vertical alignment of an element. Not inherited.
    • FONT

      public static final Style<Font> FONT
      The font used to render text. Inherited.
    • TEXT_WRAP

      public static final Style.Flag TEXT_WRAP
      Whether or not to allow text to wrap. When text cannot wrap and does not fit into the allowed space, it is truncated. Not inherited.
    • TEXT_EFFECT

      public static final Style.TextEffectStyle TEXT_EFFECT
      The effect to use when rendering text, if any. Inherited.
    • UNDERLINE

      public static final Style.Flag UNDERLINE
      Whether or not to underline text. Inherited.
    • LINE_SPACING

      public static final Style<Float> LINE_SPACING
      The line spacing to use when rendering multiline text. This is an adjustment to the default line spacing, not an absolute value.
    • AUTO_SHRINK

      public static final Style.Flag AUTO_SHRINK
      Whether or not to automatically shrink a text widget's font size until it fits into the horizontal space it has been allotted. Cannot be used with TEXT_WRAP. Not inherited.
    • MIN_FONT_SIZE

      public static final Style<Float> MIN_FONT_SIZE
      If AUTO_SHRINK is enabled, the minimum font size to use when shrinking. Not inherited.
    • ELLIPSIZE

      public static final Style.Flag ELLIPSIZE
      Whether or not to automatically clip a text widget's text to fit into the horizontal space it has been allotted. Cannot be used with TEXT_WRAP. Can be combined with AUTO_SHRINK: In that case, shrinking will be applied first, then if the text still does not fit, it will be clipped. Not inherited.
    • BACKGROUND

      public static final Style<Background> BACKGROUND
      The background for an element. Not inherited.
    • ICON_POS

      public static final Style.PosStyle ICON_POS
      The position relative to the text to render an icon for labels, buttons, etc.
    • ICON_GAP

      public static final Style<Integer> ICON_GAP
      The gap between the icon and text in labels, buttons, etc.
    • ICON_CUDDLE

      public static final Style.Flag ICON_CUDDLE
      If true, the icon is cuddled to the text, with extra space between icon and border, if false, the icon is placed next to the border with extra space between icon and label.
    • ICON_EFFECT

      public static final Style<IconEffect> ICON_EFFECT
      The effect to apply to the icon.
    • ACTION_SOUND

      public static final Style<Sound> ACTION_SOUND
      The sound to be played when this element's action is triggered.
    • inherited

      public final boolean inherited
      Indicates whether or not this style property is inherited.
  • Method Details

    • createTextStyle

      public static TextStyle createTextStyle(Element<?> elem)
      Creates a text style instance based on the supplied element's stylings.
    • getDefault

      public abstract V getDefault(Element<?> mode)
      Returns the default value for this style for the supplied element.
    • is

      public Style.Binding<V> is(V value)
      Returns a Style.Binding with this style bound to the specified value.
    • newStyle

      public static <V> Style<V> newStyle(boolean inherited, V defaultValue)
      Creates a style identifier with the supplied properties.
    • newFlag

      public static Style.Flag newFlag(boolean inherited, boolean defaultValue)
      Creates a boolean style identifier with the supplied properties.