Class CodeEditor

java.lang.Object
foundry.veil.api.client.imgui.CodeEditor
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource

public class CodeEditor extends Object implements org.lwjgl.system.NativeResource
Creates a text editor window with saving callback support.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Callback for when editor is saved.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CodeEditor(@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 Type
    Method
    Description
    void
     
    imgui.extension.texteditor.TextEditor
     
    boolean
     
    void
    Attempts to hide and save the editor.
    boolean
     
    void
    Renders the editor onto the stack.
    void
    Renders the editor in a closable window.
    void
    Fires the save callback if the text has changed.
    void
    setSaveCallback(@Nullable CodeEditor.SaveCallback saveCallback)
     
    void
    show(@Nullable String fileName, String source)
    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)
    • 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

      public void show(@Nullable @Nullable String fileName, String source)
      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

      public void setSaveCallback(@Nullable @Nullable CodeEditor.SaveCallback saveCallback)
    • free

      public void free()
      Specified by:
      free in interface org.lwjgl.system.NativeResource