mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
CComponentsItem: move/rename doCenter()to base class CComponentsItem
So it's possible to use this method for all cc-items. setCenterPos() comes now with parameter 'along_mode' (CC_ALONG_X, CC_ALONG_Y). So it's possible to center in x or y direction. As default are both directions predefined.
This commit is contained in:
@@ -182,3 +182,11 @@ void CComponentsItem::setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_p
|
||||
setXPosP(xpos_percent);
|
||||
setYPosP(ypos_percent);
|
||||
}
|
||||
|
||||
void CComponentsItem::setCenterPos(int along_mode)
|
||||
{
|
||||
if (along_mode & CC_ALONG_X)
|
||||
x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width);
|
||||
if (along_mode & CC_ALONG_Y)
|
||||
y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height);
|
||||
}
|
||||
|
Reference in New Issue
Block a user