CComponents: rename and move real position attributes

These attributes are better placed in the basic class.
This commit is contained in:
2013-05-31 21:00:51 +02:00
parent d3d0bff7ac
commit 3c5f4867fb
3 changed files with 17 additions and 16 deletions

View File

@@ -55,6 +55,10 @@ class CComponents
int x; int x;
///property: y-position on screen ///property: y-position on screen
int y; int y;
///property: contains real x-position on screen
int cc_xr;
///property: contains real y-position on screen
int cc_yr;
///property: height-dimension on screen ///property: height-dimension on screen
int height; int height;
///property: width-dimension on screen ///property: width-dimension on screen
@@ -116,8 +120,16 @@ class CComponents
inline virtual void setYPos(const int& ypos){y = ypos;}; inline virtual void setYPos(const int& ypos){y = ypos;};
///set x and y position ///set x and y position
///Note: position of bound components (items) means position related within parent form, not for screen! ///Note: position of bound components (items) means position related within parent form, not for screen!
///to set the real screen position, setRealPos(), to find in CComponentsItem sub classes ///to set the real screen position, look at setRealPos()
inline virtual void setPos(const int& xpos, const int& ypos){x = xpos; y = ypos;}; inline virtual void setPos(const int& xpos, const int& ypos){x = xpos; y = ypos;};
///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_xr = xr; cc_yr = yr;};
///get real x-position on screen. Use this, if item contains own render methods and item is bound to a form
virtual int getRealXPos(){return cc_xr;};
///get real y-position on screen. Use this, if item contains own render methods and item is bound to a form
virtual int getRealYPos(){return cc_yr;};
///set height of component on screen ///set height of component on screen
inline virtual void setHeight(const int& h){height = h;}; inline virtual void setHeight(const int& h){height = h;};
///set width of component on screen ///set width of component on screen
@@ -204,12 +216,7 @@ class CComponentsItem : public CComponents
///Pointer to the form object in which this item is embedded. ///Pointer to the form object in which this item is embedded.
///Is typically the type CComponentsForm or derived classes, default intialized with NULL ///Is typically the type CComponentsForm or derived classes, default intialized with NULL
CComponents *cc_parent; CComponentsItem *cc_parent;
///property: contains real x-position on screen
int cc_item_xr;
///property: contains real y-position on screen
int cc_item_yr;
///hides item, arg: no_restore=true causes no restore of background, but clean up pixel buffer if required ///hides item, arg: no_restore=true causes no restore of background, but clean up pixel buffer if required
void hideCCItem(bool no_restore = false); void hideCCItem(bool no_restore = false);
@@ -228,14 +235,7 @@ class CComponentsItem : public CComponents
CComponentsItem(); CComponentsItem();
///sets pointer to the form object in which this item is embedded. ///sets pointer to the form object in which this item is embedded.
virtual void setParent(CComponents *parent){cc_parent = parent;}; virtual void setParent(CComponentsItem *parent){cc_parent = parent;};
///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;};
///get real x-position on screen. Use this, if item contains own render methods and item is bound to a form
virtual int getRealXPos(){return cc_item_xr;};
///get real y-position on screen. Use this, if item contains own render methods and item is bound to a form
virtual int getRealYPos(){return cc_item_yr;};
///abstract: paint item, arg: do_save_bg see paintInit() above ///abstract: paint item, arg: do_save_bg see paintInit() above
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0; virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0;

View File

@@ -58,6 +58,8 @@ void CComponents::initVarBasic()
{ {
x = saved_screen.x = 0; x = saved_screen.x = 0;
y = saved_screen.y = 0; y = saved_screen.y = 0;
cc_xr = x;
cc_yr = y;
height = saved_screen.dy = CC_HEIGHT_MIN; height = saved_screen.dy = CC_HEIGHT_MIN;
width = saved_screen.dx = CC_WIDTH_MIN; width = saved_screen.dx = CC_WIDTH_MIN;

View File

@@ -54,7 +54,6 @@ 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;
cc_item_enabled = true; cc_item_enabled = true;
cc_item_selected = false; cc_item_selected = false;
cc_parent = NULL; cc_parent = NULL;