40class DilloHtmlReceiver;
76 friend class DilloHtmlReceiver;
77 friend class DilloHtmlInput;
83 DilloUrl *buildQueryUrl(DilloHtmlInput *active_input);
84 Dstr *buildQueryData(DilloHtmlInput *active_submit);
85 char *makeMultipartBoundary(iconv_t char_encoder,
86 DilloHtmlInput *active_submit);
87 Dstr *encodeText(iconv_t char_encoder,
Dstr **input);
88 void strUrlencodeAppend(
Dstr *dstr,
const char *str);
89 void inputUrlencodeAppend(
Dstr *data,
const char *name,
const char *value);
90 void inputMultipartAppend(
Dstr *data,
const char *boundary,
91 const char *name,
const char *value);
92 void filesInputMultipartAppend(
Dstr* data,
const char *boundary,
93 const char *name,
Dstr *file,
94 const char *filename);
96 void imageInputMultipartAppend(
Dstr *data,
const char *boundary,
Dstr *name,
103 char *submit_charset;
107 int num_entry_fields;
109 DilloHtmlReceiver *form_receiver;
117 DilloHtmlInput *getInput (
Resource *resource);
118 DilloHtmlInput *getRadioInput (
const char *name);
119 void submit(DilloHtmlInput *active_input,
EventButton *event);
121 void display_hiddens(
bool display);
123 void setEnabled(
bool enabled);
126class DilloHtmlReceiver:
130 friend class DilloHtmlForm;
132 DilloHtmlReceiver (DilloHtmlForm* form2) {
form = form2; }
133 ~DilloHtmlReceiver () { }
140class DilloHtmlInput {
143 friend class DilloHtmlForm;
155 DilloHtmlSelect *select;
161 void connectTo(DilloHtmlReceiver *form_receiver);
162 void activate(DilloHtmlForm *
form,
int num_entry_fields,
EventButton *event);
167 const char *name,
const char *init_str,
bool init_val,
bool owns_embed);
169 void appendValuesTo(
Dlist *values,
bool is_active_submit);
171 void setEnabled(
bool enabled) {
if (embed) embed->
setEnabled(enabled); };
172 Resource *getResource() {
if (embed) {
return embed->
getResource(); }
else {
return NULL; } };
175class DilloHtmlOptbase
178 virtual ~DilloHtmlOptbase () {};
179 virtual bool isSelected() {
return false;}
180 virtual bool select() {
return false;}
181 virtual const char *getValue() {
return NULL;}
182 virtual void setContent(
const char *str,
int len)
183 {
MSG_ERR(
"Form: Optbase setContent()\n");}
187class DilloHtmlOptgroup :
public DilloHtmlOptbase {
192 DilloHtmlOptgroup (
char *label,
bool enabled);
193 virtual ~DilloHtmlOptgroup ();
198class DilloHtmlOptgroupClose :
public DilloHtmlOptbase {
200 virtual ~DilloHtmlOptgroupClose () {};
205class DilloHtmlOption :
public DilloHtmlOptbase {
206 friend class DilloHtmlSelect;
208 char *value, *label, *content;
209 bool selected, enabled;
210 DilloHtmlOption (
char *value,
char *label,
bool selected,
bool enabled);
211 virtual ~DilloHtmlOption ();
212 bool isSelected() {
return selected;}
213 bool select() {
return (selected =
true);}
214 const char *getValue() {
return value ? value : content;}
215 void setContent(
const char *str,
int len) {content =
dStrndup(str, len);}
217 {res->
addItem(label ? label : content, enabled, selected);}
220class DilloHtmlSelect {
221 friend class DilloHtmlInput;
227 DilloHtmlOptbase *getCurrentOpt ();
228 void addOpt (DilloHtmlOptbase *opt);
229 void ensureSelection ();
244 return new DilloHtmlForm (html, method, action, content_type, charset,
260 ((DilloHtmlForm *)vform)->submit(NULL, NULL);
265 ((DilloHtmlForm *)vform)->reset();
270 ((DilloHtmlForm *)vform)->display_hiddens(display);
281 Embed *embed,
const char *name,
const char *init_str,
282 bool init_val,
bool owns_embed)
284 _MSG(
"name=[%s] init_str=[%s] init_val=[%d]\n", name, init_str, init_val);
285 DilloHtmlInput *input =
286 new DilloHtmlInput(type, embed, name, init_str, init_val, owns_embed);
295 input->setEnabled(
false);
313 for (
int idx = 0; idx < inputs->
size(); idx++) {
314 DilloHtmlInput *input = inputs->
get(idx);
335 return (inputs && inputs->
size() > 0) ?
336 inputs->
get (inputs->
size() - 1) : NULL;
347 char *charset, *first;
368 BUG_MSG(
"<form> submission method unknown: '%s'.", attrbuf);
375 BUG_MSG(
"<form> requires action attribute.");
386 if ((attrbuf =
a_Html_get_attr(html, tag, tagsize,
"accept-charset"))) {
388 char *ptr = first =
dStrdup(attrbuf);
389 while (ptr && !charset) {
390 char *curr =
dStrsep(&ptr,
" ,");
403 html->
formNew(method, action, content_type, charset);
421 const int MAX_SIZE = 1024;
425 size = strtol(attrbuf, NULL, 10);
426 if (size < 1 || size > MAX_SIZE) {
428 size = (size < 1 ? 20 : MAX_SIZE);
429 BUG_MSG(
"<input> size=%d, using size=%d instead.", badSize, size);
440 bool owns_embed =
true;
444 char *value, *name, *type, *init_str, *placeholder = NULL;
445 const char *attrbuf, *label;
446 bool init_val =
false;
450 BUG_MSG(
"<input> inside <select>.");
454 BUG_MSG(
"<input> inside <button>.");
458 factory =
HT2LT(html)->getResourceFactory();
478 init_str = (value) ? value :
dStrdup(
"on");
483 if (input && input->getResource())
495 init_str = (value) ? value :
dStrdup(
"Submit");
499 init_str = (value) ? value :
dStrdup(
"Reset");
507 label = attrbuf ? attrbuf : value ? value : name ? name :
"Submit";
523 BUG_MSG(
"<form> with file input MUST use HTTP POST method.");
524 MSG(
"File input ignored in form not using HTTP POST method\n");
527 BUG_MSG(
"<form> with file input MUST use multipart/form-data"
529 MSG(
"File input ignored in form not using multipart/form-data"
535 init_str =
dStrdup(
"File selector");
557 embed =
new Embed(resource);
572 int maxlen = strtol(attrbuf, NULL, 10);
591 (init_str) ? init_str :
"", init_val, owns_embed);
596 if (init_str != value)
612 MSG(
"<isindex> inside <form> not handled.\n");
657 const int MAX_COLS=1024, MAX_ROWS=10000;
667 cols = strtol(attrbuf, NULL, 10);
670 BUG_MSG(
"<textarea> requires cols attribute.");
673 if (cols < 1 || cols > MAX_COLS) {
675 cols = (cols < 1 ? 20 : MAX_COLS);
676 BUG_MSG(
"<textarea> cols=%d, using cols=%d instead.", badCols, cols);
679 rows = strtol(attrbuf, NULL, 10);
682 BUG_MSG(
"<textarea> requires rows attribute.");
685 if (rows < 1 || rows > MAX_ROWS) {
687 rows = (rows < 1 ? 2 : MAX_ROWS);
688 BUG_MSG(
"<textarea> rows=%d, using rows=%d instead.", badRows, rows);
727 DilloHtmlInput *input;
739 for (i = 0; i < html->
Stash->
len; ++i) {
741 if (html->
Stash->
str[i + 1] ==
'\n')
752 input->init_str = str;
753 Resource *res = input->getResource();
779 rows = strtol(attrbuf, NULL, 10);
784 rows = multi ? 10 : 1;
788 if (rows == 1 && multi ==
false)
838 DilloHtmlSelect *select = input->select;
841 select->ensureSelection ();
844 if (input->getResource())
853 BUG_MSG(
"<optgroup> outside <select>.");
872 bool enabled = (
a_Html_get_attr(html, tag, tagsize,
"disabled") == NULL);
875 BUG_MSG(
"<optgroup> requires label attribute.");
879 DilloHtmlOptgroup *opt =
880 new DilloHtmlOptgroup (label, enabled);
882 input->select->addOpt(opt);
900 DilloHtmlOptgroupClose *opt =
new DilloHtmlOptgroupClose ();
902 input->select->addOpt(opt);
913 BUG_MSG(
"<option> outside <select>.");
926 bool selected = (
a_Html_get_attr(html, tag, tagsize,
"selected") != NULL);
927 bool enabled = (
a_Html_get_attr(html, tag, tagsize,
"disabled") == NULL);
929 DilloHtmlOption *option =
930 new DilloHtmlOption (value, label, selected, enabled);
932 input->select->addOpt(option);
972 BUG_MSG(
"<button> type unknown: '%s'.", type);
993 bool owns_embed =
true;
1002 embed =
new Embed(resource);
1005 S_TOP(html)->textblock = html->
dw = page;
1010 embed =
new Embed(resource);
1039DilloHtmlForm::DilloHtmlForm (
DilloHtml *html2,
1043 const char *charset,
bool enabled)
1048 content_type = content_type2;
1049 submit_charset =
dStrdup(charset);
1050 inputs =
new misc::SimpleVector <DilloHtmlInput*> (4);
1051 num_entry_fields = 0;
1052 showing_hiddens =
false;
1053 this->enabled = enabled;
1054 form_receiver =
new DilloHtmlReceiver (
this);
1060DilloHtmlForm::~DilloHtmlForm ()
1063 dFree(submit_charset);
1064 for (
int j = 0; j < inputs->size(); j++)
1065 delete inputs->get(j);
1068 delete(form_receiver);
1073 _MSG(
"DilloHtmlForm::eventHandler\n");
1074 if (event && (event->
button == 3)) {
1077 DilloHtmlInput *input = getInput(resource);
1079 input->activate (
this, num_entry_fields, event);
1081 MSG(
"DilloHtmlForm::eventHandler: ERROR, input not found!\n");
1090void DilloHtmlForm::submit(DilloHtmlInput *active_input,
EventButton *event)
1095 "A form on a SECURE page wants to use an "
1096 "INSECURE protocol to submit data.",
1097 "Continue",
"Cancel", NULL);
1102 DilloUrl *url = buildQueryUrl(active_input);
1104 if (event && event->
button == 2) {
1123DilloUrl *DilloHtmlForm::buildQueryUrl(DilloHtmlInput *active_input)
1130 DilloHtmlInput *active_submit = NULL;
1132 _MSG(
"DilloHtmlForm::buildQueryUrl: action=%s\n",
URL_STR_(action));
1138 active_submit = active_input;
1142 DataStr = buildQueryData(active_submit);
1157 if ((p = strchr(action_str,
'#')))
1159 if ((p = strchr(action_str,
'?')))
1171 MSG(
"DilloHtmlForm::buildQueryUrl: Method unknown\n");
1180Dstr *DilloHtmlForm::buildQueryData(DilloHtmlInput *active_submit)
1182 Dstr *DataStr = NULL;
1183 char *boundary = NULL;
1184 iconv_t char_encoder = (iconv_t) -1;
1191 char *translit =
dStrconcat(submit_charset,
"//TRANSLIT", NULL);
1193 char_encoder = iconv_open(translit,
"UTF-8");
1196 if (char_encoder == (iconv_t) -1)
1197 char_encoder = iconv_open(submit_charset,
"UTF-8");
1199 if (char_encoder == (iconv_t) -1) {
1200 MSG_WARN(
"Cannot convert to character encoding '%s'\n",
1203 MSG(
"Form character encoding: '%s'\n", submit_charset);
1208 if (!(boundary = makeMultipartBoundary(char_encoder, active_submit)))
1209 MSG_ERR(
"Cannot generate multipart/form-data boundary.\n");
1216 for (
int i = 0; i < inputs->size(); i++) {
1217 DilloHtmlInput *input = inputs->get (i);
1219 bool is_active_submit = (input == active_submit);
1222 name = encodeText(char_encoder, &name);
1224 input->appendValuesTo(values, is_active_submit);
1229 MSG_WARN(
"multiple files per form control not supported\n");
1234 if (input->getResource()) {
1237 const char *filename = lbr->
getLabel();
1238 if (filename[0] && strcmp(filename, input->init_str)) {
1239 const char *p = strrchr(filename,
'/');
1243 dfilename = encodeText(char_encoder, &dfilename);
1244 filesInputMultipartAppend(DataStr, boundary, name->
str,
1245 file, dfilename->
str);
1254 val = encodeText(char_encoder, &val);
1255 strUrlencodeAppend(DataStr, val->
str);
1264 imageInputUrlencodeAppend(DataStr, name, x, y);
1266 imageInputMultipartAppend(DataStr, boundary, name, x, y);
1270 for (
int j = 0; j < valcount; j++) {
1273 val = encodeText(char_encoder, &val);
1275 inputUrlencodeAppend(DataStr, name->
str, val->
str);
1277 inputMultipartAppend(DataStr, boundary, name->
str,
1285 if (DataStr->
len > 0) {
1287 if (DataStr->
str[DataStr->
len - 1] ==
'&')
1296 if (char_encoder != (iconv_t) -1)
1297 (void)iconv_close(char_encoder);
1310 static const char set[] =
"abcdefghijklmnopqrstuvwxyz"
1311 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1313 static const size_t n = strlen(set);
1315 for (
int i = 0; i < 70; i++) {
1316 int c = (
unsigned char) set[rand() % n];
1325char *DilloHtmlForm::makeMultipartBoundary(iconv_t char_encoder,
1326 DilloHtmlInput *active_submit)
1334 for (
int i = 0; i < inputs->size(); i++) {
1336 DilloHtmlInput *input = inputs->get (i);
1337 bool is_active_submit = (input == active_submit);
1338 input->appendValuesTo(values, is_active_submit);
1342 dstr = encodeText(char_encoder, &dstr);
1349 const char *filename = lbr->
getLabel();
1350 if (filename[0] && strcmp(filename, input->init_str)) {
1352 dstr = encodeText(char_encoder, &dstr);
1358 for (
int i = 0; i < length; i++) {
1362 dstr = encodeText(char_encoder, &dstr);
1369 ret = boundary->
str;
1381Dstr *DilloHtmlForm::encodeText(iconv_t char_encoder,
Dstr **input)
1387 char *buffer, *outPtr;
1388 size_t inLeft, outRoom;
1389 bool bad_chars =
false;
1391 if ((char_encoder == (iconv_t) -1) || *input == NULL || (*input)->len == 0)
1395 inPtr = (*input)->str;
1396 inLeft = (*input)->len;
1399 while ((rc != EINVAL) && (inLeft > 0)) {
1404 rc = iconv(char_encoder, &inPtr, &inLeft, &outPtr, &outRoom);
1425 }
else if (rc == EINVAL) {
1426 MSG_ERR(
"Form encode text: bad source string.\n");
1436 MSG_WARN(
"Form encode text: string cannot be converted cleanly.\n");
1448void DilloHtmlForm::strUrlencodeAppend(
Dstr *dstr,
const char *str)
1458void DilloHtmlForm::inputUrlencodeAppend(
Dstr *data,
const char *name,
1461 if (name && name[0]) {
1462 strUrlencodeAppend(data, name);
1464 strUrlencodeAppend(data, value);
1473void DilloHtmlForm::filesInputMultipartAppend(
Dstr* data,
1474 const char *boundary,
1477 const char *filename)
1479 const char *ctype, *ext;
1481 if (name && name[0]) {
1484 if ((ext = strrchr(filename,
'.')) &&
1487 ctype =
"text/html";
1490 if (data->
len == 0) {
1496 "Content-Disposition: form-data; name=\"%s\"; "
1497 "filename=\"", name);
1504 for (
int i = 0;
char c = filename[i]; i++) {
1505 if (c ==
'\"' || c ==
'\r' || c ==
'\n')
1511 "Content-Type: %s\r\n"
1525void DilloHtmlForm::inputMultipartAppend(
Dstr *data,
1526 const char *boundary,
1530 if (name && name[0]) {
1531 if (data->
len == 0) {
1537 "Content-Disposition: form-data; name=\"%s\"\r\n"
1541 name, value, boundary);
1548void DilloHtmlForm::imageInputUrlencodeAppend(
Dstr *data,
Dstr *name,
Dstr *x,
1552 strUrlencodeAppend(data, name->
str);
1554 strUrlencodeAppend(data, name->
str);
1563void DilloHtmlForm::imageInputMultipartAppend(
Dstr *data,
const char *boundary,
1566 int orig_len = name->
len;
1572 inputMultipartAppend(data, boundary, name->
str, x->
str);
1575 inputMultipartAppend(data, boundary, name->
str, y->
str);
1583void DilloHtmlForm::reset ()
1585 int size = inputs->size();
1586 for (
int i = 0; i < size; i++)
1587 inputs->get(i)->reset();
1593void DilloHtmlForm::display_hiddens(
bool display)
1595 int size = inputs->size();
1596 for (
int i = 0; i < size; i++) {
1597 DilloHtmlInput *input = inputs->get(i);
1599 input->embed->setDisplayed(display);
1602 showing_hiddens = display;
1605void DilloHtmlForm::setEnabled(
bool enabled)
1607 for (
int i = 0; i < inputs->size(); i++)
1608 inputs->get(i)->setEnabled(enabled);
1616 input->connectTo (form_receiver);
1617 input->setEnabled (enabled);
1618 int ni = inputs->size ();
1619 inputs->increase ();
1620 inputs->set (ni,input);
1632DilloHtmlInput *DilloHtmlForm::getInput (
Resource *resource)
1634 if (resource == NULL)
1637 for (
int idx = 0; idx < inputs->size(); idx++) {
1638 DilloHtmlInput *input = inputs->get(idx);
1639 Resource *r = input->getResource();
1640 if (r && resource == r)
1649DilloHtmlInput *DilloHtmlForm::getRadioInput (
const char *name)
1651 for (
int idx = 0; idx < inputs->size(); idx++) {
1652 DilloHtmlInput *input = inputs->get(idx);
1667void DilloHtmlReceiver::activate (
Resource *resource)
1669 form->eventHandler(resource, NULL);
1676void DilloHtmlReceiver::enter (
Resource *resource)
1679 DilloHtmlInput *input =
form->getInput(resource);
1680 const char *msg =
"";
1698void DilloHtmlReceiver::leave (
Resource *resource)
1704void DilloHtmlReceiver::clicked (
Resource *resource,
1707 form->eventHandler(resource, event);
1718 const char *name2,
const char *init_str2,
1719 bool init_val2,
bool owns_embed)
1724 this->owns_embed = owns_embed;
1725 name = (name2) ?
dStrdup(name2) : NULL;
1726 init_str = (init_str2) ?
dStrdup(init_str2) : NULL;
1727 init_val = init_val2;
1732 select =
new DilloHtmlSelect;
1744DilloHtmlInput::~DilloHtmlInput ()
1752 if (owns_embed && embed)
1759void DilloHtmlInput::connectTo(DilloHtmlReceiver *form_receiver)
1761 Resource *resource = getResource();
1781void DilloHtmlInput::activate(DilloHtmlForm *
form,
int num_entry_fields,
1786 readFile (
form->html->bw);
1802 form->submit(
this, event);
1832void DilloHtmlInput::appendValuesTo(
Dlist *values,
bool is_active_submit)
1863 if (is_active_submit)
1870 select->appendValuesTo (values, sel_res);
1876 const char *filename = lbr->
getLabel();
1877 if (filename[0] && strcmp(filename, init_str)) {
1883 MSG(
"FORM file input \"%s\" not loaded.\n", filename);
1889 if (is_active_submit) {
1908void DilloHtmlInput::reset ()
1910 if (embed == NULL || embed->
getResource() == NULL)
1920 entryres->
setText(init_str ? init_str :
"");
1933 if (select != NULL) {
1939 if (init_str != NULL) {
1942 textres->
setText(init_str ? init_str :
"");
1963DilloHtmlSelect::DilloHtmlSelect ()
1971DilloHtmlSelect::~DilloHtmlSelect ()
1973 int size = opts->size ();
1974 for (
int k = 0; k < size; k++)
1975 delete opts->get (k);
1979DilloHtmlOptbase *DilloHtmlSelect::getCurrentOpt ()
1981 return opts->get (opts->size() - 1);
1984void DilloHtmlSelect::addOpt (DilloHtmlOptbase *opt)
1986 int size = opts->size ();
1988 opts->set (size, opt);
1994void DilloHtmlSelect::ensureSelection()
1996 int size = opts->size ();
1998 for (
int i = 0; i < size; i++) {
1999 DilloHtmlOptbase *opt = opts->get (i);
2000 if (opt->isSelected())
2003 for (
int i = 0; i < size; i++) {
2004 DilloHtmlOptbase *opt = opts->get (i);
2013 int size = opts->size ();
2014 for (
int i = 0; i < size; i++) {
2015 DilloHtmlOptbase *opt = opts->get (i);
2022 int size = opts->size ();
2023 for (
int i = 0; i < size; i++) {
2024 DilloHtmlOptbase *opt = opts->get (i);
2025 res->
setItem(i, opt->isSelected());
2031 int size = opts->size ();
2032 for (
int i = 0; i < size; i++) {
2034 DilloHtmlOptbase *opt = opts->get (i);
2035 const char *val = opt->getValue();
2043DilloHtmlOptgroup::DilloHtmlOptgroup (
char *label,
bool enabled)
2045 this->label = label;
2046 this->enabled = enabled;
2049DilloHtmlOptgroup::~DilloHtmlOptgroup ()
2061DilloHtmlOption::DilloHtmlOption (
char *value2,
char *label2,
bool selected2,
2067 selected = selected2;
2074DilloHtmlOption::~DilloHtmlOption ()
2091 Embed *button = NULL;
2106 button =
new Embed(complex_b_r);
2107 HT2TB(html)->addWidget (button, html->
style ());
2110 MSG(
"Html_input_image: unable to create image submit.\n");
2123 DilloHtmlOptbase *opt = input->select->getCurrentOpt ();
int InFlags
tracks which elements we are in
DilloHtmlDocumentType DocType
dw::core::style::Style * backgroundStyle()
int formNew(DilloHtmlMethod method, const DilloUrl *action, DilloHtmlEnc enc, const char *charset)
Allocate and insert form information.
lout::misc::SimpleVector< DilloHtmlInput * > * inputs_outside_form
dw::core::style::Style * wordStyle()
dw::core::style::Style * style()
StyleEngine * styleEngine
DilloHtmlForm * getCurrentForm()
Get the current form.
void setNonCssHint(CssPropertyName name, CssValueType type, CssPropertyValue value)
void setPseudoLink()
set the CSS pseudo class :link.
Displays an instance of dw::core::Imgbuf.
A Widget for rendering text blocks, i.e.
A widget for embedding UI widgets.
void setEnabled(bool enabled)
void setDisplayed(bool displayed)
@ SELECTION_AT_MOST_ONE
At most one item is selected.
@ SELECTION_MULTIPLE
An arbitrary number of items may be selected.
A factory for the common resource.
virtual OptionMenuResource * createOptionMenuResource()=0
virtual EntryResource * createEntryResource(int size, bool password, const char *label, const char *placeholder)=0
virtual MultiLineTextResource * createMultiLineTextResource(int cols, int rows, const char *placeholder)=0
virtual RadioButtonResource * createRadioButtonResource(RadioButtonResource *groupedWith, bool activated)=0
virtual CheckButtonResource * createCheckButtonResource(bool activated)=0
virtual ListResource * createListResource(ListResource::SelectionMode selectionMode, int rows)=0
virtual ComplexButtonResource * createComplexButtonResource(Widget *widget, bool relief)=0
virtual LabelButtonResource * createLabelButtonResource(const char *label)=0
Receiver interface for the "activate" signal.
virtual void activate(Resource *resource)=0
virtual void leave(Resource *resource)=0
virtual void enter(Resource *resource)=0
Receiver interface for the "clicked" signal.
virtual void clicked(Resource *resource, EventButton *event)=0
Basic interface for all resources.
void connectClicked(ClickedReceiver *receiver)
void connectActivate(ActivateReceiver *receiver)
Base interface for dw::core::ui::ListResource and dw::core::ui::OptionMenuResource.
virtual void pushGroup(const char *name, bool enabled)=0
virtual bool isSelected(int index)=0
virtual void setItem(int index, bool selected)=0
virtual void addItem(const char *str, bool enabled, bool selected)=0
virtual void popGroup()=0
virtual void setText(const char *text)=0
virtual const char * getText()=0
virtual void setEditable(bool editable)=0
Simple (simpler than container::untyped::Vector and container::typed::Vector) template based vector.
void increase()
Increase the vector size by one.
void set(int i, T t)
Store an object in the vector.
T get(int i) const
Return the one element, explicitly.
int size() const
Return the number of elements put into this vector.
@ CSS_TYPE_STRING
<string>
int a_Dialog_choice(const char *title, const char *msg,...)
Make a question-dialog with a question and alternatives.
char * dStrconcat(const char *s1,...)
Concatenate a NULL-terminated list of strings.
char * dStrsep(char **orig, const char *delim)
strsep() implementation
int dStrAsciiCasecmp(const char *s1, const char *s2)
void dStr_sprintfa(Dstr *ds, const char *format,...)
Printf-like function that appends.
void dStr_append(Dstr *ds, const char *s)
Append a C string to a Dstr.
char * dStrdup(const char *s)
Dlist * dList_new(int size)
Create a new empty list.
Dstr * dStr_sized_new(int sz)
Create a new string with a given size.
void dStr_erase(Dstr *ds, int pos_0, int len)
Erase a substring.
int dList_length(Dlist *lp)
For completing the ADT.
void * dList_nth_data(Dlist *lp, int n0)
Return the nth data item, NULL when not found or 'n0' is out of range.
void dStr_free(Dstr *ds, int all)
Free a dillo string.
void dStr_append_l(Dstr *ds, const char *s, int l)
Append a C string to a Dstr (providing length).
void dStr_append_c(Dstr *ds, int c)
Append one character.
char * dStrndup(const char *s, size_t sz)
void dStr_sprintf(Dstr *ds, const char *format,...)
Printf-like function.
Dstr * dStr_new(const char *s)
Create a new string.
void dList_append(Dlist *lp, void *data)
Append a data item to the list.
void dList_free(Dlist *lp)
Free a list (not its elements)
void dStr_truncate(Dstr *ds, int len)
Truncate a Dstr to be 'len' bytes long.
void dList_remove(Dlist *lp, const void *data)
#define dNew(type, count)
const char * a_Html_get_attr(DilloHtml *html, const char *tag, int tagsize, const char *attrname)
Call Html_get_attr2 telling it to parse entities and strip the result.
void a_Html_stash_init(DilloHtml *html)
Initialize the stash buffer.
bool a_Html_should_display(DilloHtml *html)
DilloUrl * a_Html_url_new(DilloHtml *html, const char *url_str, const char *base_url, int use_base_url)
Wrapper for a_Url_new that adds an error detection message.
DilloImage * a_Html_image_new(DilloHtml *html, const char *tag, int tagsize)
void a_Html_common_image_attrs(DilloHtml *html, const char *tag, int tagsize)
Read image-associated tag attributes and create new image.
char * a_Html_get_attr_wdef(DilloHtml *html, const char *tag, int tagsize, const char *attrname, const char *def)
"a_Html_get_attr with default" Call a_Html_get_attr() and dStrdup() the returned string.
char * a_Html_parse_entities(DilloHtml *html, const char *token, int toksize)
Parse all the entities in a token.
#define HT2TB(html)
"html struct" to Textblock
@ DILLO_HTML_PARSE_MODE_VERBATIM
#define BUG_MSG(...)
Add a bug-meter message.
#define S_TOP(html)
Top of the parsing stack.
#define HT2LT(html)
"html struct" to "Layout"
Dstr * a_Misc_file2dstr(const char *filename)
Load a local file into a dStr.
int a_Misc_get_content_type_from_data(void *Data, size_t Size, const char **PT)
Detects 'Content-Type' from a data stream sample.
Anything related to Dillo Widget styles is defined here.
Anything related to embedded UI widgets is defined here.
The core of Dw is defined in this namespace.
Dw is in this namespace, or sub namespaces of this one.
DilloPrefs prefs
Global Data.
Contains the specific data for a single window.
int NumPendingStyleSheets
Number of not yet arrived style sheets.
bool_t enterpress_forces_submit
bool_t middle_click_opens_new_tab
void a_UIcmd_set_msg(BrowserWindow *bw, const char *format,...)
void a_UIcmd_form_popup(void *vbw, const DilloUrl *url, void *vform, bool_t showing_hiddens)
void a_UIcmd_open_url_nw(BrowserWindow *bw, const DilloUrl *url)
const char * a_UIcmd_select_file()
void a_UIcmd_open_url(BrowserWindow *bw, const DilloUrl *url)
void a_UIcmd_open_url_nt(void *vbw, const DilloUrl *url, int focus)
void a_Url_set_flags(DilloUrl *u, int flags)
Set DilloUrl flags.
char * a_Url_encode_hex_str(const char *str)
Urlencode 'str'.
void a_Url_free(DilloUrl *url)
Free a DilloUrl.
void a_Url_set_data(DilloUrl *u, Dstr **data)
Set DilloUrl data (like POST info, etc.)
DilloUrl * a_Url_new(const char *url_str, const char *base_url)
Transform (and resolve) an URL string into the respective DilloURL.
DilloUrl * a_Url_dup(const DilloUrl *ori)
Duplicate a Url structure.