Class TabArray

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class TabArray extends ProxyInstance

A PangoTabArray contains an array of tab stops.

PangoTabArray can be used to set tab stops in a PangoLayout. Each tab stop has an alignment, a position, and optionally a character to use as decimal point.

  • Constructor Summary

    Constructors
    Constructor
    Description
    TabArray(int initialSize, boolean positionsInPixels)
    Creates an array of initialSize tab stops.
    Create a TabArray proxy instance for the provided memory address.
  • Method Summary

    Modifier and Type
    Method
    Description
    Copies a PangoTabArray.
    void
    Frees a tab array and associated resources.
    static @Nullable TabArray
    Deserializes a PangoTabArray from a string.
    int
    getDecimalPoint(int tabIndex)
    Gets the Unicode character to use as decimal point.
    The memory layout of the native struct.
    boolean
    Returns true if the tab positions are in pixels, false if they are in Pango units.
    int
    Gets the number of tab stops in tabArray.
    void
    getTab(int tabIndex, @Nullable Out<TabAlign> alignment, @Nullable Out<Integer> location)
    Gets the alignment and position of a tab stop.
    void
    getTabs(@Nullable Out<TabAlign> alignments, @Nullable int @Nullable [] locations)
    If non-null, alignments and locations are filled with allocated arrays.
    static @Nullable Type
    Get the GType of the TabArray class.
    void
    resize(int newSize)
    Resizes a tab array.
    void
    setDecimalPoint(int tabIndex, int decimalPoint)
    Sets the Unicode character to use as decimal point.
    void
    setPositionsInPixels(boolean positionsInPixels)
    Sets whether positions in this array are specified in pixels.
    void
    setTab(int tabIndex, TabAlign alignment, int location)
    Sets the alignment and location of a tab stop.
    void
    Utility function to ensure that the tab stops are in increasing order.
    Serializes a PangoTabArray to a string.
    static TabArray
    withPositions(int size, boolean positionsInPixels, TabAlign firstAlignment, int firstPosition, Object... varargs)
    Creates a PangoTabArray and allows you to specify the alignment and position of each tab stop.

    Methods inherited from class ProxyInstance

    equals, handle, hashCode

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TabArray

      public TabArray(MemorySegment address)
      Create a TabArray proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • TabArray

      public TabArray(int initialSize, boolean positionsInPixels)

      Creates an array of initialSize tab stops.

      Tab stops are specified in pixel units if positionsInPixels is true, otherwise in Pango units. All stops are initially at position 0.

      Parameters:
      initialSize - Initial number of tab stops to allocate, can be 0
      positionsInPixels - whether positions are in pixel units
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the TabArray class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • withPositions

      public static TabArray withPositions(int size, boolean positionsInPixels, TabAlign firstAlignment, int firstPosition, Object... varargs)

      Creates a PangoTabArray and allows you to specify the alignment and position of each tab stop.

      You must provide an alignment and position for size tab stops.

      Parameters:
      size - number of tab stops in the array
      positionsInPixels - whether positions are in pixel units
      firstAlignment - alignment of first tab stop
      firstPosition - position of first tab stop
      varargs - additional alignment/position pairs
      Returns:
      the newly allocated PangoTabArray, which should be freed with free().
    • fromString

      public static @Nullable TabArray fromString(String text)

      Deserializes a PangoTabArray from a string.

      This is the counterpart to toString(). See that functions for details about the format.

      Parameters:
      text - a string
      Returns:
      a new PangoTabArray
      Since:
      1.50
    • copy

      public TabArray copy()
      Copies a PangoTabArray.
      Returns:
      the newly allocated PangoTabArray, which should be freed with free().
    • free

      public void free()
      Frees a tab array and associated resources.
    • getDecimalPoint

      public int getDecimalPoint(int tabIndex)

      Gets the Unicode character to use as decimal point.

      This is only relevant for tabs with TabAlign.DECIMAL alignment, which align content at the first occurrence of the decimal point character.

      The default value of 0 means that Pango will use the decimal point according to the current locale.

      Parameters:
      tabIndex - the index of a tab stop
      Since:
      1.50
    • getPositionsInPixels

      public boolean getPositionsInPixels()
      Returns true if the tab positions are in pixels, false if they are in Pango units.
      Returns:
      whether positions are in pixels.
    • getSize

      public int getSize()
      Gets the number of tab stops in tabArray.
      Returns:
      the number of tab stops in the array.
    • getTab

      public void getTab(int tabIndex, @Nullable Out<TabAlign> alignment, @Nullable Out<Integer> location)
      Gets the alignment and position of a tab stop.
      Parameters:
      tabIndex - tab stop index
      alignment - location to store alignment
      location - location to store tab position
    • getTabs

      public void getTabs(@Nullable Out<TabAlign> alignments, @Nullable int @Nullable [] locations)

      If non-null, alignments and locations are filled with allocated arrays.

      The arrays are of length getSize(). You must free the returned array.

      Parameters:
      alignments - location to store an array of tab stop alignments
      locations - location to store an array of tab positions
    • resize

      public void resize(int newSize)

      Resizes a tab array.

      You must subsequently initialize any tabs that were added as a result of growing the array.

      Parameters:
      newSize - new size of the array
    • setDecimalPoint

      public void setDecimalPoint(int tabIndex, int decimalPoint)

      Sets the Unicode character to use as decimal point.

      This is only relevant for tabs with TabAlign.DECIMAL alignment, which align content at the first occurrence of the decimal point character.

      By default, Pango uses the decimal point according to the current locale.

      Parameters:
      tabIndex - the index of a tab stop
      decimalPoint - the decimal point to use
      Since:
      1.50
    • setPositionsInPixels

      public void setPositionsInPixels(boolean positionsInPixels)
      Sets whether positions in this array are specified in pixels.
      Parameters:
      positionsInPixels - whether positions are in pixels
      Since:
      1.50
    • setTab

      public void setTab(int tabIndex, TabAlign alignment, int location)
      Sets the alignment and location of a tab stop.
      Parameters:
      tabIndex - the index of a tab stop
      alignment - tab alignment
      location - tab location in Pango units
    • sort

      public void sort()
      Utility function to ensure that the tab stops are in increasing order.
      Since:
      1.50
    • toString

      public String toString()

      Serializes a PangoTabArray to a string.

      In the resulting string, serialized tabs are separated by newlines or commas.

      Individual tabs are serialized to a string of the form

      [ALIGNMENT:]POSITION[:DECIMAL_POINT]
      

      Where ALIGNMENT is one of left, right, center or decimal, and POSITION is the position of the tab, optionally followed by the unit px. If ALIGNMENT is omitted, it defaults to left. If ALIGNMENT is decimal, the DECIMAL_POINT character may be specified as a Unicode codepoint.

      Note that all tabs in the array must use the same unit.

      A typical example:

      100px 200px center:300px right:400px
      
      Overrides:
      toString in class Object
      Returns:
      a newly allocated string
      Since:
      1.50