CComponentsPicture: add explicit methodes to set image position

This commit is contained in:
2017-04-16 16:53:06 +02:00
parent 069379930a
commit 5361296ff4
2 changed files with 23 additions and 0 deletions

View File

@@ -148,6 +148,24 @@ void CComponentsPicture::setHeight(const int& h, bool keep_aspect)
initCCItem(); initCCItem();
} }
void CComponentsPicture::setXPos(const int& xpos)
{
CComponentsItem::setXPos(xpos);
if (xpos == x)
return;
need_init = true;
initCCItem();
}
void CComponentsPicture::setYPos(const int& ypos)
{
CComponentsItem::setYPos(ypos);
if (ypos == y)
return;
need_init = true;
initCCItem();
}
void CComponentsPicture::initCCItem() void CComponentsPicture::initCCItem()
{ {
if (pic_name.empty() || !need_init){ if (pic_name.empty() || !need_init){

View File

@@ -162,6 +162,11 @@ class CComponentsPicture : public CComponentsItem
///set height of object and image related to current screen size, see also CComponentsItem::setHeightP(), parameter as uint8_t ///set height of object and image related to current screen size, see also CComponentsItem::setHeightP(), parameter as uint8_t
virtual void setHeightP(const uint8_t& h_percent){CComponentsItem::setHeightP(h_percent), do_scale = true; need_init = hasChanges(); initCCItem();} virtual void setHeightP(const uint8_t& h_percent){CComponentsItem::setHeightP(h_percent), do_scale = true; need_init = hasChanges(); initCCItem();}
///set screen x-position, parameter as int
virtual void setXPos(const int& xpos);
///set screen y-position, parameter as int
virtual void setYPos(const int& ypos);
///return paint mode of internal image, true=image was painted, please do not to confuse with isPainted()! isPainted() is related to item itself. ///return paint mode of internal image, true=image was painted, please do not to confuse with isPainted()! isPainted() is related to item itself.
virtual inline bool isPicPainted(){return is_image_painted;}; virtual inline bool isPicPainted(){return is_image_painted;};