本文整理汇总了C++中Menu::GetPullDownMenuParent方法的典型用法代码示例。如果您正苦于以下问题:C++ Menu::GetPullDownMenuParent方法的具体用法?C++ Menu::GetPullDownMenuParent怎么用?C++ Menu::GetPullDownMenuParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::GetPullDownMenuParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MouseReleased
void MenuItem::MouseReleased(const MouseEvent& lEvent)
{
if(!IsParentMenuOpen())
{
return;
}
Menu* lpParentMenu = (Menu* )GetParent();
// Make sure that we are inside the bounds of the parent menu
if(lpParentMenu->GetPullDownMenuParent() != NULL)
{
int lTextHeight = m_pRenderer->GetFreeTypeTextHeight(lpParentMenu->GetPullDownMenuParent()->GetGUIFont(), "%s", lpParentMenu->GetMenuTitle().c_str());
int lMenuHeight = lTextHeight + (lpParentMenu->GetMenuItemSpacer() * 2);
int lFullMenuDisplayHeight = lpParentMenu->GetPullDownMenuParent()->GetMaxNumItemsDisplayed() * lMenuHeight;
Point location = lpParentMenu->GetPullDownMenuParent()->GetLocation();
for(Component* parent = lpParentMenu->GetPullDownMenuParent()->GetParent(); parent != 0;)
{
Point parentLocation = parent->GetLocation();
location.m_x += parentLocation.m_x;
location.m_y += parentLocation.m_y;
parent = parent->GetParent();
}
int lMenuX = location.m_x;
int lMenuY = location.m_y - lFullMenuDisplayHeight;
int lMenuWidth = lpParentMenu->GetBiggestWidth()+ (lpParentMenu->GetMenuItemSpacer() * 2);
if(lEvent.GetX() > lMenuX && lEvent.GetX() <= lMenuX+lMenuWidth && lEvent.GetY() > lMenuY && lEvent.GetY() <= lMenuY+lFullMenuDisplayHeight)
{
// Close the menu, since we have clicked this menu item
lpParentMenu->CloseMenu();
SetHover(false);
SetSelected(false);
// Signal that we have pressed this menu item
MenuItemPressed();
}
}
FocusManager::GetInstance()->SetFocusOwner(0);
OnMouseReleased();
}
示例2: MouseEntered
void MenuItem::MouseEntered(const MouseEvent& lEvent)
{
if(!IsParentMenuOpen())
{
return;
}
Menu* lpParentMenu = (Menu* )GetParent();
// Make sure that we are inside the bounds of the parent menu
if(lpParentMenu->GetPullDownMenuParent() != NULL)
{
int lTextHeight = m_pRenderer->GetFreeTypeTextHeight(lpParentMenu->GetPullDownMenuParent()->GetGUIFont(), "%s", lpParentMenu->GetMenuTitle().c_str());
int lMenuHeight = lTextHeight + (lpParentMenu->GetMenuItemSpacer() * 2);
int lFullMenuDisplayHeight = lpParentMenu->GetPullDownMenuParent()->GetMaxNumItemsDisplayed() * lMenuHeight;
Point location = lpParentMenu->GetPullDownMenuParent()->GetLocation();
for(Component* parent = lpParentMenu->GetPullDownMenuParent()->GetParent(); parent != 0;)
{
Point parentLocation = parent->GetLocation();
location.m_x += parentLocation.m_x;
location.m_y += parentLocation.m_y;
parent = parent->GetParent();
}
int lMenuX = location.m_x;
int lMenuY = location.m_y - lFullMenuDisplayHeight;
int lMenuWidth = lpParentMenu->GetBiggestWidth()+ (lpParentMenu->GetMenuItemSpacer() * 2);
if(lEvent.GetX() > lMenuX && lEvent.GetX() <= lMenuX+lMenuWidth && lEvent.GetY() > lMenuY && lEvent.GetY() <= lMenuY+lFullMenuDisplayHeight)
{
SetHover(true);
OnMouseEnter();
}
}
}