If I add the kChecked flag, it adds checkmarks to all of them. I’m trying to make it like the preset manager with the presets when selected they get a checkmark.
for (auto i = 0; i < view_size_options_.size(); ++i)
{
option_size.SetFormatted (10, "%d%%", view_size_options_[i]);
const auto selectedItem = m_p_size_menu_->GetChosenItemIdx();
if (i == selectedItem)
m_p_size_menu_->AddItem (option_size.Get(), -1, IPopupMenu::Item::kChecked);
else
m_p_size_menu_->AddItem (option_size.Get());
}
m_p_size_menu_->SetFunction ([this] (IPopupMenu* pop)
{
if (pop->GetChosenItem() == nullptr || GetUI() == nullptr)
return;
const int size = view_size_options_[pop->GetChosenItemIdx()];
const float scale = static_cast<float> (size) / 100.f;
GetUI()->Resize (PLUG_WIDTH, PLUG_HEIGHT, scale, true);
});
// Setup main popup menu
setting_menu_ = new IPopupMenu ("[root]");
setting_menu_->AddItem (new IPopupMenu::Item ("Window Size", m_p_size_menu_));
I don’t know if it makes it more clear what I’m trying to accomplish