mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 08:51:04 +02:00
cc_frm_footer.cpp: consider offset size for button container
Avoids overlapping button container on the right border of footer.
Origin commit data
------------------
Branch: ni/coolstream
Commit: da950c8953
Author: Thilo Graf <dbt@novatux.de>
Date: 2020-12-07 (Mon, 07 Dec 2020)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -131,6 +131,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
|
||||
* Default width this is footer width minus offset left and right of button container (btn_container).
|
||||
*/
|
||||
int w_container = max(0, width - 2*cch_offset);
|
||||
|
||||
/*
|
||||
* Calculate current available space for button container depends of already embedded footer objects.
|
||||
* If already existing some items then subtract those width from footer width.
|
||||
@@ -141,8 +142,9 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
|
||||
if (getCCItem(i) != btn_container) // avoid to point on button container itself!
|
||||
w_container -= getCCItem(i)->getWidth();
|
||||
}
|
||||
w_container = max(0, w_container);
|
||||
w_container = max(0, w_container - 2*cch_offset);
|
||||
}
|
||||
|
||||
/*
|
||||
* On defined parameter chain_width (means width of button container),
|
||||
* compare and if required recalculate current available space for button container depends of passed chain with parameter.
|
||||
@@ -152,7 +154,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
|
||||
if (chain_width <= w_container){
|
||||
w_container = chain_width;
|
||||
}else{
|
||||
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsFooter]\t[%s - %d], NOTE: parameter chain_width is too large, defined value = %d, fallback to maximal value = %d => \033[0m\n",
|
||||
dprintf(DEBUG_DEBUG, "\033[33m[CComponentsFooter]\t[%s - %d], NOTE: parameter chain_width is too large, defined value = %d, fallback to maximal value = %d => \033[0m\n",
|
||||
__func__, __LINE__, chain_width, w_container);
|
||||
}
|
||||
}
|
||||
@@ -284,7 +286,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
|
||||
btn->setWidth(w_btn_tmp); // value = 0 forces recalculation, refresh is required
|
||||
btn->Refresh();
|
||||
w_used_tmp -= max(0, btn->getWidth());
|
||||
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsFooter]\t[%s - %d] item [%d] -> w_used_tmp [%d] :: w_btn_tmp [%d] w_container = %d \t%s\033[0m\n", __func__, __LINE__, (int)i, w_used_tmp, w_btn_tmp, w_container, btn->getItemName().c_str());
|
||||
dprintf(DEBUG_DEBUG, "\033[33m[CComponentsFooter]\t[%s - %d] item [%d] -> w_used_tmp [%d] :: w_btn_tmp [%d] w_container = %d \t%s\033[0m\n", __func__, __LINE__, (int)i, w_used_tmp, w_btn_tmp, w_container, btn->getItemName().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user