示例#1
0
void CN3UIList::Render()
{
	CN3UIBase::Render();

	if(m_iCurSel >= 0 && m_iCurSel < m_ListString.size())
	{
		it_pString it = m_ListString.begin();
		for(int i = 0; i < m_iCurSel; it++, i++);
		CN3UIString* pStr = *it;
		if(pStr)
		{
			RECT rc = pStr->GetRegion(); // 선택 표시
		
			__VertexTransformedColor vLines[5];
			vLines[0].Set(rc.left, rc.top, UI_DEFAULT_Z, UI_DEFAULT_RHW, 0xff00ff00);
			vLines[1].Set(rc.right, rc.top, UI_DEFAULT_Z, UI_DEFAULT_RHW, 0xff00ff00);
			vLines[2].Set(rc.right, rc.bottom, UI_DEFAULT_Z, UI_DEFAULT_RHW, 0xff00ff00);
			vLines[3].Set(rc.left, rc.bottom, UI_DEFAULT_Z, UI_DEFAULT_RHW, 0xff00ff00);
			vLines[4] = vLines[0];
	
			DWORD dwZ, dwFog, dwAlpha, dwCOP, dwCA1, dwSrcBlend, dwDestBlend, dwVertexShader, dwAOP, dwAA1;
			CN3Base::s_lpD3DDev->GetRenderState(D3DRS_ZENABLE, &dwZ);
			CN3Base::s_lpD3DDev->GetRenderState(D3DRS_FOGENABLE, &dwFog);
			CN3Base::s_lpD3DDev->GetRenderState(D3DRS_ALPHABLENDENABLE, &dwAlpha);
			CN3Base::s_lpD3DDev->GetRenderState(D3DRS_SRCBLEND, &dwSrcBlend);
			CN3Base::s_lpD3DDev->GetRenderState(D3DRS_DESTBLEND, &dwDestBlend);
			CN3Base::s_lpD3DDev->GetTextureStageState(0, D3DTSS_COLOROP, &dwCOP);
			CN3Base::s_lpD3DDev->GetTextureStageState(0, D3DTSS_COLORARG1, &dwCA1);
			CN3Base::s_lpD3DDev->GetTextureStageState(0, D3DTSS_ALPHAOP, &dwAOP);
			CN3Base::s_lpD3DDev->GetTextureStageState(0, D3DTSS_ALPHAARG1, &dwAA1);
			CN3Base::s_lpD3DDev->GetFVF(&dwVertexShader);

			CN3Base::s_lpD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
			CN3Base::s_lpD3DDev->SetRenderState(D3DRS_FOGENABLE, FALSE);
			CN3Base::s_lpD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
			CN3Base::s_lpD3DDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
			CN3Base::s_lpD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
			CN3Base::s_lpD3DDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
			CN3Base::s_lpD3DDev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
			CN3Base::s_lpD3DDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
			CN3Base::s_lpD3DDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);

			CN3Base::s_lpD3DDev->SetFVF(FVF_TRANSFORMEDCOLOR);
			CN3Base::s_lpD3DDev->DrawPrimitiveUP(D3DPT_LINESTRIP, 4, vLines, sizeof(__VertexTransformedColor));
			
			CN3Base::s_lpD3DDev->SetRenderState(D3DRS_ZENABLE, dwZ);
			CN3Base::s_lpD3DDev->SetRenderState(D3DRS_FOGENABLE, dwFog);
			CN3Base::s_lpD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, dwAlpha);
			CN3Base::s_lpD3DDev->SetRenderState(D3DRS_SRCBLEND, dwSrcBlend);
			CN3Base::s_lpD3DDev->SetRenderState(D3DRS_DESTBLEND, dwDestBlend);
			CN3Base::s_lpD3DDev->SetTextureStageState(0, D3DTSS_COLOROP, dwCOP);
			CN3Base::s_lpD3DDev->SetTextureStageState(0, D3DTSS_COLORARG1, dwCA1);
			CN3Base::s_lpD3DDev->SetTextureStageState(0, D3DTSS_ALPHAOP, dwAOP);
			CN3Base::s_lpD3DDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, dwAA1);
			CN3Base::s_lpD3DDev->SetFVF(dwVertexShader);
		}
	}
}
示例#2
0
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;
}