⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c0_tatb.hpp

📁 windRiver提供的的Zinc5.3完整源码,文档非常齐全
💻 HPP
📖 第 1 页 / 共 2 页
字号:
    // We'll also be able to set this zFontSpec for a rotated angle:
    int         iOrientationAngle;
    int         iEscapementAngle;   //
                                    // In 10ths of a degree
                                    //
    // The choice of whether to use the base "fixed" zFontSpec,
    // or the AutoScaleFontSpec scaled to the current zDisplay
    // size MUST be available to the user:
    BOOL        bDoWeAutoScaleFontSpec;

    //
    // A "Bounding Rectangle" Dimension is the dimensioning param that
    // the zFontSpec will be scaled to.
    //
    // The "Normal" mode of operation will be to use a Bounding
    // Rectangle determined by a call to a zDisplay*
    // ->getVisible( zRect ) member.  This is the most useful mode
    // for classes like "3D Grid/Tick-Series", etc to use, and is
    // the DEFAULT mode.
    //
    // A Second mode is used by derived classes such as "3D-Text-Lines",
    // which need a bounding rectangle that is NOT the size of the
    // zDisplay*->getVisible( zRect ). (e.g. "3D-Text-Lines" that are
    // used as back wall titles need a bounding rectangle equivalent
    // to the projected size of the back face.)
    //
    // The modes are switched by calls to the members
    // cf_AutoScaleFontSpec::useBoundingRect( zRect ) or
    // cf_AutoScaleFontSpec::useBoundingRect( zDimension ) or
    // cf_AutoScaleFontSpec::useDisplayRect().
    // 
    cf_2DRect          cf_2drBoundingRect;
    BOOL                bGetDimensionsFromDisplay;

    //
    // The AutoScaleFactor(s) control how much (a Percentage) of
    // the Bounding Rectangle's dimension(s) the FontSpec will 
    // Auto-Scale to.
    //
    // The Default Values were determined empirically,
    // on VGA at Std and High Resolution.
    //
    double  dPctFontDimToProjDim;
            // C-tor inits = C0_TATB_PCT_FONT_TO_RECT
            
    double  dPctFontWidthToHeight;
            // C-tor inits = C0_TATB_PCT_WIDTH_TO_HEIGHT

    double  dSetupVHRatio;
            // C-tor inits = C0_TATB_DISP_VH_RATIO
            
    double  dSetupScaleFactor;
            // C-tor inits = C0_TATB_DEFAULT_SCALE_FAC

};  //
    // End of cf_AutoScaleFontSpec declaration.
    //



class CF_EXPORT   cf_TextAttribs
        : public cf_AutoScaleFontSpec
{

public:

    cf_TextAttribs();

    cf_TextAttribs( bf_Color    bf_clrTextForeground,
                    bf_Color    bf_clrTextBackground );

    ~cf_TextAttribs();


    //------------------------------------------------
    // Methods to manipulate Base Font-Spec Rotation:
    //------------------------------------------------
    void        angleRotationPrefer( int iAngleInClockwiseDegrees );
                // Set the "orientation" and "escapement" angles
                // for the embedded font-spec, in clockwise degrees.

    int         angleRotationDegrees();
    double      angleRotationRadians();
                // Get the orientation and/or escapement angle (in
                // clockwise degrees or converted to radians).



    BOOL    autoScale();
    void    autoScale( BOOL bNewState );
            // Get/set Auto-Scaling status/state ON or OFF,
            // corresponding to BOOL TRUE or FALSE values.

    bf_FontSpec*   baseFontSpec();
    void    baseFontSpec( bf_FontSpec  *p_bf_fspNewFontSpec );
            // Get/set the Base Font Spec for this ASFS. Enables
            // "Font Selection Dialogs" etc., which operate from
            // "pointers to Font Specs"...  Note that in the
            // baseFontSpec( bf_FontSpec* ) member method, a
            // VALUE copy of the bf_FontSpec* parameter is
            // performed, because this cf_AutoScaleFontSpec object
            // cannot know the scope of the bf_FontSpec* parameter.

    //------------------------------------------
    // Methods to control Auto-Scaling Behavior:
    //------------------------------------------
    void        autoScalePercent( double dUsingMinimumChartDimensionXY );
    double      autoScalePercent();
                // Set/get the auto-scaling size of the font to a percentage
                // of the MINIMAL dimension (vertical OR horizontal) of the
                // parent chart's 2D/3D-Box.  Typical settings range from
                // 0.04 to 0.06 (i.e 4 to 6 percent).


    //----------------------------------------------
    // Methods to manipulate Text-Attrib Color(s):
    //----------------------------------------------
    bf_Color    colorTextFore();
    BOOL        colorTextFore( bf_Color bf_clrNew );

    bf_Color    colorTextBack();
    BOOL        colorTextBack( bf_Color bf_clrNew );
                // Get/set text/text-background colors for these text-attribs.


    //------------------------------------------------
    // Methods to manipulate String Output Format(s):
    //------------------------------------------------
    cf_String   formatNumPrefer();
    void        formatNumPrefer( const char *a_cSprintfFormatString );
                // C-tor will init a numerical format string to "%g".
                // Use this method to get/set this format string to your
                // preferred sprintf(...) format spec, e.g. %2.2g", etc.



    //------------------------------------------------------
    // Methods to manipulate Text-Attrib Position-Shift(s):
    //------------------------------------------------------
    void        shiftVertUp();
    BOOL        shiftVertUpIs();

    void        shiftVertDown();
    BOOL        shiftVertDownIs();

    void        shiftVertCtr();
    BOOL        shiftVertCtrIs();

    void        shiftHorzLeft();
    BOOL        shiftHorzLeftIs();

    void        shiftHorzRight();
    BOOL        shiftHorzRightIs();

    void        shiftHorzCtr();
    BOOL        shiftHorzCtrIs();

    void        staggerUpDown();
    BOOL        staggerUpDownIs();

    void        staggerDownUp();
    BOOL        staggerDownUpIs();
                // Can be used to spec the shift of the render position of
                // any given text relative to any given projection text-point.


private:

    void        ctorInit();

    bf_Color    bf_clrTextForeground_;
    bf_Color    bf_clrTextBackground_;

    //---------------------------------------------------------------
    // Positioning Vars -- i.e. where do we place the output text?
    //---------------------------------------------------------------
    BOOL        bHorizShiftLeft_;       // Ctor inits = FALSE
    BOOL        bHorizShiftRight_;      // Ctor inits = FALSE
    BOOL        bHorizCentered_;        // Ctor inits = TRUE

    BOOL        bVertShiftUp_;          // Ctor inits = FALSE
    BOOL        bVertShiftDown_;        // Ctor inits = FALSE
    BOOL        bVertCentered_;         // Ctor inits = TRUE

    BOOL        bStaggerUpDown_;        // Ctor inits = FALSE
    BOOL        bStaggerDownUp_;        // Ctor inits = FALSE
                // The default POSITIONING of any output TEXT BOX is CENTERED
                // (vertically AND horizontally ) at any given screen-point.
                // However, this can be toggled to Shift the Draw Point to
                // any of the Text Box's four corners, or the Center Point,
                // with the shiftVert() and/or shiftHorz() methods above:

    cf_String   cf_strPreferredNumFormat_;
                // Use to format numerical items per standard sprintf(...)
                // usage.  Typically set to "%g" by the c-tor...


};  // end of class cf_TextAttribs decleartion


#endif      // Terminates include re-definition protection

//////////////////////////////////////
// END of File: C0_TATB.HPP
//////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -