예제 #1
0
    void DrawChildren(PaintInfo &pi)
    {
        const U32 DISPLAY_MASK = STATE_ACTIVE | STATE_VISIBLE;

        NList<IControl>::Iterator i(&children);

        // Draw children from lowest Z-pos to highest
        for (i.GoToTail(); *i; i--)
        {
            IControl *child = *i;

            if ((child->GetControlState() & DISPLAY_MASK) == DISPLAY_MASK)
            {
                PaintInfo p = child->GetPaintInfo();

                // Convert to screen coordinates before drawing
                Point<S32> origin = child->GetPos() + pi.client.p0;
                p.window += origin;
                p.client += origin;

                // Clamp rectangles to client area of listbox
                if (p.window.p1.x > pi.client.p1.x)
                {
                    p.window.p1.x = pi.client.p1.x;
                    p.client.p1.x = pi.client.p1.x;
                }

                // Apply global alpha scale
                p.alphaScale *= IFace::data.alphaScale;

                child->Draw(p);
            }
        }
    }