Beispiel #1
0
 /// <summary>
 /// Used to add a text entry to the list in DETAILS mode.
 /// </summary>
 /// <param name="entry">The text entry to be added.</param>
 public void AddColumn(GumpTextEntry entry)
 {
     if (m_Style == "details")
     {
         columnValues.Add(m_ColCount, entry);
         m_ColCount++;
     }
     m_ParentList.DebugWrite("Column Count: " + m_ColCount);
 }
		public virtual void HandleTextInput(GumpTextEntry input, string text)
		{
			if (TextInputHandler != null)
			{
				TextInputHandler(input, text);
			}
			else if (TextInputs[input] != null)
			{
				TextInputs[input](input, text);
			}
		}
		protected void AddTextEntry(GumpTextEntry input, Action<GumpTextEntry, string> handler)
		{
			if (input == null)
			{
				return;
			}

			if (!TextInputs.ContainsKey(input))
			{
				TextInputs.Add(input, handler);
			}
			else
			{
				TextInputs[input] = handler;
			}

			Add(input);
		}
Beispiel #4
0
		public virtual void Write(string name, GumpTextEntry e)
		{
			CreateElement(e);
			SetAttribute("name", name);
			SetAttribute("x", e.X);
			SetAttribute("y", e.Y);
			SetAttribute("width", e.Width);
			SetAttribute("height", e.Height);
			SetAttribute("entryid", e.EntryID);
			SetAttribute("hue", e.Hue);
			SetValue(e.InitialText);
			Append();
		}
Beispiel #5
0
		protected virtual void ParseInput(GumpTextEntry entry, string text)
		{
			ParseInput(text);
		}
		public virtual bool CanDisplay(GumpTextEntry input)
		{
			return (input != null);
		}
Beispiel #7
0
        /// <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);
            }
        }
		/// <summary>
		/// Used to add a text entry to the list in DETAILS mode.
		/// </summary>
		/// <param name="entry">The text entry to be added.</param>
		public void AddColumn(GumpTextEntry entry)
		{
			if (m_Style == "details")
			{
				columnValues.Add(m_ColCount, entry);
				m_ColCount++;
			}
			m_ParentList.DebugWrite("Column Count: " + m_ColCount);
		}