示例#1
0
文件: Main.cpp 项目: runya-v/run
        /*!
         * \brief Конструктор класса сайта.
         * \param[in] Класс хранения окружения сайта
         */
        CompanyesApplication(const Wt::WEnvironment& env)
            : Wt::WApplication(env)
        {
            this->messageResourceBundle().use(this->appRoot() + "rus_locale");
            this->useStyleSheet(this->appRoot() + "main.css");
            this->setTitle(Wt::WString::tr("Title"));

            Wt::WApplication *app = Wt::WApplication::instance();
            app->setLoadingIndicator(new Wt::WOverlayLoadingIndicator());
            app->styleSheet().addRule("body", "margin: 0px");

            Wt::WStackedWidget* contents = new Wt::WStackedWidget();
            contents->setOverflow(Wt::WContainerWidget::OverflowAuto);
            contents->setPositionScheme(Wt::Relative);

            Wt::WMenu* menu = new Wt::WMenu(contents, Wt::Vertical, 0);
            menu->setRenderAsList(true);
            menu->setStyleClass("menu");

            std::string absolute_path = boost::filesystem::system_complete(boost::filesystem::path(".")).string();
            new RegionsCreator(absolute_path, contents, menu);

            Wt::WHBoxLayout* hlayout = new Wt::WHBoxLayout();
            hlayout->addWidget(menu, 0);
            hlayout->addWidget(contents, 1);

            Wt::WVBoxLayout* vlayout = new Wt::WVBoxLayout(this->root());
            vlayout->addWidget(new Wt::WText(Wt::WString::tr("Header")), 0);
            vlayout->addLayout(hlayout, 1);
        }
示例#2
0
文件: mainpage.cpp 项目: nickits/cmst
MainPage::MainPage(Wt::WApplication* app): WContainerWidget()
{
	app_ = app;
	contentsStack_ = new Wt::WStackedWidget();
	contentsStack_->setOverflow(WContainerWidget::OverflowAuto);
	contentsStack_->setStyleClass("contents");

	/*
	* Setup the menu (and submenus)
	*/
	Wt::WMenu *menu = new Wt::WMenu(contentsStack_, Wt::Vertical, 0);
	menu->setRenderAsList(true);
	menu->setStyleClass("menu");
	menu->setInternalPathEnabled();
	menu->setInternalBasePath("/");
	menu->itemSelected().connect(this, &MainPage::selectedMenuItem);
	
	Wt::WContainerWidget *w = new Wt::WContainerWidget(this);
	Wt::WBorderLayout *layout = new Wt::WBorderLayout();
	layout->addWidget(new Wt::WText("North-side is best"), Wt::WBorderLayout::North);
	layout->addWidget(new Wt::WText("South-side is best"), Wt::WBorderLayout::South);
	layout->addWidget(menu, Wt::WBorderLayout::West);
	layout->addWidget(contentsStack_, Wt::WBorderLayout::Center);

	// use layout but do not justify vertically
	w->setLayout(layout, Wt::AlignTop | Wt::AlignJustify);
	
	menu->addItem("Basics", new ClientsPage(this, &session_));
	menu->addItem("Form Widgets", new CommonPage(this, &session_));
	menu->addItem("Form Validators", new CommonPage(this, &session_));

	Wt::WSubMenuItem *smi = new Wt::WSubMenuItem("Sub menu", new CommonPage(this, &session_));
	Wt::WMenu *subMenu = new Wt::WMenu(contentsStack_, Wt::Vertical, 0);
	subMenu->setRenderAsList(true);

	smi->setSubMenu(subMenu);
	
	menu->addItem(smi);

	subMenu->setInternalPathEnabled();
	subMenu->setInternalBasePath("/" + smi->pathComponent());
	subMenu->setStyleClass("menu submenu");
	subMenu->itemSelected().connect(this, &MainPage::selectedMenuItem);
	
	subMenu->addItem("Sub Item 1", new CommonPage(this, &session_));
	subMenu->addItem("Sub Item 2", new CommonPage(this, &session_));
}