Webdar 1.0.0
Web user interface to libdar
html_label.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_LABEL_HPP
25#define HTML_LABEL_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 "static_body_builder.hpp"
39#include "html_tooltip.hpp"
40#include "html_text.hpp"
41
43
45
47{
48public:
50 html_label(const std::string & x_label);
51
54 html_label(const std::string & x_label, const std::string & x_tooltip);
55 html_label(const html_label & ref) = default;
56 html_label(html_label && ref) noexcept = delete;
57 html_label & operator = (const html_label & ref) = default;
58 html_label & operator = (html_label && ref) noexcept = delete;
59 ~html_label() = default;
60
62 void set_label(const std::string & val) { label = val; };
63
65 const std::string & get_label() const { return label; };
66
68 void set_emphase(bool em) { emphase = em; };
69
71 void set_for_field(const std::string & val) { for_field = val; };
72
74 const std::string & get_for_field() const { return for_field; };
75
77 virtual std::string get_body_part() const override;
78
79protected:
81 virtual std::string inherited_get_body_part(const chemin & path,
82 const request & req) override;
83
85
87 virtual void has_adopted(body_builder *obj) { throw WEBDAR_BUG; };
88
89
90private:
91 std::string label;
92 std::string for_field;
93 bool emphase;
94};
95
96#endif
class body_builder is the root class of object generating HTML body
Definition: body_builder.hpp:99
class chemin definition
Definition: chemin.hpp:51
class html_label implements label and tooltips (helper string showing when mouse hovering)
Definition: html_label.hpp:47
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_label.cpp:60
virtual void has_adopted(body_builder *obj)
inherited from body builder
Definition: html_label.hpp:87
void set_emphase(bool em)
set the label in bold or equivalent method to emphase it compare to the others
Definition: html_label.hpp:68
virtual std::string get_body_part() const override
inherited from static_body_builder
Definition: html_label.cpp:66
void set_for_field(const std::string &val)
define the 'for' field to link this label to other CSS structure
Definition: html_label.hpp:71
const std::string & get_for_field() const
read the current 'for' field value
Definition: html_label.hpp:74
const std::string & get_label() const
get the current value of the label
Definition: html_label.hpp:65
void set_label(const std::string &val)
change the label value from the value provided at construction time
Definition: html_label.hpp:62
html_label(const std::string &x_label)
Definition: html_label.cpp:45
class html_tooltip is a partial body_builder implementation for inherited class to implement tooltips
Definition: html_tooltip.hpp:51
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45
base class of html components that are static
Definition: static_body_builder.hpp:47