Exemple #1
0
        public void Clear()
        {
            var item = Items;

            Items = null;

            while (item != null)
            {
                if (item.Right != null)
                {
                    item.Right.Left = item.Left;
                }

                if (item.Left != null)
                {
                    item.Left.Right = item.Right;
                }

                item.Left = item.Right = null;

                var next = item.ListRight;
                item.ListRight = null;
                item.RenderedText?.Destroy();
                item = next;
            }

            Size = 0;
        }
Exemple #2
0
        public void Add(TextOverhead obj)
        {
            if (obj != null)
            {
                if (Items == null)
                {
                    Items = obj;
                }
                else
                {
                    var curr = Items;

                    while (curr.ListRight != null)
                    {
                        curr = curr.ListRight;
                    }

                    curr.ListRight = obj;
                    obj.ListLeft   = curr;
                }
            }

            if (Size >= MaxSize)
            {
                if (Items != null)
                {
                    var items = Items;

                    Items = Items.ListRight;

                    if (Items != null)
                    {
                        Items.ListLeft = null;
                    }

                    items.ListRight = null;
                    items.ListLeft  = null;
                    items.RenderedText?.Destroy();

                    if (items.Right != null)
                    {
                        items.Right.Left = items.Left;
                    }

                    if (items.Left != null)
                    {
                        items.Left.Right = items.Right;
                    }
                    items.Left  = null;
                    items.Right = null;
                }
            }
            else
            {
                Size++;
            }
        }
Exemple #3
0
        public void Add(TextOverhead obj)
        {
            PushToBack(obj);

            if (Size >= MaxSize)
            {
                ((TextOverhead)Items)?.Destroy();
                Remove(Items);
            }
            else
            {
                Size++;
            }
        }