コード例 #1
0
ファイル: stdrend.cpp プロジェクト: czxxjtu/wxPython-1
void wxStdRenderer::DrawStaticBorder(wxDC& dc, wxRect *rect)
{
    DrawShadedRect(dc, rect, m_penDarkGrey, m_penHighlight);
}
コード例 #2
0
//---------------------------------------------------------------------------
void wxPagedWindow::DrawDecorations( wxDC& dc )
{
    // FIXME:: the is big body have to be split!

    int width, height;
    GetClientSize( &width, &height );

    int curX = mHorizGap;
    int curY = mVertGap;

    int xSize = width  - mHorizGap*2;
    int ySize = height - mVertGap*2;

    DrawShadedRect( curX, curY, xSize, ySize,
        mDarkPen, mWhitePen, dc );

    DrawShadedRect( curX+1, curY+1, xSize-2, ySize-2,
        mBlackPen, mGrayPen, dc );

    // draw inactive tab title bars frist (left-to-right)

    wxObjectList::compatibility_iterator pNode = mTabs.GetFirst();
    size_t  tabNo = 0;

    /* OLD STUFF::
    curX = mTitleRowStart;
    curY = height - mVertGap - BORDER_SZ - mTitleHeight;
    */

    curX = mTabTrianGap;
    curY = 0;

    // FOR NOW:: avoid creating bitmap with invalid dimensions

    if ( mTitleRowLen < 1 || mTitleHeight < 1 )
        return;

    wxMemoryDC tmpDc;
    wxBitmap   tmpBmp( mTitleRowLen, mTitleHeight );

    tmpDc.SelectObject( tmpBmp );
    tmpDc.SetPen( mGrayPen );
    tmpDc.SetBrush( mGrayBrush );
    tmpDc.DrawRectangle( 0,0, mTitleRowLen, mTitleHeight );

    tmpDc.SetDeviceOrigin( mCurentRowOfs, 0 );

    while( pNode )
    {
        twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));

        if ( tabNo != mActiveTab )
            DrawPaperBar( tab, curX, curY, mGrayBrush, mBlackPen, tmpDc );

        curX += tab.mDims.x;

        pNode = pNode->GetNext();
        ++tabNo;
    }

    // finally, draw the active tab (white-filled)

    pNode = mTabs.GetFirst();
    tabNo = 0;

    curX = mTabTrianGap;

    while( pNode )
    {
        twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));

        if ( tabNo == mActiveTab )
        {
            DrawPaperBar( tab, curX, curY, mWhiteBrush, mBlackPen, tmpDc );

            tmpDc.SetPen( mWhitePen );

            tmpDc.DrawLine( curX - mTabTrianGap+1, curY,
                curX + tab.mDims.x + mTabTrianGap, curY );
            break;
        }
        curX += tab.mDims.x;

        pNode = pNode->GetNext();
        ++tabNo;
    }

    // back to initial device origin

    tmpDc.SetDeviceOrigin( 0, 0 );

    // draw resize-hint-stick

    curX = mTitleRowLen - 6;

    DrawShadedRect( curX+0, 0+0, 6,   mTitleHeight,   mGrayPen,  mBlackPen, tmpDc );
    DrawShadedRect( curX+1, 0+1, 6-2, mTitleHeight-2, mWhitePen, mDarkPen,  tmpDc );
    DrawShadedRect( curX+2, 0+2, 6-4, mTitleHeight-4, mGrayPen,  mGrayPen,  tmpDc );



    dc.Blit( mTitleRowStart,
        height - mVertGap - BORDER_SZ - mTitleHeight,
        mTitleRowLen, mTitleHeight,
        &tmpDc, 0,0, wxCOPY );
}  // wxPagedWindow::DrawDecorations()
コード例 #3
0
ファイル: stdrend.cpp プロジェクト: czxxjtu/wxPython-1
void wxStdRenderer::DrawAntiSunkenBorder(wxDC& dc, wxRect *rect)
{
    DrawShadedRect(dc, rect, m_penLightGrey, m_penBlack);
    DrawShadedRect(dc, rect, m_penHighlight, m_penDarkGrey);
}
コード例 #4
0
//---------------------------------------------------------------------------
void wxTabbedWindow::DrawDecorations( wxDC& dc )
{
    // Protability NOTE::: DrawLine(..) draws a line from the first position,
    //                     but not including the point specified by last position.
    //                     This way Windows draws lines, not sure how Motif and Gtk
    //                     prots behave...

    int width, height;
    GetClientSize( &width, &height );

    // check if there's at least a bit of space to draw things

    if ( width  < mHorizGap*2 + BORDER_SZ*2+1 ||
        height < mVertGap*2  + BORDER_SZ*2+1 + mTitleHeight
        )
        return;

    // step #1 - draw border around the tab content area

    // setup position for kind of "pencil"
    int curX = mHorizGap;
    int curY = mVertGap;

    int xSize = width  - mHorizGap*2;
    int ySize = height - mVertGap *2  - mTitleHeight;

    // layer 1 (upper white)
    DrawShadedRect( curX+0, curY+0, xSize-0, ySize-0,
        mWhitePen, mBlackPen, dc  );

    // layer 2 (upper gray)
    DrawShadedRect( curX+1, curY+1, xSize-2-1, ySize-2-1,
        mGrayPen, mGrayPen, dc  );

    // layer 3 (upper darkGray)
    DrawShadedRect( curX+2, curY+2, xSize-3-2, ySize-3-2,
        mDarkPen, mWhitePen, dc  );

    // layer 4 (upper black)
    DrawShadedRect( curX+3, curY+3, xSize-4-3, ySize-4-3,
        mBlackPen, mGrayPen, dc  );

    // add non-siemtric layer from the lower-right side (confroming to MFC-look)

    dc.SetPen( mDarkPen );
    dc.DrawLine( curX+1, curY + ySize - 2, curX + xSize - 1, curY + ySize - 2 );   // horiz
    dc.DrawLine( curX + xSize - 2, curY + 1, curX + xSize - 2, curY + ySize - 2 ); // vert

    // step #2 - draw tab title bars

    curX = mFirstTitleGap;
    curY = height - mVertGap - mTitleHeight;

    size_t tabNo = 0;
    wxObjectList::compatibility_iterator pNode = mTabs.GetFirst();

    while( pNode )
    {
        // "hard-coded metafile" for decorations

        twTabInfo& tab = *((twTabInfo*)(pNode->GetData()));

        xSize = tab.mDims.x;
        ySize = mTitleHeight;

        if ( tabNo == mActiveTab )
        {
            dc.SetPen( mGrayPen );
            dc.DrawLine( curX+1, curY-2, curX+xSize-2, curY-2 );
            dc.DrawLine( curX+1, curY-1, curX+xSize-2, curY-1 );
        }

        dc.SetPen( mWhitePen );

        if ( tabNo == mActiveTab )
            dc.DrawLine( curX, curY-2, curX, curY+ySize-2 );
        else
            dc.DrawLine( curX, curY, curX, curY+ySize-2 );

        dc.SetPen( mDarkPen );
        dc.DrawLine( curX+1, curY+ySize-3, curX+1, curY+ySize-1 ); // to pix down
        dc.DrawLine( curX+2, curY+ySize-2, curX+xSize-2, curY+ySize-2 );
        dc.DrawLine( curX+xSize-3, curY+ySize-3, curX+xSize-2, curY+ySize-3 );
        if ( tabNo == mActiveTab )
            dc.DrawLine( curX+xSize-2, curY+ySize-3, curX+xSize-2, curY-3 );
        else
            dc.DrawLine( curX+xSize-2, curY+ySize-3, curX+xSize-2, curY-1 );

        dc.SetPen( mBlackPen );
        dc.DrawLine( curX+xSize-1, curY, curX+xSize-1, curY+ySize-2 );
        dc.DrawLine( curX+xSize-2, curY+ySize-2, curX+xSize-3, curY+ySize-2 );
        dc.DrawLine( curX+xSize-3, curY+ySize-1, curX+1, curY+ySize-1 );

        pNode = pNode->GetNext();
        ++tabNo;

        // darw image and (or without) text centered within the
        // title bar rectangle

        if ( mLayoutType != wxTITLE_BORDER_ONLY && tab.HasImg() )
        {
            wxMemoryDC tmpDc;
            tmpDc.SelectObject( tab.GetImg() );

            dc.Blit( curX + mTitleHorizGap,
                curY + ( ySize - tab.ImgHeight() ) / 2,
                tab.ImgWidth(),
                tab.ImgHeight(),
                &tmpDc, 0, 0, wxCOPY
                );
        }

        if ( mLayoutType == wxTITLE_IMG_AND_TEXT && tab.HasText() )
        {
            long x,w,h;

            // set select default font of the window into it's device context
            //dc.SetFont( GetLabelingFont() );

            dc.SetTextBackground( GetBackgroundColour() );

            dc.GetTextExtent(tab.mText, &w, &h );

            x = curX + mTitleHorizGap +
                tab.ImgWidth() + tab.ImageToTxtGap(mImageTextGap);

            dc.DrawText( tab.GetText(), x, curY + ( ySize - h ) / 2 );
        }
        curX += xSize;

    } // end of `while (pNode)'
}  // wxTabbedWindow::DrawDecorations()