summaryrefslogtreecommitdiffstats
path: root/src/utils/html.h
blob: 7e8002c7d3eddad91de1d64941d9c4001e42f04d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
 * HTML document generation
 *
 * Copyright (C) 2017  Patrick McDermott
 *
 * This file is part of Marquee.
 *
 * Marquee is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Marquee is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Marquee.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef MQ_UTILS_HTML_H
#define MQ_UTILS_HTML_H

#include <glib.h>

G_BEGIN_DECLS

gchar *
mq_html_document(const gchar *title, const gchar *styles,
	const gchar *head_tags, ...) G_GNUC_NULL_TERMINATED;

gchar *
mq_html_document_v(const gchar *title, const gchar *styles,
	const gchar *head_tags, gchar **children);

#define TEXT_ELEMENT(ELEM) \
	gchar * \
	mq_html_##ELEM(const gchar *text); \
	gchar * \
	mq_html_##ELEM##_free(gchar *text);
TEXT_ELEMENT(h1)
TEXT_ELEMENT(h2)
TEXT_ELEMENT(h3)
TEXT_ELEMENT(h4)
TEXT_ELEMENT(h5)
TEXT_ELEMENT(h6)
TEXT_ELEMENT(p)
#undef TEXT_ELEMENT

gchar *
mq_html_container(const gchar *element, const gchar *classes, ...)
	G_GNUC_NULL_TERMINATED;

gchar *
mq_html_container_v(const gchar *element, const gchar *classes,
	gchar **children);

gchar *
mq_html_list(const gchar *type, GDestroyNotify destroy, ...)
	G_GNUC_NULL_TERMINATED;

gchar *
mq_html_list_v(const gchar *type, gchar **children);

gchar *
mq_html_notebook(gboolean vertical, const gchar *name, guint current_page, ...)
	G_GNUC_NULL_TERMINATED;

gchar *
mq_html_form(const gchar *submit_name, const gchar *submit_label,
	const gchar *reset_name, const gchar *reset_label, ...)
	G_GNUC_NULL_TERMINATED;

gchar *
mq_html_form_v(const gchar *submit_name, const gchar *submit_label,
	const gchar *reset_name, const gchar *reset_label, gchar **children);

gchar *
mq_html_input_text(const gchar *name, const gchar *label, const gchar *value);

gchar *
mq_html_input_number_i(const gchar *name, const gchar *label,
	gint min, gint step, gint max, gint value);

gchar *
mq_html_input_number_d(const gchar *name, const gchar *label,
	gdouble min, gdouble step, gdouble max, gdouble value);

gchar *
mq_html_input_radio(const gchar *name, const gchar *id, const gchar *value,
	const gchar *label, gboolean checked);

gchar *
mq_html_input_checkbox(const gchar *name, const gchar *label, gboolean checked);

gchar *
mq_html_input_select(const gchar *name, const gchar *label,
	const gchar *selected,
	GDestroyNotify destroy_value, GDestroyNotify destroy_label, ...)
	G_GNUC_NULL_TERMINATED;

gchar *
mq_html_input_hidden(const gchar *name, const gchar *value);

gchar *
mq_html_label(const gchar *for_id, const gchar *label, gboolean add_colon);

gchar *
mq_html_submit(const gchar *name, const gchar *label, gboolean disabled);

gchar *
mq_html_buttonbox(const gchar *submit_name, const gchar *submit_label,
	const gchar *reset_name, const gchar *reset_label);

gchar *
mq_html_input_iframe(const gchar *src);

G_END_DECLS

#endif  /* MQ_UTILS_HTML_H */