本文整理汇总了C++中TabButton::SetMargin方法的典型用法代码示例。如果您正苦于以下问题:C++ TabButton::SetMargin方法的具体用法?C++ TabButton::SetMargin怎么用?C++ TabButton::SetMargin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TabButton
的用法示例。
在下文中一共展示了TabButton::SetMargin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Layout
void TabStrip::Layout( Skin::Base* skin )
{
Gwen::Point pLargestTab( 5, 5 );
int iNum = 0;
for ( Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter )
{
TabButton* pButton = gwen_cast<TabButton>(*iter);
if ( !pButton ) continue;
pButton->SizeToContents();
Margin m;
int iNotFirst = iNum > 0 ? -1 : 0;
if ( m_iDock == Pos::Top )
{
m.left = iNotFirst;
pButton->Dock( Pos::Left );
}
if ( m_iDock == Pos::Left )
{
m.top = iNotFirst;
pButton->Dock( Pos::Top );
}
if ( m_iDock == Pos::Right )
{
m.top = iNotFirst;
pButton->Dock( Pos::Top );
}
if ( m_iDock == Pos::Bottom )
{
m.left = iNotFirst;
pButton->Dock( Pos::Left );
}
pLargestTab.x = Utility::Max( pLargestTab.x, pButton->Width() );
pLargestTab.y = Utility::Max( pLargestTab.y, pButton->Height() );
pButton->SetMargin( m );
iNum++;
}
if ( m_iDock == Pos::Top || m_iDock == Pos::Bottom )
SetSize( Width(), pLargestTab.y );
if ( m_iDock == Pos::Left || m_iDock == Pos::Right )
SetSize( pLargestTab.x, Height() );
BaseClass::Layout( skin );
}
示例2: Layout
void TabStrip::Layout(Skin::Base* skin)
{
Gwen::Point pLargestTab(5, 5);
int iNum = 0;
for (Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter)
{
if (!*iter)
continue;
TabButton* pButton = (*iter)->DynamicCastTabButton();
if (!pButton) continue;
pButton->SizeToContents();
Margin m;
int iActive = pButton->IsActive() ? 0 : 2;
int iNotFirst = iNum > 0 ? -1 : 0;
int iControlOverhang = -3;
if (m_iDock == Pos::Top)
{
m.top = iActive;
m.left = iNotFirst;
m.bottom = iControlOverhang;
pButton->Dock(Pos::Left);
}
if (m_iDock == Pos::Left)
{
m.left = iActive * 2;
m.right = iControlOverhang;
m.top = iNotFirst;
pButton->Dock(Pos::Top);
}
if (m_iDock == Pos::Right)
{
m.right = iActive * 2;
m.left = iControlOverhang;
m.top = iNotFirst;
pButton->Dock(Pos::Top);
}
if (m_iDock == Pos::Bottom)
{
m.bottom = iActive;
m.left = iNotFirst;
m.top = iControlOverhang;
pButton->Dock(Pos::Left);
}
pLargestTab.x = Utility::Max(pLargestTab.x, pButton->Width());
pLargestTab.y = Utility::Max(pLargestTab.y, pButton->Height());
pButton->SetMargin(m);
iNum++;
}
if (m_iDock == Pos::Top || m_iDock == Pos::Bottom)
SetSize(Width(), pLargestTab.y);
if (m_iDock == Pos::Left || m_iDock == Pos::Right)
SetSize(pLargestTab.x, Height());
BaseClass::Layout(skin);
}