Skip to content

Commit

Permalink
scene2d.ui Disableable interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanSweet committed Oct 3, 2013
1 parent 12cd4d3 commit e410f90
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Button.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.Disableable;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pools;
Expand All @@ -35,7 +36,7 @@
* <p>
* The preferred size of the button is determined by the background and the button contents.
* @author Nathan Sweet */
public class Button extends Table {
public class Button extends Table implements Disableable {
private ButtonStyle style;
boolean isChecked, isDisabled;
ButtonGroup buttonGroup;
Expand Down
3 changes: 2 additions & 1 deletion gdx/src/com/badlogic/gdx/scenes/scene2d/ui/SelectBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.ScrollPaneStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.Disableable;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.utils.Pools;

Expand All @@ -44,7 +45,7 @@
* {@link SelectBoxStyle#background}.
* @author mzechner
* @author Nathan Sweet */
public class SelectBox extends Widget {
public class SelectBox extends Widget implements Disableable {
static final Vector2 tmpCoords = new Vector2();

SelectBoxStyle style;
Expand Down
3 changes: 2 additions & 1 deletion gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Slider.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.badlogic.gdx.scenes.scene2d.utils.Disableable;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.utils.Pools;

Expand All @@ -37,7 +38,7 @@
* 140, a relatively arbitrary size.
* @author mzechner
* @author Nathan Sweet */
public class Slider extends Widget {
public class Slider extends Widget implements Disableable {
private SliderStyle style;
private float min, max, stepSize;
private float value, animateFromValue;
Expand Down
3 changes: 2 additions & 1 deletion gdx/src/com/badlogic/gdx/scenes/scene2d/ui/TextField.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.Disableable;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Clipboard;
Expand All @@ -55,7 +56,7 @@
* implementation will bring up the default IME.
* @author mzechner
* @author Nathan Sweet */
public class TextField extends Widget {
public class TextField extends Widget implements Disableable {
static private final char BACKSPACE = 8;
static private final char ENTER_DESKTOP = '\r';
static private final char ENTER_ANDROID = '\n';
Expand Down
4 changes: 2 additions & 2 deletions gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ protected void drawBackground (SpriteBatch batch, float parentAlpha) {
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
Stage stage = getStage();
stageToLocalCoordinates(/* in/out */tmpPosition.set(0, 0));
stageToLocalCoordinates(/* in/out */tmpSize.set(stage.getWidth(), stage.getHeight()));
stageToLocalCoordinates(/* in/out */tmpPosition.set(0, -1));
stageToLocalCoordinates(/* in/out */tmpSize.set(stage.getWidth() + 1, stage.getHeight()));
style.stageBackground.draw(batch, x + tmpPosition.x, y + tmpPosition.y, x + tmpSize.x, y + tmpSize.y);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

package com.badlogic.gdx.scenes.scene2d.utils;

public interface Disableable {
public void setDisabled (boolean isDisabled);
}

2 comments on commit e410f90

@saejox
Copy link

@saejox saejox commented on e410f90 Oct 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a funny word, Disableable.

@NathanSweet
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea it's not a real work. I'm not real happy with it but couldn't think of anything better.

Please sign in to comment.