-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathswad_HTML.h
245 lines (203 loc) · 8.41 KB
/
swad_HTML.h
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
// swad_HTML.h: tables, divs
#ifndef _SWAD_HTM
#define _SWAD_HTM
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2025 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#include <stdbool.h> // For boolean type
#include "swad_constant.h"
/*****************************************************************************/
/********************************* Public types ******************************/
/*****************************************************************************/
typedef enum
{
HTM_Type_UNSIGNED,
HTM_Type_LONG,
HTM_Type_STRING,
} HTM_Type_t;
typedef unsigned HTM_Attributes_t;
#define HTM_NO_ATTR 0
#define HTM_CHECKED (1 << 0)
#define HTM_SELECTED (1 << 1)
#define HTM_REQUIRED (1 << 2)
#define HTM_AUTOFOCUS (1 << 3)
#define HTM_DISABLED (1 << 4)
#define HTM_SUBMIT_ON_CHANGE (1 << 5)
#define HTM_SUBMIT_ON_CLICK (1 << 6)
#define HTM_NUM_HEAD_ALIGN 3
typedef enum
{
HTM_HEAD_LEFT = 0,
HTM_HEAD_CENTER = 1,
HTM_HEAD_RIGHT = 2,
} HTM_HeadAlign;
/*****************************************************************************/
/****************************** Public prototypes ****************************/
/*****************************************************************************/
void HTM_TITLE_Begin (void);
void HTM_TITLE_End (void);
void HTM_TABLE_Begin (const char *fmt,...);
void HTM_TABLE_BeginPadding (unsigned CellPadding);
void HTM_TABLE_BeginCenterPadding (unsigned CellPadding);
void HTM_TABLE_BeginCenter (void);
void HTM_TABLE_BeginWidePadding (unsigned CellPadding);
void HTM_TABLE_BeginWide (void);
void HTM_TABLE_BeginWideMarginPadding (unsigned CellPadding);
void HTM_TABLE_End (void);
void HTM_TBODY_Begin (const char *fmt,...);
void HTM_TBODY_End (void);
void HTM_TR_Begin (const char *fmt,...);
void HTM_TR_End (void);
void HTM_TH (const char *Txt,HTM_HeadAlign HeadAlign);
void HTM_TH_Begin (HTM_HeadAlign HeadAlign);
void HTM_TH_Span (const char *Title,HTM_HeadAlign HeadAlign,
unsigned RowSpan,unsigned ColSpan,
const char *ClassFmt,...);
void HTM_TH_Span_Begin (HTM_HeadAlign HeadAlign,
unsigned RowSpan,unsigned ColSpan,
const char *ClassFmt,...);
void HTM_TH_End (void);
void HTM_TH_Empty (unsigned NumColumns);
void HTM_TD_Begin (const char *fmt,...);
void HTM_TD_End (void);
void HTM_TD_Empty (unsigned NumColumns);
void HTM_TD_ColouredEmpty (unsigned NumColumns);
void HTM_DIV_Begin (const char *fmt,...);
void HTM_DIV_End (void);
void HTM_MAIN_Begin (const char *Class);
void HTM_MAIN_End (void);
void HTM_ARTICLE_Begin (const char *ArticleId);
void HTM_ARTICLE_End (void);
void HTM_SECTION_Begin (const char *SectionId);
void HTM_SECTION_End (void);
void HTM_SPAN_Begin (const char *fmt,...);
void HTM_SPAN_End (void);
void HTM_OL_Begin (void);
void HTM_OL_End (void);
void HTM_UL_Begin (const char *fmt,...);
void HTM_UL_End (void);
void HTM_LI_Begin (const char *fmt,...);
void HTM_LI_End (void);
void HTM_DL_Begin (void);
void HTM_DL_End (void);
void HTM_DT_Begin (void);
void HTM_DT_End (void);
void HTM_DD_Begin (void);
void HTM_DD_End (void);
void HTM_A_Begin (const char *fmt,...);
void HTM_A_End (void);
void HTM_SCRIPT_Begin (const char *URL,const char *CharSet);
void HTM_SCRIPT_End (void);
void HTM_PARAM (const char *Name,const char *fmt,...);
void HTM_FIELDSET_Begin (const char *fmt,...);
void HTM_FIELDSET_End (void);
void HTM_LEGEND (const char *Txt);
void HTM_LABEL_Begin (const char *fmt,...);
void HTM_LABEL_End (void);
void HTM_INPUT_TEXT (const char *Name,unsigned MaxLength,const char *Value,
HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_INPUT_SEARCH (const char *Name,unsigned MaxLength,const char *Value,
const char *fmt,...);
void HTM_INPUT_TEL (const char *Name,const char *Value,
HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_INPUT_EMAIL (const char *Name,unsigned MaxLength,const char *Value,
HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_INPUT_URL (const char *Name,const char *Value,
HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_INPUT_FILE (const char *Name,const char *Accept,
HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_INPUT_BUTTON (const char *Name,const char *Value,const char *Attr);
void HTM_INPUT_IMAGE (const char *URL,const char *Icon,const char *Title,
const char *fmt,...);
void HTM_INPUT_PASSWORD (const char *Name,
const char *PlaceHolder,const char *AutoComplete,
HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_INPUT_LONG (const char *Name,long Min,long Max,long Value,
HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_INPUT_FLOAT (const char *Name,double Min,double Max,
double Step, // Use 0 for "any"
double Value,
HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_INPUT_RADIO (const char *Name,
HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_INPUT_CHECKBOX (const char *Name,
HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_BUTTON_Submit_Begin (const char *Title,const char *fmt,...);
void HTM_BUTTON_Begin (const char *Title,const char *fmt,...);
void HTM_BUTTON_End (void);
void HTM_TEXTAREA_Begin (HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_TEXTAREA_End (void);
void HTM_SELECT_Begin (HTM_Attributes_t Attributes,
const char *FuncsOnChange,
const char *fmt,...);
void HTM_SELECT_End (void);
void HTM_OPTGROUP_Begin (const char *Label);
void HTM_OPTGROUP_End (void);
void HTM_OPTION (HTM_Type_t Type,const void *ValuePtr,
HTM_Attributes_t Attributes,const char *fmt,...);
void HTM_IMG (const char *URL,const char *Icon,const char *Title,
const char *fmt,...);
void HTM_STRONG_Begin (void);
void HTM_STRONG_End (void);
void HTM_EM_Begin (void);
void HTM_EM_End (void);
void HTM_U_Begin (void);
void HTM_U_End (void);
void HTM_BR (void);
void HTM_TxtF (const char *fmt,...);
void HTM_SPTxt (const char *Txt);
void HTM_SP (void);
void HTM_Txt (const char *Txt);
void HTM_TxtColon (const char *Txt);
void HTM_TxtSemicolon (const char *Txt);
void HTM_TxtColonNBSP (const char *Txt);
void HTM_NBSPTxt (const char *Txt);
void HTM_NBSP (void);
void HTM_Colon (void);
void HTM_Semicolon (void);
void HTM_Dot (void);
void HTM_Comma (void);
void HTM_Hyphen (void);
void HTM_Asterisk (void);
void HTM_Unsigned (unsigned Num);
void HTM_UnsignedColon (unsigned Num);
void HTM_Light0 (void);
void HTM_Int (int Num);
void HTM_UnsignedLong (unsigned long Num);
void HTM_Long (long Num);
void HTM_Double (double Num);
void HTM_DoubleFewDigits (double Num);
void HTM_Double2Decimals (double Num);
void HTM_Percentage (double Percentage);
void HTM_TD_Txt_Left (const char *Txt);
void HTM_TD_Txt_Right (const char *Txt);
void HTM_TD_TxtColon (const char *Txt);
void HTM_TD_LINE_TOP_Txt (const char *Txt);
void HTM_TD_Unsigned (unsigned Num);
void HTM_TD_LINE_TOP_Unsigned (unsigned Num);
void HTM_TD_UnsignedLong (unsigned long Num);
void HTM_TD_LINE_TOP_UnsignedLong (unsigned long Num);
void HTM_TD_Percentage (unsigned Num,unsigned NumTotal);
void HTM_TD_LINE_TOP_Percentage (unsigned Num,unsigned NumTotal);
void HTM_TD_Ratio (unsigned Num,unsigned NumTotal);
void HTM_TD_LINE_TOP_Ratio (unsigned Num,unsigned NumTotal);
void HTM_TD_Double2Decimals (double Num);
void HTM_TD_LINE_TOP_Double2Decimals (double Num);
#endif