Search in sources :

Example 1 with TextEditorWidget

use of gregtech.api.terminal.gui.widgets.TextEditorWidget in project GregTech by GregTechCEu.

the class GuideConfigEditor method createPageConfig.

private DraggableScrollableWidgetGroup createPageConfig() {
    DraggableScrollableWidgetGroup group = new DraggableScrollableWidgetGroup(0, 0, getSize().width, getSize().height - 10).setBackground(TerminalTheme.COLOR_B_3).setYScrollBarWidth(4).setYBarStyle(null, TerminalTheme.COLOR_F_1);
    group.addWidget(new LabelWidget(5, 5, "section", -1).setShadow(true));
    group.addWidget(new TextFieldWidget(5, 15, 116, 20, new ColorRectTexture(0x9f000000), null, null).setTextResponder(s -> {
        if (pageEditor != null) {
            pageEditor.setSection(s);
        }
    }, true).setTextSupplier(() -> getPageEditor().getSection(), true).setMaxStringLength(Integer.MAX_VALUE).setValidator(s -> true));
    group.addWidget(new ImageWidget(5, 40, 116, 1, new ColorRectTexture(-1)));
    group.addWidget(new LabelWidget(5, 45, "type", -1).setShadow(true));
    group.addWidget(new SelectorWidget(30, 55, 91, 20, candidates, -1, () -> type, true).setIsUp(true).setOnChanged(type -> this.type = type).setColors(TerminalTheme.COLOR_B_2.getColor(), TerminalTheme.COLOR_F_1.getColor(), TerminalTheme.COLOR_B_2.getColor()).setBackground(TerminalTheme.COLOR_6));
    group.addWidget(new PhantomSlotWidget(handler, 0, 6, 56).setBackgroundTexture(TerminalTheme.COLOR_B_2));
    group.addWidget(new ImageWidget(5, 80, 116, 1, new ColorRectTexture(-1)));
    group.addWidget(new LabelWidget(5, 85, "title", -1).setShadow(true));
    titleEditor = new TextEditorWidget(5, 95, 116, 70, s -> {
        if (pageEditor != null) {
            pageEditor.setTitle(s);
        }
    }, true).setContent("Template").setBackground(new ColorRectTexture(0xA3FFFFFF));
    group.addWidget(titleEditor);
    return group;
}
Also used : JsonObject(com.google.gson.JsonObject) Size(gregtech.api.util.Size) MultiBlockGuideApp(gregtech.common.terminal.app.guide.MultiBlockGuideApp) Item(net.minecraft.item.Item) IGuiTextureTabInfo(gregtech.api.gui.widgets.tab.IGuiTextureTabInfo) SimpleMachineGuideApp(gregtech.common.terminal.app.guide.SimpleMachineGuideApp) TerminalTheme(gregtech.api.terminal.os.TerminalTheme) TerminalDialogWidget(gregtech.api.terminal.os.TerminalDialogWidget) TextTexture(gregtech.api.gui.resources.TextTexture) TerminalRegistry(gregtech.api.terminal.TerminalRegistry) ItemStack(net.minecraft.item.ItemStack) Widget(gregtech.api.gui.Widget) GregTechAPI(gregtech.api.GregTechAPI) gregtech.api.gui.widgets(gregtech.api.gui.widgets) Map(java.util.Map) FileUtility(gregtech.api.util.FileUtility) IItemHandlerModifiable(net.minecraftforge.items.IItemHandlerModifiable) MachineItemBlock(gregtech.api.block.machines.MachineItemBlock) IGuideWidget(gregtech.common.terminal.app.guide.widget.IGuideWidget) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) SelectorWidget(gregtech.api.terminal.gui.widgets.SelectorWidget) CustomTabListRenderer(gregtech.api.terminal.gui.CustomTabListRenderer) ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture) GuideApp(gregtech.common.terminal.app.guide.GuideApp) DraggableScrollableWidgetGroup(gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup) Collectors(java.util.stream.Collectors) GuiTextures(gregtech.api.gui.GuiTextures) File(java.io.File) AbstractApplication(gregtech.api.terminal.app.AbstractApplication) java.awt(java.awt) Objects(java.util.Objects) Position(gregtech.api.util.Position) ItemGuideApp(gregtech.common.terminal.app.guide.ItemGuideApp) List(java.util.List) TextEditorWidget(gregtech.api.terminal.gui.widgets.TextEditorWidget) GuideEditorApp(gregtech.common.terminal.app.guideeditor.GuideEditorApp) SingleItemStackHandler(gregtech.common.inventory.handlers.SingleItemStackHandler) GuidePageWidget(gregtech.common.terminal.app.guide.widget.GuidePageWidget) CircleButtonWidget(gregtech.api.terminal.gui.widgets.CircleButtonWidget) DraggableScrollableWidgetGroup(gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup) SelectorWidget(gregtech.api.terminal.gui.widgets.SelectorWidget) ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture) TextEditorWidget(gregtech.api.terminal.gui.widgets.TextEditorWidget)

Example 2 with TextEditorWidget

use of gregtech.api.terminal.gui.widgets.TextEditorWidget in project GregTech by GregTechCEu.

the class TextListConfigurator method init.

protected void init(int height) {
    JsonElement element = config.get(name);
    String initValue = "";
    if (!element.isJsonNull()) {
        List init = new Gson().fromJson(element, List.class);
        initValue = String.join("\n", init);
    }
    editor = new TextEditorWidget(0, 15, 116, height, this::updateTextList, true).setContent(initValue).setBackground(new ColorRectTexture(0xA3FFFFFF));
    this.addWidget(editor);
}
Also used : ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture) List(java.util.List) TextEditorWidget(gregtech.api.terminal.gui.widgets.TextEditorWidget)

Aggregations

ColorRectTexture (gregtech.api.gui.resources.ColorRectTexture)2 TextEditorWidget (gregtech.api.terminal.gui.widgets.TextEditorWidget)2 List (java.util.List)2 JsonObject (com.google.gson.JsonObject)1 GregTechAPI (gregtech.api.GregTechAPI)1 MachineItemBlock (gregtech.api.block.machines.MachineItemBlock)1 GuiTextures (gregtech.api.gui.GuiTextures)1 Widget (gregtech.api.gui.Widget)1 TextTexture (gregtech.api.gui.resources.TextTexture)1 gregtech.api.gui.widgets (gregtech.api.gui.widgets)1 IGuiTextureTabInfo (gregtech.api.gui.widgets.tab.IGuiTextureTabInfo)1 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 TerminalRegistry (gregtech.api.terminal.TerminalRegistry)1 AbstractApplication (gregtech.api.terminal.app.AbstractApplication)1 CustomTabListRenderer (gregtech.api.terminal.gui.CustomTabListRenderer)1 CircleButtonWidget (gregtech.api.terminal.gui.widgets.CircleButtonWidget)1 DraggableScrollableWidgetGroup (gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup)1 SelectorWidget (gregtech.api.terminal.gui.widgets.SelectorWidget)1 TerminalDialogWidget (gregtech.api.terminal.os.TerminalDialogWidget)1 TerminalTheme (gregtech.api.terminal.os.TerminalTheme)1