sdl.test.gui
Class GUIComponent

java.lang.Object
  |
  +--sdl.test.gui.GUIComponent
All Implemented Interfaces:
sdl.event.EventListener, GUIHierarchyListener
Direct Known Subclasses:
GUIContainer, ImageComp

public class GUIComponent
extends java.lang.Object
implements sdl.event.EventListener, GUIHierarchyListener

for gui demo - unfinished, Minimal Component implememntation for awt-like gui that uses SDL graphics and events. TODO. move SDLRuntime to graphics implement Hierarchy change event. notify of parent. implement container


Field Summary
protected  java.util.HashSet componentListeners
           
protected  GUIComponent parent
           
protected  java.util.HashSet subComponents
           
 
Constructor Summary
GUIComponent()
           
 
Method Summary
 void addComponentListener(sdl.event.EventListener cl)
          TODO create component listner
 boolean contains(int x, int y)
          Checks whether this component "contains" the specified point, where x and y are defined to be relative to the coordinate system of this component.
 void dispatchEvent(GUIComponentEvent ce)
          TODO must implement subcomponents and events.
 java.awt.Color getBackground()
           
 java.awt.Rectangle getBounds()
          Gets the bounds of this component in the form of a Rectangle object.
 GUIComponent getComponentAt(int x, int y)
          TODO must implement subcomponents
 GUIGraphics getGraphics()
          TODO must implement subcomponents and must make this graphics relative to the context of this component This is pretty inefficient.
 java.awt.Point getLocation()
          Gets the location of this component in the form of a point specifying the component's top-left corner.
 java.awt.Point getLocationOnScreen()
           
 GUIComponent getParent()
           
 java.awt.Dimension getSize()
           
 boolean incomingEvents(sdl.event.SDLCustomEvent ce)
          Called wrapper by SDLEvent dispatcher for native SDL events and by processEvent() for our custom GUI events
 void paint(GUIGraphics g)
           
 void paintAll(GUIGraphics g)
          TODO implement subcomponent paint
protected  void processEvent(GUIComponentEvent ce)
          Calls incomingEvents().
 void setBackground(java.awt.Color color)
           
 void setBounds(int x, int y, int width, int height)
           
 void setBounds(java.awt.Rectangle bounds)
           
 void setLocation(int x, int y)
           
 void setSize(int x, int y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected GUIComponent parent

componentListeners

protected java.util.HashSet componentListeners

subComponents

protected java.util.HashSet subComponents
Constructor Detail

GUIComponent

public GUIComponent()
Method Detail

addComponentListener

public void addComponentListener(sdl.event.EventListener cl)
TODO create component listner


contains

public boolean contains(int x,
                        int y)
Checks whether this component "contains" the specified point, where x and y are defined to be relative to the coordinate system of this component.


getBackground

public java.awt.Color getBackground()

setBackground

public void setBackground(java.awt.Color color)

getBounds

public java.awt.Rectangle getBounds()
Gets the bounds of this component in the form of a Rectangle object. The bounds specify this component's width, height, and location relative to its parent.


setBounds

public void setBounds(java.awt.Rectangle bounds)

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)

getComponentAt

public GUIComponent getComponentAt(int x,
                                   int y)
TODO must implement subcomponents


getGraphics

public GUIGraphics getGraphics()
TODO must implement subcomponents and must make this graphics relative to the context of this component This is pretty inefficient. Time willing, store local copy of graphics objec and create component event to update changes to this location


getLocation

public java.awt.Point getLocation()
Gets the location of this component in the form of a point specifying the component's top-left corner. The location will be relative to the parent's coordinate space.


setLocation

public void setLocation(int x,
                        int y)

getLocationOnScreen

public java.awt.Point getLocationOnScreen()

getParent

public GUIComponent getParent()

getSize

public java.awt.Dimension getSize()

setSize

public void setSize(int x,
                    int y)

paint

public void paint(GUIGraphics g)

paintAll

public void paintAll(GUIGraphics g)
TODO implement subcomponent paint


dispatchEvent

public final void dispatchEvent(GUIComponentEvent ce)
TODO must implement subcomponents and events. Dispatches an event to this component or one of its sub components. Calls processEvent before returning for 1.1-style events which have been enabled for the Component.


processEvent

protected void processEvent(GUIComponentEvent ce)
Calls incomingEvents(). Exists for convention sake only.


incomingEvents

public boolean incomingEvents(sdl.event.SDLCustomEvent ce)
                       throws sdl.event.SDLEventException
Called wrapper by SDLEvent dispatcher for native SDL events and by processEvent() for our custom GUI events

Specified by:
incomingEvents in interface sdl.event.EventListener
sdl.event.SDLEventException