コード例 #1
0
    void ListboxWrappedTextItem::draw(RenderCache& cache,const Rect& targetRect,
        float zBase, float alpha, const Rect* clipper) const
    {
        if (d_selected && d_selectBrush != 0)
        {
            cache.cacheImage(*d_selectBrush, targetRect, zBase,
                getModulateAlphaColourRect(d_selectCols, alpha), clipper);
        }

        Font* font = const_cast<Font*>(getFont());

        if (font)
        {
            float left_offset = 0;
            if (d_draw_bullet)
            {
                left_offset = font->getTextExtent(ds_bullet);
            }

            Rect finalPos = targetRect;
            finalPos.d_top -= (font->getLineSpacing() - font->getBaseline()) * 0.5f;
            cache.cacheText(ds_bullet, font, d_textFormatting, finalPos, zBase,
                getModulateAlphaColourRect(d_textCols, alpha), clipper);
            finalPos.d_left += left_offset;
            cache.cacheText(d_itemText, font, d_textFormatting, finalPos, zBase,
                getModulateAlphaColourRect(d_textCols, alpha), clipper);
        }
    }
コード例 #2
0
void ListboxNumberItem::draw(RenderCache& cache,const Rect& targetRect, float zBase, float alpha, const Rect* clipper) const
{
    if (d_selected && d_selectBrush != 0)
    {
        cache.cacheImage(*d_selectBrush, targetRect, zBase, getModulateAlphaColourRect(d_selectCols, alpha), clipper);
    }

    const Font* font = getFont();

    if (font)
    {
        Rect finalPos(targetRect);
        finalPos.d_top -= (font->getLineSpacing() - font->getBaseline()) * 0.5f;
        cache.cacheText(d_itemText, font, LeftAligned, finalPos, zBase, getModulateAlphaColourRect(d_textCols, alpha), clipper);
    }
}
コード例 #3
0
void ListboxTextItem::draw(RenderCache& cache,const Rect& targetRect, float zBase, float alpha, const Rect* clipper) const
{
    if (d_selected && d_selectBrush != 0)
    {
        cache.cacheImage(*d_selectBrush, targetRect, zBase, getModulateAlphaColourRect(d_selectCols, alpha), clipper);
    }

    const FontBase* font = getFont();

    if (font)
    {
        Rect finalPos(targetRect);
		finalPos.d_top += PixelAligned( FontBase::LineSpace * 0.5f);
		cache.cacheText( getOwnerWindow(), d_itemText, font, d_horzFormateing, finalPos, zBase, getModulateAlphaColourRect(d_textCols, alpha), clipper);
    }
}