//************************************ // 函数名称: AddAt // 返回类型: long // 参数信息: CTreeNodeUI * pControl // 参数信息: int iIndex // 函数说明: 该方法不会将待插入的节点进行缩位处理,若打算插入的节点为非根节点,请使用AddAt(CTreeNodeUI* pControl,CTreeNodeUI* _IndexNode) 方法 //************************************ long CTreeViewUI::AddAt( CTreeNodeUI* pControl, int iIndex ) { if (!pControl) return -1; if (_tcsicmp(pControl->GetClass(), _T("TreeNodeUI")) != 0) return -1; pControl->OnNotify += MakeDelegate(this,&CTreeViewUI::OnDBClickItem); pControl->GetFolderButton()->OnNotify += MakeDelegate(this,&CTreeViewUI::OnFolderChanged); pControl->GetCheckBox()->OnNotify += MakeDelegate(this,&CTreeViewUI::OnCheckBoxChanged); pControl->SetVisibleFolderBtn(m_bVisibleFolderBtn); pControl->SetVisibleCheckBtn(m_bVisibleCheckBtn); if(m_uItemMinWidth > 0) { pControl->SetMinWidth(m_uItemMinWidth); } CListUI::AddAt(pControl, iIndex); if(pControl->GetCountChild() > 0) { int nCount = pControl->GetCountChild(); for(int nIndex = 0; nIndex < nCount; nIndex++) { CTreeNodeUI* pNode = pControl->GetChildNode(nIndex); if(pNode) return AddAt(pNode,iIndex+1); } } else { return iIndex + 1; } return -1; }
/*! * Add a new key and object to the map. A new entry is added even if there is * already an entry with this key. * * @param[in] key The key value for the new element. * @param[in] userObj The object associated with the key. The contents of * \a userObj are copied into the map. * * @return Returns a pointer to the object which the map contains. The client * can only safely dereference this pointer if it can guarantee that * no other client has removed this element. */ OBJECT *Add(KEY key, const OBJECT &userObj) { ATOMIC_CHECK_ASSERT(key != KeyAvailable && key != KeyReserved); FUND::UINT32 highWater = OPS::Load(&_highWaterMark); FUND::UINT32 freeHint = OPS::Load(&_freeLocationHint); for (FUND::UINT32 i = freeHint; i < highWater; i++) { if (OPS::Load(&_map[i]) == KeyAvailable && AddAt(i, key, userObj)) return &_objects[i]; } for (FUND::UINT32 i = 0; i < Capacity; i++) { if (OPS::Load(&_map[i]) == KeyAvailable && AddAt(i, key, userObj)) return &_objects[i]; } return 0; }
//************************************ // 函数名称: AddAt // 返回类型: bool // 参数信息: CTreeNodeUI * pControl // 参数信息: CTreeNodeUI * _IndexNode // 函数说明: //************************************ bool CTreeViewUI::AddAt( CTreeNodeUI* pControl, CTreeNodeUI* _IndexNode ) { if(!_IndexNode && !pControl) return FALSE; int nItemIndex = -1; for(int nIndex = 0;nIndex < GetCount();nIndex++) { if(_IndexNode == GetItemAt(nIndex)) { nItemIndex = nIndex; break; } } if(nItemIndex == -1) return FALSE; return AddAt(pControl,nItemIndex) >= 0; }
bool CMusicListUI::AddGroup(LPCTSTR szGroupName, int nIndex) { CMusicListGroupUI* pListGroup = NULL; if( !m_dlgGroupBuilder.GetMarkup()->IsValid() ) { pListGroup = static_cast<CMusicListGroupUI*>(m_dlgGroupBuilder.Create(_T("xmls\\MusicList\\music_list_group.xml"), (UINT)0, this, &paint_manager_)); } else { pListGroup = static_cast<CMusicListGroupUI*>(m_dlgGroupBuilder.Create(this, &paint_manager_)); } if (pListGroup == NULL) return false; // pListGroup->SetUserData(szGroupName); pListGroup->SetName(szGroupName); pListGroup->SetItemText(szGroupName); pListGroup->SetMusicList(this); if (nIndex == -1) { if (!Add(pListGroup)) { delete pListGroup; return false; } } else { if (!AddAt(pListGroup, nIndex)) { delete pListGroup; return false; } } return true; }
void ICCProfileTransformation::Add( const ICCProfile& profile ) { AddAt( m_profiles.Length(), profile ); }
void ICCProfileTransformation::Add( const String& profilePath ) { AddAt( m_profiles.Length(), profilePath ); }