From 43519e858d448bfdad985cfcad0afec30943c090 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 16 Apr 2017 16:53:06 +0200 Subject: [PATCH] CComponentsPicture: add explicit methodes to set image position Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5361296ff48b4517eac502688d28479df69c1923 Author: Thilo Graf Date: 2017-04-16 (Sun, 16 Apr 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_item_picture.cpp | 18 ++++++++++++++++++ src/gui/components/cc_item_picture.h | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 1826431d7..4bcbc14a1 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -148,6 +148,24 @@ void CComponentsPicture::setHeight(const int& h, bool keep_aspect) 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() { if (pic_name.empty() || !need_init){ diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 0781b446e..7bf8953d0 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -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 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. virtual inline bool isPicPainted(){return is_image_painted;};