I just tried it out, thanks a ton! It's a bit odd that the titlebar isn't included and as you said it needs large borders. Nonetheless, it gives me a good foundation to tweak some things to my project. I really appreciate your help, Texus!
I do have another question related to the ListBox widget. I'm trying to size it automatically:
void rightClickMenuCreate(tgui::Gui& gui, sf::Vector2f position, tgui::Theme::Ptr& theme, std::vector<std::string>&& options)
{
popumMenu = theme->load("ListBox");
std::size_t Max = 0;
for (const auto& i: options)
{
popumMenu->addItem(i);
Max = std::max(Max, WIDTH_OF_I);//<-------
}
popumMenu->setItemHeight(25);
popumMenu->setPosition(position);
popumMenu->setOpacity(0.8f);
popumMenu->setSize(Max, popumMenu->getItemHeight() * popumMenu->getItemCount() + popumMenu->getRenderer()->getPadding().top * 2);
popumMenu->connectEx("MouseReleased", [&](const tgui::Callback& e){rightClickMenuHandle(e.text); gui.remove(popumMenu); popumMenu = nullptr;});
popumMenu->showWithEffect(tgui::ShowAnimationType::Fade, sf::milliseconds(275));
gui.add(popumMenu);
}
How would you go about determining "WIDTH_OF_I"? I figured I'd create a sf::Text before the loop and set it's font to the ListBox's renderer's font. Then set the text in the loop and get its bounds. Is there a better way to do this?