Ejemplo n.º 1
0
void PageBoundary::drawClipped (
    Canvas* c, Coord l, Coord b, Coord r, Coord t, Graphic* gs
) {
    Coord x0, y0, x1, y1, x2, y2;
    BoxObj clipBox(l, b, r, t);
    
    transform(0, 0, x0, y0, gs);
    transform(border, pageheight, x1, y1, gs);
    transform(pagewidth, border, x2, y2, gs);

    BoxObj lbox(x0, y0, x1, y1);
    BoxObj bbox(x0, y0, x2, y2);
    
    transform(pagewidth - border, 0, x0, y0, gs);
    transform(0, pageheight - border, x1, y1, gs);
    transform(pagewidth, pageheight, x2, y2, gs);

    BoxObj rbox(x0, y0, x2, y2);
    BoxObj tbox(x1, y1, x2, y2);

    update(gs);
    if (lbox.Intersects(clipBox)) {
	pFillRect(c, 0, 0, border, pageheight);
    }
    if (bbox.Intersects(clipBox)) {
	pFillRect(c, 0, 0, pagewidth, border);
    }
    if (rbox.Intersects(clipBox)) {
	pFillRect(c, pagewidth - border, 0, pagewidth, pageheight);
    }
    if (tbox.Intersects(clipBox)) {
	pFillRect(c, 0, pageheight - border, pagewidth, pageheight);
    }
}
Ejemplo n.º 2
0
void Fl_RShadow_Box::draw(
    int x, int y, int w, int h, Fl_Color color, Fl_Flags f) const
{
    w -= 3;
    h -= 3;
    // draw shadow:
    rbox(x+3, y+3, w, h, FL_DARK3, FL_DARK3);
    // draw the box:
    fl_rounded_box.draw(x, y, w, h, color, f);
}
Ejemplo n.º 3
0
void uwHexCtrl::OnPaint(wxPaintEvent& event)
{
    // Setup DC
    wxBufferedPaintDC dc(this);
    PrepareDC(dc);
    dc.BeginDrawing();
    dc.SetFont(Font);
    dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));

    // Get native renderer
    wxRendererNative& renderer = wxRendererNative::Get();

    // Get client rectangle
    wxRect rectClient(wxPoint(0,0), GetClientSize());
    wxRect rectUnscrolled(rectClient);
    CalcUnscrolledPosition(rectClient.x, rectClient.y, &rectUnscrolled.x, &rectUnscrolled.y);


    // Paint headers background
    wxRect columnRect(rectClient);
    columnRect.y = 0;
    columnRect.height = ColumnHeight+1;
    CalcUnscrolledPosition(columnRect.x, columnRect.y, &columnRect.x, &columnRect.y);
    PaintRectangle( dc, wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), columnRect );


    // Paint items background
    wxRect windowRect(rectClient);
    windowRect.y = columnRect.height;
    windowRect.height -= windowRect.y;
    CalcUnscrolledPosition(windowRect.x, windowRect.y, &windowRect.x, &windowRect.y);
    PaintRectangle( dc, GetBackgroundColour(), windowRect );


    // return if no columns
    if( Columns.empty() )
        return;

    // Ignore first event, client size is equal virtual size
    if( ++PaintCount == 1 )
        return;

    // Paint headers
    for( dword column=0; column!=Columns.size(); ++column )
    {
        wxRect rbox(Columns.at(column).BoxRect);
        wxRect rtext(Columns.at(column).TextRect);
        CalcUnscrolledPosition(rbox.x-rectUnscrolled.x, rbox.y, &rbox.x, &rbox.y);
        CalcUnscrolledPosition(rtext.x-rectUnscrolled.x, rtext.y, &rtext.x, &rtext.y);
        renderer.DrawHeaderButton( this, dc, rbox, 0 );
        dc.DrawText( Columns.at(column).Caption, rtext.x, rtext.y );
    }

    // Paint header filler
    wxCoord cwidth = Columns.back().BoxRect.x + Columns.back().BoxRect.width-rectUnscrolled.x;
    wxRect rbox( cwidth, 0, rectClient.width-cwidth-1, ColumnHeight );
    if( rbox.width > 0 )
    {
        CalcUnscrolledPosition(rbox.x, rbox.y, &rbox.x, &rbox.y);
        renderer.DrawHeaderButton( this, dc, rbox, 0 );
    }


    // Get potential line numbers
    size_t lineFrom = (rectUnscrolled.y+ColumnHeight) / ItemHeight;
    size_t lineTo = (rectUnscrolled.GetBottom()) / ItemHeight;

    // Cap line numbers
    if( lineTo > HexLines - 1)
        lineTo = HexLines - 1;

    // Get first item pos
    wxCoord y = ColumnHeight + (lineFrom * ItemHeight) + ItemMarginY;
    wxCoord x = 0;

    for( size_t line = lineFrom; line <= lineTo; ++line )
    {
        //wxCoord yPhys;
        //CalcScrolledPosition(0, y, NULL, &yPhys);
        //wxLogMessage("[%d] lineFrom=%d lineTo=%d y=%d yPhys=%d upd=%d,%d uns=%d,%d"
        //    ,line,lineFrom,lineTo,y,yPhys,rectClient.y,rectClient.height,rectUnscrolled.y,rectUnscrolled.height);

        for( dword column=0; column!=Columns.size(); ++column )
        {
            const uwHexCtrlColumn& it = Columns.at(column);

            if( column == 0 )
            {
                dword pos = (line * HexWidth) + DataOffset;
                wxString item = wxString::Format( FmtOffset, pos );
                dc.DrawText( item, it.BoxRect.x+ColumnMarginX, y );
            }
            else if ( column == 1 )
            {
                dword pos = (line * HexWidth);
                wxString item = wxString::Format( FmtOffset, pos );
                dc.DrawText( item, it.BoxRect.x+ColumnMarginX, y );
            }
            else if( column >= ColHexBegin && column < ColHexEnd )
            {
                dword pos = (line * HexWidth) + (column - ColHexBegin);
                if( pos < DataCache.size() )
                {
                    if( HighlightBegin != -1 && pos >= HighlightBegin && pos < HighlightEnd )
                    {
                        wxRect hlrect = it.BoxRect;
                        hlrect.y = y;
                        PaintRectangle( dc, wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW), hlrect );
                        dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
                        dc.DrawText( HexStrings.at(DataCache.at(pos)), it.BoxRect.x+ColumnMarginX, y );
                        dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
                    }
                    else
                    {
                        dc.DrawText( HexStrings.at(DataCache.at(pos)), it.BoxRect.x+ColumnMarginX, y );
                    }

                }
            }
            else if( column >= ColAsciiBegin && column < ColAsciiEnd )
            {
                dword pos = (line * HexWidth) + column - ColAsciiBegin;
                if( pos < DataCache.size() )
                {
                    if( HighlightBegin != -1 && pos >= HighlightBegin && pos < HighlightEnd )
                    {
                        wxRect hlrect = it.BoxRect;
                        hlrect.y = y;
                        PaintRectangle( dc, wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW), hlrect );
                        dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
                        dc.DrawText( AsciiStrings.at(DataCache.at(pos)), it.BoxRect.x+ColumnMarginX, y );
                        dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
                    }
                    else
                    {
                        dc.DrawText( AsciiStrings.at(DataCache.at(pos)), it.BoxRect.x+ColumnMarginX, y );
                    }
                }
            }
        }
      
        y += HexCharHeight + ItemMarginY + ItemMarginY;
    }

    dc.EndDrawing();
}
Ejemplo n.º 4
0
void Fl_Rounded_Box::draw(
    int x, int y, int w, int h, Fl_Color color, Fl_Flags f) const
{
    rbox(x, y, w, h, color, fl_inactive(FL_BLACK,f));
}
Ejemplo n.º 5
0
void Fl_RFlat_Box::draw(
    int x, int y, int w, int h, Fl_Color color, Fl_Flags) const
{
    rbox(x, y, w, h, color, color);
}