Ejemplo n.º 1
0
        protected sealed override void AddChildImpl(Element element)
        {
            var item = element as ItemEntry;

            // if this is an ItemEntry we add it like one, but only if it is not already in the list!
            if (item != null)
            {
                // add to the pane if we have one
                if (Pane != this)
                {
                    Pane.AddChild(item);
                }
                // add item directly to us
                else
                {
                    base.AddChildImpl(item);
                }

                if (item.OwnerList != this)
                {
                    // perform normal addItem
                    // if sorting is enabled, re-sort the list
                    if (_sortEnabled)
                    {
                        ListItems.Add(item);
                        // TODO: d_listItems.insert(std::upper_bound(d_listItems.begin(), d_listItems.end(), item, getRealSortCallback()), item);
                    }
                    // just stick it on the end.
                    else
                    {
                        ListItems.Add(item);
                    }
                    item.OwnerList = this;
                    HandleUpdatedItemData();
                }
            }
            // otherwise it's base class processing
            else
            {
                base.AddChildImpl(element);
            }
        }