A toolbar is a widget composed of child widgets which are shown beside each other.
#include <Wt/WContainerWidget.h> #include <Wt/WPopupMenu.h> #include <Wt/WPushButton.h> #include <Wt/WText.h> #include <Wt/WToolBar.h> namespace { std::unique_ptr<Wt::WPushButton> createColorButton(const char *className, const Wt::WString& text) { auto button = std::make_unique<Wt::WPushButton>(); button->setTextFormat(Wt::TextFormat::XHTML); button->setText(text); button->addStyleClass(className); return button; } } auto container = std::make_unique<Wt::WContainerWidget>(); Wt::WToolBar *toolBar = container->addNew<Wt::WToolBar>(); toolBar->addButton(createColorButton("btn-primary", "Primary")); toolBar->addButton(createColorButton("btn-danger", "Danger")); toolBar->addButton(createColorButton("btn-success", "Success")); toolBar->addButton(createColorButton("btn-warning", "Warning")); toolBar->addButton(createColorButton("btn-inverse", "Inverse")); toolBar->addButton(createColorButton("", "Default")); auto resetButton = std::make_unique<Wt::WPushButton>("Reset"); toolBar->addSeparator(); toolBar->addButton(std::move(resetButton));