示例#1
0
WidgetGallery::WidgetGallery()
  : WContainerWidget()
{
  setOverflow(OverflowHidden);

  navigation_ = new Wt::WNavigationBar();
  navigation_->addStyleClass("main-nav");
  navigation_->setTitle("Wt Widget Gallery",
			"https://www.webtoolkit.eu/widgets");
  navigation_->setResponsive(true);

  contentsStack_ = new Wt::WStackedWidget();

  Wt::WAnimation animation(Wt::WAnimation::Fade,
			   Wt::WAnimation::Linear,
			   200);
  contentsStack_->setTransitionAnimation(animation, true);

  /*
   * Setup the top-level menu
   */
  Wt::WMenu *menu = new Wt::WMenu(contentsStack_, 0);
  menu->setInternalPathEnabled();
  menu->setInternalBasePath("/");

  addToMenu(menu, "Layout", new Layout());
  addToMenu(menu, "Forms", new FormWidgets());
  addToMenu(menu, "Navigation", new Navigation());
  addToMenu(menu, "Trees & Tables", new TreesTables())
    ->setPathComponent("trees-tables");
  addToMenu(menu, "Graphics & Charts", new GraphicsWidgets())
    ->setPathComponent("graphics-charts");
  // addToMenu(menu, "Events", new EventsDemo());
  addToMenu(menu, "Media", new Media());

  navigation_->addMenu(menu);

  /*
   * Add it all inside a layout
   */
  Wt::WVBoxLayout *layout = new Wt::WVBoxLayout(this);
  layout->addWidget(navigation_);
  layout->addWidget(contentsStack_, 1);
  layout->setContentsMargins(0, 0, 0, 0);
}
示例#2
0
void PopupChatWidget::createLayout(Wt::WWidget *messages,
				   Wt::WWidget *userList,
				   Wt::WWidget *messageEdit,
				   Wt::WWidget *sendButton,
				   Wt::WWidget *logoutButton)
{
  Wt::WVBoxLayout *layout = new Wt::WVBoxLayout();
  layout->setContentsMargins(0, 0, 0, 0);
  layout->setSpacing(0);

  Wt::WContainerWidget *bar = createBar();

  layout->addWidget(bar);
  layout->addWidget(messages, 1);
  layout->addWidget(messageEdit);

  setLayout(layout);
}
示例#3
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;
}
示例#4
0
WeldingTypesPannel::WeldingTypesPannel() {
    this->setStyleClass("welding-type");

    Wt::WVBoxLayout *vlayout = new Wt::WVBoxLayout(this);
    vlayout->setContentsMargins(5, 5, 5, 5);
    vlayout->addWidget(new Wt::WText(Wt::WString::tr("WeldingTypesPannel")));
    Wt::WPushButton *button = new Wt::WPushButton(Wt::WString::tr("gas_check_button"));
    button->clicked().connect(std::bind([=] () {
        //canvas->clear();
    }));
    vlayout->addWidget(button);
    vlayout->addWidget(new LightDiode("indication_standart_welding"));
    vlayout->addWidget(new LightDiode("indication_pulse_welding"));
    button = new Wt::WPushButton(Wt::WString::tr("welding_type_button"));
    button->clicked().connect(std::bind([=] () {
        //canvas->clear();
    }));
    vlayout->addWidget(button);
}