OSDN Git Service

scene2d.ui Disableable interface.
authorNathanSweet <nathan.sweet@gmail.com>
Thu, 3 Oct 2013 16:26:19 +0000 (18:26 +0200)
committerNathanSweet <nathan.sweet@gmail.com>
Thu, 3 Oct 2013 16:26:19 +0000 (18:26 +0200)
gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Button.java
gdx/src/com/badlogic/gdx/scenes/scene2d/ui/SelectBox.java
gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Slider.java
gdx/src/com/badlogic/gdx/scenes/scene2d/ui/TextField.java
gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Window.java
gdx/src/com/badlogic/gdx/scenes/scene2d/utils/Disableable.java [new file with mode: 0644]

index cc23a09..4552d66 100644 (file)
@@ -23,6 +23,7 @@ import com.badlogic.gdx.scenes.scene2d.InputEvent;
 import com.badlogic.gdx.scenes.scene2d.Touchable;\r
 import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;\r
 import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;\r
+import com.badlogic.gdx.scenes.scene2d.utils.Disableable;\r
 import com.badlogic.gdx.scenes.scene2d.utils.Drawable;\r
 import com.badlogic.gdx.utils.Array;\r
 import com.badlogic.gdx.utils.Pools;\r
@@ -35,7 +36,7 @@ import com.badlogic.gdx.utils.Pools;
  * <p>\r
  * The preferred size of the button is determined by the background and the button contents.\r
  * @author Nathan Sweet */\r
-public class Button extends Table {\r
+public class Button extends Table implements Disableable {\r
        private ButtonStyle style;\r
        boolean isChecked, isDisabled;\r
        ButtonGroup buttonGroup;\r
index 5b460a4..4d1322e 100644 (file)
@@ -32,6 +32,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle;
 import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.ScrollPaneStyle;\r
 import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;\r
 import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;\r
+import com.badlogic.gdx.scenes.scene2d.utils.Disableable;\r
 import com.badlogic.gdx.scenes.scene2d.utils.Drawable;\r
 import com.badlogic.gdx.utils.Pools;\r
 \r
@@ -44,7 +45,7 @@ import com.badlogic.gdx.utils.Pools;
  * {@link SelectBoxStyle#background}.\r
  * @author mzechner\r
  * @author Nathan Sweet */\r
-public class SelectBox extends Widget {\r
+public class SelectBox extends Widget implements Disableable {\r
        static final Vector2 tmpCoords = new Vector2();\r
 \r
        SelectBoxStyle style;\r
index 043ce6e..91d91f3 100644 (file)
@@ -25,6 +25,7 @@ import com.badlogic.gdx.math.MathUtils;
 import com.badlogic.gdx.scenes.scene2d.InputEvent;\r
 import com.badlogic.gdx.scenes.scene2d.InputListener;\r
 import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;\r
+import com.badlogic.gdx.scenes.scene2d.utils.Disableable;\r
 import com.badlogic.gdx.scenes.scene2d.utils.Drawable;\r
 import com.badlogic.gdx.utils.Pools;\r
 \r
@@ -37,7 +38,7 @@ import com.badlogic.gdx.utils.Pools;
  * 140, a relatively arbitrary size.\r
  * @author mzechner\r
  * @author Nathan Sweet */\r
-public class Slider extends Widget {\r
+public class Slider extends Widget implements Disableable {\r
        private SliderStyle style;\r
        private float min, max, stepSize;\r
        private float value, animateFromValue;\r
index 7720608..57cc553 100644 (file)
@@ -31,6 +31,7 @@ import com.badlogic.gdx.scenes.scene2d.InputEvent;
 import com.badlogic.gdx.scenes.scene2d.InputListener;\r
 import com.badlogic.gdx.scenes.scene2d.Stage;\r
 import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;\r
+import com.badlogic.gdx.scenes.scene2d.utils.Disableable;\r
 import com.badlogic.gdx.scenes.scene2d.utils.Drawable;\r
 import com.badlogic.gdx.utils.Array;\r
 import com.badlogic.gdx.utils.Clipboard;\r
@@ -55,7 +56,7 @@ import com.badlogic.gdx.utils.Timer.Task;
  * implementation will bring up the default IME.\r
  * @author mzechner\r
  * @author Nathan Sweet */\r
-public class TextField extends Widget {\r
+public class TextField extends Widget implements Disableable {\r
        static private final char BACKSPACE = 8;\r
        static private final char ENTER_DESKTOP = '\r';\r
        static private final char ENTER_ANDROID = '\n';\r
index c3e246d..1e95ba3 100644 (file)
@@ -156,8 +156,8 @@ public class Window extends Table {
                        Color color = getColor();\r
                        batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);\r
                        Stage stage = getStage();\r
-                       stageToLocalCoordinates(/* in/out */tmpPosition.set(0, 0));\r
-                       stageToLocalCoordinates(/* in/out */tmpSize.set(stage.getWidth(), stage.getHeight()));\r
+                       stageToLocalCoordinates(/* in/out */tmpPosition.set(0, -1));\r
+                       stageToLocalCoordinates(/* in/out */tmpSize.set(stage.getWidth() + 1, stage.getHeight()));\r
                        style.stageBackground.draw(batch, x + tmpPosition.x, y + tmpPosition.y, x + tmpSize.x, y + tmpSize.y);\r
                }\r
 \r
diff --git a/gdx/src/com/badlogic/gdx/scenes/scene2d/utils/Disableable.java b/gdx/src/com/badlogic/gdx/scenes/scene2d/utils/Disableable.java
new file mode 100644 (file)
index 0000000..9effb3b
--- /dev/null
@@ -0,0 +1,6 @@
+
+package com.badlogic.gdx.scenes.scene2d.utils;
+
+public interface Disableable {
+       public void setDisabled (boolean isDisabled);
+}