Beispiel #1
0
iSpellListView::iSpellListView(iViewMgr* pViewMgr, IViewCmdHandler* pCmdHandler, const iRect& rect, uint32 uid, iHero* pOwner, bool bShowFavorites)
: iView(pViewMgr, rect, GENERIC_VIEWPORT, uid, Visible|Enabled)
, m_pCmdHandler(pCmdHandler)
, m_pOwner(pOwner)
, m_typeMask(0), m_curSel(MSP_INVALID) 
{
	sint32 bcnt = SSM_COUNT;
	if  (!bShowFavorites) bcnt--;

	sint32 btnW = iMAX<sint32>(rect.w/2,140) / bcnt;
	sint32 sbW = btnW*bcnt - 16;

	iPHScrollBar* pScrollBar = new iPHScrollBar(m_pMgr, this, iRect(sbW+1, 0, 15, rect.h-16), uid+1);
	AddChild(pScrollBar);
	m_pSpellListBox = new iSpellListBox(m_pMgr, this, iRect(0, 0, sbW, rect.h-16), uid, m_pOwner);
	AddChild(m_pSpellListBox);
	m_pSpellListBox->SetScrollBar(pScrollBar);

	AddChild(m_pSchoolSwitch = new iBarTabSwitch(pViewMgr, this, iRect(0, rect.h-15, btnW * bcnt, 15), bcnt, uid + 10));
	for (uint32 xx=0; xx<bcnt; ++xx) m_pSchoolSwitch->SetTabIcon(SCHOOL_SWITCH_ICONS[xx]);
	if (m_pOwner) {
		if (m_pOwner->GetSpellSetMode() == SSM_FAVORITES && !bShowFavorites) m_pSchoolSwitch->SetCurrentTab(SSM_ALL);
		else m_pSchoolSwitch->SetCurrentTab(m_pOwner->GetSpellSetMode());
	}

	iRect rrc(rect.size());
	rrc.DeflateRect(sbW + 16 + 5, 0, 0, 0);
	AddChild(m_pSpellButton = new iSpellBtn(m_pMgr, this, iRect(rrc.x + (rrc.w/2 - 30), 30, 61,36), uid + 20));
}
Beispiel #2
0
void test_rrc(void)
{
    for(;;) {
        r.A = rand()%256; 
        printf("A = (%hhu) %s, Tc = %hhu\n", r.A, itoab8(r.A), F_CARRY(r.F) );
        rrc(); printf("rrc A\n");
        printf("A = (%hhu) %s, Tc = %hhu\n", r.A, itoab8(r.A), F_CARRY(r.F) );
        printf("\n=============================\n");
    }
}
Beispiel #3
0
void UIElement::Render(ManagedRenderContext renderContext)
{
	size_t nchildren = GetChildrenCount();
	for (size_t i = 0; i < nchildren; ++i)
	{
		Visual* child = GetChild(i);
		child->Render_(renderContext);
	}

	if (!m_visualValid)
	{
		m_visualValid = true;
		if (m_visuals)
		{
			if (m_visuals->get_Children())
			{
				m_visuals->get_Children()->m_items.clear();
			}

			RetainedRenderContext rrc(GetRoot(), m_visuals);
			ManagedRetainedRenderContext retainedRenderContext(&rrc);
			RenderRetained(retainedRenderContext);
		}
	}

	if (m_visuals)
	{
		m_visuals->Render_(renderContext);
	}

#if 0

	UIElement* shadowTree = get_ShadowTree();

	if (shadowTree == nullptr)
	{
		m_visuals = new GroupVisual;
		set_ShadowTree(m_visuals);

		shadowTree = m_visuals;
		m_visualValid = false;
	}

	if (!m_visualValid)
	{
		m_visualValid = true;
		if (m_visuals)
		{
			if (m_visuals->get_Children())
			{
				m_visuals->get_Children()->m_items.clear();
			}

			RetainedRenderContext rrc(GetRoot(), m_visuals);
			ManagedRetainedRenderContext retainedRenderContext(&rrc);
			RenderRetained(retainedRenderContext);
		}
	}

	shadowTree->Render_(renderContext);
#endif
}