24#ifndef HTML_FORM_INPUT_UNIT_HPP
25#define HTML_FORM_INPUT_UNIT_HPP
35#include <dar/libdar.hpp>
38#include "html_form_input.hpp"
39#include "html_size_unit.hpp"
42#include "html_div.hpp"
54 static const std::string changed;
57 const libdar::infinint & initial_value,
58 const std::string &
size);
68 void set_range(
const libdar::infinint & x_min,
const libdar::infinint & x_max);
82 void change_label(
const std::string & label) { field.change_label(label); };
84 void set_value_as_infinint(
const libdar::infinint & x_val);
85 libdar::infinint get_value_as_infinint()
const {
return val; };
88 const std::string &
get_raw_value()
const {
return field.get_value(); };
107 std::string
get_event_name()
const {
return modif_change.empty()? changed: modif_change; };
110 virtual void on_event(
const std::string & event_name)
override;
125 libdar::infinint val;
126 libdar::infinint min;
127 libdar::infinint max;
129 std::string modif_change;
131 void my_act() {
if(!no_act)
act(modif_change.empty() ? changed: modif_change); };
132 void reduce_val_and_unit();
133 void set_field_val();
134 void set_value_to_largest_unit();
135 void check_min_max_compliance();
139 static libdar::infinint reduce_to_unit(
const libdar::infinint & val,
const libdar::infinint & unit);
142 static libdar::infinint reduce_to_unit_above(
const libdar::infinint & val,
const libdar::infinint & unit);
144 static const std::string css_input;
145 static const std::string css_unit;
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
class events
Definition: events.hpp:52
void act(const std::string &name)
trigger a given event
Definition: events.cpp:151
class html_div is the implementation of
Definition: html_div.hpp:46
html component in a form a couple of dropdown list for user to define a size in byte or larger units
Definition: html_size_unit.hpp:44
std::string get_string() const
return the unit label
Definition: html_size_unit.hpp:59
void set_enabled(bool val)
whether the HTML control is enable or disabled
Definition: html_size_unit.hpp:85
unsigned int size() const
the number of peers
Definition: reference.hpp:97