DialogButtonBar(WDialog& dialog) : MoreAwesomeTemplate(dialog.contents()) { setTemplateText(tr("dialog-button-bar")); bindAndCreateWidget(_okBtn, "ok-btn", tr("ok-btn")); bindAndCreateWidget(_cancelBtn, "cancel-btn", tr("cancel-btn")); _okBtn->clicked().connect(&dialog, &WDialog::accept); _cancelBtn->clicked().connect(&dialog, &WDialog::reject); }
/** * @brief Gives you a nice pair of buttons * * @param parent Parent Widget */ ButtonBar(const WString& button1Text="", const WString& button2Text="", WContainerWidget* parent=0) : MoreAwesomeTemplate(parent) { WString btn1Text = button1Text.empty() ? WString::tr("OK") : button1Text; WString btn2Text = button2Text.empty() ? WString::tr("Cancel") : button2Text; setTemplateText(tr("button-bar")); setStyleClass("yui-gb button-bar"); bindAndCreateWidget(_btn1, "btn-1", btn1Text); bindAndCreateWidget(_btn2, "btn-2", btn2Text); }