home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ool.zip / OOL / include / xgraphdv.h < prev    next >
Text File  |  1997-02-23  |  4KB  |  97 lines

  1. #ifndef __OOL_XGRAPHDEV_H__
  2. #define __OOL_XGRAPHDEV_H__
  3.  
  4. /*===========================================================================*/
  5. /* OOL ------------------- the Open Object Library ------------- OS/2 Beta 1 */
  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.       friend class XBitmapShadow;        
  44.    private:
  45.       HAB hab;
  46.       HWND hwnd;
  47.       LONG backCol;
  48.         char fonts;
  49.         XFont ** fontList;
  50.         void RegisterFont( XFont* );
  51.     protected:
  52.         XGraphicDevice( LONG mode);
  53.         void EnableFont( XFont*, LONG);
  54.       HPS hps;
  55.         HDC hdc;
  56.         LONG mode;
  57.       XGraphicObject * first, *last;
  58.       LONG aktColor, xOffset, yOffset;
  59.       char aktLineEnding;
  60.       char aktLineJoining;
  61.       LONG aktLineWidth;
  62.       SHORT aktLineType;
  63.       SHORT aktFontSize;
  64.         SHORT aktPattern;
  65.       char aktFont;
  66.       SHORT markerType;
  67.       LONG width, height;
  68.       BOOL fill;
  69.    public:
  70.       XGraphicDevice( const XWindow*, const BOOL createInMemory = FALSE, const BOOL fillBackground = TRUE, LONG mode = PU_PELS);
  71.       virtual ~XGraphicDevice();
  72.       void AddObject ( const XGraphicObject*);
  73.       void Copy( const XGraphicDevice *, const XRect *, const XRect * = NULL);
  74.       void Draw( void );
  75.         void Empty(void);
  76.       XGraphicObject * FindObject( const LONG x, const LONG y, const XGraphicObject * searchBehind = NULL);
  77.       void GetBackgroundColor( XColor * c) const { c->SetColor( backCol); }
  78.         HDC GetHDC() { return hdc; }
  79.         HPS GetHPS() { return hps; }
  80.       BOOL RemoveObject( XGraphicObject*, const BOOL destroyObject = TRUE);
  81.       void ResetFont( void );
  82.       void SetBackgroundColor( const XColor * c);
  83.         virtual void SetColor( LONG c) { aktColor = c; GpiSetColor( hps, c); }  
  84.       virtual void SetFont( XFont * );
  85.       void SetHeight( const LONG h) { height = h; }
  86.       void SetLineEnd( const char lineEnd) { GpiSetLineEnd( hps, lineEnd ); aktLineEnding = lineEnd; }
  87.       void SetLineJoin( const char lineJoin ) { GpiSetLineJoin( hps, lineJoin); aktLineJoining = lineJoin; }
  88.       void SetLineWidth( const LONG width);
  89.       void SetLineType( const SHORT type ) { GpiSetLineType( hps, type); aktLineType = type; }
  90.         void SetPattern( SHORT p) { aktPattern = p; GpiSetPattern(hps, p);}
  91.       void SetWidth( const LONG h) { width = h; }
  92.       void SetXOffset( const LONG x) { xOffset = x; }
  93.       void SetYOffset( const LONG y) { yOffset = y; }
  94. };
  95.  
  96. #endif
  97.