
//////////////////////////////////////
// START of File: b0_dspla.hpp
//////////////////////////////////////

#ifndef B0_DSPLA_HPP
#define B0_DSPLA_HPP

//===================================================================
//
// COPYRIGHT NOTICE:  This code is protected by Copyright!
//
// Copyright (c) 1994 through 1997 by DPC Technology Corporation.
// All rights reserved. 
//
// See files "cf_copyr.txt" and "cf_licen.txt" for details of 
// copyright and license specifications, and contact information.
//
//===================================================================

//
// Master Header File Listing:
//
// #include  <api/include/b0_dspla.hpp>
// Base Framework abstractions of "display/display context" 
// objects such as "pens", "brushes", "display/HDCs", etc.
//


#include    <z_dsp.hpp>
#include    <z_win.hpp>

#include    <cf_api/bf_defs.h>

enum bf_PenStyle 
{
	CF_PS_SOLID   = ZAF_LINE_SOLID,
	CF_PS_DASH    = ZAF_LINE_DOTTED, 
	CF_PS_DOT     = ZAF_LINE_DOTTED 
};



enum bf_BrushHatch
{
	CF_BHAT_VERT   = ZAF_PTN_SOLID_FILL,
 	CF_BHAT_HORZ   = ZAF_PTN_INTERLEAVE_FILL,
	CF_BHAT_NONE   = ZAF_PTN_SOLID_FILL
};





class       bf_DynaString;
#include    <cf_api/c0_dystr.hpp>

class       bf_Color;
#include    <cf_api/b0_color.hpp>

class       cf_2DPoint;
class       cf_2DRect;
#include    <cf_api/c0_dimen.hpp>

class       bf_Font;
class       bf_FontSpec;
#include    <cf_api/b0_fonts.hpp>

class       bf_2DBitmap;
#include    <cf_api/b0_dsbmp.hpp>

class       cf_Stack;
#include    <cf_api/c0_stack.hpp>




class bf_Pen;
class bf_Brush;  
class bf_DispLogFontDim;
class bf_Display;
class bf_ChartView;





class CF_EXPORT bf_Pen
{
public:

    bf_Pen(    bf_Color       bf_clrUseThisColor );
                // bf_PenStyle will be CF_SOLID
                // iWidth will be 1 (one).

    bf_Pen(    bf_Color       bf_clrUseThisColor,
                bf_PenStyle    bf_pstyUseThisStyle,
                int             iWidth = 1 );

    ~bf_Pen();

	bf_Color		getColor () { return (color_); }
	bf_PenStyle		getPenStyle () { return pen_style_; }
	int				getWidth () { return width_; }

private:

	bf_Color		color_;
	bf_PenStyle	pen_style_;
	int				width_;

};





class CF_EXPORT   bf_Brush
{

public:

    bf_Brush( bf_Color bf_clrUseThisColor );

    bf_Brush(  bf_Color       bf_clrUseThisColor,
                bf_BrushHatch  bf_bhatUseThisHatching );

    ~bf_Brush();

	bf_Color		getColor () { return (color_); }
	bf_BrushHatch	getBrushHatch () { return (hatch_); }

private:

	bf_Color		color_;
	bf_BrushHatch	hatch_;

};





class CF_EXPORT   bf_DispLogFontDim
{

public:

    bf_DispLogFontDim();

    bf_DispLogFontDim( int iWidth,
                        int jHeight,
                        bf_Display *p_bf_dspUseThisDisplay = NULL );

    ~bf_DispLogFontDim();

};





class CF_EXPORT   bf_Display
{

public:

    bf_Display (ZafDisplay* zdisplay, ZafWindowObject* view );

    ~bf_Display();

    BOOL        dsp_devToLog( cf_2DRect &r );

    void        dsp_getVisible( cf_2DRect &r );

    void        dsp_lock();

    BOOL        dsp_logToDev( cf_2DRect &r );

    void        dsp_unlock();

    void        dsp_pushBrush( bf_Brush* p_bf_brushUseThisBrush );
    void        dsp_pushBrush( bf_Color bf_clrForNoHatchBrush );
                // Default op uses brush-hatch == "NoHatch"

    void        dsp_pushPen( bf_Pen* p_bf_penUseThisPen );
    void        dsp_pushPen( bf_Color bf_clrForSolidLine );
                // Default op uses pen-style == "Solid"

    BOOL        dsp_circle( cf_2DPoint     bf_2dpUseThisPoint,
                            int             iRadius );

    bf_Color   dsp_pixel(  int         iX,
                            int         iY );

    bf_Color   dsp_pixel(  int         iX,
                            int         iY,
                            bf_Color   bf_clrUseThisColor );

    bf_Color   dsp_pixel(  cf_2DPoint bf_2dpUseThisPoint );

    bf_Color   dsp_pixel(  cf_2DPoint bf_2dpUseThisPoint,
                            bf_Color   bf_clrUseThisColor );

    bf_Brush*  dsp_popBrush();

    bf_Pen*    dsp_popPen();

    BOOL    dsp_polyline(   cf_2DPoint*    a_bf_2dpStartFrom,
                            int             iNumPoints );

    BOOL    dsp_polygon(    cf_2DPoint*    a_bf_2dpStartFrom,
                            int             iNumPoints );


    BOOL    dsp_bitmap( bf_2DBitmap*   p_bf_2dbmpUseThisBitMap,
                        cf_2DPoint     bf_2dpPlaceAt,
                        cf_2DRect      bf_2drSizedBy );


    void    dsp_getDirty( cf_2DRect&  r_bf_2drTargetRect );

    void        dsp_setDirty();

    void        dsp_pushFont( bf_Font *p_bf_fonUseThisFont );

    bf_Font*   dsp_popFont();

    bf_Color   dsp_textColor();
    bf_Color   dsp_textColor( bf_Color bf_clrUseThisColor );

    bf_Color   dsp_backColor();
    bf_Color   dsp_backColor( bf_Color bf_clrUseThisColor );

    BOOL        dsp_text(   cf_2DPoint bf_2dpPutTextHere,
                            char*       szStringAddress     );
    BOOL        dsp_text(   cf_2DPoint bf_2dpPutTextHere,
                            cf_String  cf_strUseThisString );

    cf_2DRect  dsp_getTextRect( cf_String cf_strUseThisString );
    cf_2DRect  dsp_getTextRect( char*      szStringAddress,
                                 int        iStringLength   );

    BOOL    dsp_ellipse(    cf_2DPoint bf_2dpUpperLeft,
                            cf_2DPoint bf_2dpLowerRight );

    double  zz_calcAngleDegrees(    int iOriginX,
                                    int iOriginY,
                                    int iRadialX,
                                    int iRadialY );

    BOOL    dsp_pie(    cf_2DRect  bf_2drBoundaryEllipseRect,
                        cf_2DPoint bf_2dpStartArcPoint,
                        cf_2DPoint bf_2dpEndArcPoint );

    BOOL    dsp_arc(    cf_2DRect  bf_2drBoundaryEllipseRect,
                        cf_2DPoint bf_2dpStartArcPoint,
                        cf_2DPoint bf_2dpEndArcPoint );

    void    dsp_drawModeSolid();
    void    dsp_drawModeTransparent();
            //
            // Pie slices need to set their pen style
            // to be "transparent" when they draw their
            // front-facing slice face wall, and
            // then set things back to normal...
            //
            // This memeber calls the dsp_drawMode(...)
            // member above with a *specific* value
            // that yields transparent draw ops.
            //

    BOOL    dsp_rectangle(  cf_2DRect  bf_2drBoundaryRect );
    BOOL    dsp_polyline(   cf_2DRect  bf_2drBoundaryRect );

    ZafDisplay*			getDisplay () { return zdisplay_; }
    ZafWindowObject*	getView () { return view_; }

private:

	int				    curr_width_;
	cf_Stack		    pens_;
	cf_Stack		    brushes_;
	cf_Stack		    fonts_;
	ZafDisplay*		    zdisplay_;
	ZafWindowObject*	view_;

	void				setPenAttributes (bf_Pen*);
	void				setBrushAttributes (bf_Brush*);

};

#endif

//////////////////////////////////////
// END of File: b0_dspla.hpp
//////////////////////////////////////
            
