| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include <string> |
| 24 |
|
| 25 |
#include "Languages.h" |
| 26 |
#include "Server/Web/HtmlTag.h" |
| 27 |
#include "Server/Web/HtmlTagLabel.h" |
| 28 |
#include "Server/Web/HtmlTagInputInteger.h" |
| 29 |
|
| 30 |
namespace Server { namespace Web |
| 31 |
{ |
| 32 |
class HtmlTagInputIntegerWithLabel : public HtmlTag |
| 33 |
{ |
| 34 |
public: |
| 35 |
HtmlTagInputIntegerWithLabel() = delete; |
| 36 |
|
| 37 |
HtmlTagInputIntegerWithLabel(const std::string& name, |
| 38 |
const Languages::TextSelector label, |
| 39 |
const int min, |
| 40 |
const int max) |
| 41 |
: HtmlTagInputIntegerWithLabel(name, label, 0, min, max) |
| 42 |
{} |
| 43 |
|
| 44 |
HtmlTagInputIntegerWithLabel(const std::string& name, |
| 45 |
const Languages::TextSelector label, |
| 46 |
const Languages::TextSelector tooltip, |
| 47 |
const int min, |
| 48 |
const int max) |
| 49 |
: HtmlTagInputIntegerWithLabel(name, label, tooltip, 0, min, max) |
| 50 |
{} |
| 51 |
|
| 52 |
template<typename... TextArgs> |
| 53 |
HtmlTagInputIntegerWithLabel(const std::string& name, |
| 54 |
const Languages::TextSelector label, |
| 55 |
const int value, |
| 56 |
const int min, |
| 57 |
const int max, |
| 58 |
TextArgs... textArgs) |
| 59 |
: HtmlTag("div") |
| 60 |
{ |
| 61 |
HtmlTag::AddClass("input_integer_with_label"); |
| 62 |
AddChildTag(HtmlTagLabel(label, name, textArgs...)); |
| 63 |
AddChildTag(HtmlTagInputInteger(name, value, min, max)); |
| 64 |
} |
| 65 |
|
| 66 |
template<typename... TextArgs> |
| 67 |
HtmlTagInputIntegerWithLabel(const std::string& name, |
| 68 |
const Languages::TextSelector label, |
| 69 |
const Languages::TextSelector tooltip, |
| 70 |
const int value, |
| 71 |
const int min, |
| 72 |
const int max, |
| 73 |
TextArgs... textArgs) |
| 74 |
: HtmlTag("div") |
| 75 |
{ |
| 76 |
HtmlTag::AddClass("input_integer_with_label"); |
| 77 |
AddChildTag(HtmlTagLabel(label, tooltip, name, textArgs...)); |
| 78 |
AddChildTag(HtmlTagInputInteger(name, value, min, max)); |
| 79 |
} |
| 80 |
|
| 81 |
virtual ~HtmlTagInputIntegerWithLabel() |
| 82 |
{ |
| 83 |
} |
| 84 |
|
| 85 |
inline virtual HtmlTag AddAttribute(const std::string& name, const std::string& value) override |
| 86 |
{ |
| 87 |
childTags[1].AddAttribute(name, value); |
| 88 |
return *this; |
| 89 |
} |
| 90 |
|
| 91 |
inline virtual HtmlTag AddClass(const std::string& _class) override |
| 92 |
{ |
| 93 |
childTags[1].AddClass(_class); |
| 94 |
return *this; |
| 95 |
} |
| 96 |
}; |
| 97 |
}} |
| 98 |
|