File: ControlsWidget.C

package info (click to toggle)
witty 3.1.2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 45,512 kB
  • ctags: 35,832
  • sloc: cpp: 69,469; ansic: 66,945; xml: 4,383; sh: 594; perl: 108; makefile: 106
file content (86 lines) | stat: -rw-r--r-- 2,144 bytes parent folder | download
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
/*
 * Copyright (C) 2008 Emweb bvba
 *
 * See the LICENSE file for terms of use.
 */

#include "ControlsWidget.h"
#include <Wt/WText>
#include <sstream>

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::doxygenAnchor(const std::string &classname) const
{
  std::stringstream ss;
  ss << "<a href=\"http://www.webtoolkit.eu/wt/doc/reference/html/class"
     << escape("Wt::" + classname)
     << ".html\" target=\"_blank\">doc</a>";

  return ss.str();
}

std::string ControlsWidget::title(const std::string& classname) const
{
  return "<span class=\"title\">" + classname + "</span> "
    + "<span class=\"doc\">["
    + doxygenAnchor(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);
}