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);
        }
    }
/*************************************************************************
	Draw the list box item in its current state.
*************************************************************************/
void ListboxTextItem::draw(GeometryBuffer& buffer, const Rect& targetRect,
                           float alpha, const Rect* clipper) const
{
    if (d_selected && d_selectBrush != 0)
        d_selectBrush->draw(buffer, targetRect, clipper,
                            getModulateAlphaColourRect(d_selectCols, alpha));

    Font* font = getFont();

    if (!font)
        return;

    Vector2 draw_pos(targetRect.getPosition());

    draw_pos.d_y += PixelAligned(
        (font->getLineSpacing() - font->getFontHeight()) * 0.5f);

    if (!d_renderedStringValid)
        parseTextString();

    const ColourRect final_colours(
        getModulateAlphaColourRect(ColourRect(0xFFFFFFFF), alpha));

    for (size_t i = 0; i < d_renderedString.getLineCount(); ++i)
    {
        d_renderedString.draw(i, buffer, draw_pos, &final_colours, clipper, 0.0f);
        draw_pos.d_y += d_renderedString.getPixelSize(i).d_height;
    }
}
    /*************************************************************************
    Draw the list box item in its current state.
    *************************************************************************/
    void ListboxWrappedTextItem::draw(const Vector3& position, float alpha, const Rect& clipper) const
    {
        if (d_selected && (d_selectBrush != 0))
        {
            d_selectBrush->draw(clipper, position.d_z, clipper,
                getModulateAlphaColourRect(d_selectCols, alpha));
        }

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

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

            Vector3 finalPos = position;
            finalPos.d_y -= PixelAligned((font->getLineSpacing() - font->getBaseline()) * 0.5f);
            Rect draw_area = Rect(finalPos.d_x, finalPos.d_y,
                clipper.d_right, finalPos.d_y);
            font->drawText(ds_bullet, draw_area, finalPos.d_z, clipper, d_textFormatting,
                getModulateAlphaColourRect(d_textCols, alpha));
            draw_area.d_left += left_offset;
            font->drawText(d_itemText, draw_area, finalPos.d_z, clipper, d_textFormatting,
                getModulateAlphaColourRect(d_textCols, alpha));
        }

    }
예제 #4
0
//----------------------------------------------------------------------------//
void FormattedListboxTextItem::draw(GeometryBuffer& buffer,
                                    const Rect& targetRect,
                                    float alpha, const Rect* clipper) const
{
    // reparse text if we need to.
    if (!d_renderedStringValid)
        parseTextString();

    // create formatter if needed
    if (!d_formattedRenderedString)
        setupStringFormatter();

    // get size of render area from target window, to see if we need to reformat
    // NB: We do not use targetRect, since it may not represent the same area.
    const Size area_sz(static_cast<const Listbox*>(d_owner)->
        getListRenderArea().getSize());
    if (area_sz != d_formattingAreaSize)
    {
        d_formattedRenderedString->format(area_sz);
        d_formattingAreaSize = area_sz;
    }

    // draw selection imagery
    if (d_selected && d_selectBrush != 0)
        d_selectBrush->draw(buffer, targetRect, clipper,
                            getModulateAlphaColourRect(d_selectCols, alpha));

    // factor the window alpha into our colours.
    const ColourRect final_colours(
        getModulateAlphaColourRect(ColourRect(0xFFFFFFFF), alpha));

    // draw the formatted text
    d_formattedRenderedString->draw(buffer, targetRect.getPosition(),
                                    &final_colours, clipper);
}
예제 #5
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);
    }
}
예제 #6
0
/*************************************************************************
	Draw the list box item in its current state.
*************************************************************************/
void ListboxNumberItem::draw(const Vector3& position, float alpha, const Rect& clipper) const
{
	if (d_selected && (d_selectBrush != NULL))
	{
		d_selectBrush->draw(clipper, position.d_z, clipper, getModulateAlphaColourRect(d_selectCols, alpha));
	}

	const Font* fnt = getFont();

	if (fnt != NULL)
	{
        Vector3 finalPos(position);
        finalPos.d_y -= PixelAligned((fnt->getLineSpacing() - fnt->getBaseline()) * 0.5f);
		fnt->drawText(d_itemText, finalPos, clipper, getModulateAlphaColourRect(d_textCols, alpha));
	}

}
//----------------------------------------------------------------------------//
void FormattedListboxTextItem::draw(GeometryBuffer& buffer,
	const Rect& targetRect,
	float alpha, const Rect* clipper) const
{
	updateString();

	// draw selection imagery
	if (d_selected && d_selectBrush != 0)
		d_selectBrush->draw(buffer, targetRect, clipper,
		getModulateAlphaColourRect(d_selectCols, alpha));

	// factor the window alpha into our colours.
	const ColourRect final_colours(
		getModulateAlphaColourRect(ColourRect(0xFFFFFFFF), alpha));

	// draw the formatted text
	d_formattedRenderedString->draw(buffer, targetRect.getPosition(),
		&final_colours, clipper);
}
void ListboxImageItem::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);
    }

	if (d_image != NULL)
	{
		cache.cacheImage(*d_image, targetRect, zBase, ColourRect(colour(1,1,1,alpha)), clipper);
	}
}
/*************************************************************************
	Draw the list box item in its current state.
*************************************************************************/
void ListboxImageItem::draw(const Vector3& position, float alpha, const Rect& clipper) const
{
	if (d_selected && (d_selectBrush != NULL))
	{
		d_selectBrush->draw(clipper, position.d_z, clipper, getModulateAlphaColourRect(d_selectCols, alpha));
	}

	if (d_image != NULL)
	{
		d_image->draw(position, clipper);
	}
}
예제 #10
0
/*************************************************************************
    Draw the tree item in its current state.
*************************************************************************/
void TreeItem::draw(GeometryBuffer& buffer, const Rect &targetRect,
                    float alpha, const Rect *clipper) const
{
    Rect finalRect(targetRect);

    if (d_iconImage != 0)
    {
        Rect finalPos(finalRect);
        finalPos.setWidth(targetRect.getHeight());
        finalPos.setHeight(targetRect.getHeight());
        d_iconImage->draw(buffer, finalPos, clipper,
                          ColourRect(colour(1,1,1,alpha)));
        finalRect.d_left += targetRect.getHeight();
    }

    if (d_selected && d_selectBrush != 0)
        d_selectBrush->draw(buffer, finalRect, clipper,
                            getModulateAlphaColourRect(d_selectCols, alpha));

    Font* font = getFont();

    if (!font)
        return;

    Vector2 draw_pos(finalRect.getPosition());
    draw_pos.d_y -= (font->getLineSpacing() - font->getBaseline()) * 0.5f;

    if (!d_renderedStringValid)
        parseTextString();

    const ColourRect final_colours(
        getModulateAlphaColourRect(ColourRect(0xFFFFFFFF), alpha));

    for (size_t i = 0; i < d_renderedString.getLineCount(); ++i)
    {
        d_renderedString.draw(i, buffer, draw_pos, &final_colours, clipper, 0.0f);
        draw_pos.d_y += d_renderedString.getPixelSize(i).d_height;
    }
}
예제 #11
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);
    }
}