Search in sources :

Example 1 with IGuiTextureTabInfo

use of gregtech.api.gui.widgets.tab.IGuiTextureTabInfo in project GregTech by GregTechCEu.

the class RecipeChartApp method addTab.

private RGContainer addTab(String name) {
    name = name.isEmpty() ? "default" : name;
    RGContainer container = new RGContainer(0, 0, 333, 222, getOs());
    container.setBackground(TerminalTheme.COLOR_B_3);
    tabGroup.addTab(new IGuiTextureTabInfo(new TextTexture(name, -1).setWidth(333 / getMaxPages() - 5).setType(tabGroup.getAllTag().isEmpty() ? TextTexture.TextType.ROLL : TextTexture.TextType.HIDE), name), container);
    return container;
}
Also used : TextTexture(gregtech.api.gui.resources.TextTexture) IGuiTextureTabInfo(gregtech.api.gui.widgets.tab.IGuiTextureTabInfo) RGContainer(gregtech.common.terminal.app.recipechart.widget.RGContainer)

Example 2 with IGuiTextureTabInfo

use of gregtech.api.gui.widgets.tab.IGuiTextureTabInfo in project GregTech by GregTechCEu.

the class RecipeChartApp method onPagesChanged.

private void onPagesChanged(int oldPage, int newPage) {
    ITabInfo tabInfo = tabGroup.getTabInfo(newPage);
    if (tabInfo instanceof IGuiTextureTabInfo && ((IGuiTextureTabInfo) tabInfo).texture instanceof TextTexture) {
        ((TextTexture) ((IGuiTextureTabInfo) tabInfo).texture).setType(TextTexture.TextType.ROLL);
    }
    tabInfo = tabGroup.getTabInfo(oldPage);
    if (tabInfo instanceof IGuiTextureTabInfo && ((IGuiTextureTabInfo) tabInfo).texture instanceof TextTexture) {
        ((TextTexture) ((IGuiTextureTabInfo) tabInfo).texture).setType(TextTexture.TextType.HIDE);
    }
}
Also used : ITabInfo(gregtech.api.gui.widgets.tab.ITabInfo) TextTexture(gregtech.api.gui.resources.TextTexture) IGuiTextureTabInfo(gregtech.api.gui.widgets.tab.IGuiTextureTabInfo)

Example 3 with IGuiTextureTabInfo

use of gregtech.api.gui.widgets.tab.IGuiTextureTabInfo in project GregTech by GregTechCEu.

the class SettingsApp method onPagesChanged.

private void onPagesChanged(int oldPage, int newPage) {
    ITabInfo tabInfo = tabGroup.getTabInfo(newPage);
    if (tabInfo instanceof IGuiTextureTabInfo && ((IGuiTextureTabInfo) tabInfo).texture instanceof TextTexture) {
        ((TextTexture) ((IGuiTextureTabInfo) tabInfo).texture).setType(TextTexture.TextType.ROLL);
    }
    tabInfo = tabGroup.getTabInfo(oldPage);
    if (tabInfo instanceof IGuiTextureTabInfo && ((IGuiTextureTabInfo) tabInfo).texture instanceof TextTexture) {
        ((TextTexture) ((IGuiTextureTabInfo) tabInfo).texture).setType(TextTexture.TextType.HIDE);
    }
}
Also used : ITabInfo(gregtech.api.gui.widgets.tab.ITabInfo) TextTexture(gregtech.api.gui.resources.TextTexture) IGuiTextureTabInfo(gregtech.api.gui.widgets.tab.IGuiTextureTabInfo)

Example 4 with IGuiTextureTabInfo

use of gregtech.api.gui.widgets.tab.IGuiTextureTabInfo in project GregTech by GregTechCEu.

the class RecipeChartApp method closeApp.

@Override
public NBTTagCompound closeApp() {
    // synced data to server side.
    saveLocalConfig(nbt -> {
        NBTTagList list = new NBTTagList();
        for (int i = 0; i < tabGroup.getAllTag().size(); i++) {
            IGuiTextureTabInfo tabInfo = (IGuiTextureTabInfo) tabGroup.getTabInfo(i);
            NBTTagCompound container = new NBTTagCompound();
            container.setString("name", tabInfo.nameLocale);
            container.setTag("data", tabGroup.getTabWidget(i).saveAsNBT());
            list.appendTag(container);
        }
        nbt.setTag("list", list);
        nbt.setInteger("focus", tabGroup.getAllTag().indexOf(tabGroup.getCurrentTag()));
    });
    return super.closeApp();
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IGuiTextureTabInfo(gregtech.api.gui.widgets.tab.IGuiTextureTabInfo)

Aggregations

IGuiTextureTabInfo (gregtech.api.gui.widgets.tab.IGuiTextureTabInfo)4 TextTexture (gregtech.api.gui.resources.TextTexture)3 ITabInfo (gregtech.api.gui.widgets.tab.ITabInfo)2 RGContainer (gregtech.common.terminal.app.recipechart.widget.RGContainer)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 NBTTagList (net.minecraft.nbt.NBTTagList)1