/usr/lib/Wt/examples/widgetgallery/ControlsWidget.C is in witty-examples 3.1.10-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | /*
* Copyright (C) 2008 Emweb bvba
*
* See the LICENSE file for terms of use.
*/
#include "ControlsWidget.h"
#include <Wt/WText>
#include <sstream>
#include <boost/algorithm/string.hpp>
using namespace Wt;
ControlsWidget::ControlsWidget(EventDisplayer *ed, bool hasSubMenu)
: WContainerWidget(),
ed_(ed),
hasSubMenu_(hasSubMenu)
{ }
void ControlsWidget::populateSubMenu(Wt::WMenu *menu)
{
}
std::string ControlsWidget::escape(const std::string &name) const
{
std::stringstream ss;
for(unsigned int i = 0; i < name.size(); ++i) {
if (name[i] != ':') {
ss << name[i];
} else {
ss << "_1";
}
}
return ss.str();
}
std::string ControlsWidget::docAnchor(const std::string &classname) const
{
std::stringstream ss;
#if !defined(WT_TARGET_JAVA)
ss << "<a href=\"http://www.webtoolkit.eu/wt/doc/reference/html/class"
<< escape("Wt::" + classname)
<< ".html\" target=\"_blank\">doc</a>";
#else
std::string cn = boost::replace_all(classname, "Chart::","chart/");
ss << "<a href=\"http://www.webtoolkit.eu/"
<< "jwt/latest/doc/javadoc/eu/webtoolkit/jwt/"
<< classname
<< ".html\" target=\"_blank\">doc</a>";
#endif
return ss.str();
}
std::string ControlsWidget::title(const std::string& classname) const
{
std::string cn;
#if defined(WT_TARGET_JAVA)
cn = boost::replace_all(classname, "Chart::","");
#else
cn = classname;
#endif
return std::string("<span class=\"title\">") + cn + "</span> "
+ "<span class=\"doc\">["
+ docAnchor(classname) + "]</span>";
}
void ControlsWidget::topic(const std::string &classname,
WContainerWidget *parent) const
{
new WText(title(classname) + "<br/>", parent);
}
void ControlsWidget::topic(const std::string &classname1,
const std::string &classname2,
WContainerWidget *parent) const
{
new WText(title(classname1) + " and " + title(classname2) + "<br/>",
parent);
}
void ControlsWidget::topic(const std::string &classname1,
const std::string &classname2,
const std::string &classname3,
WContainerWidget *parent) const
{
new WText(title(classname1) + ", " + title(classname2) + " and "
+ title(classname3) + "<br/>", parent);
}
void ControlsWidget::topic(const std::string &classname1,
const std::string &classname2,
const std::string &classname3,
const std::string &classname4,
WContainerWidget *parent) const
{
new WText(title(classname1) + ", " + title(classname2) + ", "
+ title(classname3) + " and " + title(classname4) + "<br/>",
parent);
}
|