Class GuiEditors

java.lang.Object
dev.boze.api.gui.editor.GuiEditors

public final class GuiEditors extends Object
Built-in editors (popups) for addons, drawn by the active theme like Boze's own. Open them with Guis.openEditor(GuiEditor).
Ids name what is edited, for example myaddon:waypoints; themes can use them to give an editor a view of its own. Callbacks run on the render thread.
  • Method Details

    • confirm

      public static ConfirmEditor confirm(String id, String title, List<String> lines, Runnable onConfirm)
      A message with Cancel and Confirm. Either button closes it; Confirm runs onConfirm first.
    • choice

      public static ChoiceEditor choice(String id, String title, List<EditorButton> options)
      A column of buttons. Pressing one closes the editor and then runs it.
    • number

      public static NumberEditor number(String id, String label, double value, double min, double max, boolean integer, DoubleConsumer onSet)
      Typed entry for one number, with Cancel, Reset and Set. Set passes the typed value, clamped to min..max; Reset passes value.
      Parameters:
      label - What the number is, shown as the title
      integer - Whether only whole numbers can be typed
    • color

      public static StaticColorEditor color(String id, String name, int rgb, IntConsumer onSave)
      A color picker. Save closes it and passes the color as RGB, without alpha.
      Parameters:
      name - What the color is, shown in the title
      rgb - Starting color
    • bind

      public static BindCaptureEditor bind(String id, String prompt, Consumer<Bind> onBind)
      Waits for the next key or mouse button, then closes. Escape gives a cleared bind (new Bind(false, -1)). Always shown on a screen of its own.
    • notice

      public static NoticeEditor notice(String id, String title, List<String> lines, Runnable onDismiss)
      A message card. Its button and Escape both close it and run onDismiss. Always shown on a screen of its own.
      Parameters:
      lines - Message lines; the first is the main line
    • form

      public static GuiEditors.FormBuilder form(String id, String title, String prompt)
      Text fields and buttons.
      Parameters:
      prompt - Line shown above the fields
    • list

      public static GuiEditors.ListBuilder list(String id, String title, Supplier<List<ListEntry>> entries)
      A list of rows with an optional text field and buttons below it.
      Parameters:
      entries - Current rows, read every frame