mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CComponentsItem/Form: add var for real item position
If items are used in forms it can be usefully to have a variable which contains the real position on screen. This can happen e.g. if an item contains separate render methods, because within forms usual x/y values related to form dimensions and be converted.
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <driver/pictureviewer/pictureviewer.h>
|
#include <driver/pictureviewer/pictureviewer.h>
|
||||||
|
|
||||||
// #define DEBUG_CC
|
//#define DEBUG_CC
|
||||||
|
|
||||||
class CComponents
|
class CComponents
|
||||||
{
|
{
|
||||||
@@ -99,6 +99,9 @@ class CComponentsItem : public CComponents
|
|||||||
int cc_item_type;
|
int cc_item_type;
|
||||||
int cc_item_index;
|
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 hideCCItem(bool no_restore = false);
|
||||||
void paintInit(bool do_save_bg);
|
void paintInit(bool do_save_bg);
|
||||||
void initVarItem();
|
void initVarItem();
|
||||||
@@ -106,6 +109,9 @@ class CComponentsItem : public CComponents
|
|||||||
public:
|
public:
|
||||||
CComponentsItem();
|
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 paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0;
|
||||||
virtual void hide(bool no_restore = false);
|
virtual void hide(bool no_restore = false);
|
||||||
virtual void kill();
|
virtual void kill();
|
||||||
|
@@ -234,7 +234,6 @@ void CComponentsForm::paintCCItems()
|
|||||||
int x_item, y_item, w_item, h_item;
|
int x_item, y_item, w_item, h_item;
|
||||||
v_cc_items[i]->getDimensions(&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
|
int xy_ref = 0+fr_thickness; //allowed minimal x and y start position
|
||||||
if (x_item < xy_ref){
|
if (x_item < xy_ref){
|
||||||
#ifdef DEBUG_CC
|
#ifdef DEBUG_CC
|
||||||
@@ -271,6 +270,11 @@ void CComponentsForm::paintCCItems()
|
|||||||
#endif
|
#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!
|
//paint element without saved screen!
|
||||||
v_cc_items[i]->paint(CC_SAVE_SCREEN_NO);
|
v_cc_items[i]->paint(CC_SAVE_SCREEN_NO);
|
||||||
|
|
||||||
|
@@ -54,6 +54,7 @@ void CComponentsItem::initVarItem()
|
|||||||
//CComponents
|
//CComponents
|
||||||
initVarBasic();
|
initVarBasic();
|
||||||
cc_item_index = CC_NO_INDEX;
|
cc_item_index = CC_NO_INDEX;
|
||||||
|
cc_item_xr = cc_item_yr = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paint container background in cc-items with shadow, background and frame.
|
// Paint container background in cc-items with shadow, background and frame.
|
||||||
|
Reference in New Issue
Block a user