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

📄 imgbutton.h

📁 STM32+Grlib
💻 H
📖 第 1 页 / 共 3 页
字号:

//*****************************************************************************
//
//! Enables the keycap 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 keycap image on an image button
//! widget.  The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonKeycapOn(pWidget)                                    \
        do                                                              \
        {                                                               \
            tImageButtonWidget *pW = (tImageButtonWidget *)(pWidget);   \
            pW->ulStyle &= ~(IB_STYLE_KEYCAP_OFF);                      \
        }                                                               \
        while(0)

//*****************************************************************************
//
//! Disables the keycap 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 keycap image on an image button
//! widget.  The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonKeycapOff(pWidget)                                   \
        do                                                              \
        {                                                               \
            tImageButtonWidget *pW = (tImageButtonWidget *)(pWidget);   \
            pW->ulStyle |= IB_STYLE_KEYCAP_OFF;                         \
        }                                                               \
        while(0)

//*****************************************************************************
//
//! Changes the image drawn on a image button widget.
//!
//! \param pWidget is a pointer to the image button widget to be modified.
//! \param pImg is a pointer to the image to draw onto the image button.
//!
//! This function changes the image that is drawn onto the background of the
//! image button in its unpressed state.  The display is not updated until the
//! next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonImageSet(pWidget, pImg)                              \
        do                                                              \
        {                                                               \
            tImageButtonWidget *pW = (tImageButtonWidget *)(pWidget);   \
            const unsigned char *pI = pImg;                             \
            pW->pucImage = pI;                                          \
        }                                                               \
        while(0)

//*****************************************************************************
//
//! Changes the image drawn on a image button widget when it is pressed.
//!
//! \param pWidget is a pointer to the image button widget to be modified.
//! \param pImg is a pointer to the image to draw onto the image button when it
//! is pressed.
//!
//! This function changes the image that is drawn onto the background of the
//! image button in its pressed state.  The display is not updated until the
//! next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonImagePressedSet(pWidget, pImg)                       \
        do                                                              \
        {                                                               \
            tImageButtonWidget *pW = (tImageButtonWidget *)(pWidget);   \
            const unsigned char *pI = pImg;                             \
            pW->pucPressImage = pI;                                     \
        }                                                               \
        while(0)

//*****************************************************************************
//
//! Changes the keycap image drawn on a image button widget.
//!
//! \param pWidget is a pointer to the image button widget to be modified.
//! \param pImg is a pointer to the image to draw onto the image button.
//!
//! This function changes the image that is drawn onto the top of the push
//! button.  The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonImageKeycapSet(pWidget, pImg)                        \
        do                                                              \
        {                                                               \
            tImageButtonWidget *pW = (tImageButtonWidget *)(pWidget);   \
            const unsigned char *pI = (pImg);                           \
            pW->pucKeycapImage = pI;                                    \
        }                                                               \
        while(0)

//*****************************************************************************
//
//! Changes the keycap image offset position on an image button widget.
//!
//! \param pWidget is a pointer to the image button widget to be modified.
//! \param sX is the signed horizontal position offset for the keycap image
//! when the image button is pressed.  Positive values move the image right.
//! \param sY is the signed vertical position offset for the keycap image
//! when the image button is pressed.  Positive values move the image down.
//!
//! This function changes the position that the keycap image is drawn at when
//! the image button is pressed.  The keycap image is moved iX pixels right and
//! iY pixels down from the center position if the image button is pressed.
//! This feature can be used to support 3D buttons.   The display is not
//! updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonKeycapOffsetSet(pWidget, sX, sY)                     \
        do                                                              \
        {                                                               \
            tImageButtonWidget *pW = (tImageButtonWidget *)(pWidget);   \
            pW->sXOffset = (short)(sX);                                 \
            pW->sYOffset = (short)(sY);                                 \
        }                                                               \
        while(0)

//*****************************************************************************
//
//! Sets the color of background pixels when using 1bpp images.
//!
//! \param pWidget is a pointer to the image button widget to be modified.
//! \param ulColor is the background color to use.
//!
//! This function changes the color that is used to draw background pixels when
//! a 1bpp image is rendered on the button and the button is in the released
//! state.  The value is ignored for all other image bit depths.  The display
//! is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonBackgroundColorSet(pWidget, ulColor)                 \
        do                                                              \
        {                                                               \
            tImageButtonWidget *pW = (tImageButtonWidget *)(pWidget);   \
            pW->ulBackgroundColor  = (ulColor);                         \
        }                                                               \
        while(0)

//*****************************************************************************
//
//! Sets the color of foreground pixels when using 1bpp images.
//!
//! \param pWidget is a pointer to the image button widget to be modified.
//! \param ulColor is the foreground color to use.
//!
//! This function changes the color that is used to draw foreground pixels when
//! a 1bpp image or text string is rendered on the button.  The value is
//! ignored for all other image bit depths.  The display is not updated until
//! the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonForegroundColorSet(pWidget, ulColor)                 \
        do                                                              \
        {                                                               \
            tImageButtonWidget *pW = (tImageButtonWidget *)(pWidget);   \
            pW->ulForegroundColor  = (ulColor);                         \
        }                                                               \
        while(0)

//*****************************************************************************
//
//! Sets the color of foreground pixels when the button is pressed and when
//! using 1bpp images.
//!
//! \param pWidget is a pointer to the image button widget to be modified.
//! \param ulColor is the pressed foreground color to use.
//!
//! This function changes the color that is used to draw foreground pixels when
//! a 1bpp image is rendered on the button and the button is in the pressed
//! state.  The value is ignored for all other image bit depths.  The display
//! is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonPressedColorSet(pWidget, ulColor)                    \
        do                                                              \
        {                                                               \
            tImageButtonWidget *pW = (tImageButtonWidget *)(pWidget);   \
            pW->ulPressedColor  = (ulColor);                            \
        }                                                               \
        while(0)


//*****************************************************************************
//
//! Changes the text drawn on a image button widget.
//!
//! \param pWidget is a pointer to the image button widget to be modified.
//! \param pcTxt is a pointer to the text to draw onto the image button.
//!
//! This function changes the text that is drawn onto the image button.  The
//! display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ImageButtonTextSet(pWidget, pcTxt)                              \
        do                                                              \
        {                                                               \
            tImageButtonWidget *pW = (tImageButtonWidget *)(pWidget);   \
            const char *pcT = pcTxt;                                    \
            pW->pcText = pcT;                                           \
        }                                                               \
        while(0)

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

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

//*****************************************************************************
//
// Prototypes for the image button widget APIs.
//
//*****************************************************************************
extern long ImageButtonMsgProc(tWidget *pWidget, unsigned long ulMsg,
                               unsigned long ulParam1,
                               unsigned long ulParam2);
extern void ImageButtonInit(tImageButtonWidget *pWidget,
                            const tDisplay *pDisplay, long lX, long lY,
                            long lWidth, long lHeight);

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif

//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

#endif // __IMGBUTTON_H__

⌨️ 快捷键说明

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