private string DrawWidget(ItemShelfElement element) { StringBuilder render = new StringBuilder (""); if (horizontalPos + ELEMENT_SIZE*2 + 10 >= this.Allocation.Width) { render.Append (element.Render (horizontalPos, verticalPos, ELEMENT_SIZE)); render.Append ("<tr><td height=\""); render.Append ((ELEMENT_SIZE+10).ToString()); render.Append ("\"></tr>"); render.Append ("<tr><td colspan=\"100\" height=\"25\" background=\""); render.Append (shelf); render.Append ("\"></td></tr>"); horizontalPos = 10; verticalPos += ELEMENT_SIZE + 35; } else { render.Append (element.Render (horizontalPos, verticalPos, ELEMENT_SIZE)); horizontalPos += ELEMENT_SIZE + 20; } return render.ToString (); }
private void AddItem(Item item) { ItemShelfElement element = new ItemShelfElement (item); if (catalog.IsBorrowed (item)) { element.IsBorrowed = true; } int pos = elements.Add (element); element.Position = pos; }