void MapItemListWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { CreateList(parent, dialog_look, rc, renderer.CalculateLayout(dialog_look)); GetList().SetLength(list.size()); UpdateButtons(); for (unsigned i = 0; i < list.size(); ++i) { const MapItem &item = *list[i]; if (HasDetails(item) || CanGotoItem(item)) { GetList().SetCursorIndex(i); break; } } }
void MapItemListWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { UPixelScalar item_height = dialog_look.list.font_bold->GetHeight() + Layout::Scale(6) + dialog_look.small_font->GetHeight(); assert(item_height > 0); CreateList(parent, dialog_look, rc, item_height); GetList().SetLength(list.size()); UpdateButtons(); for (unsigned i = 0; i < list.size(); ++i) { const MapItem &item = *list[i]; if (HasDetails(item) || CanGotoItem(item)) { GetList().SetCursorIndex(i); break; } } }
virtual bool CanActivateItem(unsigned index) const override { return HasDetails(*list[index]); }
void UpdateButtons() { const unsigned current = GetCursorIndex(); details_button->SetEnabled(HasDetails(*list[current])); goto_button->SetEnabled(CanGotoItem(current)); ack_button->SetEnabled(CanAckItem(current)); }
void UpdateButtons() { const unsigned current = GetCursorIndex(); details_button->SetEnabled(HasDetails(*list[current])); }
static void OnListIndexChange(unsigned i) { details_button->set_enabled(HasDetails(*(*list)[i])); }