mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
CComponentsItem: add methodes to set width and height via percent value
Percent value is related to current screen or parent size
This commit is contained in:
@@ -296,6 +296,11 @@ class CComponentsItem : public CComponents
|
|||||||
|
|
||||||
///do center item on screen or within a parent form, parameter along_mode assigns direction of centering
|
///do center item on screen or within a parent form, parameter along_mode assigns direction of centering
|
||||||
virtual void setCenterPos(int along_mode = CC_ALONG_X | CC_ALONG_Y);
|
virtual void setCenterPos(int along_mode = CC_ALONG_X | CC_ALONG_Y);
|
||||||
|
|
||||||
|
///set item height, parameter as uint8_t, as percent value related to current height of parent form or screen
|
||||||
|
virtual void setHeightP(const uint8_t& h_percent);
|
||||||
|
///set item width, parameter as uint8_t, as percent value related to current width of parent form or screen
|
||||||
|
virtual void setWidthP(const uint8_t& w_percent);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -190,3 +190,13 @@ void CComponentsItem::setCenterPos(int along_mode)
|
|||||||
if (along_mode & CC_ALONG_Y)
|
if (along_mode & CC_ALONG_Y)
|
||||||
y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height);
|
y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CComponentsItem::setHeightP(const uint8_t& h_percent)
|
||||||
|
{
|
||||||
|
height = cc_parent ? h_percent*cc_parent->getWidth()/100 : h_percent*frameBuffer->getScreenWidth()/100;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsItem::setWidthP(const uint8_t& w_percent)
|
||||||
|
{
|
||||||
|
width = cc_parent ? w_percent*cc_parent->getHeight()/100 : w_percent*frameBuffer->getScreenHeight()/100;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user