const MScrollCtrlInfo* MScrollView::FindCtrlInfo(HWND hwndCtrl) const { assert(::IsWindow(hwndCtrl)); assert(HasChildStyle(hwndCtrl)); size_t siz = size(); for (size_t i = 0; i < siz; ++i) { if (m_vecInfo[i].m_hwndCtrl == hwndCtrl) return &m_vecInfo[i]; } return NULL; }
void MScrollView::SetCtrlInfo(HWND hwndCtrl, const MRect& rcCtrl) { assert(::IsWindow(hwndCtrl)); assert(HasChildStyle(hwndCtrl)); assert(rcCtrl.left >= 0); assert(rcCtrl.top >= 0); MScrollCtrlInfo* info = FindCtrlInfo(hwndCtrl); if (info) info->m_rcCtrl = rcCtrl; else AddCtrlInfo(hwndCtrl, rcCtrl); }
void MScrollView::SetCtrlInfo( HWND hwndCtrl, const MPoint& ptCtrl, const MSize& sizCtrl) { assert(::IsWindow(hwndCtrl)); assert(HasChildStyle(hwndCtrl)); assert(ptCtrl.x >= 0); assert(ptCtrl.y >= 0); MScrollCtrlInfo* info = FindCtrlInfo(hwndCtrl); if (info) info->m_rcCtrl = MRect(ptCtrl, sizCtrl); else AddCtrlInfo(hwndCtrl, ptCtrl, sizCtrl); }
void MScrollView::RemoveCtrlInfo(HWND hwndCtrl) { assert(::IsWindow(hwndCtrl)); assert(HasChildStyle(hwndCtrl)); std::vector<MScrollCtrlInfo>::iterator it, end = m_vecInfo.end(); for (it = m_vecInfo.begin(); it != end; ++it) { if (it->m_hwndCtrl == hwndCtrl) { m_vecInfo.erase(it); break; } } }
AFX_STATIC CWnd* AFXAPI _AfxGetChildControl(CWnd* pWndRoot, CWnd* pWndChild) { CWnd* pWndControl = NULL; while ((pWndChild != NULL) && HasChildStyle(pWndChild) && (pWndChild != pWndRoot)) { pWndControl = pWndChild; pWndChild = pWndChild->GetParent(); if (IsControlParent(pWndChild)) break; } return pWndControl; }