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

📄 slider.h

📁 基于TI公司Cortex-M3的uart超级通信开发
💻 H
📖 第 1 页 / 共 4 页
字号:
//! This macro provides an initialized slider widget data structure, which can
//! be used to construct the widget tree at compile time in global variables
//! (as opposed to run-time via function calls).  This must be assigned to a
//! variable, such as:
//!
//! \verbatim
//!     tSliderWidget g_sSlider = SliderStruct(...);
//! \endverbatim
//!
//! Or, in an array of variables:
//!
//! \verbatim
//!     tSliderWidget g_psSliders[] =
//!     {
//!         SliderStruct(...),
//!         SliderStruct(...)
//!     };
//! \endverbatim
//!
//! \e ulStyle is the logical OR of the following:
//!
//! - \b #SL_STYLE_OUTLINE to indicate that the slider should be outlined.
//! - \b #SL_STYLE_FILL to indicate that the slider should be filled.
//! - \b #SL_STYLE_BACKG_FILL to indicate that the background portion of the
//!   slider should be filled.
//! - \b #SL_STYLE_TEXT to indicate that the slider should have text drawn
//!   on its active portion (using \e pFont and \e pcText).
//! - \b #SL_STYLE_BACKG_TEXT to indicate that the slider should have text drawn
//!   on its background portion (using \e pFont and \e pcText).
//! - \b #SL_STYLE_IMG to indicate that the slider should have an image
//!   drawn on it (using \e pucImage).
//! - \b #SL_STYLE_BACKG_IMG to indicate that the slider should have an image
//!   drawn on its background (using \e pucBackgroundImage).
//! - \b #SL_STYLE_TEXT_OPAQUE to indicate that the slider text should be
//!   drawn opaque (in other words, drawing the background pixels).
//! - \b #SL_STYLE_BACKG_TEXT_OPAQUE to indicate that the slider text should be
//!   drawn opaque in the background portion of the widget. (in other words,
//!   drawing the background pixels).
//! - \b #SL_STYLE_VERTICAL to indicate that this is a vertical slider
//!   rather than a horizontal one (the default if this style flag is not set).
//! - \b #SL_STYLE_LOCKED to indicate that the slider is being used as an
//!   indicator and should ignore user input.
//!
//! \return Nothing; this is not a function.
//
//*****************************************************************************
#define SliderStruct(pParent, pNext, pChild, pDisplay, lX, lY, lWidth,    \
                     lHeight, lMin, lMax, lValue, ulStyle, ulFillColor,   \
                     ulBackgroundFillColor, ulOutlineColor, ulTextColor,  \
                     ulBackgroundTextColor, pFont, pcText, pucImage,      \
                     pucBackgroundImage, pfnOnChange)                     \
        {                                                                 \
            {                                                             \
                sizeof(tSliderWidget),                                    \
                (tWidget *)(pParent),                                     \
                (tWidget *)(pNext),                                       \
                (tWidget *)(pChild),                                      \
                pDisplay,                                                 \
                {                                                         \
                    lX,                                                   \
                    lY,                                                   \
                    (lX) + (lWidth) - 1,                                  \
                    (lY) + (lHeight) - 1                                  \
                },                                                        \
                SliderMsgProc                                             \
            },                                                            \
            ulStyle,                                                      \
            ulFillColor,                                                  \
            ulBackgroundFillColor,                                        \
            ulOutlineColor,                                               \
            ulTextColor,                                                  \
            ulBackgroundTextColor,                                        \
            pFont,                                                        \
            pcText,                                                       \
            pucImage,                                                     \
            pucBackgroundImage,                                           \
            pfnOnChange,                                                  \
            lMin,                                                         \
            lMax,                                                         \
            lValue,                                                       \
            0                                                             \
        }

//*****************************************************************************
//
//! Declares an initialized variable containing a slider widget data structure.
//!
//! \param sName is the name of the variable to be declared.
//! \param pParent is a pointer to the parent widget.
//! \param pNext is a pointer to the sibling widget.
//! \param pChild is a pointer to the first child widget.
//! \param pDisplay is a pointer to the display on which to draw the slider.
//! \param lX is the X coordinate of the upper left corner of the slider.
//! \param lY is the Y coordinate of the upper left corner of the slider.
//! \param lWidth is the width of the slider.
//! \param lHeight is the height of the slider.
//! \param lMin is the minimum value for the slider (corresponding to the left
//!  or bottom position).
//! \param lMax is the maximum value for the slider (corresponding to the right
//!  or top position).
//! \param lValue is the initial value of the slider.  This must lie in the
//!  range defined by \e lMin and \e lMax.
//! \param ulStyle is the style to be applied to the slider.
//! \param ulFillColor is the color used to fill in the slider.
//! \param ulBackgroundFillColor is the color used to fill in the background
//!  area of the slider.
//! \param ulOutlineColor is the color used to outline the slider.
//! \param ulTextColor is the color used to draw text on the slider.
//! \param ulBackgroundTextColor is the color used to draw text on the
//! background portion of the slider.
//! \param pFont is a pointer to the font to be used to draw text on the slider.
//! \param pcText is a pointer to the text to draw on this slider.
//! \param pucImage is a pointer to the image to draw on this slider.
//! \param pucBackgroundImage is a pointer to the image to draw on the slider
//! background.
//! \param pfnOnChange is a pointer to the function that is called to notify
//! the application of slider value changes.
//!
//! This macro provides an initialized slider widget data structure, which can
//! be used to construct the widget tree at compile time in global variables
//! (as opposed to run-time via function calls).
//!
//! \e ulStyle is the logical OR of the following:
//!
//! - \b #SL_STYLE_OUTLINE to indicate that the slider should be outlined.
//! - \b #SL_STYLE_FILL to indicate that the slider should be filled.
//! - \b #SL_STYLE_BACKG_FILL to indicate that the background portion of the
//!   slider should be filled.
//! - \b #SL_STYLE_TEXT to indicate that the slider should have text drawn
//!   on its active portion (using \e pFont and \e pcText).
//! - \b #SL_STYLE_BACKG_TEXT to indicate that the slider should have text drawn
//!   on its background portion (using \e pFont and \e pcText).
//! - \b #SL_STYLE_IMG to indicate that the slider should have an image
//!   drawn on it (using \e pucImage).
//! - \b #SL_STYLE_BACKG_IMG to indicate that the slider should have an image
//!   drawn on its background (using \e pucBackgroundImage).
//! - \b #SL_STYLE_TEXT_OPAQUE to indicate that the slider text should be
//!   drawn opaque (in other words, drawing the background pixels).
//! - \b #SL_STYLE_BACKG_TEXT_OPAQUE to indicate that the slider text should be
//!   drawn opaque in the background portion of the widget. (in other words,
//!   drawing the background pixels).
//! - \b #SL_STYLE_VERTICAL to indicate that this is a vertical slider
//!   rather than a horizontal one (the default if this style flag is not set).
//! - \b #SL_STYLE_LOCKED to indicate that the slider is being used as an
//!   indicator and should ignore user input.
//!
//! \return Nothing; this is not a function.
//
//*****************************************************************************
#define Slider(sName, pParent, pNext, pChild, pDisplay, lX, lY,      \
               lWidth, lHeight, lMin, lMax, lValue, ulStyle,         \
               ulFillColor, ulBackgroundFillColor, ulOutlineColor,   \
               ulTextColor, ulBackgroundTextColor, pFont, pcText,    \
               pucImage, pucBackgroundImage, pfnOnChange)            \
        tSliderWidget sName =                                        \
            SliderStruct(pParent, pNext, pChild, pDisplay, lX, lY,   \
                         lWidth, lHeight, lMin, lMax, lValue,        \
                         ulStyle, ulFillColor, ulBackgroundFillColor,\
                         ulOutlineColor, ulTextColor,                \
                         ulBackgroundTextColor, pFont, pcText,       \
                         pucImage, pucBackgroundImage, pfnOnChange)

//*****************************************************************************
//
//! Sets the function to call when this slider widget's value changes.
//!
//! \param pWidget is a pointer to the slider widget to modify.
//! \param pfnCallback is a pointer to the function to call.
//!
//! This function sets the function to be called when the value represented by
//! the slider changes.
//!
//! \return None.
//
//*****************************************************************************
#define SliderCallbackSet(pWidget, pfnCallback)   \
        do                                        \
        {                                         \
            tSliderWidget *pW = pWidget;          \
            pW->pfnOnChange = pfnCallback;        \
        }                                         \
        while(0)

//*****************************************************************************
//
//! Sets the fill color for the active area of a slider widget.
//!
//! \param pWidget is a pointer to the slider widget to be modified.
//! \param ulColor is the 24-bit RGB color to use to fill the slider.
//!
//! This function changes the color used to fill the active are of the slider
//! on the display.  The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define SliderFillColorSet(pWidget, ulColor)     \
        do                                       \
        {                                        \
            tSliderWidget *pW = pWidget;         \
            pW->ulFillColor = ulColor;           \
        }                                        \
        while(0)

//*****************************************************************************
//
//! Sets the fill color for the background area of a slider widget.
//!
//! \param pWidget is a pointer to the slider widget to be modified.
//! \param ulColor is the 24-bit RGB color to use to fill the background area
//! of the slider.
//!
//! This function changes the color used to fill the background area of the
//! slider on the display.  The display is not updated until the next paint
//! request.
//!
//! \return None.
//
//*****************************************************************************
#define SliderFillColorBackgroundedSet(pWidget, ulColor) \
        do                                               \
        {                                                \
            tSliderWidget *pW = pWidget;                 \
            pW->ulBackgroundFillColor = ulColor;         \
        }                                                \
        while(0)

//*****************************************************************************
//
//! Disables filling of the active area of a slider widget.
//!
//! \param pWidget is a pointer to the slider widget to modify.
//!
//! This function disables the filling of the active area of a slider widget.
//! The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define SliderFillOff(pWidget)               \
        do                                   \
        {                                    \
            tSliderWidget *pW = pWidget;     \
            pW->ulStyle &= ~(SL_STYLE_FILL); \
        }                                    \
        while(0)

//*****************************************************************************
//
//! Enables filling of the active area of a slider widget.
//!
//! \param pWidget is a pointer to the slider widget to modify.
//!
//! This function enables the filling of the active area of a slider widget.
//! The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define SliderFillOn(pWidget)                \
        do                                   \
        {                                    \
            tSliderWidget *pW = pWidget;     \
            pW->ulStyle |= SL_STYLE_FILL;    \
        }                                    \
        while(0)

//*****************************************************************************
//
//! Sets the font for a slider widget.
//!
//! \param pWidget is a pointer to the slider widget to modify.
//! \param pFnt is a pointer to the font to use to draw text on the slider.
//!
//! This function changes the font used to draw text on the slider.  The
//! display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define SliderFontSet(pWidget, pFnt)         \
        do                                   \
        {                                    \

⌨️ 快捷键说明

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