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

📄 imgbutton.h

📁 基于TI公司Cortex-M3的uart超级通信开发
💻 H
📖 第 1 页 / 共 3 页
字号:
                    (lY) + (lHeight) - 1                                     \
                },                                                           \
                ImageButtonMsgProc                                           \
            },                                                               \
            ulStyle,                                                         \
            ulForeColor,                                                     \
            ulPressColor,                                                    \
            ulBackColor,                                                     \
            pFont,                                                           \
            pcText,                                                          \
            pucImage,                                                        \
            pucPressImage,                                                   \
            pucKeycapImage,                                                  \
            sXOff,                                                           \
            sYOff,                                                           \
            usAutoRepeatDelay,                                               \
            usAutoRepeatRate,                                                \
            0,                                                               \
            pfnOnClick                                                       \
        }

//*****************************************************************************
//
//! Declares an initialized variable containing a image button 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 push
//! button.
//! \param lX is the X coordinate of the upper left corner of the image button.
//! \param lY is the Y coordinate of the upper left corner of the image button.
//! \param lWidth is the width of the image button.
//! \param lHeight is the height of the image button.
//! \param ulStyle is the style to be applied to the image button.
//! \param ulForeColor is the color to be used for foreground pixels when
//! a 1bpp image is being drawn.  It is ignored for all other image bit depths.
//! \param ulPressColor is the color to be used for foreground pixels when
//! the button is pressed and a 1bpp image is being drawn.  It is ignored for
//! all other image bit depths.
//! \param ulBackColor is the color to be used for background pixels when
//! the button is released and a 1bpp image is being drawn.  It is ignored for
//! all other image bit depths.
//! \param pFont is a pointer to the font to be used to draw text on the button.
//! \param pcText is a pointer to the text to draw on this button.
//! \param pucImage is a pointer to the image to draw on the background of
//! this image button when it is in the released state.
//! \param pucPressImage is a pointer to the image to draw on the background of
//! this image button when it is in the pressed state.
//! \param pucKeycapImage is a pointer to the image to draw as the keycap of the
//! on top of the image button, on top of the background image.
//! \param sXOff is the horizontal offset to apply when drawing the keycap image
//! on the button when in the pressed state.
//! \param sYOff is the vertical offset to apply when drawing the keycap image
//! on the button when in the pressed state.
//! \param usAutoRepeatDelay is the delay before starting auto-repeat.
//! \param usAutoRepeatRate is the rate at which auto-repeat events are
//! generated.
//! \param pfnOnClick is a pointer to the function that is called when the push
//! button is pressed.
//!
//! This macro provides an initialized image button 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 #IB_STYLE_TEXT to indicate that text should be drawn on the button.
//! - \b #IB_STYLE_FILL to indicate that the background of the button should
//!   be filled with color.
//! - \b #IB_STYLE_KEYCAP_OFF to indicate that the keycap image should not be
//!   drawn.
//! - \b #IB_STYLE_IMAGE_OFF to indicate that the background image should not be
//!   drawn.
//! - \b #IB_STYLE_AUTO_REPEAT to indicate that auto-repeat should be used.
//! - \b #IB_STYLE_RELEASE_NOTIFY to indicate that the callback should be made
//!   when the button is released.  If absent, the callback is called when the
//!   button is initially pressed.
//!
//! \return Nothing; this is not a function.
//
//*****************************************************************************
#define ImageButton(sName, pParent, pNext, pChild, pDisplay, lX, lY,       \
                   lWidth, lHeight, ulStyle, ulForeColor, ulPressColor,    \
                   ulBackColor, pFont, pcText, pucImage, pucPressImage,    \
                   pucKeycapImage, sXOff, sYOff, usAutoRepeatDelay,        \
                   usAutoRepeatRate, pfnOnClick)                           \
        tImageButtonWidget sName =                                         \
            ImageButtonStruct(pParent, pNext, pChild, pDisplay, lX, lY,    \
                              lWidth, lHeight, ulStyle, ulForeColor,       \
                              ulPressColor, ulBackColor, pFont, pcText,    \
                              pucImage, pucPressImage, pucKeycapImage,     \
                              sXOff, sYOff, usAutoRepeatDelay,             \
                              usAutoRepeatRate, pfnOnClick)

//*****************************************************************************
//
//! Sets the auto-repeat delay for a image button widget.
//!
//! \param pWidget is a pointer to the image button widget to modify.
//! \param usDelay is the number of pointer events before auto-repeat starts.
//!
//! This function sets the delay before auto-repeat begins.  Unpredictable
//! behavior will occur if this is called while the image button is pressed.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonAutoRepeatDelaySet(pWidget, usDelay) \
        do                                             \
        {                                              \
            tImageButtonWidget *pW = pWidget;           \
            pW->usAutoRepeatDelay = usDelay;           \
        }                                              \
        while(0)

//*****************************************************************************
//
//! Disables auto-repeat for a image button widget.
//!
//! \param pWidget is a pointer to the image button widget to modify.
//!
//! This function disables the auto-repeat behavior of a image button.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonAutoRepeatOff(pWidget)            \
        do                                          \
        {                                           \
            tImageButtonWidget *pW = pWidget;        \
            pW->ulStyle &= ~(IB_STYLE_AUTO_REPEAT); \
        }                                           \
        while(0)

//*****************************************************************************
//
//! Enables auto-repeat for a image button widget.
//!
//! \param pWidget is a pointer to the image button widget to modify.
//!
//! This function enables the auto-repeat behavior of a image button.
//! Unpredictable behavior will occur if this is called while the image button
//! is pressed.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonAutoRepeatOn(pWidget)          \
        do                                       \
        {                                        \
            tImageButtonWidget *pW = pWidget;     \
            pW->ulStyle |= IB_STYLE_AUTO_REPEAT; \
        }                                        \
        while(0)

//*****************************************************************************
//
//! Sets the auto-repeat rate for a image button widget.
//!
//! \param pWidget is a pointer to the image button widget to modify.
//! \param usRate is the number of pointer events between auto-repeat events.
//!
//! This function sets the rate at which auto-repeat events occur.
//! Unpredictable behavior will occur if this is called while the image button
//! is pressed.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonAutoRepeatRateSet(pWidget, usRate) \
        do                                           \
        {                                            \
            tImageButtonWidget *pW = pWidget;         \
            pW->usAutoRepeatRate = usRate;           \
        }                                            \
        while(0)

//*****************************************************************************
//
//! Sets the function to call when this image button widget is pressed.
//!
//! \param pWidget is a pointer to the image button widget to modify.
//! \param pfnOnClik is a pointer to the function to call.
//!
//! This function sets the function to be called when this image button is
//! pressed.  The supplied function is called when the image button is first
//! pressed, and then repeated while the image button is pressed if auto-repeat
//! is enabled.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonCallbackSet(pWidget, pfnOnClik) \
        do                                        \
        {                                         \
            tImageButtonWidget *pW = pWidget;      \
            pW->pfnOnClick = pfnOnClik;           \
        }                                         \
        while(0)

//*****************************************************************************
//
//! Sets the fill color of a image button widget.
//!
//! \param pWidget is a pointer to the image button widget to be modified.
//! \param ulColor is the 24-bit RGB color to use to fill the image button.
//!
//! This function changes the color used to fill the background of the image
//! button on the display.  This is a duplicate of ImageButtonBackgroundColorSet
//! which is left for backwards compatibility.  The display is not updated
//! until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonFillColorSet(pWidget, ulColor) \
        do                                        \
        {                                         \
            tImageButtonWidget *pW = pWidget;     \
            pW->ulBackgroundColor = ulColor;      \
        }                                         \
        while(0)

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

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

//*****************************************************************************
//
//! Enables the background image for an image button widget.
//!
//! \param pWidget is a pointer to the image button widget to modify.
//!
//! This function enables the drawing of the background image on an image button
//! widget.  The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonImageOn(pWidget)                \
        do                                         \
        {                                          \
            tImageButtonWidget *pW = pWidget;      \
            pW->ulStyle &= ~(IB_STYLE_IMAGE_OFF);  \
        }                                          \
        while(0)

//*****************************************************************************
//
//! Disables the background image for an image button widget.
//!
//! \param pWidget is a pointer to the image button widget to modify.
//!
//! This function disables the drawing of the background image on an image
//! button widget.  The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonImageOff(pWidget)            \
        do                                      \
        {                                       \
            tImageButtonWidget *pW = pWidget;   \
            pW->ulStyle |= IB_STYLE_IMAGE_OFF;  \
        }                                       \

⌨️ 快捷键说明

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