本文整理汇总了C++中WText类的典型用法代码示例。如果您正苦于以下问题:C++ WText类的具体用法?C++ WText怎么用?C++ WText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WText类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: modelDataChanged
void WSuggestionPopup::modelDataChanged(const WModelIndex& topLeft,
const WModelIndex& bottomRight)
{
if (topLeft.parent().isValid())
return;
if (modelColumn_ < topLeft.column() || modelColumn_ > bottomRight.column())
return;
for (int i = topLeft.row(); i <= bottomRight.row(); ++i) {
WContainerWidget *w = dynamic_cast<WContainerWidget *>(impl_->widget(i));
WAnchor *anchor = dynamic_cast<WAnchor *>(w->widget(0));
WText *value = dynamic_cast<WText *>(anchor->widget(0));
WModelIndex index = model_->index(i, modelColumn_);
boost::any d = index.data();
value->setText(asString(d));
TextFormat format = index.flags() & ItemIsXHTMLText ? XHTMLText : PlainText;
value->setTextFormat(format);
boost::any d2 = model_->data(i, modelColumn_, UserRole);
if (d2.empty())
d2 = d;
value->setAttributeValue("sug", asString(d2));
}
}
开发者ID:Unss,项目名称:wt,代码行数:29,代码来源:WSuggestionPopup.C
示例2: WContainerWidget
ItemContaWidget::ItemContaWidget(Wt::WContainerWidget *parent,
ContaWidget *view,
int id_diario,
std::string data,
std::string descricao,
Moeda debito,
Moeda credito):
WContainerWidget(parent), view_(view),
id_diario_(id_diario),
data_(data),
descricao_(descricao),
debito_(debito),
credito_(credito){
setInline(true);
WText *btnRemove = new WText("<button class='bg-color-red fg-color-white'>Remove</button>", Wt::XHTMLUnsafeText);
btnRemove->clicked().connect(this, &ItemContaWidget::removeLancamento);
WTemplate *t = new WTemplate(this);
t->setTemplateText(
"<tr>"
"<td>${data}</td>"
"<td>${descricao}</td>"
"<td class='right'>${debito}</td>"
"<td class='right'>${credito}</td>"
"<td>${btnRemove}</td>"
"</tr>", XHTMLUnsafeText);
t->bindString("data", data_);
t->bindString("descricao", WString(descricao_, UTF8));
t->bindString("debito", debito_.valStr());
t->bindString("credito", credito_.valStr());
t->bindWidget("btnRemove", btnRemove);
t->setInline(true);
}
开发者ID:trumae,项目名称:PractWave,代码行数:34,代码来源:ItemContaWidget.cpp
示例3: WText
void CAnswerTable::AddErrorText(WTable* childTable,const std::string strHelp, int nRow, int nCol)
{
WText* pText = new WText(strHelp, childTable->elementAt(nRow, nCol));
childTable->elementAt(nRow, nCol)->setStyleClass("errors");
m_pListErrorText.push_back(pText);
pText->hide();
}
开发者ID:SiteView,项目名称:ecc82Server,代码行数:7,代码来源:AnswerTable.cpp
示例4: showArchive
void showArchive(WContainerWidget *parent) {
static const char* dateFormat = "MMMM yyyy";
new WText(tr("archive-title"), parent);
Posts posts = session_.find<Post>("order by date desc");
WDateTime formerDate;
for (Posts::const_iterator i = posts.begin(); i != posts.end(); ++i) {
if ((*i)->state != Post::Published)
continue;
if (formerDate.isNull()
|| yearMonthDiffer(formerDate, (*i)->date)) {
WText *title
= new WText((*i)->date.date().toString(dateFormat), parent);
title->setStyleClass("archive-month-title");
}
WAnchor *a = new WAnchor(WLink(WLink::InternalPath,
basePath_ + (*i)->permaLink()),
(*i)->title, parent);
a->setInline(false);
formerDate = (*i)->date;
}
}
开发者ID:DTidd,项目名称:wt,代码行数:27,代码来源:BlogView.C
示例5: WContainerWidget
FormExample::FormExample()
: WContainerWidget()
{
WContainerWidget *langLayout = this->addWidget(cpp14::make_unique<WContainerWidget>());
langLayout->setContentAlignment(AlignmentFlag::Right);
langLayout->addWidget(cpp14::make_unique<WText>(tr("language")));
const char *lang[] = { "en", "nl" };
for (int i = 0; i < 2; ++i) {
WText *t = langLayout->addWidget(cpp14::make_unique<WText>(lang[i]));
t->setMargin(5);
t->clicked().connect(std::bind(&FormExample::changeLanguage, this, t));
languageSelects_.push_back(t);
}
/*
* Start with the reported locale, if available
*/
setLanguage(wApp->locale().name());
Form *form = this->addWidget(cpp14::make_unique<Form>());
form->setMargin(20);
}
开发者ID:AlexanderKotliar,项目名称:wt,代码行数:25,代码来源:FormExample.C
示例6: updateView
void UpdatePasswordWidget::updateView(const std::string& var,
RegistrationModel::Field field)
{
WFormWidget *edit = resolve<WFormWidget *>(var);
WText *info = resolve<WText *>(var + "-info");
const WValidator::Result& v = model_->validationResult(field);
info->setText(v.message());
switch (v.state()) {
case WValidator::InvalidEmpty:
case WValidator::Invalid:
edit->removeStyleClass("Wt-valid");
if (validated_)
edit->addStyleClass("Wt-invalid");
info->addStyleClass("Wt-error");
break;
case WValidator::Valid:
edit->removeStyleClass("Wt-invalid");
if (validated_)
edit->addStyleClass("Wt-valid");
info->removeStyleClass("Wt-error");
}
}
开发者ID:bvanhauwaert,项目名称:wt,代码行数:25,代码来源:UpdatePasswordWidget.C
示例7: switch
void WBootstrapTheme::apply(WWidget *widget, WWidget *child, int widgetRole)
const
{
switch (widgetRole) {
case MenuItemIconRole:
child->addStyleClass("Wt-icon");
break;
case MenuItemCheckBoxRole:
child->addStyleClass("Wt-chkbox");
break;
case DialogCoverRole:
child->addStyleClass("modal-backdrop");
break;
case DialogTitleBarRole:
child->addStyleClass("modal-header");
break;
case DialogBodyRole:
child->addStyleClass("modal-body");
break;
case DialogFooterRole:
child->addStyleClass("modal-footer");
break;
case DialogCloseIconRole:
{
child->addStyleClass("close");
WText *t = dynamic_cast<WText *>(child);
t->setText("×");
break;
}
case TableViewRowContainerRole:
{
WAbstractItemView *view = dynamic_cast<WAbstractItemView *>(widget);
child->toggleStyleClass("Wt-striped", view->alternatingRowColors());
break;
}
case DatePickerPopupRole:
child->addStyleClass("Wt-datepicker");
break;
case PanelTitleBarRole:
child->addStyleClass("accordion-heading");
break;
case PanelCollapseButtonRole:
case PanelTitleRole:
child->addStyleClass("accordion-toggle");
break;
case PanelBodyRole:
child->addStyleClass("accordion-inner");
break;
case AuthWidgets:
WApplication *app = WApplication::instance();
app->builtinLocalizedStrings().useBuiltin
(skeletons::AuthBootstrapTheme_xml1);
break;
}
}
开发者ID:patrickjwhite,项目名称:wt,代码行数:60,代码来源:WBootstrapTheme.C
示例8: WContainerWidget
void WSuggestionPopup::modelRowsInserted(const WModelIndex& parent,
int start, int end)
{
if (filterLength_ != 0 && !filtering_)
return;
if (modelColumn_ >= model_->columnCount())
return;
if (parent.isValid())
return;
for (int i = start; i <= end; ++i) {
WContainerWidget *line = new WContainerWidget();
content_->insertWidget(i, line);
boost::any d = model_->data(i, modelColumn_);
WText *value = new WText(asString(d), PlainText);
boost::any d2 = model_->data(i, modelColumn_, UserRole);
if (d2.empty())
d2 = d;
line->addWidget(value);
value->setAttributeValue("sug", asString(d2));
}
}
开发者ID:bvanhauwaert,项目名称:wt,代码行数:27,代码来源:WSuggestionPopup.C
示例9: WText
/*! \brief Creates a title widget.
*/
WText *createTitle(const WString& title) {
WText *result = new WText(title);
result->setInline(false);
result->setStyleClass("title");
return result;
}
开发者ID:USP,项目名称:wtcpp,代码行数:9,代码来源:TreeViewDragDrop.C
示例10: WContainerWidget
WWidget *StyleLayout::wGridLayout()
{
WContainerWidget *result = new WContainerWidget();
topic("WGridLayout", result);
addText(tr("layout-WGridLayout"), result);
WContainerWidget *container;
container = new WContainerWidget(result);
container->resize(WLength::Auto, 400);
container->setStyleClass("yellow-box");
WGridLayout *grid = new WGridLayout();
container->setLayout(grid);
for (int row = 0; row < 3; ++row) {
for (int column = 0; column < 4; ++column) {
WText *t = addText(tr("grid-item").arg(row).arg(column));
if (row == 1 || column == 1 || column == 2)
t->setStyleClass("blue-box");
else
t->setStyleClass("green-box");
grid->addWidget(t, row, column);
}
}
grid->setRowStretch(1, 1);
grid->setColumnStretch(1, 1);
grid->setColumnStretch(2, 1);
return result;
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:32,代码来源:StyleLayout.C
示例11: WContainerWidget
WWidget *WtHome::example(const char *textKey, const std::string& sourceDir)
{
WContainerWidget *result = new WContainerWidget();
WText *w = new WText(tr(textKey), result);
w->setInternalPathEncoding(true);
result->addWidget(linkSourceBrowser(sourceDir));
return result;
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:8,代码来源:WtHome.C
示例12: WText
void WSVFlexTable::SetNullTipInfo(string strInfo)
{
if(pNullTipTable)
{
pNullTipTable->elementAt(0 , 0)->setContentAlignment(AlignTop | AlignCenter);
WText * textInfo = new WText(strInfo, (WContainerWidget *)pNullTipTable->elementAt(0, 0));
textInfo->decorationStyle().setForegroundColor(Wt::red);
}
}
开发者ID:,项目名称:,代码行数:9,代码来源:
示例13: loggedIn
void loggedIn() {
WApplication::instance()->changeSessionId();
refresh();
loginStatus_->resolveWidget("login")->show();
loginStatus_->resolveWidget("login-link")->hide();
loginStatus_->resolveWidget("register-link")->hide();
WText *profileLink = new WText(tr("profile"));
profileLink->setStyleClass("link");
profileLink->clicked().connect(this, &BlogImpl::editProfile);
dbo::ptr<User> user = session().user();
if (user->role == User::Admin) {
WText *editUsersLink = new WText(tr("edit-users"));
editUsersLink->setStyleClass("link");
editUsersLink->clicked().connect(SLOT(this, BlogImpl::editUsers));
loginStatus_->bindWidget("userlist-link", editUsersLink);
WText *authorPanelLink = new WText(tr("author-post"));
authorPanelLink->setStyleClass("link");
authorPanelLink->clicked().connect(SLOT(this, BlogImpl::authorPanel));
loginStatus_->bindWidget("author-panel-link", authorPanelLink);
} else {
loginStatus_->bindEmpty("userlist-link");
loginStatus_->bindEmpty("author-panel-link");
}
loginStatus_->bindWidget("profile-link", profileLink);
bindPanelTemplates();
}
开发者ID:DTidd,项目名称:wt,代码行数:34,代码来源:BlogView.C
示例14: WPanel
Playlist::Playlist(Session* session, Settings* settings, WContainerWidget* parent)
: WPanel(parent), d(this, session)
{
setCentralWidget(d->container = new WContainerWidget);
setTitleBar(true);
addStyleClass("playlist");
setHeaderCollapsible(this);
titleBarWidget()->addStyleClass("playtlist-titlebar");
setCollapsible(false);
d->container->hide();
d->container->setList(true);
d->container->addStyleClass("nav nav-pills nav-stacked");
d->container->setMargin(5, Side::Bottom);
WText *showHideButtonText = WW<WText>();
d->setPlaylistVisible = [=](bool visible) {
if(!visible) {
showHideButtonText->setText(wtr("playlist.show"));
settings->animateHide(Settings::PlaylistAnimation, d->container);
}
else {
showHideButtonText->setText(wtr("playlist.hide"));
settings->animateShow(Settings::PlaylistAnimation, d->container);
}
};
d->playSignal.connect([=](PlaylistItem*,_n5){ d->setPlaylistVisible(false); });
WContainerWidget *firstGroup = WW<WContainerWidget>().css("btn-group");
firstGroup->addWidget(WW<WAnchor>().css("btn btn-xs")
.setImage(WW<WImage>(Settings::staticPath("/icons/actions/playlist.png")).setMargin(5, Side::Right))
.add(showHideButtonText)
.onClick([=](WMouseEvent){
d->setPlaylistVisible(!d->container->isVisible());
}));
firstGroup->addWidget(WW<WAnchor>().css("btn btn-xs")
.setImage(WW<WImage>(Settings::staticPath("/icons/actions/playlist.clear.png")).setMargin(5, Side::Right))
.setText(wtr("playlist.clear"))
.onClick([=](WMouseEvent){
for(auto item: d->internalQueue)
delete item;
d->internalQueue.clear();
}));
WContainerWidget *secondGroup = WW<WContainerWidget>().css("btn-group");
WWidget *prev = WW<WAnchor>(secondGroup).css("btn btn-xs")
.add(new WImage{Settings::staticPath("/icons/actions/previous.png")}).onClick(boost::bind(&Playlist::previous, this));
WWidget *next = WW<WAnchor>(secondGroup).css("btn btn-xs")
.add(new WImage{Settings::staticPath("/icons/actions/next.png")}).onClick(boost::bind(&Playlist::next, this));
WContainerWidget *playlistButtonsContainer = WW<WContainerWidget>(titleBarWidget()).css("btn-toolbar")
.add(firstGroup).add(secondGroup);
d->setPlaylistVisible(false);
}
开发者ID:geolffrey,项目名称:Pandorica,代码行数:54,代码来源:playlist.cpp
示例15: WContainerWidget
WWidget *WCartesianChart::createLegendItemWidget(int index)
{
WContainerWidget *legendItem = new WContainerWidget();
legendItem->addWidget(new IconWidget(this, index));
WText *label = new WText(asString(model()->headerData(index)));
label->setVerticalAlignment(AlignTop);
legendItem->addWidget(label);
return legendItem;
}
开发者ID:913862627,项目名称:wt,代码行数:11,代码来源:WCartesianChart.C
示例16: WText
WWidget *Home::linkSourceBrowser(const std::string& example)
{
/*
* Instead of using a WAnchor, which will not progress properly because
* it is wrapped with wrapView() (-- should we not fix that?), we use
* a WText which contains an anchor, and enable internal path encoding.
*/
std::string path = "#/" + SRC_INTERNAL_PATH + "/" + example;
WText *a = new WText(tr("source-browser-link").arg(path));
a->setInternalPathEncoding(true);
return a;
}
开发者ID:GuLinux,项目名称:wt,代码行数:12,代码来源:Home.C
示例17: setCondition
void AuthWidget::updatePasswordLoginView()
{
if (model_->passwordAuth()) {
setCondition("if:passwords", true);
updateView(model_);
WInteractWidget *login = resolve<WInteractWidget *>("login");
if (!login) {
login = new WPushButton(tr("Wt.Auth.login"));
login->clicked().connect(this, &AuthWidget::attemptPasswordLogin);
bindWidget("login", login);
model_->configureThrottling(login);
if (model_->baseAuth()->emailVerificationEnabled()) {
WText *text = new WText(tr("Wt.Auth.lost-password"));
text->clicked().connect(this, &AuthWidget::handleLostPassword);
bindWidget("lost-password", text);
} else
bindEmpty("lost-password");
if (registrationEnabled_) {
WInteractWidget *w;
if (!basePath_.empty()) {
w = new WAnchor
(WLink(WLink::InternalPath, basePath_ + "register"),
tr("Wt.Auth.register"));
} else {
w = new WText(tr("Wt.Auth.register"));
w->clicked().connect(this, &AuthWidget::registerNewUser);
}
bindWidget("register", w);
} else
bindEmpty("register");
if (model_->baseAuth()->emailVerificationEnabled()
&& registrationEnabled_)
bindString("sep", " | ");
else
bindEmpty("sep");
}
model_->updateThrottling(login);
} else {
bindEmpty("lost-password");
bindEmpty("sep");
bindEmpty("register");
bindEmpty("login");
}
}
开发者ID:913862627,项目名称:wt,代码行数:53,代码来源:AuthWidget.C
示例18: WText
void WMediaPlayer::addText(WTemplate *t, TextId id, const char *bindId,
const std::string& styleClass)
{
WText *text = new WText();
text->setInline(false);
if (!styleClass.empty())
text->setStyleClass(styleClass);
t->bindWidget(bindId, text);
setText(id, text);
}
开发者ID:913862627,项目名称:wt,代码行数:13,代码来源:WMediaPlayer.C
示例19: WException
void WTreeTable::addColumn(const WString& header, const WLength& width)
{
if (treeRoot())
throw WException("WTreeTable::addColumn(): must be called before "
"setTreeRoot()");
WText *t = new WText(header);
t->resize(width, WLength::Auto);
t->setInline(false);
t->setFloatSide(Left);
headerContainer_->addWidget(t);
columnWidths_.push_back(width);
}
开发者ID:LifeGo,项目名称:wt,代码行数:14,代码来源:WTreeTable.C
示例20: asString
void WsMenu::doLoadCurPath()
{
std::string rootPath = asString(option("rootPath")).toUTF8();
boost::algorithm::replace_all(rootPath, "&", "&");
// Si pas de root path on prend l'internal Path
if ( rootPath.size() < 1 ){
m_sCurPath = WsApp->internalPath();
}else
m_sCurPath = rootPath;
std::string sWithoutPrefix = WsApp->WsModules().pathWithoutPrefix(m_sCurPath);
WsUser* pUser = WsApp->wsUser();
NodePtr tmpNode = pUser->getAccessRoot().get()->eatPath(sWithoutPrefix);
if ( !tmpNode.get() ) {
wApp->log("notice") << "WsMenu::doLoadCurPath - eatPath return NULL ";
return;
}
if ( tmpNode.get()->isRegularFile() ) {
tmpNode = pUser->getAccessRoot().get()->eatPath(boost::filesystem::path(sWithoutPrefix).parent_path().string());
if ( !tmpNode.get() ) {
wApp->log("notice") << "WsMenu::doLoadCurPath - eatPath on parent return NULL ";
return;
}
}
NodePtr startNode = pUser->getAccessRoot();
if ( !startNode.get() ) {
wApp->log("notice") << "WsMenu::doLoadCurPath - startNode = " << startNode;
return;
}
NodePtr pNode = startNode.get()->eatPath(tmpNode.get()->getPath().string());
if ( !pNode.get() ) return;
if ( asString(option("useTitle")) == "true" ) {
std::string sTitle(pNode.get()->getDisplayName());
boost::algorithm::replace_all(sTitle, "&", "&");
WText* title = new WText(sTitle);
title->addStyleClass("WsMenuTitle");
addWidget(title);
}
WMenu* menuParent = 0;
if ( asString(option("useButtons")) != "true" )
menuParent = new WMenu(this);
if ( asString(option("showRoot")) == "true" )
if ( pNode.get()->getPath() == "/" ) {
createMenu(pNode, menuParent);
}
loadMenu(pNode, menuParent);
if ( asString(option("useImages")) == "true" )
loadImage(pNode);
}
开发者ID:Wittyshare,项目名称:wittyshare,代码行数:50,代码来源:WsMenu.cpp
注:本文中的WText类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论