Project

General

Profile

Bug #1762 » menu_internal_path.cpp

test-case WMenu with internal paths and no JS - Стойчо Стефанов Stoycho Stefanov, 03/26/2013 02:14 PM

 
/*
* menu_internal_path.cpp
*
* Created on: 26.03.2013
* Author: Stoycho Stefanov
*/
#include <Wt/WApplication>
#include <Wt/WEnvironment>
#include <Wt/WMenu>
#include <Wt/WMenuItem>
#include <Wt/WText>
#include <Wt/WContainerWidget>
#include <Wt/WHBoxLayout>
#include <Wt/WStackedWidget>
#include <iostream>


using namespace Wt;
using namespace std;


class MyApp : public WApplication {
public:
MyApp(const WEnvironment& env)
:
WApplication(env){
WContainerWidget *w = root();
w->decorationStyle().backgroundColor().setRgb(14,232,133,142);
WHBoxLayout *layout = new WHBoxLayout();
WStackedWidget *content = new WStackedWidget(w);
content->setOverflow(WContainerWidget::OverflowAuto);
WMenu *menu = new WMenu(content, Vertical);
// menu_->setRenderAsList(true);
menu->setInternalPathEnabled();
menu->setInternalBasePath("/");
menu->addItem("menu1",new WText("content of menu 1"));
menu->addItem("menu2",new WText("content of menu 2"));
menu->addItem("menu3",new WText("content of menu 3"));
layout->addWidget(menu,0);
layout->addWidget(content,1);
w->setLayout(layout);
}
};

WApplication *createApplication(const WEnvironment& env) {
WApplication *app = new MyApp(env);
app->setTitle("bug report");
app->setCssTheme("polished");
app->refresh();
return app;
};

int main(int argc, char **argv) {
cout << "Wt = " << WT_VERSION_STR <<endl;
return WRun(argc, argv, &createApplication);
}




    (1-1/1)