CEGPropertyGridItem* CEGPropertyGrid::InsertItem(CEGPropertyGridItem* pItem, CEGPropertyGridItem* pParent) { if (!pItem) return NULL; if (!pParent) pParent = &m_Root; if (!pParent->GetChild()) pParent->SetChild(pItem); else { // add to end of the sibling list CEGPropertyGridItem* pNext; pNext = pParent->GetChild(); while (pNext->GetSibling()) pNext = pNext->GetSibling(); pNext->SetSibling(pItem); } pItem->SetParent(pParent); pItem->SetPropOwner(this); // auto generate a default ID pItem->SetCtrlID(m_nLastUID++); SendNotify(PTN_INSERTITEM, pItem); UpdatedItems(); return pItem; }
void COptionTree::DeleteItem(COptionTreeItem *otiItem) { // Delete iutem Delete(otiItem); // Update items UpdatedItems(); }
void COptionTree::EnsureVisible(COptionTreeItem *otiItem) { // Declare variables COptionTreeItem* otiParent; CRect rcClient; CPoint ptPoint; long lOY; // Make sure valid if (otiItem == NULL) { return; } // Item is not scroll visible (expand all parents) if (IsItemVisible(otiItem) == FALSE) { otiParent = otiItem->GetParent(); while (otiParent != NULL) { otiParent->Expand(); otiParent = otiParent->GetParent(); } UpdatedItems(); UpdateWindow(); } // Item should be visible if (IsItemVisible(otiItem) == FALSE) { return; } // Calculate list client rectangle m_otlList.GetClientRect(rcClient); rcClient.OffsetRect(0, m_ptOrigin.y); rcClient.bottom -= otiItem->GetHeight(); // Get item location ptPoint = otiItem->GetLocation(); //when the item is at the end will get a bug ,so avoid it ptPoint.y -= 2; if (!rcClient.PtInRect(ptPoint)) { if (ptPoint.y < rcClient.top) { lOY = ptPoint.y; } else { lOY = ptPoint.y - rcClient.Height() + otiItem->GetHeight(); } m_otlList.OnVScroll(SB_THUMBTRACK, lOY, NULL); } }
void CPropTree::RefreshItems(CPropTreeItem* pItem) { if (!pItem) pItem = &m_Root; EnumItems(pItem, EnumRefreshAll); UpdatedItems(); }
void CEGPropertyGrid::RefreshItems(CEGPropertyGridItem* pItem) { if (!pItem) pItem = &m_Root; EnumItems(pItem, EnumRefreshAll); UpdatedItems(); }
VOID COptionTree::ForceUpdate(VOID) { UpdatedItems(); // Force redraw Invalidate(); // Update window UpdateWindow(); }
COptionTreeItem * COptionTree::InsertItem(COptionTreeItem *otiItem, COptionTreeItem *otiParent) { // Declare variables COptionTreeItem* otiNext; // Make sure item is not NULL if (otiItem == NULL) { return NULL; } // If parent is NULL, becomes root if (otiParent == NULL) { otiParent = &m_otiRoot; } // Set child if (otiParent->GetChild() == NULL) { otiParent->SetChild(otiItem); } else { // -- Add to end of the sibling list otiNext = otiParent->GetChild(); while (otiNext->GetSibling() != NULL) { otiNext = otiNext->GetSibling(); } otiNext->SetSibling(otiItem); } // Auto generate a default ID m_uLastUID++; otiItem->SetCtrlID(m_uLastUID); // Set item information otiItem->SetParent(otiParent); otiItem->SetOptionsOwner(this); // Send notification to user SendNotify(OT_NOTIFY_INSERTITEM, otiItem); // Updated items UpdatedItems(); // Force redraw Invalidate(); // Update window UpdateWindow(); return otiItem; }
void COptionTree::DeleteAllItems() { // Delete from root Delete(NULL); // Update items UpdatedItems(); // Reset UID counter m_uLastUID = 1; }
void PropertyTree::DeleteItem(PropertyTreeItem* pItem, bool notify) { Delete(pItem); if ( notify ) { if (pItem && pItem!=&m_Root && SendNotify(PTN_DELETEITEM, pItem)) return; UpdatedItems(); } }
void COptionTree::RefreshItems(COptionTreeItem *otiItem) { // If item is NULL, refresh from root if (otiItem == NULL) { otiItem = &m_otiRoot; } // Enum refresh all EnumItems(otiItem, EnumRefreshAll); // Update items UpdatedItems(); }
void COptionTree::ExpandAllItems() { // Declare variables COptionTreeItem *otiItem; // If item is NULL, refresh from root otiItem = &m_otiRoot; // Enum refresh all EnumItems(otiItem, EnumExpandAll); // Update items UpdatedItems(); }
void CEGPropertyGrid::EnsureVisible(CEGPropertyGridItem* pItem) { if (!pItem) return; // item is not scroll visible (expand all parents) if (!IsItemVisible(pItem)) { CEGPropertyGridItem* pParent; pParent = pItem->GetParent(); while (pParent) { pParent->Expand(); pParent = pParent->GetParent(); } UpdatedItems(); UpdateWindow(); } ASSERT(IsItemVisible(pItem)); CRect rc; m_List.GetClientRect(rc); rc.OffsetRect(0, m_Origin.y); rc.bottom -= pItem->GetHeight(); CPoint pt; pt = pItem->GetLocation(); if (!rc.PtInRect(pt)) { LONG oy; if (pt.y < rc.top) oy = pt.y; else oy = pt.y - rc.Height() + pItem->GetHeight(); m_List.OnVScroll(SB_THUMBTRACK, oy, NULL); } }
void PropertyTree::EnsureVisible(PropertyTreeItem* pItem) { if (!pItem) return; // item is not scroll visible (expand all parents) if (!IsItemVisible(pItem)) { PropertyTreeItem* pParent; pParent = pItem->GetParent(); while (pParent) { pParent->Expand(); pParent = pParent->GetParent(); } UpdatedItems(); UpdateWindow(); } CRect rc; GetClientRect(rc); rc.OffsetRect(0, m_ScrollPos); rc.bottom -= pItem->GetHeight(); CPoint pt; pt = pItem->GetLocation(); if (!rc.PtInRect(pt)) { LONG oy; //if (pt.y < rc.top) oy = pt.y; //else // oy = pt.y - rc.Height() + pItem->GetHeight(); OnVScroll(SB_THUMBTRACK, oy, NULL); } }
void PropertyTree::DeleteAllItems( bool notify ) { PropertyTreeItem* pFirst = m_Root.GetChild(); while (pFirst) { PropertyTreeItem* pNext = pFirst->GetNext(); Delete(pFirst); pFirst = pNext; } m_Root.SetChild(NULL); if ( notify ) { UpdatedItems(); } m_nLastUID = 1; // reset uid counter }
CPropTreeItem* CPropTree::InsertItem(CPropTreeItem* pItem, CPropTreeItem* pParent) { // 같은 노드의 인덱스 지정 UINT nSiblingID = 0; if (!pItem) return NULL; if (!pParent) pParent = &m_Root; if (!pParent->GetChild()) pParent->SetChild(pItem); else { // add to end of the sibling list CPropTreeItem* pNext; pNext = pParent->GetChild(); while (pNext->GetSibling()) { ++nSiblingID; pNext = pNext->GetSibling(); } ++nSiblingID; pNext->SetSibling(pItem); } pItem->SetParent(pParent); pItem->SetPropOwner(this); // auto generate a default ID pItem->SetCtrlID(m_nLastUID++); pItem->SetSiblingID( nSiblingID ); SendNotify(PTN_INSERTITEM, pItem); UpdatedItems(); return pItem; }
PropertyTreeItem* PropertyTree::InsertItem(PropertyTreeItem* pItem, PropertyTreeItem* pParent) { if (!pItem) return NULL; if (!pParent) pParent = &m_Root; if ( !pParent->GetChild() ) { pParent->SetChild( pItem ); pItem->SetPrev( NULL ); pItem->SetNext( NULL ); pItem->SetParent( pParent ); } else { PropertyTreeItem* pLast = pParent->GetChild(); while (pLast->GetNext()) pLast = pLast->GetNext(); pLast->SetNext( pItem ); pItem->SetPrev( pLast ); pItem->SetNext( NULL ); pItem->SetParent( pParent ); } pItem->SetPropOwner( this ); pItem->SetChild( NULL ); // auto generate a default ID pItem->SetCtrlID( m_nLastUID++ ); SendNotify( PTN_INSERTITEM, pItem ); UpdatedItems(); return pItem; }
void CEGPropertyGrid::DeleteItem(CEGPropertyGridItem* pItem) { Delete(pItem); UpdatedItems(); }
void CEGPropertyGrid::DeleteAllItems() { Delete(NULL); UpdatedItems(); m_nLastUID = 1; // reset uid counter }
void CPropTree::DeleteItem(CPropTreeItem* pItem) { Delete(pItem); UpdatedItems(); }
void CPropTree::DeleteAllItems() { Delete(NULL); UpdatedItems(); m_nLastUID = 1; // reset uid counter }