mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 17:31:20 +02:00
cc_frm: rework getUsed/getFree methods
This commit is contained in:
@@ -791,23 +791,61 @@ bool CComponentsForm::enableColBodyGradient(const int& enable_mode, const fb_pix
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CComponentsForm::getUsedDY() const
|
int CComponentsForm::getFreeDY() const
|
||||||
{
|
{
|
||||||
int y_res = 0;
|
int ret = 0;
|
||||||
for (size_t i= 0; i< v_cc_items.size(); i++)
|
int y_top = height;
|
||||||
if (v_cc_items.at(i))
|
int y_down = 0;
|
||||||
y_res = max(v_cc_items.at(i)->getYPos() + v_cc_items.at(i)->getHeight(), y_res);
|
|
||||||
|
|
||||||
return y_res;
|
for (size_t i= 0; i< v_cc_items.size(); i++)
|
||||||
|
{
|
||||||
|
if (v_cc_items.at(i))
|
||||||
|
{
|
||||||
|
// current values
|
||||||
|
int x_cur = v_cc_items.at(i)->getYPos();
|
||||||
|
int yh_cur = x_cur + v_cc_items.at(i)->getHeight();
|
||||||
|
|
||||||
|
// free top space
|
||||||
|
if (x_cur < y_top)
|
||||||
|
y_top = x_cur;
|
||||||
|
|
||||||
|
// free down space
|
||||||
|
if (yh_cur > y_down)
|
||||||
|
y_down = yh_cur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret = y_down - y_top;
|
||||||
|
ret = max(height - ret, 0);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CComponentsForm::getUsedDX() const
|
int CComponentsForm::getFreeDX() const
|
||||||
{
|
{
|
||||||
int x_res = 0;
|
int ret = 0;
|
||||||
for (size_t i= 0; i< v_cc_items.size(); i++)
|
int x_left = width;
|
||||||
if (v_cc_items.at(i))
|
int x_right = 0;
|
||||||
x_res = max(v_cc_items.at(i)->getXPos() + v_cc_items.at(i)->getWidth(), x_res);
|
|
||||||
|
|
||||||
return x_res;
|
for (size_t i= 0; i< v_cc_items.size(); i++)
|
||||||
|
{
|
||||||
|
if (v_cc_items.at(i))
|
||||||
|
{
|
||||||
|
// current values
|
||||||
|
int x_cur = v_cc_items.at(i)->getXPos();
|
||||||
|
int xw_cur = x_cur + v_cc_items.at(i)->getWidth();
|
||||||
|
|
||||||
|
// free left space
|
||||||
|
if (x_cur < x_left)
|
||||||
|
x_left = x_cur;
|
||||||
|
|
||||||
|
// free right space
|
||||||
|
if (xw_cur > x_right)
|
||||||
|
x_right = xw_cur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret = x_right - x_left;
|
||||||
|
ret = max(width - ret, 0);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -227,25 +227,25 @@ class CComponentsForm : public CComponentsItem
|
|||||||
* @return
|
* @return
|
||||||
* int, used lines
|
* int, used lines
|
||||||
*/
|
*/
|
||||||
int getUsedDY() const;
|
int getUsedDY() const {return height - getFreeDY();}
|
||||||
|
|
||||||
/**Function to get consumed space of items inside form in x direction.
|
/**Function to get consumed space of items inside form in x direction.
|
||||||
* @return
|
* @return
|
||||||
* int, used lines
|
* int, used lines
|
||||||
*/
|
*/
|
||||||
int getUsedDX() const;
|
int getUsedDX() const {return width - getFreeDX();}
|
||||||
|
|
||||||
/**Function to get free usable space of items inside form in y direction.
|
/**Function to get free usable space of items inside form in y direction.
|
||||||
* @return
|
* @return
|
||||||
* int, free lines
|
* int, free lines
|
||||||
*/
|
*/
|
||||||
int getFreeDY() const {return height - getUsedDY();}
|
int getFreeDY() const;
|
||||||
|
|
||||||
/**Function to get free usable space of items inside form in x direction.
|
/**Function to get free usable space of items inside form in x direction.
|
||||||
* @return
|
* @return
|
||||||
* int, free lines
|
* int, free lines
|
||||||
*/
|
*/
|
||||||
int getFreeDX() const {return width - getUsedDX();}
|
int getFreeDX() const;
|
||||||
|
|
||||||
///returns pointer to selected item, return value as CComponentsItem*, returns NULL: if is nothing selected
|
///returns pointer to selected item, return value as CComponentsItem*, returns NULL: if is nothing selected
|
||||||
CComponentsItem* getSelectedItemObject() const;
|
CComponentsItem* getSelectedItemObject() const;
|
||||||
|
Reference in New Issue
Block a user