Project

General

Profile

RE: Wt 3.3.4-RC1 and menus ยป WtMenuStackApp.h

Stas Magill, 11/07/2014 02:57 PM

 

#ifndef WTTEST_WTMENUSTACKAPP_H
#define WTTEST_WTMENUSTACKAPP_H

#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WStackedWidget>
#include <Wt/WMenu>
#include <Wt/WHBoxLayout>
#include <Wt/WVBoxLayout>
#include <Wt/WText>

using namespace Wt;

class WtMenuStackApp : public WApplication
{
public:
WtMenuStackApp(const WEnvironment& in_env) :
WApplication(in_env)
{
setTitle("WtTest");

WStackedWidget* contents= new WStackedWidget();

WContainerWidget* c1= new WContainerWidget(contents);
for (int i= 0; i < 10; i++)
{
new WText("Some text for item 1", c1);
new WBreak(c1);
}

WContainerWidget* c2= new WContainerWidget(contents);
for (int i= 0; i < 10; i++)
{
new WText("Some text for item 2", c2);
new WBreak(c2);
}

WMenu* menu= new WMenu(contents);

menu->addItem("Item 1", c1, WMenuItem::PreLoading);
menu->addItem("Item 2", c2, WMenuItem::PreLoading);

WHBoxLayout* hLayout= new WHBoxLayout();
hLayout->setContentsMargins(0, 0, 0, 0);
hLayout->addWidget(menu, 0);
hLayout->addWidget(contents, 1);

WContainerWidget* divContent= new WContainerWidget();
divContent->setLayout(hLayout);

WVBoxLayout* vLayout = new WVBoxLayout(root());
vLayout->setContentsMargins(0, 0, 0, 0);
vLayout->addWidget(new WText("Top line"), 0);
vLayout->addWidget(divContent, 1);
}

private:
};

#endif
    (1-1/1)