本文整理汇总了C++中Menu::ForceCalculateWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ Menu::ForceCalculateWidth方法的具体用法?C++ Menu::ForceCalculateWidth怎么用?C++ Menu::ForceCalculateWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::ForceCalculateWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ArmItem
//-----------------------------------------------------------------------------
// Purpose: Highlight a menu item
// Menu item buttons highlight if disabled, but won't activate.
//-----------------------------------------------------------------------------
void MenuItem::ArmItem()
{
// close all other menus
GetParentMenu()->CloseOtherMenus(this);
// arm the menuItem.
Button::SetArmed(true);
// When you have a submenu with no scroll bar the menu
// border will not be drawn correctly. This fixes it.
Menu *parent = GetParentMenu();
if ( parent )
{
parent->ForceCalculateWidth();
}
Repaint();
}
示例2: DisarmItem
//-----------------------------------------------------------------------------
// Purpose: Unhighlight a menu item
//-----------------------------------------------------------------------------
void MenuItem::DisarmItem()
{
// normal behaviour is that the button becomes unarmed
// do not unarm if there is a cascading menu. CloseCascadeMenu handles this.
// and the menu handles it since we close at different times depending
// on whether menu is handling mouse or key events.
if (!m_pCascadeMenu)
{
Button::OnCursorExited();
}
// When you have a submenu with no scroll bar the menu
// border will not be drawn correctly. This fixes it.
Menu *parent = GetParentMenu();
if ( parent )
{
parent->ForceCalculateWidth();
}
Repaint();
}
示例3: ApplySchemeSettings
//-----------------------------------------------------------------------------
// Purpose: Apply the resource scheme to the menu.
//-----------------------------------------------------------------------------
void MenuItem::ApplySchemeSettings(IScheme *pScheme)
{
// chain back first
Button::ApplySchemeSettings(pScheme);
// get color settings
SetDefaultColor(GetSchemeColor("Menu.TextColor", GetFgColor(), pScheme), GetSchemeColor("Menu.BgColor", GetBgColor(), pScheme));
SetArmedColor(GetSchemeColor("Menu.ArmedTextColor", GetFgColor(), pScheme), GetSchemeColor("Menu.ArmedBgColor", GetBgColor(), pScheme));
SetDepressedColor(GetSchemeColor("Menu.ArmedTextColor", GetFgColor(), pScheme), GetSchemeColor("Menu.ArmedBgColor", GetBgColor(), pScheme));
SetTextInset(atoi(pScheme->GetResourceString("Menu.TextInset")), 0);
// reload images since applyschemesettings in label wipes them out.
if ( m_pCascadeArrow )
{
m_pCascadeArrow->SetFont(pScheme->GetFont("Marlett", IsProportional() ));
m_pCascadeArrow->ResizeImageToContent();
AddImage(m_pCascadeArrow, 0);
}
else if (m_bCheckable)
{
( static_cast<MenuItemCheckImage *>(m_pCheck) )->SetFont( pScheme->GetFont("Marlett", IsProportional()));
SetImageAtIndex(0, m_pCheck, CHECK_INSET);
( static_cast<MenuItemCheckImage *>(m_pCheck) )->ResizeImageToContent();
}
if ( m_pCurrentKeyBinding )
{
m_pCurrentKeyBinding->SetFont(pScheme->GetFont("Default", IsProportional() ));
m_pCurrentKeyBinding->ResizeImageToContent();
}
// Have the menu redo the layout
// Get the parent to resize
Menu * parent = GetParentMenu();
if ( parent )
{
parent->ForceCalculateWidth();
}
}