#include "Menu.h"

#include <AsynchronCall.h>

Menu::Menu(Screen* zScreen)
    : ReferenceCounter(),
      zScreen(zScreen)
{}

void Menu::show()
{
    zScreen->postAction([this]() {
        for (auto member : elements)
            zScreen->addMember(dynamic_cast<Drawable*>(member->getThis()));
        });
}

void Menu::hide()
{
    zScreen->postAction([this]() {
        for (auto member : elements)
            zScreen->removeMember(dynamic_cast<Drawable*>(member->getThis()));
    });
}