[UI] Fixed build using older versions of Wt. Playback is unfortunately still broken

This commit is contained in:
emeric
2016-11-12 12:23:23 +01:00
parent 0a70552f8d
commit d8f8c77c07
4 changed files with 42 additions and 11 deletions
+17 -10
View File
@@ -21,29 +21,36 @@
#if WT_VERSION < 0X03030500
#include <Wt/WTemplate>
#include <Wt/WText>
#endif
#include "InputRange.hpp"
#if WT_VERSION >= 0X03030500
InputRange::InputRange(Wt::WContainerWidget *parent)
: Wt::WWebWidget(parent)
{
//TODO woraround for older Wt versions
#if WT_VERSION >= 0X03030500
setHtmlTagName("input");
setAttributeValue("type", "range");
#else
Wt::WTemplate *t = new Wt::WTemplate("<input type=\"range\"></input>", parent);
#endif
}
std::string
InputRange::jsRef(void) const
{
#if WT_VERSION >= 0X03030500
return Wt::WWebWidget::jsRef();
#else
return this->jsRef() + ".getElementsByTagName(\"input\")[0]";
#endif
}
#else
InputRange::InputRange(Wt::WContainerWidget *parent)
: Wt::WContainerWidget(parent)
{
addWidget(new Wt::WTemplate("<input type=\"range\"></input>"));
}
std::string
InputRange::jsRef(void) const
{
return Wt::WWebWidget::jsRef() + ".getElementsByTagName(\"input\")[0]";
}
#endif
+15 -1
View File
@@ -22,11 +22,12 @@
#include <Wt/WContainerWidget>
#include <Wt/WWebWidget>
#include <Wt/WConfig.h>
#if WT_VERSION >= 0X03030500
class InputRange : public Wt::WWebWidget
{
public:
InputRange(Wt::WContainerWidget *parent = 0);
Wt::DomElementType domElementType() const
{
return Wt::DomElement_INPUT;
@@ -35,3 +36,16 @@ class InputRange : public Wt::WWebWidget
std::string jsRef() const;
};
#else
class InputRange : public Wt::WContainerWidget
{
public:
InputRange(Wt::WContainerWidget *parent = 0);
std::string jsRef() const;
};
#endif