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
Modifier and TypeClassDescriptionstatic interface
Callback for when editor is saved. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
free()
imgui.extension.texteditor.TextEditor
boolean
void
hide()
Attempts to hide and save the editor.void
render()
Renders the editor onto the stack.void
Renders the editor in a closable window.void
save()
Fires the save callback if the text has changed.void
setSaveCallback
(@Nullable CodeEditor.SaveCallback saveCallback) void
Shows the editor with the specified source.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.lwjgl.system.NativeResource
close
-
Constructor Details
-
CodeEditor
public CodeEditor(@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() -
setSaveCallback
-
free
public void free()- Specified by:
free
in interfaceorg.lwjgl.system.NativeResource
-