Class StateBlock

  • All Implemented Interfaces:
    kotlin.Cloneable

    
    public abstract class StateBlock
    extends Block
                        

    Represents a component that can be either in an active or inactive state, such as a Checkbox or a Switch.

    • Method Detail

      • getActive

         final Boolean getActive()

        This is the variable which holds what state the component is in.

      • accept

         Boolean accept(Event event)

        called when this drawable receives an event.

        make sure to call Drawable.accept!

      • setup

         Unit setup(Renderer renderer, PolyUI polyUI)

        give this a renderer reference and a PolyUI reference.

        You can also use this method to do some calculations (such as text widths) that are not dependent on other sizes.

        If you need a method that has access to component's sizes, see here or here (if you are operating on yourself only).

        this method is called once, and only once.

      • onStateChanged

         Unit onStateChanged(Boolean state)

        This function is called when the state of the component changes.

        Parameters:
        state - The new state of the component.
      • onColorsChanged

         Unit onColorsChanged(Colors colors)

        Function that is called when the colors attached to this drawable change.

        If this is a layout, the colors will change, and all its children and components will be notified and updated accordingly.

        Make sure to call super.onColorsChanged() if you override this!