Package foundry.veil.api.client.imgui
Class CodeEditor
java.lang.Object
foundry.veil.api.client.imgui.CodeEditor
- All Implemented Interfaces:
AutoCloseable,org.lwjgl.system.NativeResource
Creates a text editor window with saving callback support.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback for when editor is saved. -
Constructor Summary
ConstructorsConstructorDescriptionCodeEditor(@Nullable net.minecraft.network.chat.Component saveText) CodeEditor(net.minecraft.network.chat.Component name, @Nullable net.minecraft.network.chat.Component saveText) -
Method Summary
Modifier and TypeMethodDescriptionvoidfree()imgui.extension.texteditor.TextEditorbooleanvoidhide()Attempts to hide and save the editor.booleanisOpen()voidrender()Renders the editor onto the stack.voidRenders the editor in a closable window.voidsave()Fires the save callback if the text has changed.voidsetSaveCallback(@Nullable CodeEditor.SaveCallback saveCallback) voidShows the editor with the specified source.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.lwjgl.system.NativeResource
close
-
Constructor Details
-
CodeEditor
public CodeEditor(@Nullable @Nullable net.minecraft.network.chat.Component saveText) -
CodeEditor
public CodeEditor(net.minecraft.network.chat.Component name, @Nullable @Nullable net.minecraft.network.chat.Component saveText)
-
-
Method Details
-
hasTextChanged
public boolean hasTextChanged()- Returns:
- Whether the text has changed since last save
-
save
public void save()Fires the save callback if the text has changed. -
show
Shows the editor with the specified source.- Parameters:
source- The source to display
-
hide
public void hide()Attempts to hide and save the editor. -
renderWindow
public void renderWindow()Renders the editor in a closable window. -
render
public void render()Renders the editor onto the stack. -
getEditor
public imgui.extension.texteditor.TextEditor getEditor() -
isOpen
public boolean isOpen() -
setSaveCallback
-
free
public void free()- Specified by:
freein interfaceorg.lwjgl.system.NativeResource
-