home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ool_main.zip / ool / include / xgraphdv.h < prev    next >
Text File  |  1998-04-06  |  4KB  |  95 lines

  1. #ifndef __OOL_XGRAPHDEV_H__
  2. #define __OOL_XGRAPHDEV_H__
  3.  
  4. /*===========================================================================*/
  5. /* OOL ------------------- the Open Object Library ------------------- r 1.0 */
  6. /*===========================================================================*/
  7. /*                              class: XGraphicDevice                        */
  8. /*                       derived from: XObject                               */
  9. /*                        last update: 12/96                                 */
  10. /*                      programmed by: Stefan von Brauk (sbrauk@gwdg.de)     */
  11. /*===========================================================================*/
  12.  
  13.  
  14. #include "xcolor.h"
  15.  
  16. class XWindow;
  17. class XGraphicObject;
  18. class XColor;
  19. class XPoint;
  20. class XFont;
  21. class XRect;
  22.  
  23. #ifdef OOL_FOR_OS2_X86
  24.    #define XGRAPH_PELS         PU_PELS
  25.    #define XGRAPH_LOMETRIC      PU_LOMETRIC
  26.    #define XGRAPH_HIMETRIC      PU_HIMETRIC
  27.    #define XGRAPH_LOENGLISH   PU_LOENGLISH
  28.    #define XGRAPH_HIENGLISH   PU_HIENGLISH
  29.    #define XGRAPH_TWIPS         PU_TWIPS
  30. #endif
  31.  
  32. class _export_ XGraphicDevice: public XObject
  33. {
  34.       friend class XLine;
  35.       friend class XCircle;
  36.       friend XGraphicObject;
  37.       friend class XArc;
  38.       friend class XFont;
  39.       friend class XText;
  40.       friend class XBox;
  41.       friend class XMarker;
  42.       friend class XBitmap;
  43.    private:
  44.       HAB hab;
  45.       HWND hwnd;
  46.       LONG backCol;
  47.       char fonts;
  48.       XFont ** fontList;
  49.       void RegisterFont( XFont* );
  50.    protected:
  51.       XGraphicDevice( const LONG res);
  52.       void EnableFont( XFont*, LONG);
  53.       HPS hps;
  54.       HDC hdc;
  55.       LONG mode;
  56.       LONG aktColor, xOffset, yOffset;
  57.       char aktLineEnding;
  58.       char aktLineJoining;
  59.       LONG aktLineWidth;
  60.       SHORT aktLineType;
  61.       SHORT aktFontSize;
  62.       SHORT aktPattern;
  63.       char aktFont;
  64.       SHORT markerType;
  65.       LONG width, height;
  66.       BOOL fill;
  67.    public:
  68.       XGraphicDevice( const XWindow*, const BOOL createInMemory = FALSE, const BOOL fillBackground = TRUE, LONG res = PU_PELS, LONG mode = GPIT_MICRO | GPIA_ASSOC);
  69.       virtual ~XGraphicDevice();
  70. //      void AddObject ( const XGraphicObject*);
  71.       void Copy( const XGraphicDevice *, const XRect *, const XRect * = NULL);
  72.       void FillBackground( void );
  73. //      void Empty(void);
  74. //      XGraphicObject * FindObject( const LONG x, const LONG y, const XGraphicObject * searchBehind = NULL);
  75.       void GetBackgroundColor( XColor * c) const { c->SetColor( backCol); }
  76.       HDC GetHDC() const { return hdc; }
  77.       HPS GetHPS() const { return hps; }
  78. //      BOOL RemoveObject( XGraphicObject*, const BOOL destroyObject = TRUE);
  79.       void ResetFont( void );
  80.       void SetBackgroundColor( const XColor * c);
  81.       virtual void SetColor( const LONG c) { aktColor = c; GpiSetColor( hps, c); }
  82.       virtual void SetFont( XFont * );
  83.       void SetHeight( const LONG h) { height = h; }
  84.       void SetLineEnd( const char lineEnd) { GpiSetLineEnd( hps, lineEnd ); aktLineEnding = lineEnd; }
  85.       void SetLineJoin( const char lineJoin ) { GpiSetLineJoin( hps, lineJoin); aktLineJoining = lineJoin; }
  86.       void SetLineWidth( const LONG width);
  87.       void SetLineType( const SHORT type ) { GpiSetLineType( hps, type); aktLineType = type; }
  88.       void SetPattern( SHORT p) { aktPattern = p; GpiSetPattern(hps, p);}
  89.       void SetWidth( const LONG h) { width = h; }
  90.       void SetXOffset( const LONG x) { xOffset = x; }
  91.       void SetYOffset( const LONG y) { yOffset = y; }
  92. };
  93.  
  94. #endif
  95.