package electrosphere.renderer.ui.elementtypes;

import electrosphere.renderer.ui.events.Event;

public interface Element {

    //width and height
    public int getWidth();
    public int getHeight();
    public void setWidth(int width);
    public void setHeight(int 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 void setParentWidth(int width);
    public void setParentHeight(int height);
    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);

    
    

    //
    // I N T E R N A L
    //
    /**
     * Gets the internal x position. This is the position x value used by the layout manager. It corresponds to what is actually displayed.
     * @return The internal position x coordinate
     */
    public int getInternalX();
    /**
     * Gets the internal y position. This is the position y value used by the layout manager. It corresponds to what is actually displayed.
     * @return The internal position y coordinate
     */
    public int getInternalY();
    /**
     * Gets the internal width. This is the width value used by the layout manager. It corresponds to what is actually displayed.
     * @return The internal width
     */
    public int getInternalWidth();
    /**
     * Gets the internal height. This is the height value used by the layout manager. It corresponds to what is actually displayed.
     * @return The internal height
     */
    public int getInternalHeight();


    //
    //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);

}
