Class Dropdown

    • Method Detail

      • 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.

      • calculateSize

         Vec2<Unit> calculateSize()

        Implement this function to return the size of this drawable, if no size is specified during construction.

        This should be so that if the drawable can determine its own size (for example, it is an image), then the size parameter in the constructor can be omitted using:

        size: Vec2<org.polyfrost.polyui.unit.Unit>? = null; and this method needs to be implemented!

        Otherwise, the size parameter in the constructor must be specified.

      • calculateBounds

         Unit calculateBounds()

        Calculate the position and size of this drawable. Make sure to call doDynamicSize in this method to avoid issues with sizing.

        This method is called once the layout is populated for children and component, and when a recalculation is requested.

        The value of layout's bounds will be updated after this method is called, so do not use layout's bounds as an updated value in this method.

      • onInitComplete

         Unit onInitComplete()

        This function is called when initialization of a drawable is complete, so it has been fully calculated.

        This function is called once, and only once.

      • from

         final static Array<out Dropdown.Entry> from(Class<?> enumClass)

        Constructs a dropdown from an enum class. This method will look at the first field in the enum entries, and if it is a String it will extract that; and use that as the name.

        Otherwise, it will use the name of the enum entry as it is declared in the source code.