[Previous] [Contents] [Index] [Next]

PpPrintWidget()

Print a widget

Synopsis:

void PpPrintWidget( PpPrintContext_t *pc, 
                    PtWidget_t *widget,
                    PhPoint_t const *trans, 
                    PhRect_t const *clip_rect, 
                    ulong_t opt );

Description:

This function prints the specified widget using the provided print context. The arguments are:

pc
A print context obtained via PpPrintCreatePC() and initialized via PpPrintSetPC() and PpPrintOpen().
widget
The widget to be printed. This widget doesn't need to be realized to be printed and won't be clipped by its parent while printing.
trans
If non-NULL, the amount to translate the widget by when drawing it into the print context. Passing a trans equal to the position of the widget makes the widget print at 0,0 on the printed output.
clip_rect
If non-NULL, the rectangle to be clipped to.
Note: This isn't implemented yet; set clip_rect to NULL.

opt
A value that indicates any special resizing to be done:

Note: Be sure to call PtFlush() after calling PpPrintWidget().

Examples:

    
#include <Ph.h>
#include <Pt.h>
    
main()
    {
    int n;
    PhArea_t area, sev_area = {0,0,400,400};
    PpPrintContext_t *pc;

    PtInit( NULL );
    pc = PpPrintCreatePC();
    PpPrintOpen( pc );
        
    PtSetArg( &args[0], Pt_ARG_AREA, &sev_area, 0 );
    PtRealizeWidget( 
        PtCreateWidget( PtWindow, NULL, 1, args ) );

    n = 0;
    PtSetArg( &args[n++], Pt_ARG_AREA, &sev_area, 0 );
    PtSetArg( &args[n++], Pt_ARG_FILL_COLOR, Pg_BLUE, 0);
    button = PtCreateWidget( PtButton, NULL, n, args );
    PpPrintStart( pc );
    PtWidgetArea( button, &area);
    PpPrintWidget( pc, button, 
                   &area.pos, 
                   NULL,
                   Pt_PP_RESIZE_PC );
    PtFlush();
    PpPrintStop( pc );

    PtMainLoop();
    }

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PpPrintClose(), PpPrintCreatePC(), PpPrintGetPC(), PpPrintNewPage(), PpPrintOpen(), PpPrintReleasePC(), PpPrintSetPC(), PpPrintStart(), PpPrintStop()

Printing in the Programmer's Guide


[Previous] [Contents] [Index] [Next]