aboutsummaryrefslogtreecommitdiff
path: root/src/Java/binnie/extrabees/gui/punnett/ControlChromosome.java
blob: f4a7ffc507ddd5b465ea5888b8caa3286b2e5eb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package binnie.extrabees.gui.punnett;

import binnie.craftgui.controls.core.Control;
import binnie.craftgui.controls.core.IControlValue;
import binnie.craftgui.core.Attribute;
import binnie.craftgui.core.CraftGUI;
import binnie.craftgui.core.ITooltip;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.Tooltip;
import binnie.craftgui.core.renderer.Renderer;
import forestry.api.genetics.IChromosomeType;

public class ControlChromosome
  extends Control
  implements IControlValue<IChromosomeType>, ITooltip
{
  IChromosomeType value;
  
  protected ControlChromosome(IWidget parent, float x, float y, IChromosomeType type)
  {
    super(parent, x, y, 16.0F, 16.0F);
    setValue(type);
    addAttribute(Attribute.MouseOver);
  }
  
  public IChromosomeType getValue()
  {
    return this.value;
  }
  
  public void setValue(IChromosomeType value)
  {
    this.value = value;
  }
  
  public void onRenderBackground()
  {
    CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome, getArea());
    CraftGUI.Render.colour(16711680);
    CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome2, getArea());
  }
  
  public void getTooltip(Tooltip tooltip)
  {
    if (this.value != null) {
      tooltip.add(this.value.getName());
    }
  }
}