# 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
- doLayout
- getComponentAt
- getRootContainer
- invalidate
- isChildOf
- isRootContainer
- mouseEvent
- moveZ
- new
- onDisplayChange
- onVisibilityChange
- removeChildren
- removeComponent
- setBounds
- 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 child components on the container. Sorted from top to bottom. Be aware that the table is changed if childs are inserted / removed, which means that it that this should be avoided while iterating the list. Additionally, the table should not be modified, or behaviour is undefined.
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. Never overload delete, use onDestroy for custom actions instead.
deleteChilds (Container)
  returns: ()
  deletes all childs of the container
doLayout (Container)
  returns: ()
  Called if the size of the container was changed. Can be overloaded (does nothing per default) to change bounds of child elements.
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.
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
moveZ (Container,Component a/ number index,toindex)
  returns: ()
  deletes all childs of the container
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.
removeChildren (Container)
  returns: ()
  removes all children of the container
removeComponent (Container, Component)
  returns: ()
  removes the component from the container
setBounds (Container,x,y,w,h)
  returns: ()
  Sets the bounds of the container and calls 'doLayout'.
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, addTooltipListener, clipinsets, colors, contains, createVisibles, delete, deleteVisibles, fadeTo, focus, focuscolors, getBottom, getBounds, getClipRect, getFocusComponentAt, getFocusElement, getFocusIndex, getHeight, getLocation, getMinSize, getMouseLock, getParent, getRight, getSize, getSkin, getTooltip, 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, removeTooltipListener, setBounds, setClip, setColor, setDefaultUI, setDisabled, setDisplayable, setFont, setLocation, setSize, setSkin, setTooltip, setVisibility, showTooltipInformation, showVisibles, skinnames.defaultskin, skinnames.focusedskin, skinnames.hoveredskin, skinnames.pressedskin, think, toString, transferFocus, transferFocusOnArrows, transferFocusOnTab, unlockMouse, updateSkin, validate, validateFocus, white, world2local, zorderoffset