void CN3UIList::UpdateChildRegions() { RECT rc = this->GetRegion(); RECT rcThis = rc; POINT pt; SIZE size; int iScrollPos = 0; if(m_pScrollBarRef) { m_pScrollBarRef->GetCurrentPos(); RECT rcTmp = m_pScrollBarRef->GetRegion(); rc.right = rcTmp.left; } it_pString it = m_ListString.begin(), itEnd = m_ListString.end(); for(int i = 0; it != itEnd; it++, i++) { CN3UIString* pStr = *it; if(i < iScrollPos) { pStr->SetVisibleWithNoSound(false); continue; } pt = pStr->GetPos(); pStr->GetTextExtent(pStr->GetString(), pStr->GetString().size(), &size); pStr->SetPos(rc.left, rc.top); RECT rcTmp = { rc.left, rc.top, rc.left + (rc.right - rc.left), rc.top + size.cy }; pStr->SetRegion(rcTmp); rc.top += size.cy; if(rc.top >= rcThis.bottom) pStr->SetVisibleWithNoSound(false); else pStr->SetVisibleWithNoSound(true); } if(m_pScrollBarRef) { if(rc.bottom <= rcThis.bottom) { m_pScrollBarRef->SetCurrentPos(0); m_pScrollBarRef->SetVisibleWithNoSound(false); } else { m_pScrollBarRef->SetVisibleWithNoSound(true); } m_pScrollBarRef->SetRange(0, m_ListString.size()); } }
DWORD CN3UIList::MouseProc(DWORD dwFlags, const POINT& ptCur, const POINT& ptOld) { DWORD dwRet = UI_MOUSEPROC_NONE; if (!m_bVisible || UI_STATE_LIST_DISABLE == m_eState) return dwRet; // 특정 이벤트에 대해 메시지 전송.. if(IsIn(ptCur.x, ptCur.y) && ((dwFlags & UI_MOUSE_LBCLICK) || (dwFlags & UI_MOUSE_LBDBLCLK)) ) { RECT rc = this->GetRegion(), rcStr; SIZE size; it_pString it = m_ListString.begin(), itEnd = m_ListString.end(); for(int i = 0; it != itEnd; it++, i++) { CN3UIString* pStr = (*it); if(false == pStr->IsVisible()) continue; pStr->GetTextExtent("1", 1, &size); rcStr = pStr->GetRegion(); rc.top += size.cy; rc.bottom += size.cy; if(::PtInRect(&rcStr, ptCur)) { m_iCurSel = i; if(dwFlags & UI_MOUSE_LBCLICK) { if(m_pParent) m_pParent->ReceiveMessage(this, UIMSG_LIST_SELCHANGE); // 부모에게 버튼 클릭 통지.. dwRet |= UIMSG_LIST_SELCHANGE; } else { if(m_pParent) m_pParent->ReceiveMessage(this, UIMSG_LIST_DBLCLK); // 부모에게 버튼 클릭 통지.. dwRet |= UIMSG_LIST_DBLCLK; } dwRet |= UI_MOUSEPROC_DONESOMETHING; return dwRet; } } } dwRet |= CN3UIBase::MouseProc(dwFlags, ptCur, ptOld); return dwRet; }