sdljavax.gui
Class Widget

java.lang.Object
  extended by sdljavax.gui.Widget
All Implemented Interfaces:
java.util.EventListener, SDLEventListener
Direct Known Subclasses:
Button, Container, ListBox

public class Widget
extends java.lang.Object
implements SDLEventListener

An entity which can be drawn to a screen and may interact with the user.

Version:
$Id: Widget.java,v 1.2 2005/01/30 22:02:07 ivan_ganza Exp $
Author:
Ivan Z. Ganza

Field Summary
protected  Texture backgroundTexture
           
protected  int border
           
protected  Container container
           
protected static FTFont defaultFont
           
protected  boolean drawBorder
           
protected  int height
           
protected  java.lang.String name
           
protected  boolean visible
           
protected  int width
           
protected  int xPos
           
protected  int yPos
           
 
Constructor Summary
Widget(GL gl, java.lang.String name, SDLRect dimensions, java.lang.String backgroundTexturePath)
           
 
Method Summary
 boolean contains(int x, int y)
          x and y absolute
 boolean contains(SDLRect rect)
          Describe contains method here.
 void draw(GL gl)
          Describe draw method here.
 void draw(GL gl, int x, int y)
          Draw myself at the given co-ordinates
 Texture getBackgroundTexture()
          Gets the value of backgroundTexture
 int getHeight()
          Gets the value of height
 java.lang.String getName()
          Gets the value of name
 int getWidth()
          Gets the value of width
 int getX()
          Gets the value of x
 int getY()
          Gets the value of y
 void handleEvent(SDLEvent event)
          Describe handleEvent method here.
 void hide()
          Describe hide method here.
 boolean isVisible()
          Describe isVisible method here.
 void mouseEntered()
           
 void mouseExit()
           
 void setBackgroundTexture(Texture argBackgroundTexture)
          Sets the value of backgroundTexture
 void setHeight(int argHeight)
          Sets the value of height
 void setName(java.lang.String argName)
          Sets the value of name
 void setWidth(int argWidth)
          Sets the value of width
 void setX(int argX)
          Sets the value of x
 void setY(int argY)
          Sets the value of y
 void show()
          Describe show method here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

container

protected Container container

name

protected java.lang.String name

xPos

protected int xPos

yPos

protected int yPos

width

protected int width

height

protected int height

border

protected int border

backgroundTexture

protected Texture backgroundTexture

visible

protected boolean visible

drawBorder

protected boolean drawBorder

defaultFont

protected static FTFont defaultFont
Constructor Detail

Widget

public Widget(GL gl,
              java.lang.String name,
              SDLRect dimensions,
              java.lang.String backgroundTexturePath)
       throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getX

public int getX()
Gets the value of x

Returns:
the value of x

setX

public void setX(int argX)
Sets the value of x

Parameters:
argX - Value to assign to this.x

getY

public int getY()
Gets the value of y

Returns:
the value of y

setY

public void setY(int argY)
Sets the value of y

Parameters:
argY - Value to assign to this.y

getWidth

public int getWidth()
Gets the value of width

Returns:
the value of width

setWidth

public void setWidth(int argWidth)
Sets the value of width

Parameters:
argWidth - Value to assign to this.width

getHeight

public int getHeight()
Gets the value of height

Returns:
the value of height

setHeight

public void setHeight(int argHeight)
Sets the value of height

Parameters:
argHeight - Value to assign to this.height

getBackgroundTexture

public Texture getBackgroundTexture()
Gets the value of backgroundTexture

Returns:
the value of backgroundTexture

setBackgroundTexture

public void setBackgroundTexture(Texture argBackgroundTexture)
Sets the value of backgroundTexture

Parameters:
argBackgroundTexture - Value to assign to this.backgroundTexture

getName

public java.lang.String getName()
Gets the value of name

Returns:
the value of name

setName

public void setName(java.lang.String argName)
Sets the value of name

Parameters:
argName - Value to assign to this.name

draw

public void draw(GL gl)
Describe draw method here.

Parameters:
gl - a GL value

draw

public void draw(GL gl,
                 int x,
                 int y)
Draw myself at the given co-ordinates

Parameters:
gl - a GL value
x - an int value
y - an int value

handleEvent

public void handleEvent(SDLEvent event)
Describe handleEvent method here.

Specified by:
handleEvent in interface SDLEventListener
Parameters:
event - a SDLEvent value

isVisible

public boolean isVisible()
Describe isVisible method here.

Returns:
a boolean value

hide

public void hide()
Describe hide method here.


show

public void show()
Describe show method here.


contains

public boolean contains(SDLRect rect)
Describe contains method here.

Parameters:
rect - a SDLRect value
Returns:
a boolean value

contains

public boolean contains(int x,
                        int y)
x and y absolute


mouseEntered

public void mouseEntered()

mouseExit

public void mouseExit()