# Class: Container

### LuxModule: gui

A container is a collection of Components.

## Hierarchy

    o-+ Component
      o-+ Container
        o-- ComboBox
        o-- GroupFrame
        o-- ListBox
        o-- TitleFrame

## Methods:

### Method overview:

- add
- components
- delete
- deleteChilds
- getComponentAt
- getForegroundContainer
- getRootContainer
- invalidate
- isChildOf
- isRootContainer
- mouseEvent
- new
- onDisplayChange
- onVisibilityChange
- removeChilds
- removeComponent
- toString
- validate

new (table class, int x,y,w,h)
  returns: (Container)
  creates a container with the given bounds
add (Container, Component,[int index])
  returns: (Component)
  adds the component to the list of components. If Index is passed, it will be inserted at a certain z-position. The lower indexes are on the foreground, higher numbers are on the background. Returns the added Component
components
  {[table]} - list of components on the container
delete (Component self)
  returns: ()

  description from overloaded method of Component:

  deletes the component. Removes the component from any parent object and calls Component.onDestroy, that is also called when the Component is garbagecollected.
deleteChilds (Container)
  returns: ()
  deletes all childs of the container
getComponentAt (Container self, float x,y)
  returns: ([Component])
  returns container at the specific position. Returns self if no child is found that matches and if the point is contained in the component.
getForegroundContainer ()
  returns: (Container)
  returns the foregroundcontainer. The foreground is a container that lies on top of the root container. Any element that is placed on the foregroundcontainer will cover the elements that are placed on the rootcontainer. The elements on the foregroundcontainer can implement a function that is named "outsideclicked". If it does not exist, it assumes true as return value, which signals that it wants to be removed. As argument, the called function receives the component at first and the mouseevent as second argument.
getRootContainer ()
  returns: (Container)
  returns the rootcontainer which is the main frame.
invalidate (Component self)
  returns: ()

  description from overloaded method of Component:

  marks component to be updated on next validation
isChildOf (Container, parent)
  returns: (boolean)
  returns true if a parent of the ancestors is equal to parent
isRootContainer (Container)
  returns: (boolean)
  returns true if the container is the rootcontainer
mouseEvent (Container self, MouseEvent event, boolean exit)
  returns: ()
  processes the mouseevent and delegates it to it's children and mouselisteners. If exit is true, the mouse is now on another component
onDisplayChange (Container self, boolean isDisplayed)
  returns: ()

  called whenever the displaystate is changed, i.e. if the component was made invisible, or it's parent was removed from the rootpane etc.

  A component that is displayed has not to be visible.
onVisibilityChange (Container self, boolean isVisible)
  returns: ()
  called whenever the container is made visible / invisible. Calls onVisibilityChange of all child components.
removeChilds (Container)
  returns: ()
  removes all childs of the container
removeComponent (Container, Component)
  returns: ()
  removes the component from the container
toString (Container self)
  returns: ()
  returns a simple string representation of self
validate (Container self)
  returns: ()
  validates the container and all its childs. Is called once per frame for containers that are visible, don't call it unless you really need it.

## Inherited Methods:

### From Component

acceptSkinBounds, addKeyListener, addMouseListener, clipinsets, colors, contains, createVisibles, delete, deleteVisibles, focus, focuscolors, getBounds, getClipRect, getFocusComponentAt, getFocusElement, getFocusIndex, getHeight, getLocation, getMinSize, getMouseLock, getParent, getSize, getSkin, getWidth, getX, getY, hasFocus, hideVisibles, index, invalidate, isClipped, isDisplayedFlag, isFocusable, isMouseLocker, isVisible, isVisibleFlag, keyEvent, keylisteners, local2world, lockMouse, mouseClicked, mouseEntered, mouseEvent, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheeled, mouselisteners, moveToRect, new, newFocusOrder, onDestroy, onDisplayChange, onGainedFocus, onLostFocus, onVisibilityChange, positionUpdate, remove, removeKeyListener, removeMouseListener, setBounds, setClip, setColor, setDisplayable, setFont, setLocation, setSize, setSkin, setVisibility, showVisibles, skinnames.defaultskin, skinnames.focusedskin, skinnames.hoveredskin, skinnames.pressedskin, think, toString, transferFocus, transferFocusOnArrows, transferFocusOnTab, unlockMouse, updateSkin, validate, white, world2local, zorderoffset