home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / krcls012.zip / KrClass / include / krprint.hpp < prev    next >
Text File  |  1997-01-26  |  3KB  |  87 lines

  1. // Kroni's Classes: objects for printing graphics on printers
  2. // (c) 1997 Wolfgang Kronberg
  3. // file: krprint.hpp
  4.  
  5. // **********************************************************************************************************
  6. //
  7. // defines these classes:
  8. //
  9. //   KrPrinter               Act like a KrDrawingCanvas, but draw on printer and not on screen
  10. //
  11. // defines those global symbols for private use:
  12. //
  13. //   _KrPrintQueueInfo
  14. //   _KrDrivData
  15. //   __KrDrivData
  16. //
  17. // **********************************************************************************************************
  18.  
  19.  
  20. #ifndef __KRPRINT_HPP__
  21. #define __KRPRINT_HPP__
  22.  
  23.  
  24. #include <iglist.hpp>                            // IGList & Co.
  25. #include <ihandle.hpp>                           // IHandle
  26. #include <istring.hpp>                           // IString
  27.  
  28.  
  29.  
  30. typedef struct __KrDrivData {
  31. long   cb;
  32. long   lVersion;
  33. char   szDeviceName[32];
  34. char   abGeneralData[1];
  35. } _KrDrivData;
  36.  
  37.  
  38. class _KrPrintQueueInfo
  39. {
  40. public:
  41.   IString queueName;                             // Name of the logical queue
  42.   IString queueProcName;                         // Name of the queue processor
  43.   IString queueDescription;                      // Title of the queue
  44.   IString driver;                                // Name of the physical device driver
  45.   _KrDrivData * driverData;                      // Tells the driver which options are set
  46.   Boolean defaultQueue;                          // Is this the default queue?
  47. };
  48.  
  49.  
  50. class KrPrinter : public IBase
  51. {
  52.  
  53. public:
  54.  
  55.   KrPrinter ();                                  // Constructor
  56.  
  57.   Boolean print (IString title);                 // Do the printing; call the job "title"
  58.   IGList * setList (IGList & list);              // Sets a new graphicList; returns a pointer to the old one.
  59.   void getArea (IPoint & p1, IPoint & p2);       // Gets the area drawing takes place on
  60.                                                  //   (p1=left,low; p2=right,high)
  61.   Boolean printDialog ();                        // Lets the user choose a printer and set options for it.
  62.                                                  //   returns false if the user aborted the dialog,
  63.                                                  //   otherwise true.
  64.  
  65. private:
  66.  
  67.   _KrPrintQueueInfo * printQueues;               // Information about all accessable print queues
  68.   int selectedQueue;                             // This is the queue we will print on
  69.  
  70.   void initPrintQueues ();                       // Initialization of printQueues field
  71.   IHandle::Value openPrinterDc (IString title);  // Opens a device context for the current printer
  72.                                                  //   for job "title"
  73.  
  74.   IGList * graphicsList;                         // List of graphics elements to print
  75.  
  76.   int numberOfQueues;                            // Number of all accessable print queues
  77.  
  78.   IHandle::Value hdc;                            // Printer device context
  79.   IHandle::Value hps;                            // Printer presentation space
  80.  
  81.   friend class _KrPrHandler;                     // Needs access to printQueues and selectedQueue
  82. };
  83.  
  84.  
  85. #endif
  86.  
  87.