本文整理汇总了C++中WText::setInline方法的典型用法代码示例。如果您正苦于以下问题:C++ WText::setInline方法的具体用法?C++ WText::setInline怎么用?C++ WText::setInline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WText
的用法示例。
在下文中一共展示了WText::setInline方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WText
/*! \brief Creates a title widget.
*/
WText *createTitle(const WString& title) {
WText *result = new WText(title);
result->setInline(false);
result->setStyleClass("title");
return result;
}
示例2: addText
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);
}
示例3: addColumn
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);
}
示例4: createExtraColumns
void WTreeTableNode::createExtraColumns(int numColumns)
{
if (!row_) {
row_ = new WContainerWidget();
labelArea()->insertBefore(row_, labelArea()->children()[0]);
row_->setFloatSide(Right);
labelArea()->resize(WLength(100, WLength::Percentage), WLength::Auto);
labelArea()->table()->resize(WLength(100, WLength::Percentage),
WLength::Auto);
}
while (static_cast<int>(columnWidgets_.size()) < numColumns) {
WText *w = new WText(WString::fromUTF8(" "), row_);
w->setInline(false);
columnWidgets_.push_back(ColumnWidget(w, false));
w->setFloatSide(Left);
w->resize(columnWidth(columnWidgets_.size()), 1);
}
}
示例5: renderCell
WWidget* WCalendar::renderCell(WWidget* widget, const WDate& date)
{
WText* t = dynamic_cast<WText*>(widget);
if (!t) {
t = new WText();
t->setInline(false);
t->setTextFormat(PlainText);
}
#ifndef WT_TARGET_JAVA
char buf[30];
#else
char *buf;
#endif // WT_TARGET_JAVA
Utils::itoa(date.day(), buf);
t->setText(WString::fromUTF8(buf));
std::string styleClass;
if (isInvalid(date))
styleClass += " Wt-cal-oor";
else if (date.month() != currentMonth())
styleClass += " Wt-cal-oom";
if (isSelected(date))
styleClass += " Wt-cal-sel";
WDate currentDate = WDate::currentDate();
if (date.day() == currentDate.day() && date.month() == currentDate.month() &&
date.year() == currentDate.year()) {
if (!isSelected(date))
styleClass += " Wt-cal-now";
t->setToolTip(WString::tr("Wt.WCalendar.today"));
} else
t->setToolTip("");
t->setStyleClass(styleClass.c_str());
return t;
}
示例6: processChatEvent
void SimpleChatWidget::processChatEvent(const ChatEvent& event)
{
WApplication *app = WApplication::instance();
/*
* This is where the "server-push" happens. The chat server posts to this
* event from other sessions, see SimpleChatServer::postChatEvent()
*/
/*
* Format and append the line to the conversation.
*
* This is also the step where the automatic XSS filtering will kick in:
* - if another user tried to pass on some JavaScript, it is filtered away.
* - if another user did not provide valid XHTML, the text is automatically
* interpreted as PlainText
*/
/*
* If it is not a plain message, also update the user list.
*/
if (event.type() != ChatEvent::Message) {
if (event.type() == ChatEvent::Rename && event.user() == user_)
user_ = event.data();
updateUsers();
}
/*
* This is the server call: we (schedule to) propagate the updated UI to
* the client.
*
* This schedules an update and returns immediately
*/
app->triggerUpdate();
newMessage();
/*
* Anything else doesn't matter if we are not logged in.
*/
if (!loggedIn())
return;
bool display = event.type() != ChatEvent::Message
|| !userList_
|| (users_.find(event.user()) != users_.end() && users_[event.user()]);
if (display) {
WText *w = new WText(messages_);
/*
* If it fails, it is because the content wasn't valid XHTML
*/
if (!w->setText(event.formattedHTML(user_, XHTMLText))) {
w->setText(event.formattedHTML(user_, PlainText));
w->setTextFormat(XHTMLText);
}
w->setInline(false);
w->setStyleClass("chat-msg");
/*
* Leave no more than 100 messages in the back-log
*/
if (messages_->count() > 100)
delete messages_->children()[0];
/*
* Little javascript trick to make sure we scroll along with new content
*/
app->doJavaScript(messages_->jsRef() + ".scrollTop += "
+ messages_->jsRef() + ".scrollHeight;");
/* If this message belongs to another user, play a received sound */
if (event.user() != user_ && messageReceived_)
messageReceived_->play();
}
}