public void SetLayer(Layer layer) { this.layer = layer; foreach (var but in layerBox.Children) { but.Selected = layer == but.Tag; } table.ClearRows(); if (layer != null) { table.BeginUpdate(); foreach (var tileId in layer.TileSet.Tiles) { string ic = ""; string id = "" + tileId; string name = layer.TileSet.GetTileName(tileId); var row = table.AddRow(ic, id, name); row.Cells[0].Image = layer.TileSet.GetTile(tileId); row.Id = tileId; } table.EndUpdate(); SetTile(layer[mapX, mapY]); } Invalidate(); }
private void BasicDemo() { if (basicWindow == null) { basicWindow = new Window(screen, "Baisc Demo") { LeftEdge = 30, TopEdge = 30, CloseGadget = true, DepthGadget = true, SizeGadget = true, WindowCloseEvent = (o, i) => { screen.CloseWindow(basicWindow); basicWindow = null; } }; var tabs = new TabPanelGadget(basicWindow); var tab1 = tabs.AddTab("Tab 1", Orientation.Vertical); new LabelGadget(tab1, "First Tab"); var boxL = new BoxGadget(tab1, Orientation.Horizontal); new LabelGadget(boxL, "Selection:"); var cg = new ChooserGadget(boxL) { Items = new string[] { "Rows", "Cells", "Cols" } }; var table1 = new TableGadget(tab1); cg.SelectedIndexChangedEvent = (o, i) => { table1.SelectMode = (TableSelectMode)cg.SelectedIndex; }; var col1 = table1.AddColumn("Name", 100); var col2 = table1.AddColumn("Date", 100); var col3 = table1.AddColumn("Col 3", 100); for (int i = 0; i < 700; i++) { var row = table1.AddRow("" + i, "" + (i * i), "" + (i + i)); } table1.AddRow("Last", "The very last row!", "Ultimo"); var tab2 = tabs.AddTab("Tab 2", Orientation.Vertical); new LabelGadget(tab2, "Second Tab"); var hbox = new BoxGadget(tab2, Orientation.Horizontal); new LabelGadget(hbox, "Lab"); var table2 = new TableGadget(hbox) { ShowHeader = false }; Icons icon = Icons.ENTYPO_ICON_500PX; for (int i = 0; i < 700; i++) { string lab = icon.ToString(); var row = table2.AddRow(lab.Replace("ENTYPO_ICON_", "")); row.Cells[0].Icon = icon; icon++; if (icon > Icons.ENTYPO_ICON_YOUTUBE_WITH_CIRCLE) { break; } } var tab3 = tabs.AddTab("Tab 3", Orientation.Vertical); new LabelGadget(tab3, "Third Tab"); tabs.SelectedIndex = 2; } screen.ShowWindow(basicWindow); screen.WindowToFront(basicWindow); screen.ActivateWindow(basicWindow); }