mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-25 22:44:38 +00:00
start 1.10.2
This commit is contained in:
1 parent
f969f63b66
commit
6a7c4bf67d
826 files changed
+60550
-63758
No files matched your search
@@ -1,72 +1,67 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.craftgui.controls;
|
||||
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
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.resource.minecraft.CraftGUITexture;
|
||||
import binnie.craftgui.events.EventValueChanged;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.TextJustification;
|
||||
import binnie.craftgui.events.EventHandler;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.geometry.TextJustification;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.controls.core.IControlValue;
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.events.EventValueChanged;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
|
||||
public class ControlCheckbox extends Control implements IControlValue<Boolean>
|
||||
{
|
||||
boolean value;
|
||||
String text;
|
||||
public class ControlCheckbox extends Control implements IControlValue<Boolean> {
|
||||
boolean value;
|
||||
String text;
|
||||
|
||||
public ControlCheckbox(final IWidget parent, final float x, final float y, final boolean bool) {
|
||||
this(parent, x, y, 0.0f, "", bool);
|
||||
}
|
||||
public ControlCheckbox(final IWidget parent, final float x, final float y, final boolean bool) {
|
||||
this(parent, x, y, 0.0f, "", bool);
|
||||
}
|
||||
|
||||
public ControlCheckbox(final IWidget parent, final float x, final float y, final float w, final String text, final boolean bool) {
|
||||
super(parent, x, y, (w > 16.0f) ? w : 16.0f, 16.0f);
|
||||
this.text = text;
|
||||
this.value = bool;
|
||||
if (w > 16.0f) {
|
||||
new ControlText(this, new IArea(16.0f, 1.0f, w - 16.0f, 16.0f), text, TextJustification.MiddleCenter).setColour(4473924);
|
||||
}
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
this.addEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventMouse.Down event) {
|
||||
ControlCheckbox.this.toggleValue();
|
||||
}
|
||||
}.setOrigin(EventHandler.Origin.Self, this));
|
||||
}
|
||||
public ControlCheckbox(final IWidget parent, final float x, final float y, final float w, final String text, final boolean bool) {
|
||||
super(parent, x, y, (w > 16.0f) ? w : 16.0f, 16.0f);
|
||||
this.text = text;
|
||||
this.value = bool;
|
||||
if (w > 16.0f) {
|
||||
new ControlText(this, new IArea(16.0f, 1.0f, w - 16.0f, 16.0f), text, TextJustification.MiddleCenter).setColour(4473924);
|
||||
}
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
this.addEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventMouse.Down event) {
|
||||
ControlCheckbox.this.toggleValue();
|
||||
}
|
||||
}.setOrigin(EventHandler.Origin.Self, this));
|
||||
}
|
||||
|
||||
protected void onValueChanged(final boolean value) {
|
||||
}
|
||||
protected void onValueChanged(final boolean value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getValue() {
|
||||
return this.value;
|
||||
}
|
||||
@Override
|
||||
public Boolean getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(final Boolean value) {
|
||||
this.value = value;
|
||||
this.onValueChanged(value);
|
||||
this.callEvent(new EventValueChanged<Object>(this, value));
|
||||
}
|
||||
@Override
|
||||
public void setValue(final Boolean value) {
|
||||
this.value = value;
|
||||
this.onValueChanged(value);
|
||||
this.callEvent(new EventValueChanged<Object>(this, value));
|
||||
}
|
||||
|
||||
public void toggleValue() {
|
||||
this.setValue(Boolean.valueOf(!this.getValue()));
|
||||
}
|
||||
public void toggleValue() {
|
||||
this.setValue(Boolean.valueOf(!this.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
Object texture = this.getValue() ? CraftGUITexture.CheckboxChecked : CraftGUITexture.Checkbox;
|
||||
if (this.isMouseOver()) {
|
||||
texture = (this.getValue() ? CraftGUITexture.CheckboxCheckedHighlighted : CraftGUITexture.CheckboxHighlighted);
|
||||
}
|
||||
CraftGUI.Render.texture(texture, IPoint.ZERO);
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
Object texture = this.getValue() ? CraftGUITexture.CheckboxChecked : CraftGUITexture.Checkbox;
|
||||
if (this.isMouseOver()) {
|
||||
texture = (this.getValue() ? CraftGUITexture.CheckboxCheckedHighlighted : CraftGUITexture.CheckboxHighlighted);
|
||||
}
|
||||
CraftGUI.Render.texture(texture, IPoint.ZERO);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user