Skip to content

Commit 92b50aa

Browse files
Update WebForms.h
1 parent aa3f452 commit 92b50aa

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

c/WebForms.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <stdio.h>
44
#include <stdlib.h>
55
#include <string.h>
6+
#include <stdbool.h>
67

78
#define MAX_ENTRIES 1000
89
#define MAX_KEY_LENGTH 100
@@ -102,15 +103,15 @@ void WebForms_AddStyleWithNameValue(WebForms* webForms, const char* inputPlace,
102103
WebForms_AddStyle(webForms, inputPlace, combined);
103104
}
104105

105-
void WebForms_AddOptionTag(WebForms* webForms, const char* inputPlace, const char* text, const char* value, int selected) {
106+
void WebForms_AddOptionTag(WebForms* webForms, const char* inputPlace, const char* text, const char* value, bool selected) {
106107
char combined[MAX_VALUE_LENGTH];
107108
snprintf(combined, MAX_VALUE_LENGTH, "%s|%s%s", value, text, selected ? "|1" : "");
108109
char key[MAX_KEY_LENGTH];
109110
snprintf(key, MAX_KEY_LENGTH, "ao%s", inputPlace);
110111
NameValueCollection_Add(&webForms->WebFormsData, key, combined);
111112
}
112113

113-
void WebForms_AddCheckBoxTag(WebForms* webForms, const char* inputPlace, const char* text, const char* value, int checked) {
114+
void WebForms_AddCheckBoxTag(WebForms* webForms, const char* inputPlace, const char* text, const char* value, bool checked) {
114115
char combined[MAX_VALUE_LENGTH];
115116
snprintf(combined, MAX_VALUE_LENGTH, "%s|%s%s", value, text, checked ? "|1" : "");
116117
char key[MAX_KEY_LENGTH];
@@ -213,21 +214,21 @@ void WebForms_SetStyleWithNameValue(WebForms* webForms, const char* inputPlace,
213214
WebForms_SetStyle(webForms, inputPlace, combined);
214215
}
215216

216-
void WebForms_SetOptionTag(WebForms* webForms, const char* inputPlace, const char* text, const char* value, int selected) {
217+
void WebForms_SetOptionTag(WebForms* webForms, const char* inputPlace, const char* text, const char* value, bool selected) {
217218
char combined[MAX_VALUE_LENGTH];
218219
snprintf(combined, MAX_VALUE_LENGTH, "%s|%s%s", value, text, selected ? "|1" : "");
219220
char key[MAX_KEY_LENGTH];
220221
snprintf(key, MAX_KEY_LENGTH, "so%s", inputPlace);
221222
NameValueCollection_Add(&webForms->WebFormsData, key, combined);
222223
}
223224

224-
void WebForms_SetChecked(WebForms* webForms, const char* inputPlace, int checked) {
225+
void WebForms_SetChecked(WebForms* webForms, const char* inputPlace, bool checked) {
225226
char key[MAX_KEY_LENGTH];
226227
snprintf(key, MAX_KEY_LENGTH, "sk%s", inputPlace);
227228
NameValueCollection_Add(&webForms->WebFormsData, key, checked ? "1" : "0");
228229
}
229230

230-
void WebForms_SetCheckBoxTagToList(WebForms* webForms, const char* inputPlace, const char* text, const char* value, int checked) {
231+
void WebForms_SetCheckBoxTagToList(WebForms* webForms, const char* inputPlace, const char* text, const char* value, bool checked) {
231232
char combined[MAX_VALUE_LENGTH];
232233
snprintf(combined, MAX_VALUE_LENGTH, "%s|%s%s", value, text, checked ? "|1" : "");
233234
char key[MAX_KEY_LENGTH];
@@ -268,7 +269,7 @@ void WebForms_SetHeightString(WebForms* webForms, const char* inputPlace, const
268269
}
269270

270271
void WebForms_SetWidth(WebForms* webForms, const char* inputPlace, int width) {
271-
char widthStr[20];
272+
char widthStr[20];
272273
snprintf(widthStr, sizeof(widthStr), "%dpx", width);
273274
WebForms_SetWidthString(webForms, inputPlace, widthStr);
274275
}
@@ -316,15 +317,15 @@ void WebForms_InsertStyleWithNameValue(WebForms* webForms, const char* inputPlac
316317
WebForms_InsertStyle(webForms, inputPlace, combined);
317318
}
318319

319-
void WebForms_InsertOptionTag(WebForms* webForms, const char* inputPlace, const char* text, const char* value, int selected) {
320+
void WebForms_InsertOptionTag(WebForms* webForms, const char* inputPlace, const char* text, const char* value, bool selected) {
320321
char combined[MAX_VALUE_LENGTH];
321322
snprintf(combined, MAX_VALUE_LENGTH, "%s|%s%s", value, text, selected ? "|1" : "");
322323
char key[MAX_KEY_LENGTH];
323324
snprintf(key, MAX_KEY_LENGTH, "io%s", inputPlace);
324325
NameValueCollection_Add(&webForms->WebFormsData, key, combined);
325326
}
326327

327-
void WebForms_InsertCheckBoxTag(WebForms* webForms, const char* inputPlace, const char* text, const char* value, int checked) {
328+
void WebForms_InsertCheckBoxTag(WebForms* webForms, const char* inputPlace, const char* text, const char* value, bool checked) {
328329
char combined[MAX_VALUE_LENGTH];
329330
snprintf(combined, MAX_VALUE_LENGTH, "%s|%s%s", value, text, checked ? "|1" : "");
330331
char key[MAX_KEY_LENGTH];
@@ -468,13 +469,13 @@ void WebForms_SetFontSize(WebForms* webForms, const char* inputPlace, int size)
468469
WebForms_SetFontSizeString(webForms, inputPlace, sizeStr);
469470
}
470471

471-
void WebForms_SetFontBold(WebForms* webForms, const char* inputPlace, int bold) {
472+
void WebForms_SetFontBold(WebForms* webForms, const char* inputPlace, bool bold) {
472473
char key[MAX_KEY_LENGTH];
473474
snprintf(key, MAX_KEY_LENGTH, "fb%s", inputPlace);
474475
NameValueCollection_Add(&webForms->WebFormsData, key, bold ? "1" : "0");
475476
}
476477

477-
void WebForms_SetVisible(WebForms* webForms, const char* inputPlace, int visible) {
478+
void WebForms_SetVisible(WebForms* webForms, const char* inputPlace, bool visible) {
478479
char key[MAX_KEY_LENGTH];
479480
snprintf(key, MAX_KEY_LENGTH, "vi%s", inputPlace);
480481
NameValueCollection_Add(&webForms->WebFormsData, key, visible ? "1" : "0");
@@ -486,19 +487,19 @@ void WebForms_SetTextAlign(WebForms* webForms, const char* inputPlace, const cha
486487
NameValueCollection_Add(&webForms->WebFormsData, key, align);
487488
}
488489

489-
void WebForms_SetReadOnly(WebForms* webForms, const char* inputPlace, int readOnly) {
490+
void WebForms_SetReadOnly(WebForms* webForms, const char* inputPlace, bool readOnly) {
490491
char key[MAX_KEY_LENGTH];
491492
snprintf(key, MAX_KEY_LENGTH, "sr%s", inputPlace);
492493
NameValueCollection_Add(&webForms->WebFormsData, key, readOnly ? "1" : "0");
493494
}
494495

495-
void WebForms_SetDisabled(WebForms* webForms, const char* inputPlace, int disabled) {
496+
void WebForms_SetDisabled(WebForms* webForms, const char* inputPlace, bool disabled) {
496497
char key[MAX_KEY_LENGTH];
497498
snprintf(key, MAX_KEY_LENGTH, "sd%s", inputPlace);
498499
NameValueCollection_Add(&webForms->WebFormsData, key, disabled ? "1" : "0");
499500
}
500501

501-
void WebForms_SetFocus(WebForms* webForms, const char* inputPlace, int focus) {
502+
void WebForms_SetFocus(WebForms* webForms, const char* inputPlace, bool focus) {
502503
char key[MAX_KEY_LENGTH];
503504
snprintf(key, MAX_KEY_LENGTH, "sf%s", inputPlace);
504505
NameValueCollection_Add(&webForms->WebFormsData, key, focus ? "1" : "0");
@@ -534,15 +535,15 @@ void WebForms_SetSelectedIndex(WebForms* webForms, const char* inputPlace, int i
534535
NameValueCollection_Add(&webForms->WebFormsData, key, value);
535536
}
536537

537-
void WebForms_SetCheckedValue(WebForms* webForms, const char* inputPlace, const char* value, int selected) {
538+
void WebForms_SetCheckedValue(WebForms* webForms, const char* inputPlace, const char* value, bool selected) {
538539
char key[MAX_KEY_LENGTH];
539540
snprintf(key, MAX_KEY_LENGTH, "ks%s", inputPlace);
540541
char combined[MAX_VALUE_LENGTH];
541542
snprintf(combined, MAX_VALUE_LENGTH, "%s|%s", value, selected ? "1" : "0");
542543
NameValueCollection_Add(&webForms->WebFormsData, key, combined);
543544
}
544545

545-
void WebForms_SetCheckedIndex(WebForms* webForms, const char* inputPlace, int index, int selected) {
546+
void WebForms_SetCheckedIndex(WebForms* webForms, const char* inputPlace, int index, bool selected) {
546547
char key[MAX_KEY_LENGTH];
547548
snprintf(key, MAX_KEY_LENGTH, "ki%s", inputPlace);
548549
char combined[MAX_VALUE_LENGTH];
@@ -1454,6 +1455,7 @@ HtmlEvent createHtmlEvent() {
14541455
return event;
14551456
}
14561457

1458+
14571459
typedef struct {
14581460
const char *Abort;
14591461
const char *AfterPrint;
@@ -1667,4 +1669,4 @@ char* exportActionControlsToWebFormsTag(const char *actionControls) {
16671669
sprintf(result, "<web-forms ac=\"%s\"></web-forms>", actionControls);
16681670

16691671
return result;
1670-
}
1672+
}

0 commit comments

Comments
 (0)