package electrosphere.renderer.ui.elementtypes;

import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaAlignment;
import electrosphere.renderer.ui.events.Event;

public interface Element {

    /**
     * A yoga element that either hasn't been created or has already been destroyed
     */
    public static final int NULL_YOGA_ELEMENT = -1;

    //width and height
    public int getWidth();
    public int getHeight();
    public void setWidth(int width);
    public void setWidthPercent(float width);
    public void setHeight(int height);
    public void setHeightPercent(float height);
    public void setMaxWidth(int width);
    public void setMaxWidthPercent(float percent);
    public void setMaxHeight(int height);
    public void setMaxHeightPercent(float percent);
    public void setMinWidth(int width);
    public void setMinWidthPercent(float percent);
    public void setMinHeight(int height);
    public void setMinHeightPercent(float percent);

    //position
    public int getRelativeX();
    public int getRelativeY();
    public int getAbsoluteX();
    public int getAbsoluteY();
    public void setPositionX(int positionX);
    public void setPositionY(int positionY);

    //position-related
    public void setAbsolutePosition(boolean useAbsolutePosition);
    
    //parent data
    public Element getParent();
    public void setParent(Element parent);

    //margin
    public void setMarginTop(int marginTop);
    public void setMarginRight(int marginRight);
    public void setMarginBottom(int marginBottom);
    public void setMarginLeft(int marginLeft);

    //padding
    public void setPaddingTop(int paddingTop);
    public void setPaddingRight(int paddingRight);
    public void setPaddingBottom(int paddingBottom);
    public void setPaddingLeft(int paddingLeft);

    /**
     * Sets the self alignment
     * @param alignment the alignment style
     */
    public void setAlignSelf(YogaAlignment alignment);


    //
    //Maintenance related
    //
    public void destroy();


    //
    // Y O G A
    //
    /**
     * Gets the yoga node id
     * @return the yoga node id
     */
    public long getYogaNode();
    /**
     * Applies the yoga values to this component
     */
    public void applyYoga(int parentX, int parentY);


    //
    // E V E N T S
    //
    /**
     * 
     * @param event the even to handle
     * @return true if the event should continue to propagate
     */
    public boolean handleEvent(Event event);

}
