MCPcopy Create free account
hub / github.com/cinience/RedisStudio / AddAt

Method AddAt

DuiLib/Control/UITreeView.cpp:233–320  ·  view source on GitHub ↗

��������: AddAt ��������: bool ������Ϣ: CControlUI * pControl ������Ϣ: int iIndex �ò�������Ե�ǰ�ڵ��µ��ֵ������������б���ͼ���� ����˵��:

Source from the content-addressed store, hash-verified

231 // ����˵��:
232 //************************************
233 bool CTreeNodeUI::AddAt( CControlUI* pControl, int iIndex )
234 {
235 if (!pControl)
236 return false;
237
238 if(_tcsicmp(pControl->GetClass(), _T("TreeNodeUI")) != 0)
239 return false;
240
241 if (!GetFolderButton()->IsSelected()) //add by��Redrain 2014.8.8
242 {
243 m_pManager->SendNotify(this, DUI_MSGTYPE_ITEMDBCLICK);
244 }
245
246 //filter invalidate index
247 int iDestIndex = iIndex;
248 if (iDestIndex < 0)
249 {
250 iDestIndex = 0;
251 }
252 else if (iDestIndex > GetCountChild())
253 {
254 iDestIndex = GetCountChild();
255 }
256 if(iIndex != iDestIndex) iIndex = iDestIndex;
257
258 CTreeNodeUI* pIndexNode = static_cast<CTreeNodeUI*>(mTreeNodes.GetAt(iIndex));
259
260 pControl = CalLocation((CTreeNodeUI*)pControl);
261
262 bool bRet = false;
263 int iTreeIndex = -1;
264 if (pTreeView)
265 {
266 //Get TreeView insert index
267 if (pIndexNode)
268 {
269 iTreeIndex = pIndexNode->GetTreeIndex();
270 bRet = pTreeView->AddAt((CTreeNodeUI*)pControl, iTreeIndex) >= 0;
271 if (bRet)
272 {
273 mTreeNodes.InsertAt(iIndex, pControl);
274 }
275 }
276 else
277 {
278 CTreeNodeUI *pChildNode = NULL;
279 //insert child node position index(new node insert to tail, default add tail)
280 int iChIndex = -1;
281 //insert child node tree-view position index(new node insert to tail)
282 int iChTreeIndex = -1;
283 //search tree index reverse
284 for (int i = GetCountChild(); i > 0; i++)
285 {
286 pChildNode = GetChildNode(i - 1);
287 iChTreeIndex = pChildNode->GetTreeIndex();
288 if (iChTreeIndex >= GetTreeIndex() && iChTreeIndex <= GetTreeIndex() + GetCountChild() )
289 {
290 //new child node position

Callers 1

AddChildNodeMethod · 0.45

Calls 15

GetFolderButtonFunction · 0.85
MakeDelegateFunction · 0.85
SendNotifyMethod · 0.80
GetAtMethod · 0.80
GetTreeIndexMethod · 0.80
InsertAtMethod · 0.80
SetVisibleFolderBtnMethod · 0.80
SetVisibleCheckBtnMethod · 0.80
SetTreeViewMethod · 0.80
SetMinWidthMethod · 0.80
GetCountChildMethod · 0.80
GetChildNodeMethod · 0.80

Tested by

no test coverage detected