ComboBox::ComboBox(const IRect &rect, int drop_size, const char *prefix, CRange<const char*> values) :Window(rect), m_drop_size(drop_size), m_prefix(prefix) { m_button = make_shared<Button>(IRect(int2(0, 0), rect.size()), ""); m_dummy = make_shared<ListBox>(IRect(0, 0, 10, 10)); attach(m_button); for(auto value : values) addEntry(value, ColorId::white); if(!values.empty()) selectEntry(0); }
void Window::setInnerRect(const IRect &rect) { int2 isize = rect.size(); m_inner_rect.min = max(min(rect.min, {0, 0}), min(-isize + m_rect.size(), {0, 0})); m_inner_rect.max = m_inner_rect.min + isize; m_has_inner_rect = isize.x > m_rect.width() || isize.y > m_rect.height(); }