本文整理汇总了C++中TouchButton::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ TouchButton::setPosition方法的具体用法?C++ TouchButton::setPosition怎么用?C++ TouchButton::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TouchButton
的用法示例。
在下文中一共展示了TouchButton::setPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: void
/**
*
* @param aPositionX
* @param aPositionY
* @param aWidthX if aWidthX == 0 render only text no background box
* @param aHeightY
* @param aButtonColor if 0 take sDefaultButtonColor
* @param aCaption
* @param aCaptionSize if aCaptionSize == 0 don't render anything, just check touch area -> transparent button ;-)
* @param aValue
* @param aOnTouchHandler
* @return pointer to allocated button
*/
TouchButton * TouchButton::allocAndInitButton(uint16_t aPositionX, uint16_t aPositionY, uint16_t aWidthX, uint16_t aHeightY,
uint16_t aButtonColor, const char * aCaption, uint8_t aCaptionSize, uint8_t aFlags, int16_t aValue,
void (*aOnTouchHandler)(TouchButton *, int16_t)) {
TouchButton * tButton;
if (aFlags & BUTTON_FLAG_TYPE_AUTOREPEAT) {
tButton = TouchButtonAutorepeat::allocAutorepeatButton();
} else {
tButton = allocButton(false);
}
tButton->mWidthX = aWidthX;
tButton->mHeightY = aHeightY;
tButton->mButtonColor = aButtonColor;
tButton->mCaptionColor = sDefaultCaptionColor;
tButton->mCaption = aCaption;
tButton->mCaptionSize = aCaptionSize;
tButton->mOnTouchHandler = aOnTouchHandler;
if (aFlags & BUTTON_FLAG_TYPE_AUTO_RED_GREEN) {
if (aValue != 0) {
// map to boolean
aValue = true;
tButton->mButtonColor = COLOR_GREEN;
} else {
tButton->mButtonColor = COLOR_RED;
}
}
tButton->mValue = aValue;
// keep internal flags set by allocButton()
tButton->mFlags = (aFlags & (~INTERNAL_FLAG_MASK)) | (tButton->mFlags & INTERNAL_FLAG_MASK);
tButton->setPosition(aPositionX, aPositionY);
return tButton;
}
示例2: void
/**
*
* @param aPositionX
* @param aPositionY
* @param aWidthX if aWidthX == 0 render only text no background box
* @param aHeightY
* @param aButtonColor if 0 take sDefaultButtonColor
* @param aCaption
* @param aCaptionSize if aCaptionSize == 0 don't render anything, just check touch area -> transparent button ;-)
* @param aValue
* @param aOnTouchHandler
* @return pointer to allocated button
*/
TouchButton * TouchButton::allocAndInitSimpleButton(const uint16_t aPositionX, const uint16_t aPositionY, const uint16_t aWidthX,
const uint16_t aHeightY, const uint16_t aButtonColor, const char * aCaption, const uint8_t aCaptionSize,
const uint8_t aFlags, const int16_t aValue, void (*aOnTouchHandler)(TouchButton * const, int16_t)) {
TouchButton * tButton = allocButton(false);
tButton->mWidth = aWidthX;
tButton->mHeight = aHeightY;
tButton->mButtonColor = aButtonColor;
if (aButtonColor == 0) {
tButton->mButtonColor = sDefaultButtonColor;
}
tButton->mCaptionColor = sDefaultCaptionColor;
tButton->mCaption = aCaption;
tButton->mCaptionSize = aCaptionSize;
tButton->mOnTouchHandler = aOnTouchHandler;
tButton->mValue = aValue;
tButton->setPosition(aPositionX, aPositionY);
return tButton;
}