I would like to be able to take one menu and append it to another, a bit like this pseudo-code:
//---pseudo-code---//
PopupMenu menu1 = PopupMenu {item1, item2, item3};
PopupMenu menu2 = PopupMenu {item4, item5, item6};
PopupMenu combinedMenu = menu1.appendMenu(menu2); // or any other way of joining the two menus
// combinedMenu now = {item1, item2, item3, item4, item5, item6}
This seems like a simple task, but I can’t seem to find a way of doing it, because there are no getter methods in the PopupMenu class. I can think of three possibilities, but none of them seem to be allowed:
- A
Item* PopupMenu::getItem(int)method, which would allow you to fetch menu items and copy them; - A
void PopupMenu::appendMenu(const PopupMenu&)method, which would allow you to join menus directly, as imagined in my pseudo-code; -
.begin()and.end()iterators which would allow you to iterate over the menu in a for each loop.
Is some other way of doing this that I haven’t thought of?
It’s not a disaster if I can’t get this done, but I’m surprised because it seems like it should be easy. Is there a reason why there are no getters for the PopupMenu class?
