本文整理汇总了C++中CGUIButtonControl::GetYPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIButtonControl::GetYPosition方法的具体用法?C++ CGUIButtonControl::GetYPosition怎么用?C++ CGUIButtonControl::GetYPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIButtonControl
的用法示例。
在下文中一共展示了CGUIButtonControl::GetYPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupButtons
void CGUIDialogContextMenu::SetupButtons()
{
if (!m_buttons.size())
return;
// disable the template button control
CGUIButtonControl *pButtonTemplate = (CGUIButtonControl *)GetFirstFocusableControl(BUTTON_TEMPLATE);
if (!pButtonTemplate) pButtonTemplate = (CGUIButtonControl *)GetControl(BUTTON_TEMPLATE);
if (!pButtonTemplate)
return;
pButtonTemplate->SetVisible(false);
CGUIControlGroupList* pGroupList = NULL;
{
const CGUIControl* pControl = GetControl(GROUP_LIST);
if (pControl && pControl->GetControlType() == GUICONTROL_GROUPLIST)
pGroupList = (CGUIControlGroupList*)pControl;
}
// add our buttons
for (unsigned int i = 0; i < m_buttons.size(); i++)
{
CGUIButtonControl *pButton = new CGUIButtonControl(*pButtonTemplate);
if (pButton)
{ // set the button's ID and position
int id = BUTTON_START + i;
pButton->SetID(id);
pButton->SetVisible(true);
pButton->SetLabel(m_buttons[i].second);
if (pGroupList)
{
pButton->SetPosition(pButtonTemplate->GetXPosition(), pButtonTemplate->GetYPosition());
pGroupList->AddControl(pButton);
}
#if PRE_SKIN_VERSION_11_COMPATIBILITY
else
{
pButton->SetPosition(pButtonTemplate->GetXPosition(), i*(pButtonTemplate->GetHeight() + SPACE_BETWEEN_BUTTONS));
pButton->SetNavigation(id - 1, id + 1, id, id);
AddControl(pButton);
}
#endif
}
}
CGUIControl *pControl = NULL;
#if PRE_SKIN_VERSION_11_COMPATIBILITY
if (!pGroupList)
{
// if we don't have grouplist update the navigation of the first and last buttons
pControl = (CGUIControl *)GetControl(BUTTON_START);
if (pControl)
pControl->SetNavigation(BUTTON_END, pControl->GetControlIdDown(), pControl->GetControlIdLeft(), pControl->GetControlIdRight());
pControl = (CGUIControl *)GetControl(BUTTON_END);
if (pControl)
pControl->SetNavigation(pControl->GetControlIdUp(), BUTTON_START, pControl->GetControlIdLeft(), pControl->GetControlIdRight());
}
#endif
// fix up background images placement and size
pControl = (CGUIControl *)GetControl(BACKGROUND_IMAGE);
if (pControl)
{
// first set size of background image
if (pGroupList)
{
if (pGroupList->GetOrientation() == VERTICAL)
{
// keep gap between bottom edges of grouplist and background image
pControl->SetHeight(pControl->GetHeight() - pGroupList->Size() + pGroupList->GetHeight());
}
else
{
// keep gap between right edges of grouplist and background image
pControl->SetWidth(pControl->GetWidth() - pGroupList->Size() + pGroupList->GetWidth());
}
}
#if PRE_SKIN_VERSION_11_COMPATIBILITY
else
pControl->SetHeight(m_buttons.size() * (pButtonTemplate->GetHeight() + SPACE_BETWEEN_BUTTONS));
if (pGroupList && pGroupList->GetOrientation() == HORIZONTAL)
{
// if there is grouplist control with horizontal orientation - adjust width of top and bottom background
CGUIControl* pControl2 = (CGUIControl *)GetControl(BACKGROUND_TOP);
if (pControl2)
pControl2->SetWidth(pControl->GetWidth());
pControl2 = (CGUIControl *)GetControl(BACKGROUND_BOTTOM);
if (pControl2)
pControl2->SetWidth(pControl->GetWidth());
}
else
{
// adjust position of bottom background
CGUIControl* pControl2 = (CGUIControl *)GetControl(BACKGROUND_BOTTOM);
if (pControl2)
pControl2->SetPosition(pControl2->GetXPosition(), pControl->GetYPosition() + pControl->GetHeight());
}
#endif
//.........这里部分代码省略.........
示例2: SetupButtons
void CGUIDialogContextMenu::SetupButtons()
{
if (!m_buttons.size())
return;
// disable the template button control
CGUIButtonControl *pButtonTemplate = dynamic_cast<CGUIButtonControl *>(GetFirstFocusableControl(BUTTON_TEMPLATE));
if (!pButtonTemplate)
pButtonTemplate = dynamic_cast<CGUIButtonControl *>(GetControl(BUTTON_TEMPLATE));
if (!pButtonTemplate)
return;
pButtonTemplate->SetVisible(false);
CGUIControlGroupList* pGroupList = dynamic_cast<CGUIControlGroupList *>(GetControl(GROUP_LIST));
// add our buttons
for (unsigned int i = 0; i < m_buttons.size(); i++)
{
CGUIButtonControl *pButton = new CGUIButtonControl(*pButtonTemplate);
if (pButton)
{ // set the button's ID and position
int id = BUTTON_START + i;
pButton->SetID(id);
pButton->SetVisible(true);
pButton->SetLabel(m_buttons[i].second);
if (pGroupList)
{
pButton->SetPosition(pButtonTemplate->GetXPosition(), pButtonTemplate->GetYPosition());
// try inserting context buttons at position specified by template
// button, if template button is not in grouplist fallback to adding
// new buttons at the end of grouplist
if (!pGroupList->InsertControl(pButton, pButtonTemplate))
pGroupList->AddControl(pButton);
}
}
}
// fix up background images placement and size
CGUIControl *pControl = (CGUIControl *)GetControl(BACKGROUND_IMAGE);
if (pControl)
{
// first set size of background image
if (pGroupList)
{
if (pGroupList->GetOrientation() == VERTICAL)
{
// keep gap between bottom edges of grouplist and background image
pControl->SetHeight(m_backgroundImageSize - pGroupList->Size() + pGroupList->GetHeight());
}
else
{
// keep gap between right edges of grouplist and background image
pControl->SetWidth(m_backgroundImageSize - pGroupList->Size() + pGroupList->GetWidth());
}
}
}
// update our default control
if (pGroupList)
m_defaultControl = pGroupList->GetID();
}