1 module layerlist; 2 3 import PixelPerfectEngine.concrete.window; 4 import app; 5 import std.utf : toUTF32; 6 import std.conv : to; 7 import PixelPerfectEngine.graphics.layers; 8 import PixelPerfectEngine.map.mapformat : LayerInfo; 9 10 public class LayerList : Window { 11 ListBox listBox_layers; 12 SmallButton[] buttons; 13 public void delegate() onClose; 14 //CheckBox CheckBox_Visible; 15 public this(int x, int y, void delegate() onClose){ 16 //super(Coordinate(0 + x, 16 + y, 98 + x, 213 + y), "Layers"d); 17 super(Coordinate(0 + x, 0 + y, 130 + x, 213 + y), "Layers"d); 18 this.onClose = onClose; 19 //StyleSheet ss = getStyleSheet(); 20 listBox_layers = new ListBox("listBox0", Coordinate(1, 17, 129, 180), [], new ListBoxHeader(["Pri"d ,"Type"d, "Name"d], 21 [24, 24, 96])); 22 addElement(listBox_layers, EventProperties.MOUSE); 23 { 24 SmallButton sb = new SmallButton("trashButtonB", "trashButtonA", "trash", Coordinate(113, 196, 129, 212)); 25 sb.onMouseLClickRel = &button_trash_onClick; 26 buttons ~= sb; 27 } 28 { 29 SmallButton sb = new SmallButton("settingsButtonB", "settingsButtonA", "editMat", Coordinate(97, 196, 113, 212)); 30 //sb.onMouseLClickRel = &button_trash_onClick; 31 buttons ~= sb; 32 } 33 { 34 SmallButton sb = new SmallButton("newTileLayerButtonB", "newTileLayerButtonA", "newTileLayer", 35 Coordinate(1, 180, 17, 196)); 36 sb.onMouseLClickRel = &button_newTileLayer_onClick; 37 buttons ~= sb; 38 } 39 { 40 SmallButton sb = new SmallButton("newSpriteLayerButtonB", "newSpriteLayerButtonA", "newSpriteLayer", 41 Coordinate(17, 180, 33, 196)); 42 sb.onMouseLClickRel = &button_newSpriteLayer_onClick; 43 buttons ~= sb; 44 } 45 { 46 SmallButton sb = new SmallButton("newTransformableTileLayerButtonB", "newTransformableTileLayerButtonA", 47 "newTransformableTileLayer", Coordinate(33, 180, 49, 196)); 48 sb.onMouseLClickRel = &button_newTransformableTileLayer_onClick; 49 buttons ~= sb; 50 } 51 { 52 SmallButton sb = new SmallButton("importMaterialDataButtonB", "importMaterialDataButtonA", "importMat", 53 Coordinate(97, 180, 113, 196)); 54 sb.onMouseLClickRel = &button_importMaterialData_onClick; 55 buttons ~= sb; 56 } 57 { 58 SmallButton sb = new SmallButton("importLayerDataButtonB", "importLayerDataButtonA", "importLayer", 59 Coordinate(113, 180, 129, 196)); 60 sb.onMouseLClickRel = &button_importLayerData_onClick; 61 buttons ~= sb; 62 } 63 { 64 SmallButton sb = new SmallButton("upArrowB", "upArrowA", "moveLayerUp", Coordinate(1, 196, 17, 212)); 65 sb.onMouseLClickRel = &button_moveLayerUp_onClick; 66 buttons ~= sb; 67 } 68 { 69 SmallButton sb = new SmallButton("downArrowB", "downArrowA", "moveLayerDown", Coordinate(17, 196, 33, 212)); 70 sb.onMouseLClickRel = &button_moveLayerDown_onClick; 71 buttons ~= sb; 72 } 73 foreach(sb ; buttons){ 74 addElement(sb, EventProperties.MOUSE); 75 } 76 //CheckBox_Visible = new CheckBox("Visible"d, "CheckBox0", Coordinate(1, 180, 97, 196)); 77 } 78 private void listBox_layers_onItemSelect(Event ev){ 79 80 } 81 private void button_trash_onClick(Event ev){ 82 83 } 84 private void button_newTileLayer_onClick(Event ev){ 85 prg.initNewTileLayer; 86 } 87 private void button_newSpriteLayer_onClick(Event ev){ 88 89 } 90 private void button_newTransformableTileLayer_onClick(Event ev){ 91 92 } 93 private void button_importMaterialData_onClick(Event ev){ 94 95 } 96 private void button_importLayerData_onClick(Event ev){ 97 98 } 99 private void button_moveLayerUp_onClick(Event ev){ 100 101 } 102 private void button_moveLayerDown_onClick(Event ev){ 103 104 } 105 public void updateLayerList(LayerInfo[] items) { 106 ListBoxItem[] list; 107 foreach (i ; items) { 108 list ~= new ListBoxItem([to!dstring(i.pri), to!dstring(i.type), toUTF32(i.name)]); 109 } 110 listBox_layers.updateColumns(list); 111 } 112 public override void close(){ 113 if(onClose !is null){ 114 onClose(); 115 } 116 super.close; 117 } 118 }