本文整理汇总了C++中WPushButton::link方法的典型用法代码示例。如果您正苦于以下问题:C++ WPushButton::link方法的具体用法?C++ WPushButton::link怎么用?C++ WPushButton::link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPushButton
的用法示例。
在下文中一共展示了WPushButton::link方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMenu
void WsMenu::createMenu(NodePtr curNode, WMenu* menuParent)
{
std::string path2Icon;
WsUser* pUser = WsApp->wsUser();
std::string sIcon = curNode.get()->getProperties().get()->get("global", "icon", "");
if ( sIcon.size() > 1 ) {
NodePtr tmpNode = curNode;
if ( tmpNode.get()->isRegularFile() )
tmpNode = curNode.get()->getParent();
if ( tmpNode.get() ) {
path2Icon = tmpNode.get()->getFullPath().string() + "/ws.res/icones/" + sIcon;
if ( !boost::filesystem::exists(path2Icon) )
path2Icon.clear();
else {
boost::algorithm::replace_first(path2Icon, WsApp->docRoot(), "");
}
}
}
if ( asString(option("useButtons")) == "true" ) {
if ( curNode.get()->getPath().string() != "/" )
if ( asString(option("useSeparator")) == "true" ) {
WText* pText = new WText("|", this);
pText->addStyleClass("WsMenuSep");
}
WPushButton* button = new WPushButton(curNode.get()->getDisplayName(true), this);
m_vPushButton.push_back(button);
if ( path2Icon.size() > 1 ) {
button->setIcon(WLink(WLink::Url, path2Icon));
if ( curNode.get()->getProperties().get()->get("global", "button_text", "true") == "false" )
button->setText("");
}
// TODO : Ameliorer cette fonction
if ( (curNode.get()->isDirectory() && asString(option("directorySelectable")) == "true") ||
pUser->isAdministrator() || pUser->isEditor() ||
(asString(option("showRoot")) == "true" && curNode.get()->getPath() == "/")
) {
button->setLink(WLink(WLink::InternalPath, curNode.get()->getPath().string()));
}
if ( curNode.get()->isRegularFile() ) {
button->setLink(makeLink(curNode.get()->getPath().string(), false));
if ( button->link().type() == WLink::Url )
button->setLinkTarget(TargetNewWindow);
}
bool popupAllowed = (curNode.get()->getProperties().get()->get("global", "allow_popup", "true") == "true" ? true : false);
if ( curNode.get()->isDirectory() && popupAllowed && asString(option("usePopupMenu")) == "true" ) {
if ( !(asString(option("noRootPopup")) == "true" && curNode.get()->getPath() == "/") ) {
WPopupMenu* pPopup = new WPopupMenu();
pPopup->addStyleClass("wt-no-reparent");
loadPopupMenu(curNode, pPopup);
button->setMenu(pPopup);
pPopup->setAutoHide(true);
button->mouseWentOver().connect(boost::bind(&WsMenu::onMouseWentOver, this, button));
button->setMouseOverDelay(50);
}
}
} else { // No buttons, standard menu
if ( curNode.get()->getPath().string() != "/" )
menuParent->addSeparator();
WMenuItem* pItem = menuParent->addItem(curNode.get()->getDisplayName(true));
pItem->setLink(WLink(WLink::InternalPath, curNode.get()->getPath().string()));
if ( path2Icon.size() > 1 )
pItem->setIcon(path2Icon);
if ( curNode.get()->isDirectory() && asString(option("usePopupMenu")) == "true" )
if ( curNode.get()->getDirectories().size() ) {
WPopupMenu* pPopup = new WPopupMenu();
pPopup->addStyleClass("wt-no-reparent");
loadPopupMenu(curNode, pPopup);
pItem->setMenu(pPopup);
}
}
}
示例2: apply
void WBootstrapTheme::apply(WWidget *widget, DomElement& element,
int elementRole) const
{
bool creating = element.mode() == DomElement::Mode::Create;
if (!widget->isThemeStyleEnabled())
return;
{
WPopupWidget *popup = dynamic_cast<WPopupWidget *>(widget);
if (popup) {
WDialog *dialog = dynamic_cast<WDialog *>(widget);
if (!dialog)
element.addPropertyWord(Property::Class, "dropdown-menu");
}
}
switch (element.type()) {
case DomElementType::A: {
if (creating && dynamic_cast<WPushButton *>(widget))
element.addPropertyWord(Property::Class, classBtn(widget));
WPushButton *btn = dynamic_cast<WPushButton *>(widget);
if (creating && btn && btn->isDefault())
element.addPropertyWord(Property::Class, "btn-primary");
if (element.getProperty(Property::Class).find("dropdown-toggle")
!= std::string::npos) {
WMenuItem *item = dynamic_cast<WMenuItem *>(widget->parent());
if (!dynamic_cast<WPopupMenu *>(item->parentMenu())) {
DomElement *b = DomElement::createNew(DomElementType::B);
b->setProperty(Property::Class, "caret");
element.addChild(b);
}
}
break;
}
case DomElementType::BUTTON: {
if (creating && !widget->hasStyleClass("list-group-item"))
element.addPropertyWord(Property::Class, classBtn(widget));
WPushButton *button = dynamic_cast<WPushButton *>(widget);
if (button) {
if (creating && button->isDefault())
element.addPropertyWord(Property::Class, "btn-primary");
if (button->menu() &&
element.properties().find(Property::InnerHTML) !=
element.properties().end()) {
element.addPropertyWord(Property::InnerHTML,
"<span class=\"caret\"></span>");
}
if (creating && !button->text().empty())
element.addPropertyWord(Property::Class, "with-label");
if (!button->link().isNull())
LOG_ERROR("Cannot use WPushButton::setLink() after the button has "
"been rendered with WBootstrapTheme");
}
break;
}
case DomElementType::DIV:
{
WDialog *dialog = dynamic_cast<WDialog *>(widget);
if (dialog) {
if (version_ == BootstrapVersion::v2)
element.addPropertyWord(Property::Class, "modal");
else
element.addPropertyWord(Property::Class, "modal-dialog Wt-dialog");
return;
}
WPanel *panel = dynamic_cast<WPanel *>(widget);
if (panel) {
element.addPropertyWord(Property::Class, classAccordionGroup());
return;
}
WProgressBar *bar = dynamic_cast<WProgressBar *>(widget);
if (bar) {
switch (elementRole) {
case MainElement:
element.addPropertyWord(Property::Class, "progress");
break;
case ProgressBarBar:
element.addPropertyWord(Property::Class, classBar());
break;
case ProgressBarLabel:
element.addPropertyWord(Property::Class, "bar-label");
}
return;
}
WGoogleMap *map = dynamic_cast<WGoogleMap *>(widget);
//.........这里部分代码省略.........