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;
152 DilloHtmlSelect *select;
158 void connectTo(DilloHtmlReceiver *form_receiver);
159 void activate(DilloHtmlForm *
form,
int num_entry_fields,
EventButton *event);
164 const char *name,
const char *init_str,
bool init_val);
166 void appendValuesTo(
Dlist *values,
bool is_active_submit);
168 void setEnabled(
bool enabled) {
if (embed) embed->
setEnabled(enabled); };
171class DilloHtmlOptbase
174 virtual ~DilloHtmlOptbase () {};
175 virtual bool isSelected() {
return false;}
176 virtual bool select() {
return false;}
177 virtual const char *getValue() {
return NULL;}
178 virtual void setContent(
const char *str,
int len)
179 {
MSG_ERR(
"Form: Optbase setContent()\n");}
183class DilloHtmlOptgroup :
public DilloHtmlOptbase {
188 DilloHtmlOptgroup (
char *label,
bool enabled);
189 virtual ~DilloHtmlOptgroup ();
194class DilloHtmlOptgroupClose :
public DilloHtmlOptbase {
196 virtual ~DilloHtmlOptgroupClose () {};
201class DilloHtmlOption :
public DilloHtmlOptbase {
202 friend class DilloHtmlSelect;
204 char *value, *label, *content;
205 bool selected, enabled;
206 DilloHtmlOption (
char *value,
char *label,
bool selected,
bool enabled);
207 virtual ~DilloHtmlOption ();
208 bool isSelected() {
return selected;}
209 bool select() {
return (selected =
true);}
210 const char *getValue() {
return value ? value : content;}
211 void setContent(
const char *str,
int len) {content =
dStrndup(str, len);}
213 {res->
addItem(label ? label : content, enabled, selected);}
216class DilloHtmlSelect {
217 friend class DilloHtmlInput;
223 DilloHtmlOptbase *getCurrentOpt ();
224 void addOpt (DilloHtmlOptbase *opt);
225 void ensureSelection ();
240 return new DilloHtmlForm (html, method, action, content_type, charset,
256 ((DilloHtmlForm *)vform)->submit(NULL, NULL);
261 ((DilloHtmlForm *)vform)->reset();
266 ((DilloHtmlForm *)vform)->display_hiddens(display);
277 Embed *embed,
const char *name,
278 const char *init_str,
bool init_val)
280 _MSG(
"name=[%s] init_str=[%s] init_val=[%d]\n", name, init_str, init_val);
281 DilloHtmlInput *input =
new DilloHtmlInput(type, embed, name, init_str,
291 input->setEnabled(
false);
309 for (
int idx = 0; idx < inputs->
size(); idx++) {
310 DilloHtmlInput *input = inputs->
get(idx);
331 return (inputs && inputs->
size() > 0) ?
332 inputs->
get (inputs->
size() - 1) : NULL;
343 char *charset, *first;
362 BUG_MSG(
"<form> submission method unknown: '%s'.", attrbuf);
369 BUG_MSG(
"<form> requires action attribute.");
380 if ((attrbuf =
a_Html_get_attr(html, tag, tagsize,
"accept-charset"))) {
382 char *ptr = first =
dStrdup(attrbuf);
383 while (ptr && !charset) {
384 char *curr =
dStrsep(&ptr,
" ,");
397 html->
formNew(method, action, content_type, charset);
415 const int MAX_SIZE = 1024;
419 size = strtol(attrbuf, NULL, 10);
420 if (size < 1 || size > MAX_SIZE) {
422 size = (size < 1 ? 20 : MAX_SIZE);
423 BUG_MSG(
"<input> size=%d, using size=%d instead.", badSize, size);
437 char *value, *name, *type, *init_str, *placeholder = NULL;
438 const char *attrbuf, *label;
439 bool init_val =
false;
443 BUG_MSG(
"<input> inside <select>.");
447 BUG_MSG(
"<input> inside <button>.");
451 factory =
HT2LT(html)->getResourceFactory();
471 init_str = (value) ? value :
dStrdup(
"on");
488 init_str = (value) ? value :
dStrdup(
"submit");
492 init_str = (value) ? value :
dStrdup(
"Reset");
499 label = attrbuf ? attrbuf : value ? value : name ? name :
"Submit";
514 BUG_MSG(
"<form> with file input MUST use HTTP POST method.");
515 MSG(
"File input ignored in form not using HTTP POST method\n");
518 BUG_MSG(
"<form> with file input MUST use multipart/form-data"
520 MSG(
"File input ignored in form not using multipart/form-data"
526 init_str =
dStrdup(
"File selector");
545 embed =
new Embed (resource);
549 (init_str) ? init_str :
"", init_val);
565 int maxlen = strtol(attrbuf, NULL, 10);
579 if (init_str != value)
596 MSG(
"<isindex> inside <form> not handled.\n");
617 embed =
new Embed (entryResource);
638 const int MAX_COLS=1024, MAX_ROWS=10000;
648 cols = strtol(attrbuf, NULL, 10);
651 BUG_MSG(
"<textarea> requires cols attribute.");
654 if (cols < 1 || cols > MAX_COLS) {
656 cols = (cols < 1 ? 20 : MAX_COLS);
657 BUG_MSG(
"<textarea> cols=%d, using cols=%d instead.", badCols, cols);
660 rows = strtol(attrbuf, NULL, 10);
663 BUG_MSG(
"<textarea> requires rows attribute.");
666 if (rows < 1 || rows > MAX_ROWS) {
668 rows = (rows < 1 ? 2 : MAX_ROWS);
669 BUG_MSG(
"<textarea> rows=%d, using rows=%d instead.", badRows, rows);
698 DilloHtmlInput *input;
710 for (i = 0; i < html->
Stash->
len; ++i) {
712 if (html->
Stash->
str[i + 1] ==
'\n')
723 input->init_str = str;
752 rows = strtol(attrbuf, NULL, 10);
757 rows = multi ? 10 : 1;
759 if (rows == 1 && multi ==
false) {
798 DilloHtmlSelect *select = input->select;
801 select->ensureSelection ();
811 BUG_MSG(
"<optgroup> outside <select>.");
830 bool enabled = (
a_Html_get_attr(html, tag, tagsize,
"disabled") == NULL);
833 BUG_MSG(
"<optgroup> requires label attribute.");
837 DilloHtmlOptgroup *opt =
838 new DilloHtmlOptgroup (label, enabled);
840 input->select->addOpt(opt);
858 DilloHtmlOptgroupClose *opt =
new DilloHtmlOptgroupClose ();
860 input->select->addOpt(opt);
871 BUG_MSG(
"<option> outside <select>.");
884 bool selected = (
a_Html_get_attr(html, tag, tagsize,
"selected") != NULL);
885 bool enabled = (
a_Html_get_attr(html, tag, tagsize,
"disabled") == NULL);
887 DilloHtmlOption *option =
888 new DilloHtmlOption (value, label, selected, enabled);
890 input->select->addOpt(option);
930 BUG_MSG(
"<button> type unknown: '%s'.", type);
954 embed =
new Embed(resource);
959 S_TOP(html)->textblock = html->
dw = page;
990DilloHtmlForm::DilloHtmlForm (
DilloHtml *html2,
994 const char *charset,
bool enabled)
999 content_type = content_type2;
1000 submit_charset =
dStrdup(charset);
1001 inputs =
new misc::SimpleVector <DilloHtmlInput*> (4);
1002 num_entry_fields = 0;
1003 showing_hiddens =
false;
1004 this->enabled = enabled;
1005 form_receiver =
new DilloHtmlReceiver (
this);
1011DilloHtmlForm::~DilloHtmlForm ()
1014 dFree(submit_charset);
1015 for (
int j = 0; j < inputs->size(); j++)
1016 delete inputs->get(j);
1019 delete(form_receiver);
1024 _MSG(
"DilloHtmlForm::eventHandler\n");
1025 if (event && (event->
button == 3)) {
1028 DilloHtmlInput *input = getInput(resource);
1030 input->activate (
this, num_entry_fields, event);
1032 MSG(
"DilloHtmlForm::eventHandler: ERROR, input not found!\n");
1041void DilloHtmlForm::submit(DilloHtmlInput *active_input,
EventButton *event)
1046 "A form on a SECURE page wants to use an "
1047 "INSECURE protocol to submit data.",
1048 "Continue",
"Cancel", NULL);
1053 DilloUrl *url = buildQueryUrl(active_input);
1055 if (event && event->
button == 2) {
1074DilloUrl *DilloHtmlForm::buildQueryUrl(DilloHtmlInput *active_input)
1081 DilloHtmlInput *active_submit = NULL;
1083 _MSG(
"DilloHtmlForm::buildQueryUrl: action=%s\n",
URL_STR_(action));
1089 active_submit = active_input;
1093 DataStr = buildQueryData(active_submit);
1108 if ((p = strchr(action_str,
'#')))
1110 if ((p = strchr(action_str,
'?')))
1122 MSG(
"DilloHtmlForm::buildQueryUrl: Method unknown\n");
1131Dstr *DilloHtmlForm::buildQueryData(DilloHtmlInput *active_submit)
1133 Dstr *DataStr = NULL;
1134 char *boundary = NULL;
1135 iconv_t char_encoder = (iconv_t) -1;
1142 char *translit =
dStrconcat(submit_charset,
"//TRANSLIT", NULL);
1144 char_encoder = iconv_open(translit,
"UTF-8");
1147 if (char_encoder == (iconv_t) -1)
1148 char_encoder = iconv_open(submit_charset,
"UTF-8");
1150 if (char_encoder == (iconv_t) -1) {
1151 MSG_WARN(
"Cannot convert to character encoding '%s'\n",
1154 MSG(
"Form character encoding: '%s'\n", submit_charset);
1159 if (!(boundary = makeMultipartBoundary(char_encoder, active_submit)))
1160 MSG_ERR(
"Cannot generate multipart/form-data boundary.\n");
1167 for (
int i = 0; i < inputs->size(); i++) {
1168 DilloHtmlInput *input = inputs->get (i);
1170 bool is_active_submit = (input == active_submit);
1173 name = encodeText(char_encoder, &name);
1175 input->appendValuesTo(values, is_active_submit);
1180 MSG_WARN(
"multiple files per form control not supported\n");
1187 const char *filename = lbr->
getLabel();
1188 if (filename[0] && strcmp(filename, input->init_str)) {
1189 const char *p = strrchr(filename,
'/');
1193 dfilename = encodeText(char_encoder, &dfilename);
1194 filesInputMultipartAppend(DataStr, boundary, name->
str,
1195 file, dfilename->
str);
1203 val = encodeText(char_encoder, &val);
1204 strUrlencodeAppend(DataStr, val->
str);
1213 imageInputUrlencodeAppend(DataStr, name, x, y);
1215 imageInputMultipartAppend(DataStr, boundary, name, x, y);
1219 for (
int j = 0; j < valcount; j++) {
1222 val = encodeText(char_encoder, &val);
1224 inputUrlencodeAppend(DataStr, name->
str, val->
str);
1226 inputMultipartAppend(DataStr, boundary, name->
str,
1234 if (DataStr->
len > 0) {
1236 if (DataStr->
str[DataStr->
len - 1] ==
'&')
1245 if (char_encoder != (iconv_t) -1)
1246 (void)iconv_close(char_encoder);
1259 static const char set[] =
"abcdefghijklmnopqrstuvwxyz"
1260 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1262 static const size_t n = strlen(set);
1264 for (
int i = 0; i < 70; i++) {
1265 int c = (
unsigned char) set[rand() % n];
1274char *DilloHtmlForm::makeMultipartBoundary(iconv_t char_encoder,
1275 DilloHtmlInput *active_submit)
1283 for (
int i = 0; i < inputs->size(); i++) {
1285 DilloHtmlInput *input = inputs->get (i);
1286 bool is_active_submit = (input == active_submit);
1287 input->appendValuesTo(values, is_active_submit);
1291 dstr = encodeText(char_encoder, &dstr);
1298 const char *filename = lbr->
getLabel();
1299 if (filename[0] && strcmp(filename, input->init_str)) {
1301 dstr = encodeText(char_encoder, &dstr);
1307 for (
int i = 0; i < length; i++) {
1311 dstr = encodeText(char_encoder, &dstr);
1318 ret = boundary->
str;
1330Dstr *DilloHtmlForm::encodeText(iconv_t char_encoder,
Dstr **input)
1336 char *buffer, *outPtr;
1337 size_t inLeft, outRoom;
1338 bool bad_chars =
false;
1340 if ((char_encoder == (iconv_t) -1) || *input == NULL || (*input)->len == 0)
1344 inPtr = (*input)->str;
1345 inLeft = (*input)->len;
1348 while ((rc != EINVAL) && (inLeft > 0)) {
1353 rc = iconv(char_encoder, &inPtr, &inLeft, &outPtr, &outRoom);
1374 }
else if (rc == EINVAL) {
1375 MSG_ERR(
"Form encode text: bad source string.\n");
1385 MSG_WARN(
"Form encode text: string cannot be converted cleanly.\n");
1397void DilloHtmlForm::strUrlencodeAppend(
Dstr *dstr,
const char *str)
1407void DilloHtmlForm::inputUrlencodeAppend(
Dstr *data,
const char *name,
1410 if (name && name[0]) {
1411 strUrlencodeAppend(data, name);
1413 strUrlencodeAppend(data, value);
1422void DilloHtmlForm::filesInputMultipartAppend(
Dstr* data,
1423 const char *boundary,
1426 const char *filename)
1428 const char *ctype, *ext;
1430 if (name && name[0]) {
1433 if ((ext = strrchr(filename,
'.')) &&
1436 ctype =
"text/html";
1439 if (data->
len == 0) {
1445 "Content-Disposition: form-data; name=\"%s\"; "
1446 "filename=\"", name);
1453 for (
int i = 0;
char c = filename[i]; i++) {
1454 if (c ==
'\"' || c ==
'\r' || c ==
'\n')
1460 "Content-Type: %s\r\n"
1474void DilloHtmlForm::inputMultipartAppend(
Dstr *data,
1475 const char *boundary,
1479 if (name && name[0]) {
1480 if (data->
len == 0) {
1486 "Content-Disposition: form-data; name=\"%s\"\r\n"
1490 name, value, boundary);
1497void DilloHtmlForm::imageInputUrlencodeAppend(
Dstr *data,
Dstr *name,
Dstr *x,
1501 strUrlencodeAppend(data, name->
str);
1503 strUrlencodeAppend(data, name->
str);
1512void DilloHtmlForm::imageInputMultipartAppend(
Dstr *data,
const char *boundary,
1515 int orig_len = name->
len;
1521 inputMultipartAppend(data, boundary, name->
str, x->
str);
1524 inputMultipartAppend(data, boundary, name->
str, y->
str);
1532void DilloHtmlForm::reset ()
1534 int size = inputs->size();
1535 for (
int i = 0; i < size; i++)
1536 inputs->get(i)->reset();
1542void DilloHtmlForm::display_hiddens(
bool display)
1544 int size = inputs->size();
1545 for (
int i = 0; i < size; i++) {
1546 DilloHtmlInput *input = inputs->get(i);
1548 input->embed->setDisplayed(display);
1551 showing_hiddens = display;
1554void DilloHtmlForm::setEnabled(
bool enabled)
1556 for (
int i = 0; i < inputs->size(); i++)
1557 inputs->get(i)->setEnabled(enabled);
1565 input->connectTo (form_receiver);
1566 input->setEnabled (enabled);
1567 int ni = inputs->size ();
1568 inputs->increase ();
1569 inputs->set (ni,input);
1581DilloHtmlInput *DilloHtmlForm::getInput (
Resource *resource)
1583 for (
int idx = 0; idx < inputs->size(); idx++) {
1584 DilloHtmlInput *input = inputs->get(idx);
1586 resource == input->embed->getResource())
1595DilloHtmlInput *DilloHtmlForm::getRadioInput (
const char *name)
1597 for (
int idx = 0; idx < inputs->size(); idx++) {
1598 DilloHtmlInput *input = inputs->get(idx);
1613void DilloHtmlReceiver::activate (
Resource *resource)
1615 form->eventHandler(resource, NULL);
1622void DilloHtmlReceiver::enter (
Resource *resource)
1625 DilloHtmlInput *input =
form->getInput(resource);
1626 const char *msg =
"";
1644void DilloHtmlReceiver::leave (
Resource *resource)
1650void DilloHtmlReceiver::clicked (
Resource *resource,
1653 form->eventHandler(resource, event);
1664 const char *name2,
const char *init_str2,
1669 name = (name2) ?
dStrdup(name2) : NULL;
1670 init_str = (init_str2) ?
dStrdup(init_str2) : NULL;
1671 init_val = init_val2;
1676 select =
new DilloHtmlSelect;
1688DilloHtmlInput::~DilloHtmlInput ()
1700void DilloHtmlInput::connectTo(DilloHtmlReceiver *form_receiver)
1722void DilloHtmlInput::activate(DilloHtmlForm *
form,
int num_entry_fields,
1727 readFile (
form->html->bw);
1743 form->submit(
this, event);
1773void DilloHtmlInput::appendValuesTo(
Dlist *values,
bool is_active_submit)
1804 if (is_active_submit)
1811 select->appendValuesTo (values, sel_res);
1817 const char *filename = lbr->
getLabel();
1818 if (filename[0] && strcmp(filename, init_str)) {
1824 MSG(
"FORM file input \"%s\" not loaded.\n", filename);
1830 if (is_active_submit) {
1849void DilloHtmlInput::reset ()
1858 entryres->
setText(init_str ? init_str :
"");
1871 if (select != NULL) {
1877 if (init_str != NULL) {
1880 textres->
setText(init_str ? init_str :
"");
1901DilloHtmlSelect::DilloHtmlSelect ()
1909DilloHtmlSelect::~DilloHtmlSelect ()
1911 int size = opts->size ();
1912 for (
int k = 0; k < size; k++)
1913 delete opts->get (k);
1917DilloHtmlOptbase *DilloHtmlSelect::getCurrentOpt ()
1919 return opts->get (opts->size() - 1);
1922void DilloHtmlSelect::addOpt (DilloHtmlOptbase *opt)
1924 int size = opts->size ();
1926 opts->set (size, opt);
1932void DilloHtmlSelect::ensureSelection()
1934 int size = opts->size ();
1936 for (
int i = 0; i < size; i++) {
1937 DilloHtmlOptbase *opt = opts->get (i);
1938 if (opt->isSelected())
1941 for (
int i = 0; i < size; i++) {
1942 DilloHtmlOptbase *opt = opts->get (i);
1951 int size = opts->size ();
1952 for (
int i = 0; i < size; i++) {
1953 DilloHtmlOptbase *opt = opts->get (i);
1960 int size = opts->size ();
1961 for (
int i = 0; i < size; i++) {
1962 DilloHtmlOptbase *opt = opts->get (i);
1963 res->
setItem(i, opt->isSelected());
1969 int size = opts->size ();
1970 for (
int i = 0; i < size; i++) {
1972 DilloHtmlOptbase *opt = opts->get (i);
1973 const char *val = opt->getValue();
1981DilloHtmlOptgroup::DilloHtmlOptgroup (
char *label,
bool enabled)
1983 this->label = label;
1984 this->enabled = enabled;
1987DilloHtmlOptgroup::~DilloHtmlOptgroup ()
1999DilloHtmlOption::DilloHtmlOption (
char *value2,
char *label2,
bool selected2,
2005 selected = selected2;
2012DilloHtmlOption::~DilloHtmlOption ()
2029 Embed *button = NULL;
2044 button =
new Embed(complex_b_r);
2045 HT2TB(html)->addWidget (button, html->
style ());
2048 MSG(
"Html_input_image: unable to create image submit.\n");
2061 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.
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.