📄 pushbutton.h
字号:
//! 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 CircularButtonStruct(pParent, pNext, pChild, pDisplay, lX, lY, lR, \
ulStyle, ulFillColor, ulPressFillColor, \
ulOutlineColor, ulTextColor, pFont, pcText, \
pucImage, pucPressImage, usAutoRepeatDelay, \
usAutoRepeatRate, pfnOnClick) \
{ \
{ \
sizeof(tPushButtonWidget), \
(tWidget *)(pParent), \
(tWidget *)(pNext), \
(tWidget *)(pChild), \
pDisplay, \
{ \
(lX) - (lR), \
(lY) - (lR), \
(lX) + (lR), \
(lY) + (lR) \
}, \
CircularButtonMsgProc \
}, \
ulStyle, \
ulFillColor, \
ulPressFillColor, \
ulOutlineColor, \
ulTextColor, \
pFont, \
pcText, \
pucImage, \
pucPressImage, \
usAutoRepeatDelay, \
usAutoRepeatRate, \
0, \
pfnOnClick \
}
//*****************************************************************************
//
//! Declares an initialized variable containing a circular push 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 center of the push button.
//! \param lY is the Y coordinate of the center of the push button.
//! \param lR is the radius of the push button.
//! \param ulStyle is the style to be applied to the push button.
//! \param ulFillColor is the color used to fill in the push button.
//! \param ulPressFillColor is the color used to fill in the push button when
//! it is pressed.
//! \param ulOutlineColor is the color used to outline the push button.
//! \param ulTextColor is the color used to draw text on the push button.
//! \param pFont is a pointer to the font to be used to draw text on the push
//! button.
//! \param pcText is a pointer to the text to draw on this push button.
//! \param pucImage is a pointer to the image to draw on this push button.
//! \param pucPressImage is a pointer to the image to draw on this push button
//! when it is pressed.
//! \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 circular push 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 #PB_STYLE_OUTLINE to indicate that the push button should be outlined.
//! - \b #PB_STYLE_FILL to indicate that the push button should be filled.
//! - \b #PB_STYLE_TEXT to indicate that the push button should have text drawn
//! on it (using \e pFont and \e pcText).
//! - \b #PB_STYLE_IMG to indicate that the push button should have an image
//! drawn on it (using \e pucImage).
//! - \b #PB_STYLE_TEXT_OPAQUE to indicate that the push button text should be
//! drawn opaque (in other words, drawing the background pixels).
//! - \b #PB_STYLE_AUTO_REPEAT to indicate that auto-repeat should be used.
//! - \b #PB_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 CircularButton(sName, pParent, pNext, pChild, pDisplay, lX, lY, lR, \
ulStyle, ulFillColor, ulPressFillColor, \
ulOutlineColor, ulTextColor, pFont, pcText, pucImage, \
pucPressImage, usAutoRepeatDelay, usAutoRepeatRate, \
pfnOnClick) \
tPushButtonWidget sName = \
CircularButtonStruct(pParent, pNext, pChild, pDisplay, lX, lY, \
lR, ulStyle, ulFillColor, ulPressFillColor, \
ulOutlineColor, ulTextColor, pFont, pcText, \
pucImage, pucPressImage, usAutoRepeatDelay, \
usAutoRepeatRate, pfnOnClick)
//*****************************************************************************
//
//! Declares an initialized rectangular push button widget data structure.
//!
//! \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 push button.
//! \param lY is the Y coordinate of the upper left corner of the push button.
//! \param lWidth is the width of the push button.
//! \param lHeight is the height of the push button.
//! \param ulStyle is the style to be applied to the push button.
//! \param ulFillColor is the color used to fill in the push button.
//! \param ulPressFillColor is the color used to fill in the push button when
//! it is pressed.
//! \param ulOutlineColor is the color used to outline the push button.
//! \param ulTextColor is the color used to draw text on the push button.
//! \param pFont is a pointer to the font to be used to draw text on the push
//! button.
//! \param pcText is a pointer to the text to draw on this push button.
//! \param pucImage is a pointer to the image to draw on this push button.
//! \param pucPressImage is a pointer to the image to draw on this push button
//! when it is pressed.
//! \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 rectangular push 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). This must
//! be assigned to a variable, such as:
//!
//! \verbatim
//! tPushButtonWidget g_sPushButton = RectangularButtonStruct(...);
//! \endverbatim
//!
//! Or, in an array of variables:
//!
//! \verbatim
//! tPushButtonWidget g_psPushButtons[] =
//! {
//! RectangularButtonStruct(...),
//! RectangularButtonStruct(...)
//! };
//! \endverbatim
//!
//! \e ulStyle is the logical OR of the following:
//!
//! - \b #PB_STYLE_OUTLINE to indicate that the push button should be outlined.
//! - \b #PB_STYLE_FILL to indicate that the push button should be filled.
//! - \b #PB_STYLE_TEXT to indicate that the push button should have text drawn
//! on it (using \e pFont and \e pcText).
//! - \b #PB_STYLE_IMG to indicate that the push button should have an image
//! drawn on it (using \e pucImage).
//! - \b #PB_STYLE_TEXT_OPAQUE to indicate that the push button text should be
//! drawn opaque (in other words, drawing the background pixels).
//! - \b #PB_STYLE_AUTO_REPEAT to indicate that auto-repeat should be used.
//! - \b #PB_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 RectangularButtonStruct(pParent, pNext, pChild, pDisplay, lX, lY, \
lWidth, lHeight, ulStyle, ulFillColor, \
ulPressFillColor, ulOutlineColor, \
ulTextColor, pFont, pcText, pucImage, \
pucPressImage, usAutoRepeatDelay, \
usAutoRepeatRate, pfnOnClick) \
{ \
{ \
sizeof(tPushButtonWidget), \
(tWidget *)(pParent), \
(tWidget *)(pNext), \
(tWidget *)(pChild), \
pDisplay, \
{ \
lX, \
lY, \
(lX) + (lWidth) - 1, \
(lY) + (lHeight) - 1 \
}, \
RectangularButtonMsgProc \
}, \
ulStyle, \
ulFillColor, \
ulPressFillColor, \
ulOutlineColor, \
ulTextColor, \
pFont, \
pcText, \
pucImage, \
pucPressImage, \
usAutoRepeatDelay, \
usAutoRepeatRate, \
0, \
pfnOnClick \
}
//*****************************************************************************
//
//! Declares an initialized variable containing a rectangular push 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 push button.
//! \param lY is the Y coordinate of the upper left corner of the push button.
//! \param lWidth is the width of the push button.
//! \param lHeight is the height of the push button.
//! \param ulStyle is the style to be applied to the push button.
//! \param ulFillColor is the color used to fill in the push button.
//! \param ulPressFillColor is the color used to fill in the push button when
//! it is pressed.
//! \param ulOutlineColor is the color used to outline the push button.
//! \param ulTextColor is the color used to draw text on the push button.
//! \param pFont is a pointer to the font to be used to draw text on the push
//! button.
//! \param pcText is a pointer to the text to draw on this push button.
//! \param pucImage is a pointer to the image to draw on this push button.
//! \param pucPressImage is a pointer to the image to draw on this push button
//! when it is pressed.
//! \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 rectangular push 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 #PB_STYLE_OUTLINE to indicate that the push button should be outlined.
//! - \b #PB_STYLE_FILL to indicate that the push button should be filled.
//! - \b #PB_STYLE_TEXT to indicate that the push button should have text drawn
//! on it (using \e pFont and \e pcText).
//! - \b #PB_STYLE_IMG to indicate that the push button should have an image
//! drawn on it (using \e pucImage).
//! - \b #PB_STYLE_TEXT_OPAQUE to indicate that the push button text should be
//! drawn opaque (in other words, drawing the background pixels).
//! - \b #PB_STYLE_AUTO_REPEAT to indicate that auto-repeat should be used.
//! - \b #PB_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 RectangularButton(sName, pParent, pNext, pChild, pDisplay, lX, lY, \
lWidth, lHeight, ulStyle, ulFillColor, \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -