moka.x
Class Container

java.lang.Object
  extended bymoka.lang.Object
      extended bymoka.event.EventListener
          extended bymoka.x.Component
              extended bymoka.x.Container
Direct Known Subclasses:
Frame, GEM, MenuBar, Panel, ScrollPane

public class Container
extends Component

Container is a component that contains child components.

Since:
MDK1.0a

Field Summary
protected  Component child
          The first component in this Container.
protected  Component tail
          The last component in this Container.
 
Fields inherited from class moka.x.Component
enabled, height, listen, mnemonic, next, parent, prev, visible, width, x, y
 
Constructor Summary
Container()
          Constructs a newly allocated Container.
 
Method Summary
 void add(Component c)
          Adds the specified component to this container.
 void checkMnemonic(char m)
          Checks if the mnemonic of this container correspond to the current mnemonic.
protected  void clean()
          Disposes of all ressources used by this container and all its children.
 void empty()
          Empties the container (removes all its children).
 void onPaint()
          Called when a PaintEvent occurs to paint the image of the container and stores it in its virtual memory.
 void onRefresh()
          Called when an UpdateEvent occurs.
 void paintChildren(moka.x.SCR_RECT_p clip)
          Paints the children of this container to the virtual screen.
 void paintForeground()
          This method is called to draw the foreground of the container.
 void remove(Component c)
          Removes the specified component from this container.
 void repaintChildren()
          Sends a PaintEvent to all the children of this component that need to be repainted.
 Component toFront(Component c)
          Called to brings a component to the front of this container.
 void use()
          This method is invoked by the GEM when the user interacts with the container.
 
Methods inherited from class moka.x.Component
bottom, center, eventTriggered, finalize, isCursorOver, left, move, paint, right, setBounds, setEnabled, setHeight, setMnemonic, setVisible, setWidth, setX, setY, top
 
Methods inherited from class moka.event.EventListener
eventTriggered
 
Methods inherited from class moka.lang.Object
equals, getClassName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

child

protected Component child
The first component in this Container.


tail

protected Component tail
The last component in this Container.

Constructor Detail

Container

public Container()
Constructs a newly allocated Container.

Method Detail

onPaint

public void onPaint()
Called when a PaintEvent occurs to paint the image of the container and stores it in its virtual memory. The container is painted, then all its children are and finally its foreground is. A PaintEvent occurs when the aspect of the container is altered or any of its children is.

Overrides:
onPaint in class Component

onRefresh

public void onRefresh()
Called when an UpdateEvent occurs. An update event occurs when a visible component contained in this container has changed its appearance.


repaintChildren

public void repaintChildren()
Sends a PaintEvent to all the children of this component that need to be repainted.


paintForeground

public void paintForeground()
This method is called to draw the foreground of the container. This method is called after all the children of this container are painted.


paintChildren

public void paintChildren(moka.x.SCR_RECT_p clip)
Paints the children of this container to the virtual screen. param clip The SCR_RECT clip


use

public void use()
This method is invoked by the GEM when the user interacts with the container.

Overrides:
use in class Component

checkMnemonic

public void checkMnemonic(char m)
Checks if the mnemonic of this container correspond to the current mnemonic. If it is the case, an event is triggered.

Overrides:
checkMnemonic in class Component

add

public void add(Component c)
Adds the specified component to this container.

Parameters:
c - the component to add to this container.

remove

public void remove(Component c)
Removes the specified component from this container.

Parameters:
c - the component to remove from this container

empty

public void empty()
Empties the container (removes all its children).


toFront

public Component toFront(Component c)
Called to brings a component to the front of this container.

Overrides:
toFront in class Component
Parameters:
c - The component to bring to front.
Returns:
This container if it is the component to bring to front or if a child of this container is, null otherwize.

clean

protected void clean()
Disposes of all ressources used by this container and all its children.

Overrides:
clean in class Component