home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / OWLINC.PAK / PRINTDIA.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  3KB  |  94 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1992, 1994 by Borland International, All Rights Reserved
  4. //
  5. //   Implementation of Print and PrintSetup common Dialogs
  6. //   classes
  7. //----------------------------------------------------------------------------
  8. #if !defined(OWL_PRINTDIA_H)
  9. #define OWL_PRINTDIA_H
  10.  
  11. #if !defined(OWL_COMMDIAL_H)
  12. # include <owl/commdial.h>
  13. #endif
  14. #if !defined(OWL_DC_H)
  15. # include <owl/dc.h>
  16. #endif
  17.  
  18. class _OWLCLASS TPrintDialog : public TCommonDialog {
  19.   public:
  20.     class _OWLCLASS TData {
  21.       public:
  22.         uint32          Flags;
  23.         uint32          Error;
  24.         int             FromPage;
  25.         int             ToPage;
  26.         int             MinPage;
  27.         int             MaxPage;
  28.         int             Copies;
  29.  
  30.         TData();
  31.        ~TData();
  32.         void                Lock();
  33.         void                Unlock();
  34.         void                ClearDevMode();
  35.         const DEVMODE far*  GetDevMode() const {return DevMode;}
  36.         void                SetDevMode(const DEVMODE far* devMode);
  37.         void                ClearDevNames();
  38.         const DEVNAMES far* GetDevNames() const {return DevNames;}
  39.         const char far*     GetDriverName() const;
  40.         const char far*     GetDeviceName() const;
  41.         const char far*     GetOutputName() const;
  42.         void                SetDevNames(const char far* driver,
  43.                                         const char far* device,
  44.                                         const char far* output);
  45.         TPrintDC*           TransferDC();
  46.         
  47.         void*               Read(ipstream& is, uint32 version);
  48.         void                Write(opstream& os);
  49.  
  50.       private:
  51.         HGLOBAL       hDevMode;
  52.         HGLOBAL       hDevNames;
  53.         HDC           hDC;
  54.  
  55.         DEVMODE far*  DevMode;
  56.         DEVNAMES far* DevNames;
  57.  
  58.         TData(const TData&);         // hidden to prevent copying & assignment
  59.         TData& operator =(const TData&);
  60.  
  61.       friend class TPrintDialog;
  62.     };
  63.  
  64.     TPrintDialog(TWindow*        parent,
  65.                  TData&          data,
  66.                  const char far* printTemplateName = 0,
  67.                  const char far* setupTemplateName = 0,
  68.                  const char far* title = 0,
  69.                  TModule*        module = 0);
  70.                
  71.     bool       GetDefaultPrinter();
  72.  
  73.     int        DoExecute();
  74.  
  75.   protected:
  76.     PRINTDLG   pd;
  77.     TData&     Data;
  78.  
  79.     bool    DialogFunction(uint message, WPARAM, LPARAM);
  80.  
  81.     // Default behavior inline for message response functions
  82.     //
  83.     void       CmSetup() {DefaultProcessing();} //EV_COMMAND(psh1, 
  84.  
  85.   private:
  86.     TPrintDialog(const TPrintDialog&);
  87.     TPrintDialog& operator=(const TPrintDialog&);
  88.  
  89.   DECLARE_RESPONSE_TABLE(TPrintDialog);
  90.   DECLARE_CASTABLE;
  91. };
  92.  
  93. #endif  // OWL_PRINTDIA_H
  94.