Warning:  main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pp/ppprintwidget.html on line 1
Warning:  main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pp/ppprintwidget.html on line 1
Warning:  main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pp/ppprintwidget.html on line 8
Warning:  main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pp/ppprintwidget.html on line 8
Print a widget
void PpPrintWidget( PpPrintContext_t *pc,
                    PtWidget_t *widget,
                    PhPoint_t const *trans,
                    PhRect_t const *clip_rect,
                    unsigned long resize );
- pc
 
- A print context obtained via
  PpCreatePC()
  and initialized via
  PpSetPC()
  and
  PpStartJob().
  
 
- 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, this argument points to a
    PhPoint_t
    structure that's used to set the print context's offsets.
    These offsets define the amounts by which to translate widgets
    when drawing them into the print context.
    
    Specifying a translation equal to the position of the widget
      makes the widget print at 0,0 on the printed output.
  
 
- clip_rect
  
 
- If non-NULL, a pointer to a
    PhRect_t
    structure that defines the rectangle to be clipped to.
      
  | 
      This isn't implemented yet; set clip_rect to
      NULL.
       | 
 
   
- resize
    
 
- A value that indicates any special resizing to be done:
      
- Pt_PP_RESIZE_WIDGET—set the dimension of the
          widget to match the drawable area of the destination page.
          The widget is resized to fit the page.
          
        
 
- Pt_PP_NO_RESIZE —don't modify the source
          size of the print context or the widget's dimensions.
          It's important to set the source size of the print context before
          calling PpPrintWidget() with this option.
          
        
 
- Pt_PP_RESIZE_PC — set the source size of the
          print context to the size of the widget,
          The result is scaled to fit the destination page, but the aspect
          ratio of the widget is preserved.
          
      
 
 
ph
This function prints the specified widget using
the provided print context.
The widget doesn't need to be realized in order to be printed.
#include <Ph.h>
#include <Pt.h>
int
main()
{
    int              n;
    int              do_preview_only = 1;
    PhArea_t         area, sev_area = {{ 0,0 },{400,400}};
    PpPrintContext_t *pc;
    PtArg_t          args[10];
    PtWidget_t       *window, *button;
    PhDim_t          dim = { 750, 1000 };
    PtInit( NULL );
    pc = PpCreatePC();
    /* Set override on print context to do preview mode only */
       PpSetPC( pc, Pp_PC_DO_PREVIEW, &do_preview_only, 0 );
    PpStartJob( pc );
    PtSetArg( &args[0], Pt_ARG_AREA, &sev_area, 0 );
    window = PtCreateWidget( PtWindow, Pt_NO_PARENT, 1, args );
    n = 0;
    PtSetArg( &args[n++], Pt_ARG_AREA, &sev_area, 0 );
    PtSetArg( &args[n++], Pt_ARG_FILL_COLOR, Pg_BLUE, 0);
    PtSetArg( &args[n++], Pt_ARG_TEXT_STRING, "Test Button", 0 );
    button = PtCreateWidget( PtButton, Pt_DEFAULT_PARENT, n, args );
    PtRealizeWidget( window );
    PpContinueJob( pc );
    PtWidgetArea( button, &area);
    PpSetCanvas( pc, dim );
    PpPrintWidget( pc, button, &area.pos, NULL, Pt_PP_NO_RESIZE );
    PpEndJob( pc );
    PtMainLoop();
    return EXIT_SUCCESS;
}
Photon
| Safety: |  | 
| Interrupt handler | 
    No | 
| Signal handler | 
    No | 
| Thread | 
    No | 
PhPoint_t,
PhRect_t,
PpContinueJob(),
PpCreatePC(),
PpEndJob(),
PpGetPC(),
PpPrintContext_t,
PpPrintNewPage(),
PpReleasePC(),
PpSetPC(),
PpStartJob(),
PpSuspendJob()
Printing in the
Photon Programmer's Guide
Warning:  main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pp/ppprintwidget.html on line 235
Warning:  main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pp/ppprintwidget.html on line 235