Project

General

Profile

Feature #3974 ยป WLinkTarget.patch

patching WLink and WItemDelegate classes - Stefan Ruppert, 04/10/2015 08:34 AM

View differences:

wt-3.3.4/src/Wt/WItemDelegate.C 2015-04-10 08:25:55.996116876 +0200
WLink link = boost::any_cast<WLink>(linkData);
IndexAnchor *a = anchorWidget(widgetRef, index);
a->setLink(link);
if (link.type() == WLink::Resource)
a->setTarget(TargetNewWindow);
a->setTarget(link.target());
}
IndexText *t = textWidget(widgetRef, index);
wt-3.3.4/src/Wt/WLink 2015-04-10 08:21:01.328109235 +0200
*/
Type type() const { return type_; }
/*! \brief Sets the link target.
*
* For a resource link the target can not be changed.
*/
void setTarget(AnchorTarget target);
/*! \brief Returns the link target.
*
* The target is implicitly set to TargetNewWindow for a resource link type
* and for any other type the default is set to TargetThisWindow. For none
* resource link types the target can be changed by calling setTarget()
* method.
*/
AnchorTarget target() const { return target_; }
/*! \brief Returns whether the link is unspecified.
*
* A null link is a link created using the default constructor and
......
private:
Type type_;
AnchorTarget target_;
#ifndef WT_CNOR
boost::variant<std::string, WResource *> value_;
#else
wt-3.3.4/src/Wt/WLink.C 2015-04-10 08:28:44.012121233 +0200
return type_ == Url && url().empty();
}
void WLink::setTarget(AnchorTarget target)
{
target_ = target;
}
void WLink::setUrl(const std::string& url)
{
type_ = Url;
value_ = url;
target_ = TargetSelf;
}
std::string WLink::url() const
......
{
type_ = Resource;
value_ = resource;
target_ = TargetNewWindow;
}
WResource *WLink::resource() const
    (1-1/1)