aboutsummaryrefslogtreecommitdiff
path: root/src/Java/binnie/craftgui/controls/page
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-01-20 14:24:34 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-01-20 14:24:34 +1000
commit869c206c4fcc8001bd2e1d66f704290331813835 (patch)
tree96735ce8fe4665e2759c3374221d6f06f4527df2 /src/Java/binnie/craftgui/controls/page
parentec2c72827f01dd4bb2174137f1ab162f9ddaab62 (diff)
downloadGT5-Unofficial-869c206c4fcc8001bd2e1d66f704290331813835.tar.gz
GT5-Unofficial-869c206c4fcc8001bd2e1d66f704290331813835.tar.bz2
GT5-Unofficial-869c206c4fcc8001bd2e1d66f704290331813835.zip
Initial Commit
Diffstat (limited to 'src/Java/binnie/craftgui/controls/page')
-rw-r--r--src/Java/binnie/craftgui/controls/page/ControlPage.java36
-rw-r--r--src/Java/binnie/craftgui/controls/page/ControlPages.java57
2 files changed, 93 insertions, 0 deletions
diff --git a/src/Java/binnie/craftgui/controls/page/ControlPage.java b/src/Java/binnie/craftgui/controls/page/ControlPage.java
new file mode 100644
index 0000000000..0e5c89492e
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/page/ControlPage.java
@@ -0,0 +1,36 @@
+package binnie.craftgui.controls.page;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.controls.core.IControlValue;
+import binnie.craftgui.core.IWidget;
+
+public class ControlPage<T>
+ extends Control
+ implements IControlValue<T>
+{
+ T value;
+
+ public ControlPage(IWidget parent, T value)
+ {
+ this(parent, 0.0F, 0.0F, parent.w(), parent.h(), value);
+ }
+
+ public ControlPage(IWidget parent, float x, float y, float w, float h, T value)
+ {
+ super(parent, x, y, w, h);
+ setValue(value);
+ if (((parent instanceof IControlValue)) && (((IControlValue)parent).getValue() == null)) {
+ ((IControlValue)parent).setValue(value);
+ }
+ }
+
+ public T getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(T value)
+ {
+ this.value = value;
+ }
+}
diff --git a/src/Java/binnie/craftgui/controls/page/ControlPages.java b/src/Java/binnie/craftgui/controls/page/ControlPages.java
new file mode 100644
index 0000000000..43a205e874
--- /dev/null
+++ b/src/Java/binnie/craftgui/controls/page/ControlPages.java
@@ -0,0 +1,57 @@
+package binnie.craftgui.controls.page;
+
+import binnie.craftgui.controls.core.Control;
+import binnie.craftgui.controls.core.IControlValue;
+import binnie.craftgui.controls.core.IControlValues;
+import binnie.craftgui.core.IWidget;
+import binnie.craftgui.events.EventValueChanged;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class ControlPages<T>
+ extends Control
+ implements IControlValues<T>, IControlValue<T>
+{
+ public boolean isChildVisible(IWidget child)
+ {
+ if (child == null) {
+ return false;
+ }
+ return this.value == ((IControlValue)child).getValue();
+ }
+
+ public ControlPages(IWidget parent, float x, float y, float w, float h)
+ {
+ super(parent, x, y, w, h);
+ }
+
+ T value = null;
+
+ public void onAddChild(IWidget widget) {}
+
+ public T getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(T value)
+ {
+ if (this.value != value)
+ {
+ this.value = value;
+ callEvent(new EventValueChanged(this, value));
+ }
+ }
+
+ public Collection<T> getValues()
+ {
+ List<T> list = new ArrayList();
+ for (IWidget child : getWidgets()) {
+ list.add(((IControlValue)child).getValue());
+ }
+ return list;
+ }
+
+ public void setValues(Collection<T> values) {}
+}