package invtweaks;

import net.minecraft.client.Minecraft;

import org.lwjgl.opengl.GL11;

/**
 * Icon-size button, which get drawns in a specific way to fit its small size.
 * @author Jimeo Wan
 *
 */
public class InvTweaksGuiIconButton extends InvTweaksGuiTooltipButton {
    
    protected InvTweaksConfigManager cfgManager;
    
    private boolean useCustomTexture;
    
    public InvTweaksGuiIconButton(InvTweaksConfigManager cfgManager,
            int id, int x, int y, int w, int h, 
            String displayString, String tooltip, boolean useCustomTexture) {
        super(id, x, y, w, h, displayString, tooltip);
        this.cfgManager = cfgManager;
        this.useCustomTexture = useCustomTexture;
    }

    public void drawButton(Minecraft minecraft, int i, int j) {
        super.drawButton(minecraft, i, j);

        // Draw background (use the 4 corners of the texture to fit best its small size)
        int k = getHoverState(isMouseOverButton(i, j));
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        
        if (useCustomTexture) {
            GL11.glBindTexture(3553, minecraft.renderEngine.getTexture("/gui/button10px.png"));
            drawTexturedModalRect(xPosition, yPosition, (k - 1) * 10, 0, width, height);
        }
        else {
            GL11.glBindTexture(3553, minecraft.renderEngine.getTexture("/gui/gui.png"));
            drawTexturedModalRect(xPosition, yPosition, 1, 46 + k * 20 + 1, width / 2, height / 2);
            drawTexturedModalRect(xPosition, yPosition + height / 2, 1, 46 + k * 20 + 20 - height / 2 - 1, width / 2, height / 2);
            drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2 - 1, 46 + k * 20 + 1, width / 2, height / 2);
            drawTexturedModalRect(xPosition + width / 2, yPosition + height / 2, 200 - width / 2 - 1, 46 + k * 20 + 19 - height / 2, width / 2,
                    height / 2);
        }
        
    }

}
@@ -1072,33 +1072,8 @@
     
- GL11.glBindTexture(3553,
  min
@@ -1088,34 +1088,36 @@
 enderEngine.
-getTexture
+func_98187_b
 (%22/gui/butto
@@ -1123,25 +1123,24 @@
 on10px.png%22)
-)
 ;%0A          
@@ -1258,33 +1258,8 @@
     
- GL11.glBindTexture(3553,
  min
@@ -1282,18 +1282,20 @@
 ine.
-getTexture
+func_98187_b
 (%22/g
@@ -1306,17 +1306,16 @@
 ui.png%22)
-)
 ;%0A      

Call MC's bindTexture instead of using GL.