24#ifndef HTML_FORM_DYNAMIC_TABLE_HPP
25#define HTML_FORM_DYNAMIC_TABLE_HPP
41#include "html_div.hpp"
42#include "html_table.hpp"
43#include "html_button.hpp"
44#include "html_text.hpp"
45#include "html_form_input.hpp"
46#include "html_form_select.hpp"
74 const std::string & context,
75 std::string & changed_event)
const = 0;
126 static const std::string changed;
131 const std::string & adder_text,
132 const std::string & adder_default_choice
151 iterator & operator ++ (
signed int n) { ++ptr;
return *
this; };
152 iterator operator ++ () {
iterator ret; ret.ptr = ptr; ++ptr;
return ret; };
153 bool operator == (
const iterator & ref)
const {
return ptr == ref.ptr; };
154 bool operator != (
const iterator & ref)
const {
return ptr != ref.ptr; };
155 std::shared_ptr<html_text> get_left_label()
const {
return ptr->left_label; };
156 unsigned int get_object_type()
const {
return ptr->object_type_index; };
157 std::shared_ptr<body_builder> get_object()
const {
return ptr->dynobj; };
160 std::list<line>::const_iterator ptr;
165 iterator begin()
const {
iterator ret; ret.ptr = table_content.begin();
return ret; };
166 iterator end()
const { iterator ret; ret.ptr = table_content.end();
return ret; };
167 iterator last()
const { iterator ret; ret.ptr = prev(table_content.end());
return ret; };
170 bool empty()
const {
return table_content.empty(); };
214 void clear() { table_content.clear(); del_event_to_content.clear(); events_to_delete.clear(); };
222 void add_line(
unsigned int typenum);
225 virtual void load_json(
const json & source)
override;
234 virtual void on_event(
const std::string & event_name)
override;
269 static constexpr const char* new_line_to_add =
"new_line";
274 line() { left_label.reset(); dynobj.reset(); del.reset(); };
276 std::shared_ptr<html_text> left_label;
277 unsigned int object_type_index;
278 std::shared_ptr<body_builder> dynobj;
279 std::unique_ptr<html_form_input> del;
286 std::list<line> table_content;
287 unsigned int event_del_count;
288 std::map<std::string, std::list<line>::iterator> del_event_to_content;
289 std::deque<std::string> events_to_delete;
290 std::string default_choice;
295 void del_line(
const std::string & event_name);
296 void purge_to_delete();
298 static constexpr const unsigned int format_version = 1;
299 static constexpr const char* myclass_id =
"html_form_dynamic_table";
301 static constexpr const char* jlabel_has_left_label =
"has-lef-labels";
302 static constexpr const char* jlabel_contents =
"contents";
303 static constexpr const char* jlabel_left_label =
"left-label";
304 static constexpr const char* jlabel_index_type =
"type";
305 static constexpr const char* jlabel_dynobj =
"object";
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
class chemin definition
Definition: chemin.hpp:51
class events
Definition: events.hpp:52
class html_div is the implementation of
Definition: html_div.hpp:46
html component implementing the html table structure
Definition: html_table.hpp:52
void css_border_collapsed(bool mode)
whether border are collapsed or separated (collasped by default)
Definition: html_table.cpp:52
void set_css_class_first_row(const std::string &val)
define a specific css object for the cells first row
Definition: html_table.cpp:63
void set_css_class_first_column(const std::string &val)
define a specific css class for the cells first column
Definition: html_table.cpp:84
void set_css_class_cells(const std::string &val)
assigned to all cells except those of the first raw if set_css_cells_first_raw was set
Definition: html_table.cpp:104
class jsoner
Definition: jsoner.hpp:73
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45
defines jsoner class and class exception_json