Package imgui

Class ImString

java.lang.Object
imgui.ImString

public final class ImString
extends java.lang.Object
Wrapper for String to use inside of th Dear ImGui input widgets.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static short CARET_LEN
    Size of ImGui caret which is shown during the input text focus.
    static short DEFAULT_LENGTH
    Default size of the inner buffer, if ImString created with a constructor without args.
    ImGuiInputTextData inputData
    Configuration class to setup some specific behaviour for current string.
  • Constructor Summary

    Constructors 
    Constructor Description
    ImString()
    Creates an ImString instance with DEFAULT_LENGTH size for the inner buffer.
    ImString​(int length)
    Creates an ImString instance with provided size for the inner buffer.
    ImString​(java.lang.String text)
    Creates an ImString instance from provided string.
    ImString​(java.lang.String text, int length)
    Create an ImString instance from provided string with custom size for the inner buffer.
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object o)  
    java.lang.String get()  
    int getBufferSize()
    Get the size of the data buffer.
    int getLength()
    Get the length of the text inside of the data buffer.
    int hashCode()  
    void resize​(int newSize)  
    void set​(java.lang.String value)  
    void set​(java.lang.String value, boolean resize)  
    void set​(java.lang.String value, boolean resize, int resizeValue)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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:
      Constant Field Values
    • CARET_LEN

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

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

    • ImString

      public ImString()
      Creates an ImString instance with DEFAULT_LENGTH size for the inner buffer.
    • 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​(java.lang.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​(java.lang.String text, int length)
      Create an ImString instance from provided string with custom size for the inner buffer.
      Parameters:
      text - string to a create a new ImString
      length - custom size for the inner buffer
  • Method Details

    • get

      public java.lang.String get()
    • set

      public void set​(java.lang.String value)
    • set

      public void set​(java.lang.String value, boolean resize)
    • set

      public void set​(java.lang.String value, boolean resize, int resizeValue)
    • resize

      public void resize​(int newSize)
    • getLength

      public int getLength()
      Get the length of the text inside of the data buffer.
      Returns:
      length of the text inside of 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
    • toString

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

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object