void ComboBox::setOpen(bool b) { m_open = b; if (m_open) { int newHeight = m_height; for(unsigned int i = 0; i < m_items.size(); i++) { ComboBoxItem* item = m_items.at(i); item->setSize(m_width, ARK2D::getRenderer()->getFont()->getLineHeight()); item->m_parent = m_parent; newHeight += item->getHeight(); } m_height = newHeight; } else { m_height = m_originalHeight; } }
void ComboBox::setOpen(bool b) { m_open = b; if (m_open) { int newHeight = m_height; for(unsigned int i = 0; i < m_items.size(); i++) { ComboBoxItem* item = m_items.at(i); item->setSize(m_width, ARK2D::getRenderer()->getFont()->getLineHeight()); item->m_parent = m_parent; newHeight += item->getHeight(); } m_height = newHeight; } else { m_height = m_originalHeight; // state state to off for all children for(unsigned int i = 0; i < m_items.size(); i++) { m_items[i]->m_state = Button::STATE_OFF; } } }