本文整理汇总了C++中CGUIControl::CanFocus方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIControl::CanFocus方法的具体用法?C++ CGUIControl::CanFocus怎么用?C++ CGUIControl::CanFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIControl
的用法示例。
在下文中一共展示了CGUIControl::CanFocus方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsLastFocusableControl
bool CGUIControlGroupList::IsLastFocusableControl(const CGUIControl *control) const
{
for (crControls it = m_children.rbegin(); it != m_children.rend(); ++it)
{
CGUIControl *child = *it;
if (child->IsVisible() && child->CanFocus())
{ // found first focusable
return child == control;
}
}
return false;
}
示例2: DoProcess
void CGUIWindow::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
g_graphicsContext.SetRenderingResolution(m_coordsRes, m_needsScaling);
g_graphicsContext.AddGUITransform();
CGUIControlGroup::DoProcess(currentTime, dirtyregions);
g_graphicsContext.RemoveTransform();
// check if currently focused control can have it
// and fallback to default control if not
CGUIControl* focusedControl = GetFocusedControl();
if (focusedControl && !focusedControl->CanFocus())
SET_CONTROL_FOCUS(m_defaultControl, 0);
}
示例3: DoProcess
void CGUIWindow::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
if (!IsControlDirty() && CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_guiSmartRedraw)
return;
CServiceBroker::GetWinSystem()->GetGfxContext().SetRenderingResolution(m_coordsRes, m_needsScaling);
CServiceBroker::GetWinSystem()->GetGfxContext().AddGUITransform();
CGUIControlGroup::DoProcess(currentTime, dirtyregions);
CServiceBroker::GetWinSystem()->GetGfxContext().RemoveTransform();
// check if currently focused control can have it
// and fallback to default control if not
CGUIControl* focusedControl = GetFocusedControl();
if (focusedControl && !focusedControl->CanFocus())
SET_CONTROL_FOCUS(m_defaultControl, 0);
}
示例4:
// in the case of id == 0, we don't match id
CGUIControl *CGUIControlGroup::GetFirstFocusableControl(int id)
{
if (!CanFocus()) return NULL;
if (id && id == (int) GetID()) return this; // we're focusable and they want us
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl* pControl = *it;
if (pControl->IsGroup())
{
CGUIControlGroup *group = (CGUIControlGroup *)pControl;
CGUIControl *control = group->GetFirstFocusableControl(id);
if (control) return control;
}
if ((!id || (int) pControl->GetID() == id) && pControl->CanFocus())
return pControl;
}
return NULL;
}
示例5: OnMessage
bool CGUIControlGroupList::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage() )
{
case GUI_MSG_FOCUSED:
{ // a control has been focused
// scroll if we need to and update our page control
ValidateOffset();
float offset = 0;
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
if (!control->IsVisible())
continue;
if (control->GetID() == message.GetControlId())
{
// find out whether this is the first or last control
if (IsFirstFocusableControl(control))
ScrollTo(0);
else if (IsLastFocusableControl(control))
ScrollTo(m_totalSize - Size());
else if (offset < m_scroller.GetValue())
ScrollTo(offset);
else if (offset + Size(control) > m_scroller.GetValue() + Size())
ScrollTo(offset + Size(control) - Size());
break;
}
offset += Size(control) + m_itemGap;
}
}
break;
case GUI_MSG_SETFOCUS:
{
// we've been asked to focus. We focus the last control if it's on this page,
// else we'll focus the first focusable control from our offset (after verifying it)
ValidateOffset();
// now check the focusControl's offset
float offset = 0;
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
if (!control->IsVisible())
continue;
if (control->GetID() == m_focusedControl)
{
if (IsControlOnScreen(offset, control))
return CGUIControlGroup::OnMessage(message);
break;
}
offset += Size(control) + m_itemGap;
}
// find the first control on this page
offset = 0;
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
if (!control->IsVisible())
continue;
if (control->CanFocus() && IsControlOnScreen(offset, control))
{
m_focusedControl = control->GetID();
break;
}
offset += Size(control) + m_itemGap;
}
}
break;
case GUI_MSG_PAGE_CHANGE:
{
if (message.GetSenderId() == m_pageControl)
{ // it's from our page control
ScrollTo((float)message.GetParam1());
return true;
}
}
break;
}
return CGUIControlGroup::OnMessage(message);
}