Project

General

Profile

Bug #1802 ยป bootstrap_button_bug_20130331a.cc

Bruce Toll, 04/01/2013 01:24 PM

 
#include <Wt/WServer>
#include <Wt/WBootstrapTheme>
#include <Wt/WEnvironment>
#include <Wt/WPushButton>
#include <Wt/WTemplate>

using namespace Wt;

class TestApplication : public WApplication
{
public:
TestApplication(const WEnvironment& env);
~TestApplication();
void setPushButtonLink();

private:
Wt::WBootstrapTheme *bs_theme_;
Wt::WPushButton *pb1_;
Wt::WPushButton *pb2_;
};

TestApplication::TestApplication(const WEnvironment& env)
: WApplication(env), bs_theme_(0), pb2_(0)
{
setTitle("Test Application");
if (env.getParameter("polished")) {
setCssTheme("polished");
}
else if (env.getParameter("default")) {
setCssTheme("default");
}
else {
bs_theme_ = new Wt::WBootstrapTheme();
setTheme(bs_theme_);
}

WContainerWidget *w = new WContainerWidget(root());

pb1_ = new Wt::WPushButton("Click here for options", w);

pb2_ = new Wt::WPushButton("Click for external link", w);
pb2_->setHidden(true);

if (env.getParameter("workaround")) {
pb2_->setLink(WLink("/"));
}

pb1_->clicked().connect(this, &TestApplication::setPushButtonLink);
}

void TestApplication::setPushButtonLink() {
pb2_->setLink(WLink("http://www.webtoolkit.eu"));
pb2_->setLinkTarget(TargetNewWindow);
pb2_->setHidden(false);
}

TestApplication::~TestApplication()
{
delete bs_theme_;
}

WApplication *createApplication(const WEnvironment& env)
{
return new TestApplication(env);
}

int main(int argc, char **argv)
{
int status = WRun(argc, argv, &createApplication);
return status;
}
    (1-1/1)