示例#1
0
        public static bool TryGetBounds(this GumpEntry e, out int x, out int y, out int width, out int height)
        {
            if (e is IGumpEntryVector)
            {
                x      = ((IGumpEntryVector)e).X;
                y      = ((IGumpEntryVector)e).Y;
                width  = ((IGumpEntryVector)e).Width;
                height = ((IGumpEntryVector)e).Height;
                return(true);
            }

            Description props;

            if (_PositionProps.TryGetValue(e.GetType(), out props) &&          //
                props.X != null && props.Y != null && props.Width != null && props.Height != null)
            {
                x      = (int)props.X.GetValue(e, null);
                y      = (int)props.Y.GetValue(e, null);
                width  = (int)props.Width.GetValue(e, null);
                height = (int)props.Height.GetValue(e, null);
                return(true);
            }

            x = y = width = height = 0;
            return(false);
        }
示例#2
0
        public static bool TrySetBounds(this GumpEntry e, int x, int y, int width, int height)
        {
            if (e is IGumpEntryVector)
            {
                ((IGumpEntryVector)e).X      = x;
                ((IGumpEntryVector)e).Y      = y;
                ((IGumpEntryVector)e).Width  = width;
                ((IGumpEntryVector)e).Height = height;
                return(true);
            }

            Description props;

            if (_PositionProps.TryGetValue(e.GetType(), out props) &&          //
                props.X != null && props.Y != null && props.Width != null && props.Height != null)
            {
                props.X.SetValue(e, x, null);
                props.Y.SetValue(e, y, null);
                props.Width.SetValue(e, width, null);
                props.Height.SetValue(e, height, null);
                return(true);
            }

            return(false);
        }
示例#3
0
        public static bool TrySetHeight(this GumpEntry e, int height)
        {
            if (e is IGumpEntrySize)
            {
                ((IGumpEntrySize)e).Height = height;
                return(true);
            }

            return(e.SetPropertyValue("Height", height));
        }
示例#4
0
        public static bool TrySetX(this GumpEntry e, int x)
        {
            if (e is IGumpEntryPoint)
            {
                ((IGumpEntryPoint)e).X = x;
                return(true);
            }

            return(e.SetPropertyValue("X", x));
        }
示例#5
0
        public static bool TrySetWidth(this GumpEntry e, int width)
        {
            if (e is IGumpEntrySize)
            {
                ((IGumpEntrySize)e).Width = width;
                return(true);
            }

            return(e.SetPropertyValue("Width", width));
        }
示例#6
0
        public static bool TrySetY(this GumpEntry e, int y)
        {
            if (e is IGumpEntryPoint)
            {
                ((IGumpEntryPoint)e).Y = y;
                return(true);
            }

            return(e.SetPropertyValue("Y", y));
        }
示例#7
0
        public static bool TryGetHeight(this GumpEntry e, out int height)
        {
            if (e is IGumpEntrySize)
            {
                height = ((IGumpEntrySize)e).Height;
                return(true);
            }

            return(e.GetPropertyValue("Height", out height));
        }
示例#8
0
        public static bool TryGetWidth(this GumpEntry e, out int width)
        {
            if (e is IGumpEntrySize)
            {
                width = ((IGumpEntrySize)e).Width;
                return(true);
            }

            return(e.GetPropertyValue("Width", out width));
        }
示例#9
0
        public void Remove(GumpEntry g)
        {
            if (g == null || !Entries.Contains(g))
            {
                return;
            }

            Entries.Remove(g);
            g.Parent = null;
        }
示例#10
0
        public static bool TryGetY(this GumpEntry e, out int y)
        {
            if (e is IGumpEntryPoint)
            {
                y = ((IGumpEntryPoint)e).Y;
                return(true);
            }

            return(e.GetPropertyValue("Y", out y));
        }
示例#11
0
        public static bool TryGetX(this GumpEntry e, out int x)
        {
            if (e is IGumpEntryPoint)
            {
                x = ((IGumpEntryPoint)e).X;
                return(true);
            }

            return(e.GetPropertyValue("X", out x));
        }
示例#12
0
        public static bool TryOffsetBounds(this GumpEntry e, int x, int y, int width, int height)
        {
            int ox, oy, ow, oh;

            if (TryGetBounds(e, out ox, out oy, out ow, out oh))
            {
                return(TrySetBounds(e, ox + x, oy + y, ow + width, oh + height));
            }

            return(false);
        }
示例#13
0
        public static bool TryOffsetSize(this GumpEntry e, int width, int height)
        {
            int ow, oh;

            if (TryGetSize(e, out ow, out oh))
            {
                return(TrySetSize(e, ow + width, oh + height));
            }

            return(false);
        }
示例#14
0
        public static bool TryOffsetPosition(this GumpEntry e, int x, int y)
        {
            int ox, oy;

            if (TryGetPosition(e, out ox, out oy))
            {
                return(TrySetPosition(e, ox + x, oy + y));
            }

            return(false);
        }
示例#15
0
        public static bool TryOffsetWidth(this GumpEntry e, int width)
        {
            int ow;

            if (TryGetWidth(e, out ow))
            {
                return(TrySetWidth(e, ow + width));
            }

            return(false);
        }
示例#16
0
        public static bool TryOffsetY(this GumpEntry e, int y)
        {
            int oy;

            if (TryGetY(e, out oy))
            {
                return(TrySetY(e, oy + y));
            }

            return(false);
        }
示例#17
0
        public static bool TryOffsetX(this GumpEntry e, int x)
        {
            int ox;

            if (TryGetX(e, out ox))
            {
                return(TrySetX(e, ox + x));
            }

            return(false);
        }
示例#18
0
        public static bool TryGetPosition(this GumpEntry e, out int x, out int y)
        {
            if (e is IGumpEntryPoint)
            {
                x = ((IGumpEntryPoint)e).X;
                y = ((IGumpEntryPoint)e).Y;
                return(true);
            }

            return(e.GetPropertyValue("X", out x) & e.GetPropertyValue("Y", out y));
        }
示例#19
0
        public static bool TrySetPosition(this GumpEntry e, int x, int y)
        {
            if (e is IGumpEntryPoint)
            {
                ((IGumpEntryPoint)e).X = x;
                ((IGumpEntryPoint)e).Y = y;
                return(true);
            }

            return(e.SetPropertyValue("X", x) & e.SetPropertyValue("Y", y));
        }
示例#20
0
        public static bool TrySetSize(this GumpEntry e, int width, int height)
        {
            if (e is IGumpEntrySize)
            {
                ((IGumpEntrySize)e).Width  = width;
                ((IGumpEntrySize)e).Height = height;
                return(true);
            }

            return(e.SetPropertyValue("Width", width) & e.SetPropertyValue("Height", height));
        }
示例#21
0
        public static bool TryGetSize(this GumpEntry e, out int width, out int height)
        {
            if (e is IGumpEntrySize)
            {
                width  = ((IGumpEntrySize)e).Width;
                height = ((IGumpEntrySize)e).Height;
                return(true);
            }

            return(e.GetPropertyValue("Width", out width) & e.GetPropertyValue("Height", out height));
        }
示例#22
0
        public static bool TryOffsetHeight(this GumpEntry e, int height)
        {
            int oh;

            if (TryGetHeight(e, out oh))
            {
                return(TrySetHeight(e, oh + height));
            }

            return(false);
        }
示例#23
0
        public void Remove(GumpEntry g)
        {
            if (g == null || !m_Entries.Contains(g))
            {
                return;
            }

            Invalidate();
            m_Entries.Remove(g);
            g.Parent = null;
        }
示例#24
0
 public void Add(GumpEntry g)
 {
     if (g.Parent != this)
     {
         g.Parent = this;
     }
     else if (!Entries.Contains(g))
     {
         Entries.Add(g);
     }
 }
示例#25
0
 public void Add(GumpEntry g)
 {
     if (g.Parent != this)
     {
         g.Parent = this;
     }
     else if (!m_Entries.Contains(g))
     {
         Invalidate();
         m_Entries.Add(g);
     }
 }
示例#26
0
 public void Add(GumpEntry g)
 {
     if (g.Parent != this)
     {
         g.Parent = this;
         return;
     }
     if (!this.m_Entries.Contains(g))
     {
         this.Invalidate();
         this.m_Entries.Add(g);
     }
 }
示例#27
0
        public static bool TryGetBounds(this GumpEntry e, out int x, out int y, out int width, out int height)
        {
            if (e is IGumpEntryVector)
            {
                x      = ((IGumpEntryVector)e).X;
                y      = ((IGumpEntryVector)e).Y;
                width  = ((IGumpEntryVector)e).Width;
                height = ((IGumpEntryVector)e).Height;
                return(true);
            }

            return(e.GetPropertyValue("X", out x) & e.GetPropertyValue("Y", out y) &             //
                   e.GetPropertyValue("Width", out width) & e.GetPropertyValue("Height", out height));
        }
示例#28
0
        public static bool TrySetBounds(this GumpEntry e, int x, int y, int width, int height)
        {
            if (e is IGumpEntryVector)
            {
                ((IGumpEntryVector)e).X      = x;
                ((IGumpEntryVector)e).Y      = y;
                ((IGumpEntryVector)e).Width  = width;
                ((IGumpEntryVector)e).Height = height;
                return(true);
            }

            return(e.SetPropertyValue("X", x) & e.SetPropertyValue("Y", y) &             //
                   e.SetPropertyValue("Width", width) & e.SetPropertyValue("Height", height));
        }
示例#29
0
        public static bool TrySetHeight(this GumpEntry e, int height)
        {
            if (e is IGumpEntrySize)
            {
                ((IGumpEntrySize)e).Height = height;
                return(true);
            }

            Description props;

            if (_PositionProps.TryGetValue(e.GetType(), out props) && props.Height != null)
            {
                props.Height.SetValue(e, height, null);
                return(true);
            }

            return(false);
        }
示例#30
0
        public static bool TrySetWidth(this GumpEntry e, int width)
        {
            if (e is IGumpEntrySize)
            {
                ((IGumpEntrySize)e).Width = width;
                return(true);
            }

            Description props;

            if (_PositionProps.TryGetValue(e.GetType(), out props) && props.Width != null)
            {
                props.Width.SetValue(e, width, null);
                return(true);
            }

            return(false);
        }
示例#31
0
		public void Remove( GumpEntry g )
		{
			Invalidate();
			m_Entries.Remove( g );
			g.Parent = null;
		}
示例#32
0
		public void Add( GumpEntry g )
		{
			if ( g.Parent != this )
			{
				g.Parent = this;
			}
			else if ( !m_Entries.Contains( g ) )
			{
				Invalidate();
				m_Entries.Add( g );
			}
		}
示例#33
0
		private void CreateElement(GumpEntry e)
		{
			_CurrentNode = _Document.CreateElement(e.GetType().Name);
		}
示例#34
0
		public void Remove( GumpEntry g )
		{
			if (g == null || !m_Entries.Contains(g))
				return;

			Invalidate();
			m_Entries.Remove( g );
			g.Parent = null;
		}
示例#35
0
文件: Gump.cs 项目: Ravenwolfe/xrunuo
 public void Remove( GumpEntry g )
 {
     m_Entries.Remove( g );
     g.Parent = null;
 }