1 module elementTypes; 2 3 import std.conv; 4 import std.stdio; 5 6 import PixelPerfectEngine.concrete.elements; 7 import PixelPerfectEngine.graphics.common; 8 import PixelPerfectEngine.system.inputHandler; 9 10 public class ElementParameter{ 11 string name; 12 int type; 13 wstring text; 14 int numeric; 15 public this(){} 16 } 17 18 public enum ElementValueParameter{ 19 OpensANewWindow, 20 None, 21 Text, 22 Description, 23 Numeric 24 } 25 26 public void loadParametersIntoListbox(ListBox l, ElementParameter[] data){ 27 ListBoxItem[] newItems; 28 /*newItems ~= new ListBoxItem(["text", data["text"]], [TextInputType.DISABLE, TextInputType.TEXT]); 29 newItems ~= new ListBoxItem(["name", data["name"]], [TextInputType.DISABLE, TextInputType.TEXT]); 30 newItems ~= new ListBoxItem(["source", data["source"]], [TextInputType.DISABLE, TextInputType.TEXT]); 31 newItems ~= new ListBoxItem(["icon", data["icon"]], [TextInputType.DISABLE, TextInputType.TEXT]); 32 newItems ~= new ListBoxItem(["top", data["Coordinate.top"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 33 newItems ~= new ListBoxItem(["bottom", data["Coordinate.bottom"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 34 newItems ~= new ListBoxItem(["left", data["Coordinate.left"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 35 newItems ~= new ListBoxItem(["right", data["Coordinate.right"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 36 newItems ~= new ListBoxItem(["CSS.borderWidth", data["CSS.borderWidth"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 37 newItems ~= new ListBoxItem(["CSS.borderColorA", data["CSS.borderColorA"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 38 newItems ~= new ListBoxItem(["CSS.borderColorB", data["CSS.borderColorB"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 39 newItems ~= new ListBoxItem(["CSS.button", data["CSS.button"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 40 newItems ~= new ListBoxItem(["CSS.buttonPressed", data["CSS.buttonPressed"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 41 newItems ~= new ListBoxItem(["CSS.fontType", data["CSS.fontType"]], [TextInputType.DISABLE, TextInputType.TEXT]); 42 newItems ~= new ListBoxItem(["CSS.fontColor", data["CSS.fontColor"]], [TextInputType.DISABLE, TextInputType.TEXT]);*/ 43 foreach(s ; data){ 44 //writeln(s.name,";",s.text,";",s.numeric); 45 newItems ~= new ListBoxItem([to!wstring(s.name), s.type == ElementValueParameter.Numeric ? to!wstring(s.numeric) : s.text], [TextInputType.DISABLE, s.type == ElementValueParameter.None || s.type == ElementValueParameter.OpensANewWindow ? TextInputType.DISABLE : TextInputType.TEXT]); 46 } 47 l.updateColumns(newItems); 48 } 49 50 /*public void loadLabelParametersIntoListbox(ListBox l, Coordinate initialPosition, string initialName){ 51 ListBoxItem[] newItems; 52 newItems ~= new ListBoxItem(["text", data["text"]], [TextInputType.DISABLE, TextInputType.TEXT]); 53 newItems ~= new ListBoxItem(["name", data["name"]], [TextInputType.DISABLE, TextInputType.TEXT]); 54 newItems ~= new ListBoxItem(["source", data["source"]], [TextInputType.DISABLE, TextInputType.TEXT]); 55 newItems ~= new ListBoxItem(["top", data["Coordinate.top"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 56 newItems ~= new ListBoxItem(["bottom", data["Coordinate.bottom"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 57 newItems ~= new ListBoxItem(["left", data["Coordinate.left"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 58 newItems ~= new ListBoxItem(["right", data["Coordinate.right"]], [TextInputType.DISABLE, TextInputType.DECIMAL]); 59 newItems ~= new ListBoxItem(["CSS.fontType", data["CSS.fontType"]], [TextInputType.DISABLE, TextInputType.TEXT]); 60 newItems ~= new ListBoxItem(["CSS.fontColor", data["CSS.fontColor"]], [TextInputType.DISABLE, TextInputType.TEXT]); 61 }*/