/// <summary> /// The main method for putting the entry on the page. This method is accessed from the GumpList class when CommitList() is called. /// </summary> /// <param name="page">The gump to which the entry should be appended.</param> public void AppendTo(Gump page) { m_ColCount = columnValues.Count < m_ParentList.columns? columnValues.Count: m_ParentList.columns; if (m_ColCount == 0) { return; } if (m_Background) { GumpImageTiled b = new GumpImageTiled(m_X, m_Y, m_Width, m_Height, m_BackgroundID); page.Add(b); } if (m_Style == "details") { m_ParentList.DebugWrite("Details mode."); int i = 0; //int columnval = -1; int colWidth = Width / m_ColCount; int xbase = m_X; while (i < columnValues.Count && i < m_ParentList.columns) { colWidth = getWidthOfColumn(i); xbase = m_X + getCurrentXLocation(i + 1); m_ParentList.DebugWrite("Appending Columns."); try { object o = columnValues[i]; if (o is GumpButton) { GumpButton btn = (GumpButton)o; btn.X = xbase + skin.ListColumnIndent; btn.Y = m_Y; page.Add(btn); } else if (o is GumpCheck) { GumpCheck c = (GumpCheck)o; c.X = xbase + skin.ListColumnIndent; c.Y = m_Y; page.Add(c); } else if (o is GumpTextEntry) { GumpTextEntry t = (GumpTextEntry)o; t.X = xbase + skin.ListColumnIndent; t.Y = m_Y; t.Width = colWidth; t.Height = m_Height; page.Add(t); } else if (o is string) { string s = (string)o; m_ParentList.DebugWrite("stringy! " + s); if (s.Contains("</")) { GumpHtml h = new GumpHtml(xbase + skin.ListColumnIndent, m_Y, colWidth, m_Height, s, false, false); h.Parent = page; page.Add(h); } else { m_ParentList.DebugWrite("text"); GumpLabel g = new GumpLabel(xbase + skin.ListColumnIndent, m_Y, skin.NormalText, s); g.Parent = page; page.Add(g); } } i++; } catch (Exception e) { Console.WriteLine("Problem in AppendTo - " + e); i = columnValues.Count; } if (m_Dividers) { GumpImageTiled t = new GumpImageTiled(xbase + colWidth, m_Y, skin.EntryDividerWidth, skin.EntryDividerHeight, skin.EntryDividerID); page.Add(t); } } m_ParentList.DebugWrite("Done, details."); } else if (m_Style == "icons") { m_ParentList.DebugWrite("Icons mode."); Hashtable table = (Hashtable)columnValues[0]; string s = (string)table["caption"]; if (m_Background) { GumpImageTiled t = new GumpImageTiled(m_X, m_Y, m_Width, m_Height, m_BackgroundID); page.Add(t); } GumpButton button; if (arguments.ContainsKey("button")) { button = (GumpButton)arguments["button"]; page.Add(button); } else { return; } int icon = arguments["icon"] != null ? (int)arguments["icon"] : skin.EntryDefaultIcon; GumpImage im = new GumpImage((skin.EntryCaptionWidth - m_X) - skin.EntryIconWidth / 2, m_Y + skin.EntryIconY, icon); page.Add(im); if (s.Contains("</")) { GumpHtml h = new GumpHtml(m_X, m_Y, m_Width, m_Height, s, false, false); h.Parent = page; page.Add(h); } else { GumpLabel g = new GumpLabel(m_X, m_Y + skin.EntryCaptionPositionY, skin.NormalText, s); g.Parent = page; page.Add(g); } } else { Console.WriteLine("Unknown style: " + m_Style); } }
public virtual void Write(string name, GumpImage e) { CreateElement(e); SetAttribute("name", name); SetAttribute("x", e.X); SetAttribute("y", e.Y); SetAttribute("hue", e.Hue); SetAttribute("gumpid", e.GumpID); Append(); }
/// <summary> /// The main method for putting the entry on the page. This method is accessed from the GumpList class when CommitList() is called. /// </summary> /// <param name="page">The gump to which the entry should be appended.</param> public void AppendTo(Gump page) { m_ColCount = columnValues.Count < m_ParentList.columns? columnValues.Count: m_ParentList.columns; if( m_ColCount == 0 ) return; if (m_Background) { GumpImageTiled b = new GumpImageTiled( m_X, m_Y, m_Width, m_Height, m_BackgroundID ); page.Add(b); } if (m_Style == "details") { m_ParentList.DebugWrite("Details mode."); int i = 0; //int columnval = -1; int colWidth = Width / m_ColCount; int xbase = m_X; while (i < columnValues.Count && i < m_ParentList.columns) { colWidth = getWidthOfColumn(i); xbase = m_X + getCurrentXLocation(i+1); m_ParentList.DebugWrite("Appending Columns."); try { object o = columnValues[i]; if (o is GumpButton) { GumpButton btn = (GumpButton)o; btn.X = xbase+skin.ListColumnIndent; btn.Y = m_Y; page.Add(btn); } else if (o is GumpCheck) { GumpCheck c = (GumpCheck)o; c.X = xbase + skin.ListColumnIndent; c.Y = m_Y; page.Add(c); } else if (o is GumpTextEntry) { GumpTextEntry t = (GumpTextEntry)o; t.X = xbase + skin.ListColumnIndent; t.Y = m_Y; t.Width = colWidth; t.Height = m_Height; page.Add(t); } else if (o is string) { string s = (string)o; m_ParentList.DebugWrite("stringy! " + s); if (s.Contains("</")) { GumpHtml h = new GumpHtml(xbase + skin.ListColumnIndent, m_Y, colWidth, m_Height, s, false, false); h.Parent = page; page.Add(h); } else { m_ParentList.DebugWrite("text"); GumpLabel g = new GumpLabel(xbase + skin.ListColumnIndent, m_Y, skin.NormalText, s); g.Parent = page; page.Add(g); } } i++; } catch (Exception e) { Console.WriteLine("Problem in AppendTo - " + e); i = columnValues.Count; } if (m_Dividers) { GumpImageTiled t = new GumpImageTiled(xbase + colWidth, m_Y, skin.EntryDividerWidth, skin.EntryDividerHeight, skin.EntryDividerID); page.Add(t); } } m_ParentList.DebugWrite("Done, details."); } else if (m_Style == "icons") { m_ParentList.DebugWrite("Icons mode."); Hashtable table = (Hashtable)columnValues[0]; string s = (string)table["caption"]; if (m_Background) { GumpImageTiled t = new GumpImageTiled( m_X, m_Y, m_Width, m_Height, m_BackgroundID ); page.Add(t); } GumpButton button; if ( arguments.ContainsKey("button") ) { button = (GumpButton)arguments["button"]; page.Add(button); } else { return; } int icon = arguments["icon"] != null ? (int)arguments["icon"] : skin.EntryDefaultIcon; GumpImage im = new GumpImage( (skin.EntryCaptionWidth-m_X)-skin.EntryIconWidth/2, m_Y+skin.EntryIconY, icon ); page.Add(im); if (s.Contains("</")) { GumpHtml h = new GumpHtml(m_X, m_Y, m_Width, m_Height, s, false, false); h.Parent = page; page.Add(h); } else { GumpLabel g = new GumpLabel(m_X, m_Y+skin.EntryCaptionPositionY, skin.NormalText, s); g.Parent = page; page.Add(g); } } else Console.WriteLine("Unknown style: "+m_Style); }