Esempio n. 1
0
Menu::Menu(const String& name, MenuManager* manager):
    myName(name),
    myManager(manager),
    myActiveSubMenu(NULL),
    myParent(NULL)
{
    UiModule* ui = UiModule::instance();
    WidgetFactory* wf = ui->getWidgetFactory();
    myContainer = wf->createContainer("container", ui->getUi(), Container::LayoutVertical);
    myContainer->setPosition(Vector2f(10, 10));
    myContainer->setStyleValue("fill", "#000000d0");
    //myContainer->setLayout(Container::LayoutHorizontal);

    my3dSettings.enable3d = MenuManager::instance()->is3dMenuEnabled();
    myContainer->setAutosize(true);
    myContainer->setHorizontalAlign(Container::AlignLeft);

    // By default menus are attached to the default camera.
    my3dSettings.node = manager->getEngine()->getDefaultCamera();
    firstHide = true;
}
Esempio n. 2
0
Container* Container::create(Layout layout, Container* container)
{
    WidgetFactory* wf = UiModule::instance()->getWidgetFactory();
    return wf->createContainer(sContainerNameGenerator.generate(), container, layout);
}
Esempio n. 3
0
MenuItem::MenuItem(Type type, Menu* owner):
    myMenu(owner),
    myType(type),
    myListener(NULL),
    myButton(NULL),
    myCommand(NULL),
    myWidget(NULL),
    myUserData(NULL),
    mySubMenu(NULL)
{
    UiModule* ui = owner->getManager()->getUiModule();
    WidgetFactory* wf = ui->getWidgetFactory();

    if(type == MenuItem::SubMenu)
    {
        myButton = wf->createButton("subMenu_button", myMenu->myContainer);
        myButton->setText("Button");
        myWidget = myButton;
        myWidget->setUIEventHandler(this);

        mySubMenu = myMenu->getManager()->createMenu("Submenu");
    }
    else if(type == MenuItem::Button)
    {
        myButton = wf->createButton("button", myMenu->myContainer);
        myButton->setText("Button");
        myWidget = myButton;
    }
    else if(type == MenuItem::Slider)
    {
        mySlider = wf->createSlider("slider", myMenu->myContainer);
        myWidget = mySlider;
    }
    else if(type == MenuItem::Checkbox)
    {
        myButton = wf->createButton("button", myMenu->myContainer);
        myButton->setText("Checkbox");
        myButton->setCheckable(true);
        myWidget = myButton;
    }
    else if(type == MenuItem::Label)
    {
        myLabel = wf->createLabel("label", myMenu->myContainer);
        myLabel->setText("Label");
        myWidget = myLabel;
    }
    else if(type == MenuItem::Image)
    {
        myImage = wf->createImage("img", myMenu->myContainer);
        myWidget = myImage;
    }
    else if(type == MenuItem::Container)
    {
        myContainer = wf->createContainer("container", myMenu->myContainer);
        myWidget = myContainer;
    }

    //myWidget->setStyleValue("fill", "#00000090");

    myWidget->setAutosize(true);
}