Package imgui.type

Class ImString

java.lang.Object
imgui.type.ImString
All Implemented Interfaces:
Cloneable, Comparable<ImString>

public final class ImString extends Object implements Cloneable, Comparable<ImString>
Wrapper for String to use inside th Dear ImGui input widgets.
  • Field Details

    • DEFAULT_LENGTH

      public static final short DEFAULT_LENGTH
      Default size of the inner buffer, if ImString created with a constructor without args.
      See Also:
    • CARET_LEN

      public static final short CARET_LEN
      Size of ImGui caret which is shown during the input text focus.
      See Also:
    • inputData

      public final ImString.InputData inputData
      Configuration class to set up some specific behaviour for current string. This is useful when string used inside ImGui#InputText*() methods.
  • Constructor Details

    • ImString

      public ImString()
      Creates an ImString instance with DEFAULT_LENGTH size for the inner buffer.
    • ImString

      public ImString(ImString imString)
    • ImString

      public ImString(int length)
      Creates an ImString instance with provided size for the inner buffer.
      Parameters:
      length - size of the inner buffer to use
    • ImString

      public ImString(String text)
      Creates an ImString instance from provided string. Inner buffer size will be equal to the length of the string + CARET_LEN.
      Parameters:
      text - string to create a new ImString
    • ImString

      public ImString(String text, int length)
      Create an ImString instance from provided string with custom size for the inner buffer.
      Parameters:
      text - string to a creation a new ImString
      length - custom size for the inner buffer
  • Method Details

    • get

      public String get()
    • getData

      public byte[] getData()
    • set

      public void set(Object object)
    • set

      public void set(ImString value)
    • set

      public void set(ImString value, boolean resize)
    • set

      public void set(String value)
    • set

      public void set(String value, boolean resize)
    • set

      public void set(String value, boolean resize, int resizeValue)
    • resize

      public void resize(int newSize)
    • getLength

      public int getLength()
      Get the length of the text inside the data buffer.
      Returns:
      length of the text inside the data buffer
    • getBufferSize

      public int getBufferSize()
      Get the size of the data buffer. Buffer size will always have '+1' to its size, since it's used by the Dear ImGui to draw a caret char.
      Returns:
      size of the data buffer
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if the length of the text inside the data buffer is 0
    • isNotEmpty

      public boolean isNotEmpty()
      Returns:
      true if the length of the text inside the data buffer is not 0
    • clear

      public void clear()
      Clears underlying string by setting empty value.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      public ImString clone()
      Overrides:
      clone in class Object
    • compareTo

      public int compareTo(ImString o)
      Specified by:
      compareTo in interface Comparable<ImString>