本文整理汇总了C++中ListboxItem::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ ListboxItem::draw方法的具体用法?C++ ListboxItem::draw怎么用?C++ ListboxItem::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListboxItem
的用法示例。
在下文中一共展示了ListboxItem::draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void FalagardListbox::render()
{
Listbox* lb = (Listbox*)d_window;
// render frame and stuff before we handle the items
cacheListboxBaseImagery();
//
// Render list items
//
Vector3 itemPos;
Size itemSize;
Rect itemClipper, itemRect;
float widest = lb->getWidestItemWidth();
// calculate position of area we have to render into
Rect itemsArea(getListRenderArea());
// set up some initial positional details for items
itemPos.d_x = itemsArea.d_left - lb->getHorzScrollbar()->getScrollPosition();
itemPos.d_y = itemsArea.d_top - lb->getVertScrollbar()->getScrollPosition();
itemPos.d_z = System::getSingleton().getRenderer()->getZLayer(3) - System::getSingleton().getRenderer()->getCurrentZ();
float alpha = lb->getEffectiveAlpha();
// loop through the items
size_t itemCount = lb->getItemCount();
for (size_t i = 0; i < itemCount; ++i)
{
ListboxItem* listItem = lb->getListboxItemFromIndex(i);
itemSize.d_height = listItem->getPixelSize().d_height;
// allow item to have full width of box if this is wider than items
itemSize.d_width = ceguimax(itemsArea.getWidth(), widest);
// calculate destination area for this item.
itemRect.d_left = itemPos.d_x;
itemRect.d_top = itemPos.d_y;
itemRect.setSize(itemSize);
itemClipper = itemRect.getIntersection(itemsArea);
// skip this item if totally clipped
if (itemClipper.getWidth() == 0)
{
itemPos.d_y += itemSize.d_height;
continue;
}
// draw this item
listItem->draw(lb->getRenderCache(), itemRect, itemPos.d_z, alpha, &itemClipper);
// update position ready for next item
itemPos.d_y += itemSize.d_height;
}
}
示例2: render
void FalagardMultiColumnList::render()
{
MultiColumnList* w = (MultiColumnList*)d_window;
const ListHeader* header = w->getListHeader();
const Scrollbar* vertScrollbar = w->getVertScrollbar();
const Scrollbar* horzScrollbar = w->getHorzScrollbar();
// render general stuff before we handle the items
cacheListboxBaseImagery();
//
// Render list items
//
Vector3f itemPos;
Sizef itemSize;
Rectf itemClipper, itemRect;
// calculate position of area we have to render into
Rectf itemsArea(getListRenderArea());
// set up initial positional details for items
itemPos.d_y = itemsArea.top() - vertScrollbar->getScrollPosition();
itemPos.d_z = 0.0f;
const float alpha = w->getEffectiveAlpha();
// loop through the items
for (uint i = 0; i < w->getRowCount(); ++i)
{
// set initial x position for this row.
itemPos.d_x = itemsArea.left() - horzScrollbar->getScrollPosition();
// calculate height for this row.
itemSize.d_height = w->getHighestRowItemHeight(i);
// loop through the columns in this row
for (uint j = 0; j < w->getColumnCount(); ++j)
{
// allow item to use full width of the column
itemSize.d_width = CoordConverter::asAbsolute(header->getColumnWidth(j), header->getPixelSize().d_width);
ListboxItem* item = w->getItemAtGridReference(MCLGridRef(i,j));
// is the item for this column set?
if (item)
{
// calculate destination area for this item.
itemRect.left(itemPos.d_x);
itemRect.top(itemPos.d_y);
itemRect.setSize(itemSize);
itemClipper = itemRect.getIntersection(itemsArea);
// skip this item if totally clipped
if (itemClipper.getWidth() == 0)
{
itemPos.d_x += itemSize.d_width;
continue;
}
// draw this item
item->draw(w->getGeometryBuffer(), itemRect, alpha, &itemClipper);
}
// update position for next column.
itemPos.d_x += itemSize.d_width;
}
// update position ready for next row
itemPos.d_y += itemSize.d_height;
}
}