12 #include <boost/filesystem.hpp>
21 #include <gdcore/gdCore.h>
34 : WContainerWidget(parent)
36 addStyleClass(
"WsAnchor");
45 Wt::WContainerWidget::load();
46 std::string linkType = asString(
option(
"linkType")).toUTF8();
47 std::string link = asString(
option(
"link")).toUTF8();
48 std::string text = asString(
option(
"text")).toUTF8();
49 std::string icon = asString(
option(
"icon")).toUTF8();
50 std::string iconText = asString(
option(
"iconText")).toUTF8();
51 std::string target = asString(
option(
"target")).toUTF8();
52 std::string title = asString(
option(
"title")).toUTF8();
53 if ( linkType.size() < 1 ) linkType =
"InternalPath";
54 if ( title.size() > 0 ) {
55 WText* ptext =
new WText(title);
56 ptext->addStyleClass(
"WsTitle");
57 addWidget(
new WText(title));
60 if ( linkType ==
"Url" ) wLink.setUrl(link);
62 if ( linkType ==
"InternalPath" ) wLink.setInternalPath(link);
63 WAnchor* pAnchor =
new WAnchor(wLink, text);
64 if ( icon.size() > 0 ) {
65 WImage* pImage =
new WImage(WLink(WLink::Url, icon), iconText, 0);
66 pAnchor->setImage(pImage);
68 if ( target ==
"TargetNewWindow" )
69 pAnchor->setTarget(Wt::TargetNewWindow);
70 if ( target ==
"TargetSelf" )
71 pAnchor->setTarget(Wt::TargetSelf);
72 if ( target ==
"TargetThisWindow" )
73 pAnchor->setTarget(Wt::TargetThisWindow);
const boost::any & option(const std::string &attribute) const
Get an options value.
WsAnchor(Wt::WContainerWidget *parent=0)
CTor.