Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #9
0
        public void Remove(GumpEntry g)
        {
            if (g == null || !Entries.Contains(g))
            {
                return;
            }

            Entries.Remove(g);
            g.Parent = null;
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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);
        }
Beispiel #23
0
        public void Remove(GumpEntry g)
        {
            if (g == null || !m_Entries.Contains(g))
            {
                return;
            }

            Invalidate();
            m_Entries.Remove(g);
            g.Parent = null;
        }
Beispiel #24
0
 public void Add(GumpEntry g)
 {
     if (g.Parent != this)
     {
         g.Parent = this;
     }
     else if (!Entries.Contains(g))
     {
         Entries.Add(g);
     }
 }
Beispiel #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);
     }
 }
Beispiel #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);
     }
 }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #31
0
		public void Remove( GumpEntry g )
		{
			Invalidate();
			m_Entries.Remove( g );
			g.Parent = null;
		}
Beispiel #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 );
			}
		}
Beispiel #33
0
		private void CreateElement(GumpEntry e)
		{
			_CurrentNode = _Document.CreateElement(e.GetType().Name);
		}
Beispiel #34
0
		public void Remove( GumpEntry g )
		{
			if (g == null || !m_Entries.Contains(g))
				return;

			Invalidate();
			m_Entries.Remove( g );
			g.Parent = null;
		}
Beispiel #35
0
 public void Remove( GumpEntry g )
 {
     m_Entries.Remove( g );
     g.Parent = null;
 }