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;
154 DilloHtmlSelect *select;
160 void connectTo(DilloHtmlReceiver *form_receiver);
161 void activate(DilloHtmlForm *
form,
int num_entry_fields,
EventButton *event);
166 const char *name,
const char *init_str,
bool init_val);
168 void appendValuesTo(
Dlist *values,
bool is_active_submit);
170 void setEnabled(
bool enabled) {
if (embed) embed->
setEnabled(enabled); };
171 Resource *getResource() {
if (embed) {
return embed->
getResource(); }
else {
return NULL; } };
174class DilloHtmlOptbase
177 virtual ~DilloHtmlOptbase () {};
178 virtual bool isSelected() {
return false;}
179 virtual bool select() {
return false;}
180 virtual const char *getValue() {
return NULL;}
181 virtual void setContent(
const char *str,
int len)
182 {
MSG_ERR(
"Form: Optbase setContent()\n");}
186class DilloHtmlOptgroup :
public DilloHtmlOptbase {
191 DilloHtmlOptgroup (
char *label,
bool enabled);
192 virtual ~DilloHtmlOptgroup ();
197class DilloHtmlOptgroupClose :
public DilloHtmlOptbase {
199 virtual ~DilloHtmlOptgroupClose () {};
204class DilloHtmlOption :
public DilloHtmlOptbase {
205 friend class DilloHtmlSelect;
207 char *value, *label, *content;
208 bool selected, enabled;
209 DilloHtmlOption (
char *value,
char *label,
bool selected,
bool enabled);
210 virtual ~DilloHtmlOption ();
211 bool isSelected() {
return selected;}
212 bool select() {
return (selected =
true);}
213 const char *getValue() {
return value ? value : content;}
214 void setContent(
const char *str,
int len) {content =
dStrndup(str, len);}
216 {res->
addItem(label ? label : content, enabled, selected);}
219class DilloHtmlSelect {
220 friend class DilloHtmlInput;
226 DilloHtmlOptbase *getCurrentOpt ();
227 void addOpt (DilloHtmlOptbase *opt);
228 void ensureSelection ();
243 return new DilloHtmlForm (html, method, action, content_type, charset,
259 ((DilloHtmlForm *)vform)->submit(NULL, NULL);
264 ((DilloHtmlForm *)vform)->reset();
269 ((DilloHtmlForm *)vform)->display_hiddens(display);
280 Embed *embed,
const char *name,
281 const char *init_str,
bool init_val)
283 _MSG(
"name=[%s] init_str=[%s] init_val=[%d]\n", name, init_str, init_val);
284 DilloHtmlInput *input =
new DilloHtmlInput(type, embed, name, init_str,
294 input->setEnabled(
false);
312 for (
int idx = 0; idx < inputs->
size(); idx++) {
313 DilloHtmlInput *input = inputs->
get(idx);
334 return (inputs && inputs->
size() > 0) ?
335 inputs->
get (inputs->
size() - 1) : NULL;
346 char *charset, *first;
367 BUG_MSG(
"<form> submission method unknown: '%s'.", attrbuf);
374 BUG_MSG(
"<form> requires action attribute.");
385 if ((attrbuf =
a_Html_get_attr(html, tag, tagsize,
"accept-charset"))) {
387 char *ptr = first =
dStrdup(attrbuf);
388 while (ptr && !charset) {
389 char *curr =
dStrsep(&ptr,
" ,");
402 html->
formNew(method, action, content_type, charset);
420 const int MAX_SIZE = 1024;
424 size = strtol(attrbuf, NULL, 10);
425 if (size < 1 || size > MAX_SIZE) {
427 size = (size < 1 ? 20 : MAX_SIZE);
428 BUG_MSG(
"<input> size=%d, using size=%d instead.", badSize, size);
442 char *value, *name, *type, *init_str, *placeholder = NULL;
443 const char *attrbuf, *label;
444 bool init_val =
false;
448 BUG_MSG(
"<input> inside <select>.");
452 BUG_MSG(
"<input> inside <button>.");
456 factory =
HT2LT(html)->getResourceFactory();
478 init_str = (value) ? value :
dStrdup(
"on");
484 if (input && input->getResource())
498 init_str = (value) ? value :
dStrdup(
"Submit");
503 init_str = (value) ? value :
dStrdup(
"Reset");
511 label = attrbuf ? attrbuf : value ? value : name ? name :
"Submit";
528 BUG_MSG(
"<form> with file input MUST use HTTP POST method.");
529 MSG(
"File input ignored in form not using HTTP POST method\n");
532 BUG_MSG(
"<form> with file input MUST use multipart/form-data"
534 MSG(
"File input ignored in form not using multipart/form-data"
540 init_str =
dStrdup(
"File selector");
566 embed =
new Embed (resource);
570 (init_str) ? init_str :
"", init_val);
589 int maxlen = strtol(attrbuf, NULL, 10);
604 if (init_str != value)
620 MSG(
"<isindex> inside <form> not handled.\n");
644 embed =
new Embed (entryResource);
667 const int MAX_COLS=1024, MAX_ROWS=10000;
677 cols = strtol(attrbuf, NULL, 10);
680 BUG_MSG(
"<textarea> requires cols attribute.");
683 if (cols < 1 || cols > MAX_COLS) {
685 cols = (cols < 1 ? 20 : MAX_COLS);
686 BUG_MSG(
"<textarea> cols=%d, using cols=%d instead.", badCols, cols);
689 rows = strtol(attrbuf, NULL, 10);
692 BUG_MSG(
"<textarea> requires rows attribute.");
695 if (rows < 1 || rows > MAX_ROWS) {
697 rows = (rows < 1 ? 2 : MAX_ROWS);
698 BUG_MSG(
"<textarea> rows=%d, using rows=%d instead.", badRows, rows);
712 embed =
new Embed(textres);
732 DilloHtmlInput *input;
744 for (i = 0; i < html->
Stash->
len; ++i) {
746 if (html->
Stash->
str[i + 1] ==
'\n')
757 input->init_str = str;
758 Resource *res = input->getResource();
784 rows = strtol(attrbuf, NULL, 10);
789 rows = multi ? 10 : 1;
793 if (rows == 1 && multi ==
false)
814 embed =
new Embed(res);
844 DilloHtmlSelect *select = input->select;
847 select->ensureSelection ();
850 if (input->getResource())
859 BUG_MSG(
"<optgroup> outside <select>.");
878 bool enabled = (
a_Html_get_attr(html, tag, tagsize,
"disabled") == NULL);
881 BUG_MSG(
"<optgroup> requires label attribute.");
885 DilloHtmlOptgroup *opt =
886 new DilloHtmlOptgroup (label, enabled);
888 input->select->addOpt(opt);
906 DilloHtmlOptgroupClose *opt =
new DilloHtmlOptgroupClose ();
908 input->select->addOpt(opt);
919 BUG_MSG(
"<option> outside <select>.");
932 bool selected = (
a_Html_get_attr(html, tag, tagsize,
"selected") != NULL);
933 bool enabled = (
a_Html_get_attr(html, tag, tagsize,
"disabled") == NULL);
935 DilloHtmlOption *option =
936 new DilloHtmlOption (value, label, selected, enabled);
938 input->select->addOpt(option);
978 BUG_MSG(
"<button> type unknown: '%s'.", type);
1003 embed =
new Embed(resource);
1005 S_TOP(html)->textblock = html->
dw = page;
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,
1723 name = (name2) ?
dStrdup(name2) : NULL;
1724 init_str = (init_str2) ?
dStrdup(init_str2) : NULL;
1725 init_val = init_val2;
1730 select =
new DilloHtmlSelect;
1742DilloHtmlInput::~DilloHtmlInput ()
1755void DilloHtmlInput::connectTo(DilloHtmlReceiver *form_receiver)
1757 Resource *resource = getResource();
1777void DilloHtmlInput::activate(DilloHtmlForm *
form,
int num_entry_fields,
1782 readFile (
form->html->bw);
1798 form->submit(
this, event);
1828void DilloHtmlInput::appendValuesTo(
Dlist *values,
bool is_active_submit)
1859 if (is_active_submit)
1866 select->appendValuesTo (values, sel_res);
1872 const char *filename = lbr->
getLabel();
1873 if (filename[0] && strcmp(filename, init_str)) {
1879 MSG(
"FORM file input \"%s\" not loaded.\n", filename);
1885 if (is_active_submit) {
1904void DilloHtmlInput::reset ()
1906 if (embed == NULL || embed->
getResource() == NULL)
1916 entryres->
setText(init_str ? init_str :
"");
1929 if (select != NULL) {
1935 if (init_str != NULL) {
1938 textres->
setText(init_str ? init_str :
"");
1959DilloHtmlSelect::DilloHtmlSelect ()
1967DilloHtmlSelect::~DilloHtmlSelect ()
1969 int size = opts->size ();
1970 for (
int k = 0; k < size; k++)
1971 delete opts->get (k);
1975DilloHtmlOptbase *DilloHtmlSelect::getCurrentOpt ()
1977 return opts->get (opts->size() - 1);
1980void DilloHtmlSelect::addOpt (DilloHtmlOptbase *opt)
1982 int size = opts->size ();
1984 opts->set (size, opt);
1990void DilloHtmlSelect::ensureSelection()
1992 int size = opts->size ();
1994 for (
int i = 0; i < size; i++) {
1995 DilloHtmlOptbase *opt = opts->get (i);
1996 if (opt->isSelected())
1999 for (
int i = 0; i < size; i++) {
2000 DilloHtmlOptbase *opt = opts->get (i);
2009 int size = opts->size ();
2010 for (
int i = 0; i < size; i++) {
2011 DilloHtmlOptbase *opt = opts->get (i);
2018 int size = opts->size ();
2019 for (
int i = 0; i < size; i++) {
2020 DilloHtmlOptbase *opt = opts->get (i);
2021 res->
setItem(i, opt->isSelected());
2027 int size = opts->size ();
2028 for (
int i = 0; i < size; i++) {
2030 DilloHtmlOptbase *opt = opts->get (i);
2031 const char *val = opt->getValue();
2039DilloHtmlOptgroup::DilloHtmlOptgroup (
char *label,
bool enabled)
2041 this->label = label;
2042 this->enabled = enabled;
2045DilloHtmlOptgroup::~DilloHtmlOptgroup ()
2057DilloHtmlOption::DilloHtmlOption (
char *value2,
char *label2,
bool selected2,
2063 selected = selected2;
2070DilloHtmlOption::~DilloHtmlOption ()
2087 Embed *button = NULL;
2104 button =
new Embed(complex_b_r);
2105 HT2TB(html)->addWidget (button, html->
style ());
2108 MSG(
"Html_input_image: unable to create image submit.\n");
2121 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.