WWidget *EventsDemo::wMouseEvent() { WContainerWidget *result = new WContainerWidget(); topic("WMouseEvent", result); addText(tr("events-WMouseEvent"), result); WContainerWidget *c = new WContainerWidget(result); WHBoxLayout *hlayout = new WHBoxLayout; c->setLayout(hlayout); WContainerWidget *l = new WContainerWidget; WContainerWidget *r = new WContainerWidget; new WText("clicked<br/>doubleClicked<br/>mouseWentOut<br/>mouseWentOver", l); new WText("mouseWentDown<br/>mouseWentUp<br/>mouseMoved<br/>mouseWheel", r); hlayout->addWidget(l); hlayout->addWidget(r); c->resize(600, 300); l->decorationStyle().setBackgroundColor(Wt::gray); r->decorationStyle().setBackgroundColor(Wt::gray); // prevent that firefox interprets drag as drag&drop action l->setStyleClass("unselectable"); r->setStyleClass("unselectable"); l->clicked().connect(this, &EventsDemo::showClicked); l->doubleClicked().connect(this, &EventsDemo::showDoubleClicked); l->mouseWentOut().connect(this, &EventsDemo::showMouseWentOut); l->mouseWentOver().connect(this, &EventsDemo::showMouseWentOver); r->mouseMoved().connect(this, &EventsDemo::showMouseMoved); r->mouseWentUp().connect(this, &EventsDemo::showMouseWentUp); r->mouseWentDown().connect(this, &EventsDemo::showMouseWentDown); r->mouseWheel().connect(this, &EventsDemo::showMouseWheel); r->mouseWheel().preventDefaultAction(true); l->setAttributeValue ("oncontextmenu", "event.cancelBubble = true; event.returnValue = false; return false;"); r->setAttributeValue ("oncontextmenu", "event.cancelBubble = true; event.returnValue = false; return false;"); new WBreak(result); new WText("Last event: ", result); mouseEventType_ = new WText(result); new WBreak(result); mouseEventDescription_ = new WText(result); return result; }
WTreeTable::WTreeTable() { setImplementation(std::unique_ptr<WContainerWidget>(impl_ = new WContainerWidget())); setStyleClass("Wt-treetable"); setPositionScheme(PositionScheme::Relative); headers_ = impl_->addWidget(cpp14::make_unique<WContainerWidget>()); headers_->setStyleClass("Wt-header header"); /* * spacer for when a scroll bar is visible */ WContainerWidget *spacer = headers_->addWidget(cpp14::make_unique<WContainerWidget>()); spacer->setStyleClass("Wt-sbspacer"); headerContainer_ = headers_->addWidget(cpp14::make_unique<WContainerWidget>()); headerContainer_->setFloatSide(Side::Right); headers_->addWidget(cpp14::make_unique<WText>()); columnWidths_.push_back(WLength::Auto); WContainerWidget *content = impl_->addWidget(cpp14::make_unique<WContainerWidget>()); content->setStyleClass("Wt-content"); if (!wApp->environment().agentIsIE()) content->setOverflow(Overflow::Auto); else content->setAttributeValue ("style", "overflow-y: auto; overflow-x: hidden; zoom: 1"); tree_ = content->addWidget(cpp14::make_unique<WTree>()); tree_->setMargin(3, Side::Top); tree_->resize(WLength(100, LengthUnit::Percentage), WLength::Auto); }
WTreeTable::WTreeTable(WContainerWidget *parent) : WCompositeWidget(parent) { setImplementation(impl_ = new WContainerWidget()); setStyleClass("Wt-treetable"); setPositionScheme(Relative); headers_ = new WContainerWidget(impl_); headers_->setStyleClass("Wt-header header"); /* * spacer for when a scroll bar is visible */ WContainerWidget *spacer = new WContainerWidget(headers_); spacer->setStyleClass("Wt-sbspacer"); headerContainer_ = new WContainerWidget(headers_); headerContainer_->setFloatSide(Right); headers_->addWidget(new WText()); columnWidths_.push_back(WLength::Auto); WContainerWidget *content = new WContainerWidget(impl_); content->setStyleClass("Wt-content"); if (!wApp->environment().agentIsIE()) content->setOverflow(WContainerWidget::OverflowAuto); else content->setAttributeValue ("style", "overflow-y: auto; overflow-x: hidden; zoom: 1"); content->addWidget(tree_ = new WTree()); tree_->setMargin(3, Top); tree_->resize(WLength(100, WLength::Percentage), WLength::Auto); }