예제 #1
0
    void ScrollArea::draw(Graphics *graphics)
    {
        drawBackground(graphics);

        if (mVBarVisible)
        {
            drawUpButton(graphics);
            drawDownButton(graphics);
            drawVBar(graphics);
            drawVMarker(graphics);
        }

        if (mHBarVisible)
        {
            drawLeftButton(graphics);
            drawRightButton(graphics);
            drawHBar(graphics);
            drawHMarker(graphics);
        }

        if (mHBarVisible && mVBarVisible)
        {
            graphics->setColor(getBaseColor());
            graphics->fillRectangle(Rectangle(getWidth() - mScrollbarWidth,
                                              getHeight() - mScrollbarWidth,
                                              mScrollbarWidth,
                                              mScrollbarWidth));
        }

        drawChildren(graphics);
    }
예제 #2
0
    void ScrollArea::draw(Graphics *graphics)
    {
        graphics->setColor(getBackgroundColor());
        graphics->fillRectangle(getContentDimension());
      
        int alpha = getBaseColor().a;
        Color highlightColor = getBaseColor() + 0x303030;
        highlightColor.a = alpha;    
        Color shadowColor = getBaseColor() - 0x303030;      
        shadowColor.a = alpha;
      
        if (mVBarVisible)
        {
            drawUpButton(graphics);
            drawDownButton(graphics);
            drawVBar(graphics);
            drawVMarker(graphics);
        }
      
        if (mHBarVisible)
        {
            drawLeftButton(graphics);
            drawRightButton(graphics);
            drawHBar(graphics);
            drawHMarker(graphics);
        }
      
        if (mHBarVisible && mVBarVisible)
        {
            graphics->setColor(getBaseColor());
            graphics->fillRectangle(Rectangle(getWidth() - mScrollbarWidth,
                                              getHeight() - mScrollbarWidth,
                                              mScrollbarWidth,
                                              mScrollbarWidth));
        }

        if (mContent)
        {
            Rectangle contdim = mContent->getDimension();        
            graphics->pushClipArea(getContentDimension());

            if (mContent->getBorderSize() > 0)
            {
                Rectangle rec = mContent->getDimension();
                rec.x -= mContent->getBorderSize();
                rec.y -= mContent->getBorderSize();
                rec.width += 2 * mContent->getBorderSize();
                rec.height += 2 * mContent->getBorderSize();                    
                graphics->pushClipArea(rec);
                mContent->drawBorder(graphics);
                graphics->popClipArea();
            }
                
            graphics->pushClipArea(contdim);
            mContent->draw(graphics);
            graphics->popClipArea();
            graphics->popClipArea();
        }
    }