Minor refactoring
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5412 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
36303b806d
commit
dbce446f81
@ -178,12 +178,12 @@ void DynamicRibbonWidget::add()
|
|||||||
//std::cout << "ribbon : getNewID returns " << m_ids[i] << std::endl;
|
//std::cout << "ribbon : getNewID returns " << m_ids[i] << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
setSubElements();
|
buildInternalStructure();
|
||||||
}
|
}
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void DynamicRibbonWidget::setSubElements()
|
void DynamicRibbonWidget::buildInternalStructure()
|
||||||
{
|
{
|
||||||
//printf("****DynamicRibbonWidget::setSubElements()****\n");
|
//printf("****DynamicRibbonWidget::buildInternalStructure()****\n");
|
||||||
|
|
||||||
// ---- Clean-up what was previously there
|
// ---- Clean-up what was previously there
|
||||||
for (int i=0; i<m_children.size(); i++)
|
for (int i=0; i<m_children.size(); i++)
|
||||||
@ -673,7 +673,7 @@ void DynamicRibbonWidget::updateItemDisplay()
|
|||||||
// ---- Check if we need to update the number of icons in the ribbon
|
// ---- Check if we need to update the number of icons in the ribbon
|
||||||
if ((int)m_items.size() != m_previous_item_count)
|
if ((int)m_items.size() != m_previous_item_count)
|
||||||
{
|
{
|
||||||
setSubElements();
|
buildInternalStructure();
|
||||||
m_previous_item_count = m_items.size();
|
m_previous_item_count = m_items.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,7 +683,7 @@ void DynamicRibbonWidget::updateItemDisplay()
|
|||||||
const int row_amount = m_rows.size();
|
const int row_amount = m_rows.size();
|
||||||
const int item_amount = m_items.size();
|
const int item_amount = m_items.size();
|
||||||
|
|
||||||
//FIXME: isn't this set by 'setSubElements' already?
|
//FIXME: isn't this set by 'buildInternalStructure' already?
|
||||||
m_needed_cols = (int)ceil( (float)item_amount / (float)row_amount );
|
m_needed_cols = (int)ceil( (float)item_amount / (float)row_amount );
|
||||||
|
|
||||||
//const int max_scroll = std::max(m_col_amount, m_needed_cols) - 1;
|
//const int max_scroll = std::max(m_col_amount, m_needed_cols) - 1;
|
||||||
|
@ -142,7 +142,7 @@ namespace GUIEngine
|
|||||||
EventPropagation focused(const int playerID);
|
EventPropagation focused(const int playerID);
|
||||||
|
|
||||||
/** Removes all previously added contents icons, and re-adds them (calculating the new amount) */
|
/** Removes all previously added contents icons, and re-adds them (calculating the new amount) */
|
||||||
void setSubElements();
|
void buildInternalStructure();
|
||||||
|
|
||||||
/** Call this to scroll within a scrollable ribbon */
|
/** Call this to scroll within a scrollable ribbon */
|
||||||
void scroll(const int x_delta);
|
void scroll(const int x_delta);
|
||||||
|
Loading…
Reference in New Issue
Block a user