Esempio n. 1
0
void MainPage::setMainPage(){
    Wt::WHBoxLayout *mainLayout = new Wt::WHBoxLayout();
    root()->setLayout(mainLayout);
    mainLayout->setContentsMargins(0, 10, 0, 0);
    mainLayout->setSpacing(0);


    Wt::WStackedWidget *contents = new Wt::WStackedWidget(0);
    contents->setOverflow(WContainerWidget::OverflowAuto);    
    contents->setStyleClass("contentsp");
    contents->setPositionScheme(Relative); // without needs testing on IE...

    // create a menu
    Wt::WMenu *menu = new Wt::WMenu(contents, Wt::Vertical, 0);
    menu->setRenderAsList(true);
    menu->addStyleClass("menu");

    mainLayout->addWidget(menu);
    mainLayout->addWidget(contents,1);
    mainLayout->addWidget(new Notification());    

    TabWidget *ftp = new TabWidget();
    ftp->addTab("General options", new Wt::WText("Not yet available"));
    ftp->addTab("Users management", new FtpUserController());

    TabWidget *samba = new TabWidget();
    samba->addTab("General options", new Wt::WText("Not yet available"));
    samba->addTab("More options", new Wt::WText("Not yet available"));

    menu->addItem("FTP", ftp);
    menu->addItem("Samba", samba);



    std::vector<WWidget*>::const_iterator a;

    for(a = root()->children().begin();
        a < (root()->children().end());
        a++){        

        if (dynamic_cast<WText*>(*a) != NULL)
          {
            std::cout << dynamic_cast<WText*>(*a)->text() << std::endl;
          }
    }

}
Esempio n. 2
0
Wt::WMenuItem *WidgetGallery::addToMenu(Wt::WMenu *menu,
					const Wt::WString& name,
					TopicWidget *topic)
{
  Wt::WContainerWidget *result = new Wt::WContainerWidget();

  Wt::WContainerWidget *pane = new Wt::WContainerWidget();

  Wt::WVBoxLayout *vLayout = new Wt::WVBoxLayout(result);
  vLayout->setContentsMargins(0, 0, 0, 0);
  vLayout->addWidget(topic);
  vLayout->addWidget(pane, 1);

  Wt::WHBoxLayout *hLayout = new Wt::WHBoxLayout(pane);

  Wt::WMenuItem *item = new Wt::WMenuItem(name, result);
  menu->addItem(item);

  Wt::WStackedWidget *subStack = new Wt::WStackedWidget();
  subStack->addStyleClass("contents");
  subStack->setOverflow(WContainerWidget::OverflowAuto);

  /*
  Wt::WAnimation animation(Wt::WAnimation::Fade,
			   Wt::WAnimation::Linear,
			   100);
  subStack->setTransitionAnimation(animation, true);
  */

  Wt::WMenu *subMenu = new Wt::WMenu(subStack);
  subMenu->addStyleClass("nav-pills nav-stacked");
  subMenu->setWidth(200);

  hLayout->addWidget(subMenu);
  hLayout->addWidget(subStack,1);

  subMenu->setInternalPathEnabled();
  subMenu->setInternalBasePath("/" + item->pathComponent());

  topic->populateSubMenu(subMenu);

  return item;
}