Class AnchorLayout

java.lang.Object
com.blackrook.gui.layout.AnchorLayout
All Implemented Interfaces:
GUILayout

public class AnchorLayout extends Object implements GUILayout
A layout that anchors objects to places in a parent object.
Author:
Matthew Tropiano
  • Field Details

    • AUTO

      public static final float AUTO
      Anchor value for automatic alignment.
      See Also:
    • UNUSED

      public static final float UNUSED
      Anchor value for ignoring an anchor point.
      See Also:
  • Constructor Details

    • AnchorLayout

      public AnchorLayout()
  • Method Details

    • resizeChild

      public void resizeChild(GUIObject object, int index, int childTotal)
      Description copied from interface: GUILayout
      Called when a child object needs resizing. DO NOT RESIZE THE PARENT OBJECT IN THIS METHOD, AS IT MAY CAUSE AN INFINITE LOOP TO OCCUR.
      Specified by:
      resizeChild in interface GUILayout
      Parameters:
      object - the object to resize.
      index - the child index while traversing through the list of children.
      childTotal - the total number of children.
    • createAnchor

      public static AnchorLayout.Anchor createAnchor(float left, float right, float top, float bottom)
      Creates an anchor attribute for objects in the layout. Left takes precedence over right, if not UNUSED. Top takes precedence over bottom, if not UNUSED.
      Parameters:
      left - units from the left. If auto, centered between left and right. If unused, ignored.
      right - units from the right. If auto, centered between left and right. If unused, ignored.
      top - units from the top. If auto, centered between top and bottom. If unused, ignored.
      bottom - units from the bottom. If auto, centered between top and bottom. If unused, ignored.
      Returns:
      the created Anchor.
    • createCenteredAnchor

      public static AnchorLayout.Anchor createCenteredAnchor()
      Returns an Anchor that describes centering an object in its parent. This doesn't actually return a new Anchor - it is a pooled one.
      Returns:
      the created Anchor.
    • createTopLeftAnchor

      public static AnchorLayout.Anchor createTopLeftAnchor()
      Returns an Anchor that describes anchoring an object in the top-left of its parent. This doesn't actually return a new Anchor - it is a pooled one.
      Returns:
      the created Anchor.
    • createTopCenterAnchor

      public static AnchorLayout.Anchor createTopCenterAnchor()
      Returns an Anchor that describes anchoring an object in the top-center of its parent. This doesn't actually return a new Anchor - it is a pooled one.
      Returns:
      the created Anchor.
    • createTopRightAnchor

      public static AnchorLayout.Anchor createTopRightAnchor()
      Returns an Anchor that describes anchoring an object in the top-right of its parent. This doesn't actually return a new Anchor - it is a pooled one.
      Returns:
      the created Anchor.
    • createMiddleLeftAnchor

      public static AnchorLayout.Anchor createMiddleLeftAnchor()
      Returns an Anchor that describes anchoring an object in the middle-left of its parent. This doesn't actually return a new Anchor - it is a pooled one.
      Returns:
      the created Anchor.
    • createMiddleRightAnchor

      public static AnchorLayout.Anchor createMiddleRightAnchor()
      Returns an Anchor that describes anchoring an object in the middle-right of its parent. This doesn't actually return a new Anchor - it is a pooled one.
      Returns:
      the created Anchor.
    • createBottomLeftAnchor

      public static AnchorLayout.Anchor createBottomLeftAnchor()
      Returns an Anchor that describes anchoring an object in the bottom-left of its parent. This doesn't actually return a new Anchor - it is a pooled one.
      Returns:
      the created Anchor.
    • createBottomCenterAnchor

      public static AnchorLayout.Anchor createBottomCenterAnchor()
      Returns an Anchor that describes anchoring an object in the bottom-center of its parent. This doesn't actually return a new Anchor - it is a pooled one.
      Returns:
      the created Anchor.
    • createBottomRightAnchor

      public static AnchorLayout.Anchor createBottomRightAnchor()
      Returns an Anchor that describes anchoring an object in the bottom-right of its parent. This doesn't actually return a new Anchor - it is a pooled one.
      Returns:
      the created Anchor.