39class DilloHtmlReceiver;
75 friend class DilloHtmlReceiver;
76 friend class DilloHtmlInput;
82 DilloUrl *buildQueryUrl(DilloHtmlInput *active_input);
83 Dstr *buildQueryData(DilloHtmlInput *active_submit);
84 char *makeMultipartBoundary(iconv_t char_encoder,
85 DilloHtmlInput *active_submit);
86 Dstr *encodeText(iconv_t char_encoder,
Dstr **input);
87 void strUrlencodeAppend(
Dstr *dstr,
const char *str);
88 void inputUrlencodeAppend(
Dstr *data,
const char *name,
const char *value);
89 void inputMultipartAppend(
Dstr *data,
const char *boundary,
90 const char *name,
const char *value);
91 void filesInputMultipartAppend(
Dstr* data,
const char *boundary,
92 const char *name,
Dstr *file,
93 const char *filename);
95 void imageInputMultipartAppend(
Dstr *data,
const char *boundary,
Dstr *name,
102 char *submit_charset;
106 int num_entry_fields;
108 DilloHtmlReceiver *form_receiver;
116 DilloHtmlInput *getInput (
Resource *resource);
117 DilloHtmlInput *getRadioInput (
const char *name);
118 void submit(DilloHtmlInput *active_input,
EventButton *event);
120 void display_hiddens(
bool display);
122 void setEnabled(
bool enabled);
125class DilloHtmlReceiver:
129 friend class DilloHtmlForm;
131 DilloHtmlReceiver (DilloHtmlForm* form2) {
form = form2; }
132 ~DilloHtmlReceiver () { }
139class DilloHtmlInput {
142 friend class DilloHtmlForm;
151 DilloHtmlSelect *select;
157 void connectTo(DilloHtmlReceiver *form_receiver);
158 void activate(DilloHtmlForm *
form,
int num_entry_fields,
EventButton *event);
163 const char *name,
const char *init_str,
bool init_val);
165 void appendValuesTo(
Dlist *values,
bool is_active_submit);
167 void setEnabled(
bool enabled) {
if (embed) embed->
setEnabled(enabled); };
170class DilloHtmlOptbase
173 virtual ~DilloHtmlOptbase () {};
174 virtual bool isSelected() {
return false;}
175 virtual bool select() {
return false;}
176 virtual const char *getValue() {
return NULL;}
177 virtual void setContent(
const char *str,
int len)
178 {
MSG_ERR(
"Form: Optbase setContent()\n");}
182class DilloHtmlOptgroup :
public DilloHtmlOptbase {
187 DilloHtmlOptgroup (
char *label,
bool enabled);
188 virtual ~DilloHtmlOptgroup ();
193class DilloHtmlOptgroupClose :
public DilloHtmlOptbase {
195 virtual ~DilloHtmlOptgroupClose () {};
200class DilloHtmlOption :
public DilloHtmlOptbase {
201 friend class DilloHtmlSelect;
203 char *value, *label, *content;
204 bool selected, enabled;
205 DilloHtmlOption (
char *value,
char *label,
bool selected,
bool enabled);
206 virtual ~DilloHtmlOption ();
207 bool isSelected() {
return selected;}
208 bool select() {
return (selected =
true);}
209 const char *getValue() {
return value ? value : content;}
210 void setContent(
const char *str,
int len) {content =
dStrndup(str, len);}
212 {res->
addItem(label ? label : content, enabled, selected);}
215class DilloHtmlSelect {
216 friend class DilloHtmlInput;
222 DilloHtmlOptbase *getCurrentOpt ();
223 void addOpt (DilloHtmlOptbase *opt);
224 void ensureSelection ();
239 return new DilloHtmlForm (html, method, action, content_type, charset,
255 ((DilloHtmlForm *)vform)->submit(NULL, NULL);
260 ((DilloHtmlForm *)vform)->reset();
265 ((DilloHtmlForm *)vform)->display_hiddens(display);
276 Embed *embed,
const char *name,
277 const char *init_str,
bool init_val)
279 _MSG(
"name=[%s] init_str=[%s] init_val=[%d]\n", name, init_str, init_val);
280 DilloHtmlInput *input =
new DilloHtmlInput(type, embed, name, init_str,
290 input->setEnabled(
false);
308 for (
int idx = 0; idx < inputs->
size(); idx++) {
309 DilloHtmlInput *input = inputs->
get(idx);
330 return (inputs && inputs->
size() > 0) ?
331 inputs->
get (inputs->
size() - 1) : NULL;
342 char *charset, *first;
361 BUG_MSG(
"<form> submission method unknown: '%s'.", attrbuf);
368 BUG_MSG(
"<form> requires action attribute.");
379 if ((attrbuf =
a_Html_get_attr(html, tag, tagsize,
"accept-charset"))) {
381 char *ptr = first =
dStrdup(attrbuf);
382 while (ptr && !charset) {
383 char *curr =
dStrsep(&ptr,
" ,");
396 html->
formNew(method, action, content_type, charset);
414 const int MAX_SIZE = 1024;
418 size = strtol(attrbuf, NULL, 10);
419 if (size < 1 || size > MAX_SIZE) {
421 size = (size < 1 ? 20 : MAX_SIZE);
422 BUG_MSG(
"<input> size=%d, using size=%d instead.", badSize, size);
436 char *value, *name, *type, *init_str, *placeholder = NULL;
437 const char *attrbuf, *label;
438 bool init_val =
false;
442 BUG_MSG(
"<input> inside <select>.");
446 BUG_MSG(
"<input> inside <button>.");
450 factory =
HT2LT(html)->getResourceFactory();
470 init_str = (value) ? value :
dStrdup(
"on");
487 init_str = (value) ? value :
dStrdup(
"submit");
491 init_str = (value) ? value :
dStrdup(
"Reset");
498 label = attrbuf ? attrbuf : value ? value : name ? name :
"Submit";
513 BUG_MSG(
"<form> with file input MUST use HTTP POST method.");
514 MSG(
"File input ignored in form not using HTTP POST method\n");
517 BUG_MSG(
"<form> with file input MUST use multipart/form-data"
519 MSG(
"File input ignored in form not using multipart/form-data"
525 init_str =
dStrdup(
"File selector");
544 embed =
new Embed (resource);
548 (init_str) ? init_str :
"", init_val);
564 int maxlen = strtol(attrbuf, NULL, 10);
578 if (init_str != value)
595 MSG(
"<isindex> inside <form> not handled.\n");
616 embed =
new Embed (entryResource);
637 const int MAX_COLS=1024, MAX_ROWS=10000;
647 cols = strtol(attrbuf, NULL, 10);
650 BUG_MSG(
"<textarea> requires cols attribute.");
653 if (cols < 1 || cols > MAX_COLS) {
655 cols = (cols < 1 ? 20 : MAX_COLS);
656 BUG_MSG(
"<textarea> cols=%d, using cols=%d instead.", badCols, cols);
659 rows = strtol(attrbuf, NULL, 10);
662 BUG_MSG(
"<textarea> requires rows attribute.");
665 if (rows < 1 || rows > MAX_ROWS) {
667 rows = (rows < 1 ? 2 : MAX_ROWS);
668 BUG_MSG(
"<textarea> rows=%d, using rows=%d instead.", badRows, rows);
697 DilloHtmlInput *input;
709 for (i = 0; i < html->
Stash->
len; ++i) {
711 if (html->
Stash->
str[i + 1] ==
'\n')
722 input->init_str = str;
751 rows = strtol(attrbuf, NULL, 10);
756 rows = multi ? 10 : 1;
758 if (rows == 1 && multi ==
false) {
797 DilloHtmlSelect *select = input->select;
800 select->ensureSelection ();
810 BUG_MSG(
"<optgroup> outside <select>.");
829 bool enabled = (
a_Html_get_attr(html, tag, tagsize,
"disabled") == NULL);
832 BUG_MSG(
"<optgroup> requires label attribute.");
836 DilloHtmlOptgroup *opt =
837 new DilloHtmlOptgroup (label, enabled);
839 input->select->addOpt(opt);
857 DilloHtmlOptgroupClose *opt =
new DilloHtmlOptgroupClose ();
859 input->select->addOpt(opt);
870 BUG_MSG(
"<option> outside <select>.");
883 bool selected = (
a_Html_get_attr(html, tag, tagsize,
"selected") != NULL);
884 bool enabled = (
a_Html_get_attr(html, tag, tagsize,
"disabled") == NULL);
886 DilloHtmlOption *option =
887 new DilloHtmlOption (value, label, selected, enabled);
889 input->select->addOpt(option);
929 BUG_MSG(
"<button> type unknown: '%s'.", type);
953 embed =
new Embed(resource);
958 S_TOP(html)->textblock = html->
dw = page;
989DilloHtmlForm::DilloHtmlForm (
DilloHtml *html2,
993 const char *charset,
bool enabled)
998 content_type = content_type2;
999 submit_charset =
dStrdup(charset);
1000 inputs =
new misc::SimpleVector <DilloHtmlInput*> (4);
1001 num_entry_fields = 0;
1002 showing_hiddens =
false;
1003 this->enabled = enabled;
1004 form_receiver =
new DilloHtmlReceiver (
this);
1010DilloHtmlForm::~DilloHtmlForm ()
1013 dFree(submit_charset);
1014 for (
int j = 0; j < inputs->size(); j++)
1015 delete inputs->get(j);
1018 delete(form_receiver);
1023 _MSG(
"DilloHtmlForm::eventHandler\n");
1024 if (event && (event->
button == 3)) {
1027 DilloHtmlInput *input = getInput(resource);
1029 input->activate (
this, num_entry_fields, event);
1031 MSG(
"DilloHtmlForm::eventHandler: ERROR, input not found!\n");
1040void DilloHtmlForm::submit(DilloHtmlInput *active_input,
EventButton *event)
1045 "A form on a SECURE page wants to use an "
1046 "INSECURE protocol to submit data.",
1047 "Continue",
"Cancel", NULL);
1052 DilloUrl *url = buildQueryUrl(active_input);
1054 if (event && event->
button == 2) {
1073DilloUrl *DilloHtmlForm::buildQueryUrl(DilloHtmlInput *active_input)
1080 DilloHtmlInput *active_submit = NULL;
1082 _MSG(
"DilloHtmlForm::buildQueryUrl: action=%s\n",
URL_STR_(action));
1088 active_submit = active_input;
1092 DataStr = buildQueryData(active_submit);
1107 if ((p = strchr(action_str,
'#')))
1109 if ((p = strchr(action_str,
'?')))
1121 MSG(
"DilloHtmlForm::buildQueryUrl: Method unknown\n");
1130Dstr *DilloHtmlForm::buildQueryData(DilloHtmlInput *active_submit)
1132 Dstr *DataStr = NULL;
1133 char *boundary = NULL;
1134 iconv_t char_encoder = (iconv_t) -1;
1141 char *translit =
dStrconcat(submit_charset,
"//TRANSLIT", NULL);
1143 char_encoder = iconv_open(translit,
"UTF-8");
1146 if (char_encoder == (iconv_t) -1)
1147 char_encoder = iconv_open(submit_charset,
"UTF-8");
1149 if (char_encoder == (iconv_t) -1) {
1150 MSG_WARN(
"Cannot convert to character encoding '%s'\n",
1153 MSG(
"Form character encoding: '%s'\n", submit_charset);
1158 if (!(boundary = makeMultipartBoundary(char_encoder, active_submit)))
1159 MSG_ERR(
"Cannot generate multipart/form-data boundary.\n");
1166 for (
int i = 0; i < inputs->size(); i++) {
1167 DilloHtmlInput *input = inputs->get (i);
1169 bool is_active_submit = (input == active_submit);
1172 name = encodeText(char_encoder, &name);
1174 input->appendValuesTo(values, is_active_submit);
1179 MSG_WARN(
"multiple files per form control not supported\n");
1186 const char *filename = lbr->
getLabel();
1187 if (filename[0] && strcmp(filename, input->init_str)) {
1188 const char *p = strrchr(filename,
'/');
1192 dfilename = encodeText(char_encoder, &dfilename);
1193 filesInputMultipartAppend(DataStr, boundary, name->
str,
1194 file, dfilename->
str);
1202 val = encodeText(char_encoder, &val);
1203 strUrlencodeAppend(DataStr, val->
str);
1212 imageInputUrlencodeAppend(DataStr, name, x, y);
1214 imageInputMultipartAppend(DataStr, boundary, name, x, y);
1218 for (
int j = 0; j < valcount; j++) {
1221 val = encodeText(char_encoder, &val);
1223 inputUrlencodeAppend(DataStr, name->
str, val->
str);
1225 inputMultipartAppend(DataStr, boundary, name->
str,
1233 if (DataStr->
len > 0) {
1235 if (DataStr->
str[DataStr->
len - 1] ==
'&')
1244 if (char_encoder != (iconv_t) -1)
1245 (void)iconv_close(char_encoder);
1253char *DilloHtmlForm::makeMultipartBoundary(iconv_t char_encoder,
1254 DilloHtmlInput *active_submit)
1256 const int max_tries = 10;
1263 for (
int i = 0; i < inputs->size(); i++) {
1265 DilloHtmlInput *input = inputs->get (i);
1266 bool is_active_submit = (input == active_submit);
1267 input->appendValuesTo(values, is_active_submit);
1271 dstr = encodeText(char_encoder, &dstr);
1278 const char *filename = lbr->
getLabel();
1279 if (filename[0] && strcmp(filename, input->init_str)) {
1281 dstr = encodeText(char_encoder, &dstr);
1287 for (
int i = 0; i < length; i++) {
1291 dstr = encodeText(char_encoder, &dstr);
1298 for (
int i = 0; i < max_tries && !ret; i++) {
1300 dStr_sprintf(boundary,
"---------------------------%d%d%d",
1301 rand(), rand(), rand());
1304 ret = boundary->
str;
1317Dstr *DilloHtmlForm::encodeText(iconv_t char_encoder,
Dstr **input)
1323 char *buffer, *outPtr;
1324 size_t inLeft, outRoom;
1325 bool bad_chars =
false;
1327 if ((char_encoder == (iconv_t) -1) || *input == NULL || (*input)->len == 0)
1331 inPtr = (*input)->str;
1332 inLeft = (*input)->len;
1335 while ((rc != EINVAL) && (inLeft > 0)) {
1340 rc = iconv(char_encoder, &inPtr, &inLeft, &outPtr, &outRoom);
1361 }
else if (rc == EINVAL) {
1362 MSG_ERR(
"Form encode text: bad source string.\n");
1372 MSG_WARN(
"Form encode text: string cannot be converted cleanly.\n");
1384void DilloHtmlForm::strUrlencodeAppend(
Dstr *dstr,
const char *str)
1394void DilloHtmlForm::inputUrlencodeAppend(
Dstr *data,
const char *name,
1397 if (name && name[0]) {
1398 strUrlencodeAppend(data, name);
1400 strUrlencodeAppend(data, value);
1409void DilloHtmlForm::filesInputMultipartAppend(
Dstr* data,
1410 const char *boundary,
1413 const char *filename)
1415 const char *ctype, *ext;
1417 if (name && name[0]) {
1420 if ((ext = strrchr(filename,
'.')) &&
1423 ctype =
"text/html";
1426 if (data->
len == 0) {
1432 "Content-Disposition: form-data; name=\"%s\"; "
1433 "filename=\"", name);
1440 for (
int i = 0;
char c = filename[i]; i++) {
1441 if (c ==
'\"' || c ==
'\r' || c ==
'\n')
1447 "Content-Type: %s\r\n"
1461void DilloHtmlForm::inputMultipartAppend(
Dstr *data,
1462 const char *boundary,
1466 if (name && name[0]) {
1467 if (data->
len == 0) {
1473 "Content-Disposition: form-data; name=\"%s\"\r\n"
1477 name, value, boundary);
1484void DilloHtmlForm::imageInputUrlencodeAppend(
Dstr *data,
Dstr *name,
Dstr *x,
1488 strUrlencodeAppend(data, name->
str);
1490 strUrlencodeAppend(data, name->
str);
1499void DilloHtmlForm::imageInputMultipartAppend(
Dstr *data,
const char *boundary,
1502 int orig_len = name->
len;
1508 inputMultipartAppend(data, boundary, name->
str, x->
str);
1511 inputMultipartAppend(data, boundary, name->
str, y->
str);
1519void DilloHtmlForm::reset ()
1521 int size = inputs->size();
1522 for (
int i = 0; i < size; i++)
1523 inputs->get(i)->reset();
1529void DilloHtmlForm::display_hiddens(
bool display)
1531 int size = inputs->size();
1532 for (
int i = 0; i < size; i++) {
1533 DilloHtmlInput *input = inputs->get(i);
1535 input->embed->setDisplayed(display);
1538 showing_hiddens = display;
1541void DilloHtmlForm::setEnabled(
bool enabled)
1543 for (
int i = 0; i < inputs->size(); i++)
1544 inputs->get(i)->setEnabled(enabled);
1552 input->connectTo (form_receiver);
1553 input->setEnabled (enabled);
1554 int ni = inputs->size ();
1555 inputs->increase ();
1556 inputs->set (ni,input);
1568DilloHtmlInput *DilloHtmlForm::getInput (
Resource *resource)
1570 for (
int idx = 0; idx < inputs->size(); idx++) {
1571 DilloHtmlInput *input = inputs->get(idx);
1573 resource == input->embed->getResource())
1582DilloHtmlInput *DilloHtmlForm::getRadioInput (
const char *name)
1584 for (
int idx = 0; idx < inputs->size(); idx++) {
1585 DilloHtmlInput *input = inputs->get(idx);
1600void DilloHtmlReceiver::activate (
Resource *resource)
1602 form->eventHandler(resource, NULL);
1609void DilloHtmlReceiver::enter (
Resource *resource)
1612 DilloHtmlInput *input =
form->getInput(resource);
1613 const char *msg =
"";
1631void DilloHtmlReceiver::leave (
Resource *resource)
1637void DilloHtmlReceiver::clicked (
Resource *resource,
1640 form->eventHandler(resource, event);
1651 const char *name2,
const char *init_str2,
1656 name = (name2) ?
dStrdup(name2) : NULL;
1657 init_str = (init_str2) ?
dStrdup(init_str2) : NULL;
1658 init_val = init_val2;
1663 select =
new DilloHtmlSelect;
1675DilloHtmlInput::~DilloHtmlInput ()
1687void DilloHtmlInput::connectTo(DilloHtmlReceiver *form_receiver)
1709void DilloHtmlInput::activate(DilloHtmlForm *
form,
int num_entry_fields,
1714 readFile (
form->html->bw);
1730 form->submit(
this, event);
1760void DilloHtmlInput::appendValuesTo(
Dlist *values,
bool is_active_submit)
1791 if (is_active_submit)
1798 select->appendValuesTo (values, sel_res);
1804 const char *filename = lbr->
getLabel();
1805 if (filename[0] && strcmp(filename, init_str)) {
1811 MSG(
"FORM file input \"%s\" not loaded.\n", filename);
1817 if (is_active_submit) {
1836void DilloHtmlInput::reset ()
1845 entryres->
setText(init_str ? init_str :
"");
1858 if (select != NULL) {
1864 if (init_str != NULL) {
1867 textres->
setText(init_str ? init_str :
"");
1888DilloHtmlSelect::DilloHtmlSelect ()
1896DilloHtmlSelect::~DilloHtmlSelect ()
1898 int size = opts->size ();
1899 for (
int k = 0; k < size; k++)
1900 delete opts->get (k);
1904DilloHtmlOptbase *DilloHtmlSelect::getCurrentOpt ()
1906 return opts->get (opts->size() - 1);
1909void DilloHtmlSelect::addOpt (DilloHtmlOptbase *opt)
1911 int size = opts->size ();
1913 opts->set (size, opt);
1919void DilloHtmlSelect::ensureSelection()
1921 int size = opts->size ();
1923 for (
int i = 0; i < size; i++) {
1924 DilloHtmlOptbase *opt = opts->get (i);
1925 if (opt->isSelected())
1928 for (
int i = 0; i < size; i++) {
1929 DilloHtmlOptbase *opt = opts->get (i);
1938 int size = opts->size ();
1939 for (
int i = 0; i < size; i++) {
1940 DilloHtmlOptbase *opt = opts->get (i);
1947 int size = opts->size ();
1948 for (
int i = 0; i < size; i++) {
1949 DilloHtmlOptbase *opt = opts->get (i);
1950 res->
setItem(i, opt->isSelected());
1956 int size = opts->size ();
1957 for (
int i = 0; i < size; i++) {
1959 DilloHtmlOptbase *opt = opts->get (i);
1960 const char *val = opt->getValue();
1968DilloHtmlOptgroup::DilloHtmlOptgroup (
char *label,
bool enabled)
1970 this->label = label;
1971 this->enabled = enabled;
1974DilloHtmlOptgroup::~DilloHtmlOptgroup ()
1986DilloHtmlOption::DilloHtmlOption (
char *value2,
char *label2,
bool selected2,
1992 selected = selected2;
1999DilloHtmlOption::~DilloHtmlOption ()
2016 Embed *button = NULL;
2031 button =
new Embed(complex_b_r);
2032 HT2TB(html)->addWidget (button, html->
style ());
2035 MSG(
"Html_input_image: unable to create image submit.\n");
2048 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
char * dStr_memmem(Dstr *haystack, Dstr *needle)
Return a pointer to the first occurrence of needle in haystack.
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.
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.