diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 3dfa32763..75c1fc074 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -32,7 +32,7 @@ #include #include -// #define DEBUG_CC +//#define DEBUG_CC class CComponents { @@ -98,6 +98,9 @@ class CComponentsItem : public CComponents protected: int cc_item_type; int cc_item_index; + + ///contains real position and dimensions on screen, + int cc_item_xr, cc_item_yr; void hideCCItem(bool no_restore = false); void paintInit(bool do_save_bg); @@ -105,6 +108,9 @@ class CComponentsItem : public CComponents public: CComponentsItem(); + + ///sets real position on screen. Use this, if item contains own render methods and item is added to a form + virtual void setRealPos(const int& xr, const int& yr){cc_item_xr = xr; cc_item_yr = yr;}; virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0; virtual void hide(bool no_restore = false); diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 1a55a32f1..041b98295 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -233,7 +233,6 @@ void CComponentsForm::paintCCItems() //cache original item position and dimensions int x_item, y_item, w_item, h_item; v_cc_items[i]->getDimensions(&x_item, &y_item, &w_item, &h_item); - int xy_ref = 0+fr_thickness; //allowed minimal x and y start position if (x_item < xy_ref){ @@ -270,6 +269,11 @@ void CComponentsForm::paintCCItems() printf("[CComponentsForm] %s: item %d too large, definied height=%d, possible height=%d \n", __FUNCTION__, i, h_item, v_cc_items[i]->getHeight()); #endif } + + //set real position dimension to item + int real_x = v_cc_items[i]->getXPos(); + int real_y = v_cc_items[i]->getYPos(); + v_cc_items[i]->setRealPos(real_x, real_y); //paint element without saved screen! v_cc_items[i]->paint(CC_SAVE_SCREEN_NO); diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 92fd55c7c..88587f14c 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -54,6 +54,7 @@ void CComponentsItem::initVarItem() //CComponents initVarBasic(); cc_item_index = CC_NO_INDEX; + cc_item_xr = cc_item_yr = -1; } // Paint container background in cc-items with shadow, background and frame.