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, ifImString
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 anImString
instance withDEFAULT_LENGTH
size for the inner buffer.ImString(int length)
Creates anImString
instance with provided size for the inner buffer.ImString(java.lang.String text)
Creates anImString
instance from provided string.ImString(java.lang.String text, int length)
Create anImString
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()
-
Field Details
-
DEFAULT_LENGTH
public static final short DEFAULT_LENGTHDefault size of the inner buffer, ifImString
created with a constructor without args.- See Also:
- Constant Field Values
-
CARET_LEN
public static final short CARET_LENSize of ImGui caret which is shown during the input text focus.- See Also:
- Constant Field Values
-
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 anImString
instance withDEFAULT_LENGTH
size for the inner buffer. -
ImString
public ImString(int length)Creates anImString
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 anImString
instance from provided string. Inner buffer size will be equal to the length of the string +CARET_LEN
.- Parameters:
text
- string to create a newImString
-
ImString
public ImString(java.lang.String text, int length)Create anImString
instance from provided string with custom size for the inner buffer.- Parameters:
text
- string to a create a newImString
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 classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-