Webdar 1.0.0
Web user interface to libdar
html_tabs.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_TABS_HPP
25#define HTML_TABS_HPP
26
27 // C system header files
28#include "my_config.h"
29extern "C"
30{
31
32}
33
34 // C++ system header files
35#include <string>
36#include <deque>
37
38 // webdar headers
39#include "body_builder.hpp"
40#include "html_div.hpp"
41#include "html_button.hpp"
42#include "html_aiguille.hpp"
43#include "css.hpp"
44#include "html_hr.hpp"
45
47
53
54class html_tabs: public body_builder, public actor
55{
56public:
57 html_tabs();
58 html_tabs(const html_tabs & ref) = delete;
59 html_tabs(html_tabs && ref) noexcept = delete;
60 html_tabs & operator = (const html_tabs & ref) = delete;
61 html_tabs & operator = (html_tabs && ref) noexcept = delete;
62 virtual ~html_tabs();
63
65
69 void add_tab(const std::string & label, const std::string & tag);
70
72 virtual void on_event(const std::string & event_name) override;
73
75 void adopt_in_section(const std::string & tag, body_builder *obj);
76
78 void adopt_in_section(signed int num, body_builder* obj);
79
80
81protected:
82
84 virtual std::string inherited_get_body_part(const chemin & path,
85 const request & req) override;
86
88 virtual void new_css_library_available() override;
89
92
93private:
94 std::map<std::string, unsigned int> corres;
95 std::deque<html_button*> tabs;
96
99
117 html_div tab_bar;
118 html_hr line;
119 html_div content_wrapper;
120 html_aiguille content;
121 unsigned int current_mode;
122
123 void set_css_on(html_button & ref);
124 void set_css_off(html_button & ref);
125
126 void set_mode(unsigned int mode);
127
128 static const char* tab_shape_on;
129 static const char* tab_shape_off;
130 static const char* menu_bar;
131 static const char* tab_sep;
132
133 static const char* css_content_wrapper;
134};
135
136#endif
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
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
class chemin definition
Definition: chemin.hpp:51
class html_aiguille is a pure virtual class
Definition: html_aiguille.hpp:61
simple html component providing the usual button feature of GUIs, better using html_double_button ins...
Definition: html_button.hpp:48
class html_div is the implementation of
Definition: html_div.hpp:46
class html_hr is the implementation of
Definition: html_hr.hpp:45
class html_tabs implements tabs
Definition: html_tabs.hpp:55
virtual void on_event(const std::string &event_name) override
inherited from actor class
Definition: html_tabs.cpp:121
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_tabs.cpp:141
void adopt_in_section(const std::string &tag, body_builder *obj)
adopt_in_section replaces body_builder::adopt()
Definition: html_tabs.cpp:131
virtual void new_css_library_available() override
inherited from body_builder
Definition: html_tabs.cpp:148
void add_tab(const std::string &label, const std::string &tag)
add a new tab to the tab bar
Definition: html_tabs.cpp:80
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45