当前位置: 首页>>代码示例>>C++>>正文


C++ Control::CanFocus方法代码示例

本文整理汇总了C++中Control::CanFocus方法的典型用法代码示例。如果您正苦于以下问题:C++ Control::CanFocus方法的具体用法?C++ Control::CanFocus怎么用?C++ Control::CanFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Control的用法示例。


在下文中一共展示了Control::CanFocus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Move

void Menu::Move(bool down)
{
	Control *find = m_focus;
	if (find == NULL)
		return;
	do {
		if (down)
		{
			find = find->m_next;
			if (find == NULL)
				find = m_controls;
		}
		else
		{
			find = find->m_last;
			if (find == NULL)
			{
				find = m_controls;
				while (find->m_next != NULL)
					find = find->m_next;
			}
		}
		if (find == m_focus)
		{
			// Avoid an infinite loop, if we're on the input it must be the only one (or none)
			return;
		}
	} while((!find->CanFocus()) || (!find->Visible()));
	m_focus->SetFocus(false);
	m_focus = find;
	m_focus->SetFocus(true);
	Update();
}
开发者ID:RAFACG,项目名称:IndependentlySmartWatch,代码行数:33,代码来源:Menu.cpp

示例2: Update

void Menu::Update(void)
{
	if (!IsOnScreen(m_focus))
	{
		int dir = FindInList(m_topView, m_focus);
		if (dir == 0)
		{
			// Item not in list? Suspicious
			return;
		}
		if (dir < 0)
		{
			// First, move up until view is visible
			do
			{
				do
				{
					m_topView = m_topView->m_last;
				}
				while ((m_topView != NULL) && (!m_topView->Visible()));
			}
			while (!IsOnScreen(m_focus));
			// Second, optionally find top label
			Control *label = m_topView->m_last;
			while ((label != NULL) && ((!label->Visible()) || label->CanFocus()))
				label = label->m_last;
			if (label != NULL)
			{
				Control *minTop = m_topView;
				m_topView = label;
				if (!IsOnScreen(m_focus))
					m_topView = minTop;
			}
		}
		else
		{
			// Simply move down until item visible
			do
			{
				do
				{
					m_topView = m_topView->m_next;
				}
				while (!m_topView->Visible());
			}
			while (!IsOnScreen(m_focus));
		}
	}
	OnPaint(m_destination);
}
开发者ID:RAFACG,项目名称:IndependentlySmartWatch,代码行数:50,代码来源:Menu.cpp


注:本文中的Control::CanFocus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。