本文整理汇总了C++中CGUIControl类的典型用法代码示例。如果您正苦于以下问题:C++ CGUIControl类的具体用法?C++ CGUIControl怎么用?C++ CGUIControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGUIControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MarkDirtyRegion
void CGUIControlGroupList::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
if (m_scroller.Update(currentTime))
MarkDirtyRegion();
// first we update visibility of all our items, to ensure our size and
// alignment computations are correct.
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
GUIPROFILER_VISIBILITY_BEGIN(control);
control->UpdateVisibility();
GUIPROFILER_VISIBILITY_END(control);
}
ValidateOffset();
if (m_pageControl)
{
CGUIMessage message(GUI_MSG_LABEL_RESET, GetParentID(), m_pageControl, (int)Size(), (int)m_totalSize);
SendWindowMessage(message);
CGUIMessage message2(GUI_MSG_ITEM_SELECT, GetParentID(), m_pageControl, (int)m_scroller.GetValue());
SendWindowMessage(message2);
}
// we run through the controls, rendering as we go
float pos = GetAlignOffset();
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
// note we render all controls, even if they're offscreen, as then they'll be updated
// with respect to animations
CGUIControl *control = *it;
if (m_orientation == VERTICAL)
g_graphicsContext.SetOrigin(m_posX, m_posY + pos - m_scroller.GetValue());
else
g_graphicsContext.SetOrigin(m_posX + pos - m_scroller.GetValue(), m_posY);
control->DoProcess(currentTime, dirtyregions);
if (control->IsVisible())
pos += Size(control) + m_itemGap;
g_graphicsContext.RestoreOrigin();
}
CGUIControl::Process(currentTime, dirtyregions);
}
示例2: Process
void CGUIListGroup::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
CServiceBroker::GetWinSystem()->GetGfxContext().SetOrigin(m_posX, m_posY);
CRect rect;
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
control->UpdateVisibility(m_item);
unsigned int oldDirty = dirtyregions.size();
control->DoProcess(currentTime, dirtyregions);
if (control->IsVisible() || (oldDirty != dirtyregions.size())) // visible or dirty (was visible?)
rect.Union(control->GetRenderRegion());
}
CServiceBroker::GetWinSystem()->GetGfxContext().RestoreOrigin();
CGUIControl::Process(currentTime, dirtyregions);
m_renderRegion = rect;
m_item = NULL;
}
示例3: controlCoords
void CGUIControlGroupList::UnfocusFromPoint(const CPoint &point)
{
float pos = 0;
CPoint controlCoords(point);
m_transform.InverseTransformPosition(controlCoords.x, controlCoords.y);
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *child = *it;
if (child->IsVisible())
{
if (pos + Size(child) > m_offset && pos < m_offset + Size())
{ // we're on screen
CPoint offset = (m_orientation == VERTICAL) ? CPoint(m_posX, m_posY + pos - m_offset) : CPoint(m_posX + pos - m_offset, m_posY);
child->UnfocusFromPoint(controlCoords - offset);
}
pos += Size(child) + m_itemGap;
}
}
CGUIControl::UnfocusFromPoint(point);
}
示例4: pos
void CGUIControlGroup::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
CPoint pos(GetPosition());
g_graphicsContext.SetOrigin(pos.x, pos.y);
CRect rect;
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl *control = *it;
control->UpdateVisibility();
unsigned int oldDirty = dirtyregions.size();
control->DoProcess(currentTime, dirtyregions);
if (control->IsVisible() || (oldDirty != dirtyregions.size())) // visible or dirty (was visible?)
rect.Union(control->GetRenderRegion());
}
g_graphicsContext.RestoreOrigin();
CGUIControl::Process(currentTime, dirtyregions);
m_renderRegion = rect;
}
示例5: EnlargeHeight
void CGUIListGroup::EnlargeHeight(float difference)
{
// Alters the width of the controls that have an ID of 1
for (iControls it = m_children.begin(); it != m_children.end(); it++)
{
CGUIControl *child = *it;
if (child->GetID() >= 1 && child->GetID() <= 14)
{
if (child->GetID() == 1) // label
{
child->SetHeight(child->GetHeight() + difference);
child->SetVisible(child->GetHeight() > 10); ///
}
else
{
child->SetHeight(child->GetHeight() + difference);
}
}
}
SetInvalid();
}
示例6: UpdateViewVisibility
void CGUIViewControl::UpdateViewVisibility()
{
// first reset our infomanager cache, as it's likely that the vis conditions
// used for views (i.e. based on contenttype) may have changed
CGUIInfoManager& infoMgr = CServiceBroker::GetGUI()->GetInfoManager();
infoMgr.ResetCache();
infoMgr.GetInfoProviders().GetGUIControlsInfoProvider().ResetContainerMovingCache();
m_visibleViews.clear();
for (unsigned int i = 0; i < m_allViews.size(); i++)
{
CGUIControl *view = m_allViews[i];
if (view->HasVisibleCondition())
{
view->UpdateVisibility(nullptr);
if (view->IsVisibleFromSkin())
m_visibleViews.push_back(view);
}
else
m_visibleViews.push_back(view);
}
}
示例7: handled
bool CGUIControlGroup::SendControlMessage(CGUIMessage &message)
{
// see if a child matches, and send to the child control if so
for (iControls it = m_children.begin();it != m_children.end(); ++it)
{
CGUIControl* control = *it;
if (control->HasVisibleID(message.GetControlId()))
{
if (control->OnMessage(message))
return true;
}
}
// Unhandled - send to all matching invisible controls as well
bool handled(false);
for (iControls it = m_children.begin(); it != m_children.end(); ++it)
{
CGUIControl* control = *it;
if (control->HasID(message.GetControlId()))
{
if (control->OnMessage(message))
handled = true;
}
}
return handled;
}
示例8: GetFirstFocusableControl
void CGUIControllerWindow::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
/*
* Apply the faded focus texture to the current controller when unfocused
*/
CGUIControl* control = nullptr; // The controller button
bool bAlphaFaded = false; // True if the controller button has been focused and faded this frame
if (m_controllerList && m_controllerList->GetFocusedController() >= 0)
{
control = GetFirstFocusableControl(CONTROL_CONTROLLER_BUTTONS_START + m_controllerList->GetFocusedController());
if (control && !control->HasFocus())
{
if (control->GetControlType() == CGUIControl::GUICONTROL_BUTTON)
{
control->SetFocus(true);
static_cast<CGUIButtonControl*>(control)->SetAlpha(0x80);
bAlphaFaded = true;
}
}
}
CGUIDialog::DoProcess(currentTime, dirtyregions);
if (control && bAlphaFaded)
{
control->SetFocus(false);
if (control->GetControlType() == CGUIControl::GUICONTROL_BUTTON)
static_cast<CGUIButtonControl*>(control)->SetAlpha(0xFF);
}
}
示例9: GetFirstFocusableControl
// returns true if the control group with id groupID has controlID as
// its focused control
bool CGUIWindow::ControlGroupHasFocus(int groupID, int controlID)
{
// 1. Run through and get control with groupID (assume unique)
// 2. Get it's selected item.
CGUIControl *group = GetFirstFocusableControl(groupID);
if (!group) group = (CGUIControl *)GetControl(groupID);
if (group && group->IsGroup())
{
if (controlID == 0)
{ // just want to know if the group is focused
return group->HasFocus();
}
else
{
CGUIMessage message(GUI_MSG_ITEM_SELECTED, GetID(), group->GetID());
group->OnMessage(message);
return (controlID == (int) message.GetParam1());
}
}
return false;
}
示例10: mousePoint
// OnMouseAction - called by OnAction()
EVENT_RESULT CGUIWindow::OnMouseAction(const CAction &action)
{
g_graphicsContext.SetScalingResolution(m_coordsRes, m_needsScaling);
CPoint mousePoint(action.GetAmount(0), action.GetAmount(1));
g_graphicsContext.InvertFinalCoords(mousePoint.x, mousePoint.y);
// create the mouse event
CMouseEvent event(action.GetID(), action.GetHoldTime(), action.GetAmount(2), action.GetAmount(3));
if (m_exclusiveMouseControl)
{
CGUIControl *child = (CGUIControl *)GetControl(m_exclusiveMouseControl);
if (child)
{
CPoint renderPos = child->GetRenderPosition() - CPoint(child->GetXPosition(), child->GetYPosition());
return child->OnMouseEvent(mousePoint - renderPos, event);
}
}
UnfocusFromPoint(mousePoint);
return SendMouseEvent(mousePoint, event);
}
示例11: Initialize
bool CGUIPVRChannelGroupsSelector::Initialize(CGUIWindow* parent, bool bRadio)
{
CGUIControl* control = parent->GetControl(CONTROL_LSTCHANNELGROUPS);
if (control && control->IsContainer())
{
m_control = control;
m_channelGroups = CServiceBroker::GetPVRManager().ChannelGroups()->Get(bRadio)->GetMembers(true);
CFileItemList channelGroupItems;
for (const auto& group : m_channelGroups)
{
CFileItemPtr item(new CFileItem(group->GetPath(), true));
item->m_strTitle = group->GroupName();
item->SetLabel(group->GroupName());
channelGroupItems.Add(item);
}
CGUIMessage msg(GUI_MSG_LABEL_BIND, m_control->GetID(), CONTROL_LSTCHANNELGROUPS, 0, 0, &channelGroupItems);
m_control->OnMessage(msg);
return true;
}
return false;
}
示例12: GetAddonControl
CGUIControl* CGUIAddonWindow::GetAddonControl(int controlId, CGUIControl::GUICONTROLTYPES type, const std::string& typeName)
{
CGUIControl* pGUIControl = dynamic_cast<CGUIControl*>(GetControl(controlId));
if (!pGUIControl)
{
CLog::Log(LOGERROR, "CGUIAddonGUI_Window::%s: %s - Requested GUI control Id '%i' for '%s' not present!",
__FUNCTION__,
m_addon->Name().c_str(),
controlId, typeName.c_str());
return nullptr;
}
else if (pGUIControl->GetControlType() != type)
{
CLog::Log(LOGERROR, "CGUIAddonGUI_Window::%s: %s - Requested GUI control Id '%i' not the type '%s'!",
__FUNCTION__,
m_addon->Name().c_str(),
controlId, typeName.c_str());
return nullptr;
}
return pGUIControl;
}
示例13: handled
bool CGUIDialogKeyboardGeneric::OnAction(const CAction &action)
{
bool handled(true);
if (action.GetID() == ACTION_BACKSPACE)
{
Backspace();
}
else if (action.GetID() == ACTION_ENTER)
{
OnOK();
}
else if (action.GetID() == ACTION_CURSOR_LEFT)
{
MoveCursor( -1);
}
else if (action.GetID() == ACTION_CURSOR_RIGHT)
{
MoveCursor(1);
}
else if (action.GetID() == ACTION_SHIFT)
{
OnShift();
}
else if (action.GetID() == ACTION_SYMBOLS)
{
OnSymbols();
}
else if (action.GetID() >= KEY_ASCII)
{ // send action to the edit control
CGUIControl *edit = GetControl(CTL_EDIT);
if (edit)
edit->OnAction(action);
}
else // unhandled by us - let's see if the baseclass wants it
handled = CGUIDialog::OnAction(action);
return handled;
}
示例14: rect
void CGUIListItemLayout::LoadControl(TiXmlElement *child, CGUIControlGroup *group)
{
if (!group) return;
CRect rect(group->GetXPosition(), group->GetYPosition(), group->GetXPosition() + group->GetWidth(), group->GetYPosition() + group->GetHeight());
CGUIControlFactory factory;
CGUIControl *control = factory.Create(0, rect, child, true); // true indicating we're inside a list for the
// different label control + defaults.
if (control)
{
group->AddControl(control);
if (control->IsGroup())
{
TiXmlElement *grandChild = child->FirstChildElement("control");
while (grandChild)
{
LoadControl(grandChild, (CGUIControlGroup *)control);
grandChild = grandChild->NextSiblingElement("control");
}
}
}
}
示例15: MarkDirtyRegion
void CGUIWindowSettingsScreenCalibration::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
MarkDirtyRegion();
for (int i = CONTROL_TOP_LEFT; i <= CONTROL_PIXEL_RATIO; i++)
SET_CONTROL_HIDDEN(i);
m_needsScaling = true;
CGUIWindow::DoProcess(currentTime, dirtyregions);
m_needsScaling = false;
g_graphicsContext.SetRenderingResolution(m_Res[m_iCurRes], false);
g_graphicsContext.ResetWindowTransform();
// process the movers etc.
for (int i = CONTROL_TOP_LEFT; i <= CONTROL_PIXEL_RATIO; i++)
{
SET_CONTROL_VISIBLE(i);
CGUIControl *control = (CGUIControl *)GetControl(i);
if (control)
control->DoProcess(currentTime, dirtyregions);
}
}