Webdar 1.0.0
Web user interface to libdar
html_form_fieldset.hpp
1/*********************************************************************/
2// webdar - a web server and interface program to libdar
3// Copyright (C) 2013-2025 Denis Corbin
4//
5// This file is part of Webdar
6//
7// Webdar is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// Webdar is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Webdar. If not, see <http://www.gnu.org/licenses/>
19//
20//----
21// to contact the author: dar.linux@free.fr
22/*********************************************************************/
23
24#ifndef HTML_FORM_FIELDSET_HPP
25#define HTML_FORM_FIELDSET_HPP
26
27 // C system header files
28#include "my_config.h"
29extern "C"
30{
31
32}
33
34 // C++ system header files
35
36
37 // webdar headers
38#include "body_builder.hpp"
39#include "html_legend.hpp"
40
42
49
51{
52public:
53 html_form_fieldset(const std::string & label):legend(label) { adopt(&legend); };
54 html_form_fieldset(const html_form_fieldset & ref) = default;
55 html_form_fieldset(html_form_fieldset && ref) noexcept = delete;
56 html_form_fieldset & operator = (const html_form_fieldset & ref) = default;
57 html_form_fieldset & operator = (html_form_fieldset && ref) noexcept = delete;
58 ~html_form_fieldset() = default;
59
60 void change_label(const std::string & label) { legend.change_label(label); };
61 const std::string get_label() const { return legend.get_label(); };
62
64 void add_label_css_class(const std::string & name) { legend.add_css_class(name); };
65
67 void remove_label_css_class(const std::string & name) { legend.remove_css_class(name); };
68
70 void clear() { orphan_all_children(); adopt(&legend); };
71
73 virtual void bind_to_anchor(const std::string & val) override { update_anchor(val); };
74
76 void set_tooltip(const std::string & val) { legend.set_tooltip(val); };
77
78
79protected:
81 virtual std::string inherited_get_body_part(const chemin & path,
82 const request & req) override;
83
85 virtual void has_adopted(body_builder *obj) override;
86
87
88private:
89 html_legend legend;
90 std::string bounded_anchor;
91
92 void update_anchor(const std::string & val);
93
94
95};
96
97#endif
class body_builder is the root class of object generating HTML body
Definition: body_builder.hpp:99
void adopt(body_builder *obj)
Definition: body_builder.cpp:117
void remove_css_class(const std::string &name)
remove the provided css_class name from the list of css_class names this object has been assigned to
Definition: body_builder.cpp:273
void orphan_all_children()
orphan all adopted children
Definition: body_builder.cpp:552
void add_css_class(const std::string &name)
set this object with a additional css_class (assuming it is defined in a css_library available for th...
Definition: body_builder.cpp:247
class chemin definition
Definition: chemin.hpp:51
class html_form_fieldset implements HTML fieldset feature
Definition: html_form_fieldset.hpp:51
void remove_label_css_class(const std::string &name)
css is only applied css to the title of the form fieldset
Definition: html_form_fieldset.hpp:67
virtual void bind_to_anchor(const std::string &val) override
inherited from body_builder
Definition: html_form_fieldset.hpp:73
virtual void has_adopted(body_builder *obj) override
inherited from body_builder
Definition: html_form_fieldset.cpp:55
void add_label_css_class(const std::string &name)
css is only applied css to the title of the form fieldset
Definition: html_form_fieldset.hpp:64
void set_tooltip(const std::string &val)
surfacing the tooltip feature of html_legend
Definition: html_form_fieldset.hpp:76
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_form_fieldset.cpp:43
void clear()
clear and destroy previously added objects
Definition: html_form_fieldset.hpp:70
class html_legend implements HTML legend feature
Definition: html_legend.hpp:45
void set_tooltip(const std::string &helper)
set the helper to the tooltip (helper popup)
Definition: html_tooltip.cpp:45
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45