void QColorTabWidget::paintEvent(QPaintEvent *)
{
    QPainter p(this);

    p.save();

    p.setRenderHint(QPainter::Antialiasing);

    QRect rcBody(0, 0, width()-1, height()-1);
    rcBody.adjust( 1, 1, -1, -1 );

    drawTabs(p, rcBody);

    p.restore();
}
Exemplo n.º 2
0
void TabContainer::draw(const Font & font, const Graphics::Bitmap & work){
    const int tabHeight = font.getHeight();
    const int height = location.getHeight() - tabHeight+1;
    
    // Draw tabs
    drawTabs(font, Graphics::Bitmap(work, location.getX(), location.getY(), location.getWidth(), tabHeight+1));
    
    // Draw body
    Graphics::Bitmap area(work, location.getX(), location.getY() + tabHeight+1, location.getWidth(), height);
    drawBox(transforms.getRadius(), 0, -(tabHeight+1), location.getWidth(), height, colors, area);
    
    // Draw body content
    const int modifier = (area.getWidth() * (transforms.getRadius()*.001)) == 0 ? 2 : area.getWidth() * (transforms.getRadius()*.001);
    body.drawStretched(modifier, modifier, area.getWidth() - modifier*2, area.getHeight() - modifier*2, area);
}
Exemplo n.º 3
0
    /*--------------------------------------------------------------------------------
        Function    : MenuScreen::drawFolders
        Description : draws tabbed folders in a MenuScreen
        Inputs      : two ints representing the coodinates of the topleft of the
                      folder area, the dimensions of the game window, and a vector
                      of the characters to put in the tabs.
        Outputs     : None
        Return      : Point representing the topleft corner of the writable area
    --------------------------------------------------------------------------------*/
    Point MenuScreen::drawFolders(int& x, int& y, const Point& dim, 
                                  const vector< pair<int, TCODColor> >& tabChars) 
    {
        const int xstart = x;
        const int ystart = y;
        const int width = dim.X();
        const int height = dim.Y();
        const int NUMTABS = static_cast<int>(tabChars.size());
        drawTabs(x,y, tabChars);
        
        // draw the top of the folder, leaving the current tab open at the bottom
        for(; x<TABWIDTH*NUMTABS; ++x)
        {
            // if this is the selected tab
            if(x/TABWIDTH == selectedTab)
            {
                // if this is the left border
                if(x % TABWIDTH == 0) 
                {
                    if(selectedTab == 0) 
                        screen.setChar(x,y, TCOD_CHAR_VLINE);
                    else 
                        screen.setChar(x,y, TCOD_CHAR_SE);
                }
                // else if this is the right tab border
                else if(x % TABWIDTH == TABWIDTH-1) 
                {
                    if(selectedTab == NUMTABS) 
                        screen.setChar(x,y, TCOD_CHAR_VLINE);
                    else 
                        screen.setChar(x,y, TCOD_CHAR_SW);
                }
            }
            else
            {
                // if this is the left border
                if(x % TABWIDTH == 0) 
                {
                    if(x == xstart) 
                        screen.setChar(x,y, TCOD_CHAR_TEEE);
                    else 
                        screen.setChar(x,y, TCOD_CHAR_TEEN);
                }
                // else if this is the right tab border
                else if(x % TABWIDTH == TABWIDTH-1)
                {
                    screen.setChar(x,y, TCOD_CHAR_TEEN);
                }
                else screen.setChar(x,y, TCOD_CHAR_HLINE);
            }
        }

        // draw the rest of the top line
        for(; x<width-1; ++x) 
        {
            screen.setChar(x,y, TCOD_CHAR_HLINE);
        }
        screen.setChar(x,y++, TCOD_CHAR_NE); 
        x=xstart;

        // draw the rest of the folder box
        for(; y<height-1; ++y)
        {
            screen.setChar(xstart,y, TCOD_CHAR_VLINE);
            screen.setChar(width-1,y, TCOD_CHAR_VLINE);
        }

        screen.setChar(xstart,y, TCOD_CHAR_SW);
        screen.setChar(width-1,y, TCOD_CHAR_SE);

        for(x=xstart+1; x<width-1; ++x) 
        {
            screen.setChar(x,y, TCOD_CHAR_HLINE);
        }

        return Point(xstart+1, ystart+TABHEIGHT);
    }