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)); }