本文整理汇总了C++中wt::WTemplate::bindString方法的典型用法代码示例。如果您正苦于以下问题:C++ WTemplate::bindString方法的具体用法?C++ WTemplate::bindString怎么用?C++ WTemplate::bindString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wt::WTemplate
的用法示例。
在下文中一共展示了WTemplate::bindString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TopicTemplate
Wt::WWidget *FormWidgets::pushButton()
{
Wt::WTemplate *result = new TopicTemplate("forms-pushButton");
result->bindWidget("PushButton", PushButton());
result->bindWidget("PushButtonOnce", PushButtonOnce());
result->bindWidget("PushButtonLink", PushButtonLink());
result->bindWidget("PushButtonDropdownAppended",
PushButtonDropdownAppended());
result->bindWidget("PushButtonColor", PushButtonColor());
result->bindWidget("PushButtonSize", PushButtonSize());
result->bindWidget("PushButtonPrimary", PushButtonPrimary());
result->bindWidget("PushButtonAction", PushButtonAction());
// Show the XML-templates as text
result->bindString("appendedDropdownButton-template",
reindent(tr("appendedDropdownButton-template")),
Wt::PlainText);
result->bindString("pushButtonColor-template",
reindent(tr("pushButtonColor-template")), Wt::PlainText);
result->bindString("pushButtonSize-template",
reindent(tr("pushButtonSize-template")), Wt::PlainText);
result->bindString("pushButtonAction-template",
reindent(tr("pushButtonAction-template")), Wt::PlainText);
return result;
}
示例2: TopicTemplate
Wt::WWidget *TreesTables::treeViews()
{
Wt::WTemplate *result = new TopicTemplate("treestables-TreeViews");
#ifndef _WIN32
result->bindWidget("TreeView", TreeView());
#else
result->bindString("TreeView", "Example not available on windows");
#endif
return result;
}
示例3: TopicTemplate
Wt::WWidget *GraphicsWidgets::googleMap()
{
Wt::WTemplate *result = new TopicTemplate("graphics-GoogleMap");
result->bindWidget("GoogleMap", GoogleMap());
// Show the XML-template as text
result->bindString("GoogleMap-controls",
reindent(tr("graphics-GoogleMap-controls")),
Wt::PlainText);
return result;
}
示例4: transaction
void
ShareEdit::refresh(void)
{
if (!wApp->internalPathMatches("/share-edit"))
return;
clear();
std::string editUUID = wApp->internalPathNextPart("/share-edit/");
Wt::Dbo::Transaction transaction(FsApp->getDboSession());
Database::Share::pointer share = Database::Share::getByEditUUID(FsApp->getDboSession(), editUUID);
if (!share || !boost::filesystem::exists(share->getPath()))
{
FS_LOG(UI, ERROR) << "Edit UUID '" << editUUID << "' not found";
displayNotFound();
return;
}
FS_LOG(UI, INFO) << "[" << share->getDownloadUUID() << "] Editing share from " << wApp->environment().clientAddress();
Wt::WTemplate *t = addNew<Wt::WTemplate>(tr("template-share-edit"));
t->addFunction("tr", &Wt::WTemplate::Functions::tr);
if (!share->getDesc().empty())
{
t->setCondition("if-desc", true);
t->bindString("file-desc", Wt::WString::fromUTF8(share->getDesc()));
}
t->bindString("file-name", Wt::WString::fromUTF8(share->getFileName()));
t->bindString("file-size", sizeToString(share->getFileSize()));
t->bindString("expiry-date-time", share->getExpiryTime().toString() + " UTC");
auto hits = std::to_string(share->getHits());
if (share->getMaxHits() > 0)
hits += " / " + std::to_string(share->getMaxHits());
t->bindString("hits", hits);
t->bindWidget("download-link", createShareDownloadAnchor(share));
Wt::WPushButton* deleteBtn = t->bindNew<Wt::WPushButton>("delete-btn", tr("msg-delete"));
deleteBtn->clicked().connect([=] ()
{
auto messageBox = deleteBtn->addChild(std::make_unique<Wt::WMessageBox>(tr("msg-share-delete"),
tr("msg-confirm-action"),
Wt::Icon::Question,
Wt::StandardButton::Yes | Wt::StandardButton::No));
messageBox->setModal(true);
messageBox->buttonClicked().connect([=] (Wt::StandardButton btn)
{
if (btn == Wt::StandardButton::Yes)
{
Wt::Dbo::Transaction transaction(FsApp->getDboSession());
Database::Share::pointer share = Database::Share::getByEditUUID(FsApp->getDboSession(), editUUID);
if (share)
{
FS_LOG(UI, INFO) << "[" << share->getDownloadUUID() << "] Deleting share from " << wApp->environment().clientAddress();
share.modify()->destroy();
share.remove();
}
displayRemoved();
}
deleteBtn->removeChild(messageBox);
});
messageBox->show();
});
}
示例5: emblem_url
Wt::WContainerWidget *nav_bar()
{
// Main Container holding navbar and content
Wt::WContainerWidget *container = new Wt::WContainerWidget();
// Content stack shows content, one at a time
Wt::WStackedWidget *contentsStack = new Wt::WStackedWidget(container);
contentsStack->addStyleClass("container");
// Container holding content for layout purposes
Wt::WContainerWidget *container2 = new Wt::WContainerWidget();
// Create a NAVBAR
Wt::WNavigationBar *navigation = new Wt::WNavigationBar(container);
navigation->setTitle("Halo Viewer",
"http://haloviewer.bluewizard.ca/");
navigation->setResponsive(true);
navigation->addStyleClass("navbar-fixed-top");
navigation->addStyleClass("navbar-inner");
// Setup a Left-aligned menu.
Wt::WMenu *leftMenu = new Wt::WMenu(contentsStack, container2);
navigation->addMenu(leftMenu, Wt::AlignCenter);
Wt::WText *searchResult = new Wt::WText("Buy or Sell... Bye!");
// Create Spartan profile
SpartanProfile *mySpartan = new SpartanProfile();
// Create Profile view container
Wt::WContainerWidget *profile = new Wt::WContainerWidget();
profile->addStyleClass("summary-container");
// User summary template (emblem, name, rank etc.)
Wt::WTemplate *t = new Wt::WTemplate("<div class=\"summary-container\">\n<img src=\"${emblem-url}\" class=\"emblem-image\" />\n<div class=\"spartan-name\">${spartan-name}</div>\n<div class=\"spartan-rank\">SR ${spartan-rank}</div>\n</div>");
std::string emblem_url("https://image.halocdn.com/h5/emblems/311_0_31_48?width=256&hash=%2blRdfGUDXqlSen9Z1eRb8OoX%2fqYz9zaLqu3TNgYxffs%3d");
boost::replace_all(emblem_url, "&", "&");
t->bindString("emblem-url", emblem_url);
t->bindWidget("spartan-name", new Wt::WText("CLWakaLaka"));
t->bindWidget("spartan-rank", new Wt::WText("SR 74"));
profile->addWidget(t);
// Ranks Container shows playlist ranks for a given SpartanProfile
Wt::WContainerWidget *summary_layout = new Wt::WContainerWidget();
PlaylistRanksContainer *ranks = new PlaylistRanksContainer(mySpartan);
Wt::WContainerWidget *panels = new Wt::WContainerWidget();
panels->setWidth("60%");
Wt::WPanel *panel = new Wt::WPanel();
panel->setTitle("Collapsible panel");
panel->addStyleClass("centered-example");
panel->setCollapsible(true);
Wt::WAnimation animation(Wt::WAnimation::SlideInFromTop,
Wt::WAnimation::EaseOut,
100);
panel->setAnimation(animation);
Wt::WText *temp_text = new Wt::WText(mySpartan->printRecentMatches());
panel->setCentralWidget(temp_text);
panels->addWidget(panel);
RecentMatchesContainer *recent_matches_panel = new RecentMatchesContainer(mySpartan);
ranks->setFloatSide(Wt::Left);
recent_matches_panel->setFloatSide(Wt::Left);
summary_layout->addWidget(ranks);
summary_layout->addWidget(recent_matches_panel);
// Create TabWidget for profile view
Wt::WTabWidget *tabW = new Wt::WTabWidget(profile);
Wt::WTextArea *text = new Wt::WTextArea(mySpartan->getRanks());
tabW->addTab(summary_layout,
"Summary", Wt::WTabWidget::PreLoading);
tabW->addTab(text,
"Weapons", Wt::WTabWidget::PreLoading);
tabW->addTab(new Wt::WTextArea("You could change any other style attribute of the"
" tab widget by modifying the style class."
" The style class 'trhead' is applied to this tab."),
"Medals", Wt::WTabWidget::PreLoading)->setStyleClass("trhead");
tabW->setStyleClass("tabwidget");
// Add containers to Left Menu
leftMenu->addItem("Profile", profile);
leftMenu->addItem("Matches", new Wt::WText("Layout contents"));
leftMenu->addItem("Sales", searchResult);
// Setup a Right-aligned menu.
Wt::WMenu *rightMenu = new Wt::WMenu();
navigation->addMenu(rightMenu, Wt::AlignRight);
// Create a popup submenu for the Help menu.
Wt::WPopupMenu *popup = new Wt::WPopupMenu();
popup->addItem("Contents");
popup->addItem("Index");
popup->addSeparator();
popup->addItem("About");
panel->expanded().connect(std::bind([=] () {
temp_text->setText(mySpartan->printRecentMatches());
//.........这里部分代码省略.........