예제 #1
0
        public override bool addAt(ControlUI pControl, int iIndex)
        {
            if (!base.addAt(pControl, iIndex))
            {
                return(false);
            }

            // 所有的列表项目都是我们指定的
            IListItemUI pListItem = (IListItemUI)pControl.getInterface("ListItem");

            if (pListItem != null)
            {
                pListItem.setOwner(this);
                pListItem.setIndex(iIndex);
            }

            for (int i = iIndex + 1; i < getCount(); ++i)
            {
                ControlUI p = getItemAt(i);
                pListItem = (IListItemUI)p.getInterface("ListItem");
                if (pListItem != null)
                {
                    pListItem.setIndex(pListItem.getIndex() + 1);
                }
            }
            return(true);
        }
예제 #2
0
        public override bool setItemIndex(ControlUI pControl, int iIndex)
        {
            int iOrginIndex = getItemIndex(pControl);

            if (iOrginIndex == -1)
            {
                return(false);
            }

            if (!base.setItemIndex(pControl, iIndex))
            {
                return(false);
            }

            IListItemUI pListItem = (IListItemUI)pControl.getInterface("ListItem");

            if (pListItem != null)
            {
                pListItem.setIndex(getCount());
            }

            for (int i = iOrginIndex; i < getCount(); ++i)
            {
                ControlUI p = getItemAt(i);
                pListItem = (IListItemUI)p.getInterface("ListItem");
                if (pListItem != null)
                {
                    pListItem.setIndex(pListItem.getIndex() - 1);
                }
            }

            selectItem(findSelectable(mCurSel, false));
            return(true);
        }
예제 #3
0
파일: ListUI.cs 프로젝트: weimingtom/QUILib
        public override bool setItemIndex(ControlUI pControl, int iIndex)
        {
            if (pControl.getInterface("ListHeader") != null)
            {
                return(base.setItemIndex(pControl, iIndex));
            }
            // We also need to recognize header sub-items
            if (pControl.getClass() == "ListHeaderItemUI")
            {
                return(mHeader.setItemIndex(pControl, iIndex));
            }

            int iOrginIndex = mList.getItemIndex(pControl);

            if (iOrginIndex == -1)
            {
                return(false);
            }

            if (!mList.setItemIndex(pControl, iIndex))
            {
                return(false);
            }

            // The list items should know about us
            IListItemUI pListItem = (IListItemUI)pControl.getInterface("ListItem");

            if (pListItem != null)
            {
                pListItem.setIndex(getCount());
            }

            for (int i = iOrginIndex; i < mList.getCount(); ++i)
            {
                ControlUI p = mList.getItemAt(i);
                pListItem = (IListItemUI)(p.getInterface("ListItem"));
                if (pListItem != null)
                {
                    pListItem.setIndex(pListItem.getIndex() - 1);
                }
            }

            selectItem(findSelectable(mCurSel, false));
            ensureVisible(mCurSel);

            return(true);
        }
예제 #4
0
        public override bool add(ControlUI pControl)
        {
            IListItemUI pListItem = (IListItemUI)pControl.getInterface("ListItem");

            if (pListItem != null)
            {
                pListItem.setOwner(this);
                pListItem.setIndex(mItems.Count);
            }
            return(base.add(pControl));
        }
예제 #5
0
파일: ListUI.cs 프로젝트: weimingtom/QUILib
        public override bool addAt(ControlUI pControl, int iIndex)
        {
            // Override the AddAt() method so we can add items specifically to
            // the intended widgets. Headers and are assumed to be
            // answer the correct interface so we can add multiple list headers.
            if (pControl.getInterface("ListHeader") != null)
            {
                return(base.addAt(pControl, iIndex));
            }
            // We also need to recognize header sub-items
            if (pControl.getClass() == "ListHeaderItemUI")
            {
                return(mHeader.addAt(pControl, iIndex));
            }

            if (!mList.addAt(pControl, iIndex))
            {
                return(false);
            }

            // The list items should know about us
            IListItemUI pListItem = (IListItemUI)pControl.getInterface("ListItem");

            if (pListItem != null)
            {
                pListItem.setOwner(this);
                pListItem.setIndex(iIndex);
            }

            for (int i = iIndex + 1; i < mList.getCount(); ++i)
            {
                ControlUI p = mList.getItemAt(i);
                pListItem = (IListItemUI)p.getInterface("ListItem");
                if (pListItem != null)
                {
                    pListItem.setIndex(pListItem.getIndex() + 1);
                }
            }
            return(true);
        }
예제 #6
0
        public override bool removeAt(int iIndex)
        {
            if (!base.removeAt(iIndex))
            {
                return(false);
            }

            for (int i = iIndex; i < getCount(); ++i)
            {
                ControlUI   p         = getItemAt(i);
                IListItemUI pListItem = (IListItemUI)p.getInterface("ListItem");
                if (pListItem != null)
                {
                    pListItem.setIndex(pListItem.getIndex() - 1);
                }
            }

            selectItem(findSelectable(mCurSel, false));

            return(true);
        }
예제 #7
0
파일: ListUI.cs 프로젝트: weimingtom/QUILib
        public override bool remove(ControlUI pControl)
        {
            if (pControl.getInterface("ListHeader") != null)
            {
                return(base.remove(pControl));
            }
            // We also need to recognize header sub-items
            if (pControl.getClass() == "ListHeaderItemUI")
            {
                return(mHeader.remove(pControl));
            }

            int iIndex = mList.getItemIndex(pControl);

            if (iIndex == -1)
            {
                return(false);
            }

            if (!mList.removeAt(iIndex))
            {
                return(false);
            }

            for (int i = iIndex; i < mList.getCount(); ++i)
            {
                ControlUI   p         = mList.getItemAt(i);
                IListItemUI pListItem = (IListItemUI)p.getInterface("ListItem");
                if (pListItem != null)
                {
                    pListItem.setIndex(pListItem.getIndex() - 1);
                }
            }

            selectItem(findSelectable(mCurSel, false));
            ensureVisible(mCurSel);

            return(true);
        }
예제 #8
0
파일: ListUI.cs 프로젝트: weimingtom/QUILib
        public override bool add(ControlUI pControl)
        {
            // Override the Add() method so we can add items specifically to
            // the intended widgets. Headers are assumed to be
            // answer the correct interface so we can add multiple list headers.
            if (pControl.getInterface("ListHeader") != null)
            {
                if (mHeader != pControl && mHeader.getCount() == 0)
                {
                    {
                        // 把旧的表头控件属性赋予到新的表头控件
                        pControl.setBackImage(mHeader.getBackImage());
                        pControl.setVisible(mHeader.isVisible());
                    }
                    base.remove(mHeader);
                    mHeader = null;
                    mHeader = (ListHeaderUI)(pControl);
                }

                return(base.addAt(pControl, 0));
            }
            // We also need to recognize header sub-items
            if (pControl.getClass() == "ListHeaderItemUI")
            {
                return(mHeader.add(pControl));
            }
            // The list items should know about us
            IListItemUI pListItem = (IListItemUI)pControl.getInterface("ListItem");

            if (pListItem != null)
            {
                pListItem.setOwner(this);
                pListItem.setIndex(getCount());
            }
            return(mList.add(pControl));
        }
예제 #9
0
        public override bool removeAt(int iIndex)
        {
            if (!mList.removeAt(iIndex))
            {
                return(false);
            }

            for (int i = iIndex; i < mList.getCount(); ++i)
            {
                ControlUI   p         = mList.getItemAt(i);
                IListItemUI pListItem = (IListItemUI)p.getInterface("ListItem");
                if (pListItem != null)
                {
                    pListItem.setIndex(pListItem.getIndex() - 1);
                }
            }

            mCurSel = mCurSel > iIndex ? mCurSel - 1 : mCurSel;
            selectItem(findSelectable(mCurSel, false));
            ensureVisible(mCurSel);
            needParentUpdate();

            return(true);
        }