eventlist: use footer instance at heap

Some settings were never applied on runtime.
This ensures re assign possible changed settings (e.g. colors).
This commit is contained in:
2022-03-04 20:33:32 +01:00
parent 82a04ed87c
commit 96174bc313
2 changed files with 16 additions and 9 deletions

View File

@@ -121,7 +121,7 @@ CEventList::CEventList()
header = NULL;
pb = NULL;
navibar = NULL;
footer.enableShadow(CC_SHADOW_ON, -1, true);
footer = NULL;
}
CEventList::~CEventList()
@@ -140,6 +140,9 @@ void CEventList::ResetModules()
if (pb){
delete pb; pb = NULL;
}
if (footer){
delete footer; footer = NULL;
}
}
void CEventList::UpdateTimerList(void)
@@ -704,7 +707,6 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna
void CEventList::hide()
{
ResetModules();
footer.kill();
frameBuffer->paintBackgroundBoxRel(x, y, full_width + OFFSET_SHADOW, height + OFFSET_SHADOW);
}
@@ -1071,15 +1073,20 @@ void CEventList::paintFoot(t_channel_id channel_id)
btn_cnt++;
// paint footer only on changed content
size_t btn_size = 0;
if (footer.getButtonChainObject())
if (!footer)
{
btn_size = footer.getButtonChainObject()->size();
footer = new CComponentsFooter();
footer->enableShadow(CC_SHADOW_ON, -1, true);
}
size_t btn_size = 0;
if (footer->getButtonChainObject())
{
btn_size = footer->getButtonChainObject()->size();
if (btn_cnt == (int)btn_size)
{
for(size_t i=0; i < btn_size; i++)
{
CComponentsButton *btn = static_cast<CComponentsButton*> (footer.getButtonChainObject()->getCCItem(i));
CComponentsButton *btn = static_cast<CComponentsButton*> (footer->getButtonChainObject()->getCCItem(i));
if (g_Locale->getString(buttons[i].locale) != btn->getCaptionString())
{
btn->setCaption(buttons[i].locale);
@@ -1090,8 +1097,8 @@ void CEventList::paintFoot(t_channel_id channel_id)
}
}
if (!footer.isPainted() || btn_cnt != (int)btn_size)
footer.paintButtons(x, y + height - OFFSET_SHADOW - footer_height, full_width, footer_height, btn_cnt, buttons);
if (!footer->isPainted() || btn_cnt != (int)btn_size)
footer->paintButtons(x, y + height - OFFSET_SHADOW - footer_height, full_width, footer_height, btn_cnt, buttons);
}
// -- Eventlist Menu Handler Class