Split button

A split button is a widget composed of an action button in addition to a drop-down button which are shown beside each other.

The action button of a WSplitButton is implemented as a WPushButton while the drop-down button is implemented as a push button with a WPopupMenu.

Example
source
#include <Wt/WContainerWidget.h>
#include <Wt/WPopupMenu.h>
#include <Wt/WPushButton.h>
#include <Wt/WSplitButton.h>
#include <Wt/WText.h>

auto container = std::make_unique<Wt::WContainerWidget>();

Wt::WSplitButton *sb = container->addNew<Wt::WSplitButton>("Save");

Wt::WText *out = container->addNew<Wt::WText>();
out->setMargin(10, Wt::Side::Left);

auto popup = std::make_unique<Wt::WPopupMenu>();
auto popup_ = popup.get();
popup_->addItem("Save As ...");
popup_->addItem("Save Template");

sb->dropDownButton()->setMenu(std::move(popup));

sb->actionButton()->clicked().connect([=] {
    out->setText("Saved!");
});

popup_->itemSelected().connect([=] (Wt::WMenuItem *item) {
    out->setText(item->text());
});