本文整理汇总了C++中TabButton::getPixelSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TabButton::getPixelSize方法的具体用法?C++ TabButton::getPixelSize怎么用?C++ TabButton::getPixelSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TabButton
的用法示例。
在下文中一共展示了TabButton::getPixelSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateTabButtonSizePosition
/*************************************************************************
Calculate size and position for a tab button
*************************************************************************/
void TabControl::calculateTabButtonSizePosition(size_t index)
{
TabButton* btn = d_tabButtonVector [index];
// relative height is always 1.0 for buttons since they are embedded in a
// panel of the correct height already
btn->setHeight(cegui_reldim(1.0f));
btn->setYPosition(cegui_absdim(0.0f));
// x position is based on previous button
if (!index)
// First button
btn->setXPosition(cegui_absdim(d_firstTabOffset));
else
{
Window* prevButton = d_tabButtonVector [index - 1];
// position is prev pos + width
btn->setXPosition(prevButton->getArea().d_max.d_x);
}
// Width is based on font size (expressed as absolute)
Font* fnt = btn->getFont();
btn->setWidth(cegui_absdim(fnt->getTextExtent(btn->getText())) +
getTabTextPadding() + getTabTextPadding());
float left_x = btn->getXPosition ().d_offset;
btn->setVisible ((left_x < getPixelSize ().d_width) &&
(left_x + btn->getPixelSize ().d_width > 0));
btn->invalidate();
}
示例2: makeTabVisible_impl
/*************************************************************************
Make tab visible implementation
*************************************************************************/
void TabControl::makeTabVisible_impl(Window* wnd)
{
TabButton *tb = 0;
for (size_t i = 0; i < d_tabButtonVector.size (); ++i)
{
// get corresponding tab button and content window
tb = d_tabButtonVector [i];
Window* child = tb->getTargetWindow();
if (child == wnd)
break;
tb = 0;
}
if (!tb)
return;
float ww = getPixelSize ().d_width;
float x = tb->getXPosition().asAbsolute (ww);
float w = tb->getPixelSize ().d_width;
float lx = 0, rx = ww;
Window *scrollLeftBtn = 0, *scrollRightBtn = 0;
String name = getName() + ButtonScrollLeftSuffix;
if (WindowManager::getSingleton().isWindowPresent (name))
{
scrollLeftBtn = WindowManager::getSingleton().getWindow (name);
lx = scrollLeftBtn->getArea ().d_max.d_x.asAbsolute (ww);
scrollLeftBtn->setWantsMultiClickEvents (false);
}
name = getName() + ButtonScrollRightSuffix;
if (WindowManager::getSingleton().isWindowPresent (name))
{
scrollRightBtn = WindowManager::getSingleton().getWindow (name);
rx = scrollRightBtn->getXPosition ().asAbsolute (ww);
scrollRightBtn->setWantsMultiClickEvents (false);
}
if (x < lx)
d_firstTabOffset += lx - x;
else
{
if (x + w <= rx)
return; // nothing to do
d_firstTabOffset += rx - (x + w);
}
performChildWindowLayout ();
}