本文整理汇总了C++中WTemplate类的典型用法代码示例。如果您正苦于以下问题:C++ WTemplate类的具体用法?C++ WTemplate怎么用?C++ WTemplate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WTemplate类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Div
WWidget *CmsSubscribers::Layout()
{
Div *container = new Div("CmsSubscribers", "container-fluid");
try {
CgiRoot *cgiRoot = static_cast<CgiRoot *>(WApplication::instance());
CgiEnv *cgiEnv = cgiRoot->GetCgiEnvInstance();
string htmlData;
string file;
if (cgiEnv->GetCurrentLanguage() == CgiEnv::Language::Fa) {
file = "../templates/cms-subscribers-fa.wtml";
} else {
file = "../templates/cms-subscribers.wtml";
}
if (CoreLib::FileSystem::Read(file, htmlData)) {
/// Fill the template
WTemplate *tmpl = new WTemplate(container);
tmpl->setTemplateText(WString::fromUTF8(htmlData), TextFormat::XHTMLUnsafeText);
WPushButton *allSubscribersPushButton = new WPushButton(tr("cms-subscribers-all"));
allSubscribersPushButton->setStyleClass("btn btn-default");
WPushButton *englishFarsiSubscribersPushButton = new WPushButton(tr("cms-subscribers-english-farsi"));
englishFarsiSubscribersPushButton->setStyleClass("btn btn-default");
WPushButton *englishSubscribersPushButton = new WPushButton(tr("cms-subscribers-english"));
englishSubscribersPushButton->setStyleClass("btn btn-default");
WPushButton *farsiSubscribersPushButton = new WPushButton(tr("cms-subscribers-farsi"));
farsiSubscribersPushButton->setStyleClass("btn btn-default");
WPushButton *inactiveSubscribersPushButton = new WPushButton(tr("cms-subscribers-inactive"));
inactiveSubscribersPushButton->setStyleClass("btn btn-default");
m_pimpl->SubscribersTableContainer = new Div("SubscribersTableContainer", "subscribers-table-container");
tmpl->bindWidget("subscribers-title", new WText(tr("cms-subscribers-page-title")));
tmpl->bindWidget("subscribers-table", m_pimpl->SubscribersTableContainer);
tmpl->bindWidget("all-subscribers-button", allSubscribersPushButton);
tmpl->bindWidget("english-farsi-subscribers-button", englishFarsiSubscribersPushButton);
tmpl->bindWidget("english-subscribers-button", englishSubscribersPushButton);
tmpl->bindWidget("farsi-subscribers-button", farsiSubscribersPushButton);
tmpl->bindWidget("inactive-subscribers-button", inactiveSubscribersPushButton);
allSubscribersPushButton->clicked().connect(m_pimpl.get(), &CmsSubscribers::Impl::OnAllButtonPressed);
englishFarsiSubscribersPushButton->clicked().connect(m_pimpl.get(), &CmsSubscribers::Impl::OnEnFaButtonPressed);
englishSubscribersPushButton->clicked().connect(m_pimpl.get(), &CmsSubscribers::Impl::OnEnButtonPressed);
farsiSubscribersPushButton->clicked().connect(m_pimpl.get(), &CmsSubscribers::Impl::OnFaButtonPressed);
inactiveSubscribersPushButton->clicked().connect(m_pimpl.get(), &CmsSubscribers::Impl::OnInactiveButtonPressed);
allSubscribersPushButton->setFocus();
}
}
catch (boost::exception &ex) {
LOG_ERROR(boost::diagnostic_information(ex));
}
catch (std::exception &ex) {
LOG_ERROR(ex.what());
}
catch (...) {
LOG_ERROR(UNKNOWN_ERROR);
}
return container;
}
开发者ID:NuLL3rr0r,项目名称:blog-subscription-service,代码行数:72,代码来源:CmsSubscribers.cpp
示例2: WTemplate
void WTimePicker::init(const WTime &time)
{
Wt::WStringStream text;
text << "<table>"
"""<tr>"
"" "<th>${incrementHour}</th>"
"" "<th></th>"
"" "<th>${incrementMinute}</th>"
"" "<th></th>"
"" "<th>${incrementSecond}</th>"
"""</tr>"
"""<tr>"
"" "<td valign=\"middle\" align=\"center\">${hourText}</td>"
"" "<td valign=\"middle\" align=\"center\">:</td>"
"" "<td valign=\"middle\" align=\"center\">${minuteText}</td>"
"" "<td valign=\"middle\" align=\"center\">:</td>"
"" "<td valign=\"middle\" align=\"center\">${secondText}</td>"
"""</tr>"
"""<tr>"
"" "<th>${decrementHour}</th>"
"" "<th></th>"
"" "<th>${decrementMinute}</th>"
"" "<th></th>"
"" "<th>${decrementSecond}</th>"
"""</tr>"
"</table>";
WTemplate *impl = new WTemplate();
setImplementation(impl);
impl->setTemplateText(WString::fromUTF8(text.str(), XHTMLUnsafeText));
WIcon::loadIconFont();
WPushButton *incHourButton = new WPushButton();
incHourButton->addStyleClass("fa fa-arrow-up");
WPushButton *decHourButton = new WPushButton();
decHourButton->addStyleClass("fa fa-arrow-down");
WPushButton *incMinuteButton = new WPushButton();
incMinuteButton->addStyleClass("fa fa-arrow-up");
WPushButton *decMinuteButton = new WPushButton();
decMinuteButton->addStyleClass("fa fa-arrow-down");
WPushButton *incSecondButton = new WPushButton();
incSecondButton->addStyleClass("fa fa-arrow-up");
WPushButton *decSecondButton = new WPushButton();
decSecondButton->addStyleClass("fa fa-arrow-down");
hourText_ = new WText("0");
hourText_->setInline(false);
hourText_->setTextAlignment(AlignCenter);
minuteText_ = new WText("00");
minuteText_->setInline(false);
minuteText_->setTextAlignment(AlignCenter);
secondText_ = new WText("00");
secondText_->setInline(false);
secondText_->setTextAlignment(AlignCenter);
impl->bindWidget("incrementHour", incHourButton);
impl->bindWidget("decrementHour", decHourButton);
impl->bindWidget("hourText", hourText_);
impl->bindWidget("minuteText", minuteText_);
impl->bindWidget("secondText", secondText_);
impl->bindWidget("incrementMinute", incMinuteButton);
impl->bindWidget("decrementMinute", decMinuteButton);
impl->bindWidget("incrementSecond", incSecondButton);
impl->bindWidget("decrementSecond", decSecondButton);
incHourButton->clicked().connect(this, &WTimePicker::incrementHours);
decHourButton->clicked().connect(this, &WTimePicker::decrementHours);
incMinuteButton->clicked().connect(this, &WTimePicker::incrementMinutes);
decMinuteButton->clicked().connect(this, &WTimePicker::decrementMinutes);
incSecondButton->clicked().connect(this, &WTimePicker::incrementSeconds);
decSecondButton->clicked().connect(this, &WTimePicker::decrementSeconds);
}
开发者ID:mickythump,项目名称:wt,代码行数:85,代码来源:WTimePicker.C
注:本文中的WTemplate类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论