public void draw(sAttribute attr) { sGraphicElement ele = null; Type type = attr.GetType(); if (type == typeof(sAttributeScreen)) { ele = new sGraphicScreen((sAttributeScreen)attr); } else if (type == typeof(sAttributeLabel)) { ele = new sGraphicLabel((sAttributeLabel)attr); } else if (type == typeof(sAttributePixmap)) { ele = new sGraphicPixmap((sAttributePixmap)attr); } else if (type == typeof(sAttributeWidget)) { //ele = new sGraphicRectangel((sAttributeWidget)attr, false, 1.0F, Color.GreenYellow); ele = new sGraphicWidget((sAttributeWidget)attr); } pDrawList.Add(ele); }
public sGraphicElement getElement(uint x, uint y) { //x = (uint)((float)x * pScale); //y = (uint)((float)y * pScale); //the array should be sorrted regarding zposition !!! for (int i = 0; i < pDrawList.Count; i++) { sGraphicElement ele = (sGraphicElement)pDrawList[pDrawList.Count - 1 - i]; if (ele.pX <= x && x < ele.pX + ele.pWidth && ele.pY <= y && y < ele.pY + ele.pHeight && ele.pZPosition != 1000) { return(ele); } } return(null); }