Esempio n. 1
0
	std::pair<CombSet::iterator,bool> ReqS_MF::operator() (
				std::list<CombSet::iterator> &local_state_cache,
				std::set<int> &dealed_factors,
				const Requirement &req)
	{
		int max_num=m_min_number;
		std::list<CombSet::iterator>::iterator selected_it1=local_state_cache.end();
		std::list<CombSet::iterator>::iterator selected_it2=local_state_cache.end();
		for(std::list<CombSet::iterator>::iterator it=local_state_cache.begin();
			it!=local_state_cache.end();++it)
		{
			int number=(*it)->getParaSet().size();
			if(number>max_num)
			{
				max_num=number;
				selected_it1=it;
				if(0!=IsRelated(*it,dealed_factors))
					selected_it2=it;
			}
		}

		CombSet::iterator selected_one;
		bool flag=ModifyLocalStateCache(selected_it1,selected_it2,
			local_state_cache,dealed_factors,selected_one);
		return std::pair<CombSet::iterator,bool>(selected_one,flag);
	}
bool UIMenuLaneView::ProcessCommand(CommandType* _command)
{
	UIColorComponent* renderableComponent = FindComponent<UIColorComponent>();

	// Hover
	if (_command->actor == CommandActor::System && _command->action == CommandAction::Hover)
	{
		// Confirm the chain
		SetChainStatus(true);
	}

	// Hover clear
	if (_command->actor == CommandActor::System && _command->action == CommandAction::HoverClear)
	{
		// Check if we lost the hover to another widget
		if (_command->object != nullptr)
		{
			// Try to cast to a chain-like object
			UIMenuChain* chainObject = dynamic_cast<UIMenuChain*>((UIBase*)_command->object);
			if (chainObject == nullptr)
			{
				// Lost by another widget different from any menu-like ones
				SetChainStatus(false);

				return true;
			}

			// Check if the widget is related to this laneview
			bool isRelated = IsRelated(chainObject);
			if (isRelated)
			{
				// Stay normal!
				SetChainStatus(true);
			}
			else
			{
				// Lost by another widget different from any menu-like ones
				SetChainStatus(false);
			}

		}
		// We lost by going out of bounds
		else
		{
			// Set the chain status
			SetChainStatus(false);
		}
	}

	return true;
}
Esempio n. 3
0
	std::pair<CombSet::iterator,bool> ReqS_First::operator() (
				std::list<CombSet::iterator> &local_state_cache,
				std::set<int> &dealed_factors,
				const Requirement &req)
	{
		std::list<CombSet::iterator>::iterator selected_it=local_state_cache.begin();

		bool flag=false;
		if(0!=IsRelated(*selected_it,dealed_factors))
			flag=true;

		CombSet::iterator selected_one=*selected_it;
		local_state_cache.erase(selected_it);
		dealed_factors.insert(selected_one->getParaSet().begin(),
			selected_one->getParaSet().end());

		return std::pair<CombSet::iterator,bool>(selected_one,flag);
	}
bool UIMenuButton::ProcessCommand(CommandType* _command)
{
	// Get our renderable component
	UIColorComponent* renderableComponent = FindComponent<UIColorComponent>();

	// Hover
	if (_command->actor == CommandActor::System && _command->action == CommandAction::Hover && !m_Pressing)
	{
		// Confirm the chain
		if (m_LaneViewChild != nullptr)
		{
			m_LaneViewChild->SetChainStatus(true);
		}
		else
		{
			SetChainStatus(true);
		}
	}

	// Hover clear
	if (_command->actor == CommandActor::System && _command->action == CommandAction::HoverClear && !m_Pressing)
	{
		// Check if we are a top button
		if (!m_IsTopMenuButton)
		{
			// We lost our hover, ok, got it!
			ForceVisibleStatus(false);
		}

		// Check if we lost the hover to another widget
		if (_command->object != nullptr)
		{
			// Try to cast to a chain-like object
			UIMenuChain* chainObject = dynamic_cast<UIMenuChain*>((UIBase*)_command->object);
			if (chainObject == nullptr)
			{
				// Lost by another widget different from any menu-like ones
				SetChainStatus(false);
				// m_Selected = false;

				return true;
			}

			// Check if the widget is related to us
			bool isRelated = IsRelated(chainObject);
			if (isRelated)
			{

			}
			// No
			else
			{
				// Hide our childlane
				if (m_LaneViewChild != nullptr) m_LaneViewChild->ForceVisibleStatus(false);
				if(m_ChainOwner != nullptr) m_ChainOwner->ForceVisibleStatus(false);
				ForceVisibleStatus(false);
			}
		}
		// We lost by going out of bounds
		else
		{
			// Set the chain status
			SetChainStatus(false);
			// m_Selected = false;
		}
	}

	// Press
	if (_command->actor == CommandActor::Mouse && _command->action == CommandAction::Press)
	{
		// Set the renderable component data
		renderableComponent->SetColor(Vector4(0.1, 0.1, 0.1, 1.0));

		// Confirm the chain
		if (m_LaneViewChild != nullptr) m_LaneViewChild->SetChainStatus(true);

		// Set pressing to true
		m_Pressing = true;

		// We selected this button
		m_Selected = true;
	}
	// Release
	else if (_command->actor == CommandActor::Mouse && _command->action == CommandAction::Release && m_Pressing)
	{
		// Check if the click callback exist
		if (m_ClickCallback.IsSet())
		{
			// Call the click callback
			m_ClickCallback.Run(this);
		}

		// Set pressing to false
		m_Pressing = false;
	}

	// Lost focus
	if (_command->actor == CommandActor::System && _command->action == CommandAction::LostFocus)
	{
		// Set pressing to false
		m_Pressing = false;
	}

	return true;
}
BOOL CXTPMouseManager::PreTranslateMouseEvents(WPARAM wParam, POINT point)
{
	HWND hWndMouse = ::WindowFromPoint(point);
	CTrackArray& arrTracked = m_arrTracked;
	int i;

	for (i = (int)arrTracked.GetSize() - 1; i >= 0; i--)
	{
		CXTPCommandBar* pCommandBar = arrTracked[i];

		if (!pCommandBar->GetSafeHwnd())
			continue;

		int nHtCode = pCommandBar->OnMouseHitTest(point);

		if ((nHtCode != HTERROR) && ((nHtCode == HTCLIENT) || ::IsChild(pCommandBar->GetSafeHwnd(), hWndMouse) || IsRelated(pCommandBar->GetSafeHwnd(), hWndMouse)))
		{
			if (pCommandBar->m_nLockRecurse > 0 && wParam != WM_MOUSEMOVE && wParam != WM_NCMOUSEMOVE && !m_bIgnoreLButtonUp)
			{
				SendTrackLostRecurse();
				ptMouse = 0;
			}
			return FALSE;
		}
	}

	if (arrTracked.GetSize() > 0)
	{
		CTrustedArray& arrTrusted = m_arrTrusted;
		for (i = 0; i < arrTrusted.GetSize(); i++)
		{
			HWND hWnd = arrTrusted[i];
			if (IsWindow(hWnd) && IsWindowVisible(hWnd) && CXTPWindowRect(hWnd).PtInRect(point))
			{
				return FALSE;
			}
		}

	}

	if (hWndMouse && arrTracked.GetSize() > 0)
	{
		if (GetClassLong(hWndMouse, GCL_STYLE) & CS_IME)
			return FALSE;
	}

	for (i = 0; i < arrTracked.GetSize(); i++)
	{
		DeliverMessage(arrTracked.GetAt(i), wParam, point);
	}

	return FALSE;

}