PtGenListDrawString()

Draw a string

Synopsis:

void PtGenListDrawString( PtWidget_t *list,
                          PtGenListItem_t const *item,
                          const char *string,
                          PhRect_t const *where,
                          int lmarg,
                          int rmarg );

Arguments:

list
A pointer to the list widget. This should be the same as that used in the list argument of the List Draw method.
item
A pointer to a PtGenListItem_t structure, which describes the item in the list widget you want to draw the string for.
string
The string to display. Any Tab characters in the string are interpreted as column separators.
where
A pointer to a PhRect_t structure (see the Photon Library Reference) that defines the rectangle in which the text is positioned. The x values for the rectangle should be the same as those used in the where argument of the List Draw method. The y values define the vertical position of the string to be drawn between the given values.
lmarg, rmarg
Define additional margins. The value of lmarg is added to the from value of the first column, and rmarg is subtracted from the to value of the last column. If the widget doesn't have columns, the width of the widget's canvas is used as a column.

Description:

This function can be used by a child class of PtGenList for drawing strings.

To determine the font and colors it uses to draw a string, PtGenListDrawString() calls the List Attributes method for the list widget.

Examples:

Here's an excerpt showing the List Draw method of a widget (taken from PtList):



static PtGenListDrawF_t list_draw;

static void list_draw(
                PtWidget_t *const widget, PtGenListItem_t *items,
                unsigned index, unsigned nitems, PhRect_t *where
                ) {
        const int item_height = items->size.h;

        PtGenListDrawBackground( widget, items, nitems, where, 0, 0, 0, 0 );

        do        {
                short bot;
                bot = where->ul.y + item_height;
                if ( items->flags & Pt_LIST_ITEM_DAMAGED ) {
                        where->lr.y = bot - 1;
                        PtGenListDrawString( widget, items, STRING(items),
                                             where, 0, 0 );
                        }
                where->ul.y = bot;
                items = items->next;
                }        while ( --nitems );
        }

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtGenList, PtGenListItem_t

PhRect_t in the Photon Library Reference