void CPropTreeList::OnLButtonDblClk(UINT, CPoint point) { ASSERT(m_pProp!=NULL); m_pProp->SendNotify(NM_DBLCLK); CPropTreeItem* pItem; CPropTreeItem* pOldFocus; if ((pItem = m_pProp->FindItem(point))!=NULL && pItem->GetChild()) { switch (m_pProp->HitTest(point)) { case HTCOLUMN: break; case HTCHECKBOX: pItem->Check(!pItem->IsChecked()); m_pProp->SendNotify(PTN_CHECKCLICK, pItem); Invalidate(); break; case HTATTRIBUTE: if (!pItem->IsRootLevel()) break; // pass thru to default default: pOldFocus = m_pProp->GetFocusedItem(); m_pProp->SelectItems(NULL, FALSE); m_pProp->SetFocusedItem(pItem); pItem->Select(); if (pItem!=pOldFocus) m_pProp->SendNotify(PTN_SELCHANGE, pItem); // pass thru to HTEXPAND case HTEXPAND: if (!m_pProp->SendNotify(PTN_ITEMEXPANDING, pItem)) { pItem->Expand(!pItem->IsExpanded()); UpdateResize(); Invalidate(); UpdateWindow(); CheckVisibleFocus(); } break; } } }
void CPropTreeList::CheckVisibleFocus() { ASSERT(m_pProp!=NULL); CPropTreeItem *pItem; if ((pItem = m_pProp->GetFocusedItem())==NULL) return; if (!m_pProp->IsItemVisible(pItem)) { if (m_pProp->IsSingleSelection()) pItem->Select(FALSE); m_pProp->SetFocusedItem(NULL); m_pProp->SendNotify(PTN_SELCHANGE, NULL); Invalidate(); } }
void CPropTreeList::OnLButtonDown(UINT, CPoint point) { ASSERT(m_pProp!=NULL); if (m_pProp->IsDisableInput()) return; m_pProp->SendNotify(NM_CLICK); if (!m_pProp->IsWindowEnabled()) return; SetFocus(); LONG nHit = m_pProp->HitTest(point); CPropTreeItem* pItem; CRect rc; CDC* pDC; switch (nHit) { case HTCOLUMN: if (m_pProp->SendNotify(PTN_COLUMNCLICK)) break; m_bColDrag = TRUE; SetCapture(); m_nPrevCol = m_pProp->GetOrigin().x; // paint drag line pDC = GetDC(); GetClientRect(rc); pDC->PatBlt(m_nPrevCol - PROPTREEITEM_COLRNG/2, 0, PROPTREEITEM_COLRNG, rc.bottom, PATINVERT); ReleaseDC(pDC); break; case HTCHECKBOX: if ((pItem = m_pProp->FindItem(point))!=NULL) { pItem->Check(!pItem->IsChecked()); m_pProp->SendNotify(PTN_CHECKCLICK, pItem); Invalidate(); } break; case HTEXPAND: if ((pItem = m_pProp->FindItem(point))!=NULL) { if (pItem->GetChild() && !m_pProp->SendNotify(PTN_ITEMEXPANDING, pItem)) { pItem->Expand(!pItem->IsExpanded()); UpdateResize(); Invalidate(); UpdateWindow(); CheckVisibleFocus(); } } break; default: if ((pItem = m_pProp->FindItem(point))!=NULL) { CPropTreeItem* pOldFocus = m_pProp->GetFocusedItem(); m_pProp->SelectItems(NULL, FALSE); m_pProp->SetFocusedItem(pItem); pItem->Select(); Invalidate(); if (pItem!=pOldFocus) m_pProp->SendNotify(PTN_SELCHANGE, pItem); if (nHit==HTATTRIBUTE && !pItem->IsRootLevel()) { if (!m_pProp->SendNotify(PTN_PROPCLICK, pItem) && !pItem->IsReadOnly()) pItem->Activate(); } } else { m_pProp->SelectItems(NULL, FALSE); m_pProp->SetFocusedItem(NULL); m_pProp->SendNotify(PTN_SELCHANGE); Invalidate(); } break; } }