6 * Portable Windows Library
8 * Copyright (c) 1993-2002 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Contributor(s): ______________________________________.
27 * Revision 1.19 2002/11/06 22:47:24 robertj
28 * Fixed header comment (copyright etc)
30 * Revision 1.18 2001/02/13 04:39:08 robertj
31 * Fixed problem with operator= in container classes. Some containers will
32 * break unless the copy is virtual (eg PStringStream's buffer pointers) so
33 * needed to add a new AssignContents() function to all containers.
35 * Revision 1.17 1998/11/30 04:51:51 robertj
36 * New directory structure
38 * Revision 1.16 1998/09/23 06:22:04 robertj
39 * Added open source copyright license.
41 * Revision 1.15 1998/01/26 02:49:15 robertj
44 * Revision 1.14 1997/06/16 13:18:03 robertj
45 * Set Is() function to be const as it should have been.
47 * Revision 1.13 1996/08/19 13:40:31 robertj
48 * Fixed incorrect formatting of HTML tags (cosmetic only).
50 * Revision 1.12 1996/06/28 13:08:55 robertj
51 * Changed PHTML class so can create html fragments.
52 * Fixed nesting problem in tables.
54 * Revision 1.11 1996/06/01 04:18:45 robertj
55 * Fixed bug in RadioButton, having 2 VALUE fields
57 * Revision 1.10 1996/04/29 12:21:22 robertj
58 * Fixed spelling error in assert.
59 * Fixed check box HTML, should always have a value.
60 * Added display of value of unclosed HTML element.
62 * Revision 1.9 1996/04/14 02:52:04 robertj
63 * Added hidden fields to HTML.
65 * Revision 1.8 1996/03/31 09:03:07 robertj
66 * Changed HTML token so doesn't have trailing CRLF.
68 * Revision 1.7 1996/03/16 04:54:06 robertj
69 * Made the assert for unclosed HTML elements only on debug version.
71 * Revision 1.6 1996/03/12 11:30:33 robertj
72 * Fixed resetting of HTML output using operator=.
74 * Revision 1.5 1996/03/10 13:14:55 robertj
75 * Simplified some of the classes and added catch all string for attributes.
77 * Revision 1.4 1996/02/25 11:14:22 robertj
78 * Radio button support for forms.
80 * Revision 1.3 1996/02/19 13:31:51 robertj
81 * Removed MSC_VER test as now completely removed from WIN16 library.
83 * Revision 1.2 1996/02/08 12:24:30 robertj
84 * Further implementation.
86 * Revision 1.1 1996/02/03 11:18:46 robertj
89 * Revision 1.3 1996/01/28 02:49:16 robertj
90 * Further implementation.
92 * Revision 1.2 1996/01/26 02:24:30 robertj
93 * Further implemetation.
95 * Revision 1.1 1996/01/23 13:04:32 robertj
101 #pragma implementation "html.h"
105 #include <ptclib/html.h>
108 //////////////////////////////////////////////////////////////////////////////
111 PHTML::PHTML(ElementInSet initialState
)
113 memset(elementSet
, 0, sizeof(elementSet
));
115 initialElement
= initialState
;
116 switch (initialState
) {
117 case NumElementsInSet
:
127 PAssertAlways(PInvalidParameter
);
132 PHTML::PHTML(const char * cstr
)
134 memset(elementSet
, 0, sizeof(elementSet
));
136 initialElement
= NumElementsInSet
;
137 *this << Title(cstr
) << Body() << Heading(1) << cstr
<< Heading(1);
141 PHTML::PHTML(const PString
& str
)
143 memset(elementSet
, 0, sizeof(elementSet
));
145 initialElement
= NumElementsInSet
;
146 *this << Title(str
) << Body() << Heading(1) << str
<< Heading(1);
153 if (initialElement
!= NumElementsInSet
) {
157 for (PINDEX i
= 0; i
< PARRAYSIZE(elementSet
); i
++)
158 PAssert(elementSet
[i
] == 0, psprintf("Failed to close element %u", i
));
163 void PHTML::AssignContents(const PContainer
& cont
)
165 PStringStream::AssignContents(cont
);
166 memset(elementSet
, 0, sizeof(elementSet
));
170 BOOL
PHTML::Is(ElementInSet elmt
) const
172 return (elementSet
[elmt
>>3]&(1<<(elmt
&7))) != 0;
176 void PHTML::Set(ElementInSet elmt
)
178 elementSet
[elmt
>>3] |= (1<<(elmt
&7));
182 void PHTML::Clr(ElementInSet elmt
)
184 elementSet
[elmt
>>3] &= ~(1<<(elmt
&7));
188 void PHTML::Toggle(ElementInSet elmt
)
190 elementSet
[elmt
>>3] ^= (1<<(elmt
&7));
194 void PHTML::Element::Output(PHTML
& html
) const
196 PAssert(reqElement
== NumElementsInSet
|| html
.Is(reqElement
),
197 "HTML element out of context");
199 if (crlf
== BothCRLF
|| (crlf
== OpenCRLF
&& !html
.Is(inElement
)))
203 if (html
.Is(inElement
))
213 if (crlf
== BothCRLF
|| (crlf
== CloseCRLF
&& html
.Is(inElement
)))
216 if (inElement
!= NumElementsInSet
)
217 html
.Toggle(inElement
);
221 void PHTML::Element::AddAttr(PHTML
&) const
226 PHTML::HTML::HTML(const char * attr
)
227 : Element("HTML", attr
, InHTML
, NumElementsInSet
, BothCRLF
)
232 : Element("HEAD", NULL
, InHead
, NumElementsInSet
, BothCRLF
)
236 void PHTML::Head::Output(PHTML
& html
) const
238 PAssert(!html
.Is(InBody
), "HTML element out of context");
239 if (!html
.Is(InHTML
))
241 Element::Output(html
);
245 PHTML::Body::Body(const char * attr
)
246 : Element("BODY", attr
, InBody
, NumElementsInSet
, BothCRLF
)
251 void PHTML::Body::Output(PHTML
& html
) const
253 if (!html
.Is(InHTML
))
255 if (html
.Is(InTitle
))
259 Element::Output(html
);
260 if (!html
.Is(InBody
))
265 PHTML::Title::Title()
266 : Element("TITLE", NULL
, InTitle
, InHead
, CloseCRLF
)
271 PHTML::Title::Title(const char * titleCStr
)
272 : Element("TITLE", NULL
, InTitle
, InHead
, CloseCRLF
)
274 titleString
= titleCStr
;
277 PHTML::Title::Title(const PString
& titleStr
)
278 : Element("TITLE", NULL
, InTitle
, InHead
, CloseCRLF
)
280 titleString
= titleStr
;
283 void PHTML::Title::Output(PHTML
& html
) const
285 PAssert(!html
.Is(InBody
), "HTML element out of context");
286 if (!html
.Is(InHead
))
288 if (html
.Is(InTitle
)) {
289 if (titleString
!= NULL
)
291 Element::Output(html
);
294 Element::Output(html
);
295 if (titleString
!= NULL
) {
297 Element::Output(html
);
303 PHTML::Banner::Banner(const char * attr
)
304 : Element("BANNER", attr
, NumElementsInSet
, InBody
, BothCRLF
)
309 PHTML::Division::Division(const char * attr
)
310 : Element("DIV", attr
, InDivision
, InBody
, BothCRLF
)
315 PHTML::Heading::Heading(int number
,
319 : Element("H", attr
, InHeading
, InBody
, CloseCRLF
)
327 PHTML::Heading::Heading(int number
,
332 : Element("H", attr
, InHeading
, InBody
, CloseCRLF
)
340 PHTML::Heading::Heading(int number
,
341 const PString
& imageStr
,
345 : Element("H", attr
, InHeading
, InBody
, CloseCRLF
)
348 srcString
= imageStr
;
353 void PHTML::Heading::AddAttr(PHTML
& html
) const
355 PAssert(num
>= 1 && num
<= 6, "Bad heading number");
357 if (srcString
!= NULL
)
358 html
<< " SRC=\"" << srcString
<< '"';
360 html
<< " SEQNUM=" << seqNum
;
362 html
<< " SKIP=" << skipSeq
;
366 PHTML::BreakLine::BreakLine(const char * attr
)
367 : Element("BR", attr
, NumElementsInSet
, InBody
, CloseCRLF
)
372 PHTML::Paragraph::Paragraph(const char * attr
)
373 : Element("P", attr
, NumElementsInSet
, InBody
, OpenCRLF
)
378 PHTML::PreFormat::PreFormat(int widthInChars
, const char * attr
)
379 : Element("PRE", attr
, InPreFormat
, InBody
, CloseCRLF
)
381 width
= widthInChars
;
385 void PHTML::PreFormat::AddAttr(PHTML
& html
) const
388 html
<< " WIDTH=" << width
;
392 PHTML::HotLink::HotLink(const char * href
, const char * attr
)
393 : Element("A", attr
, InAnchor
, InBody
, NoCRLF
)
398 void PHTML::HotLink::AddAttr(PHTML
& html
) const
400 if (hrefString
!= NULL
&& *hrefString
!= '\0')
401 html
<< " HREF=\"" << hrefString
<< '"';
403 PAssert(html
.Is(InAnchor
), PInvalidParameter
);
407 PHTML::Target::Target(const char * name
, const char * attr
)
408 : Element("A", attr
, NumElementsInSet
, InBody
, NoCRLF
)
413 void PHTML::Target::AddAttr(PHTML
& html
) const
415 if (nameString
!= NULL
&& *nameString
!= '\0')
416 html
<< " NAME=\"" << nameString
<< '"';
420 PHTML::ImageElement::ImageElement(const char * n
,
426 : Element(n
, attr
, elmt
, req
, c
)
432 void PHTML::ImageElement::AddAttr(PHTML
& html
) const
434 if (srcString
!= NULL
)
435 html
<< " SRC=\"" << srcString
<< '"';
439 PHTML::Image::Image(const char * src
, int w
, int h
, const char * attr
)
440 : ImageElement("IMG", attr
, NumElementsInSet
, InBody
, NoCRLF
, src
)
447 PHTML::Image::Image(const char * src
,
451 : ImageElement("IMG", attr
, NumElementsInSet
, InBody
, NoCRLF
, src
)
458 void PHTML::Image::AddAttr(PHTML
& html
) const
460 PAssert(srcString
!= NULL
&& *srcString
!= '\0', PInvalidParameter
);
461 if (altString
!= NULL
)
462 html
<< " ALT=\"" << altString
<< '"';
464 html
<< " WIDTH=" << width
;
466 html
<< " HEIGHT=" << height
;
467 ImageElement::AddAttr(html
);
471 PHTML::HRule::HRule(const char * image
, const char * attr
)
472 : ImageElement("HR", attr
, NumElementsInSet
, InBody
, BothCRLF
, image
)
477 PHTML::Note::Note(const char * image
, const char * attr
)
478 : ImageElement("NOTE", attr
, InNote
, InBody
, BothCRLF
, image
)
483 PHTML::Address::Address(const char * attr
)
484 : Element("ADDRESS", attr
, InAddress
, InBody
, BothCRLF
)
489 PHTML::BlockQuote::BlockQuote(const char * attr
)
490 : Element("BQ", attr
, InBlockQuote
, InBody
, BothCRLF
)
495 PHTML::Credit::Credit(const char * attr
)
496 : Element("CREDIT", attr
, NumElementsInSet
, InBlockQuote
, OpenCRLF
)
500 PHTML::SetTab::SetTab(const char * id
, const char * attr
)
501 : Element("TAB", attr
, NumElementsInSet
, InBody
, NoCRLF
)
506 void PHTML::SetTab::AddAttr(PHTML
& html
) const
508 PAssert(ident
!= NULL
&& *ident
!= '\0', PInvalidParameter
);
509 html
<< " ID=" << ident
;
513 PHTML::Tab::Tab(int indent
, const char * attr
)
514 : Element("TAB", attr
, NumElementsInSet
, InBody
, NoCRLF
)
520 PHTML::Tab::Tab(const char * id
, const char * attr
)
521 : Element("TAB", attr
, NumElementsInSet
, InBody
, NoCRLF
)
527 void PHTML::Tab::AddAttr(PHTML
& html
) const
529 PAssert(indentSize
!=0 || (ident
!=NULL
&& *ident
!='\0'), PInvalidParameter
);
531 html
<< " INDENT=" << indentSize
;
533 html
<< " TO=" << ident
;
537 PHTML::SimpleList::SimpleList(const char * attr
)
538 : Element("UL", attr
, InList
, InBody
, BothCRLF
)
542 void PHTML::SimpleList::AddAttr(PHTML
& html
) const
548 PHTML::BulletList::BulletList(const char * attr
)
549 : Element("UL", attr
, InList
, InBody
, BothCRLF
)
554 PHTML::OrderedList::OrderedList(int seqNum
, const char * attr
)
555 : Element("OL", attr
, InList
, InBody
, BothCRLF
)
557 sequenceNum
= seqNum
;
560 void PHTML::OrderedList::AddAttr(PHTML
& html
) const
563 html
<< " SEQNUM=" << sequenceNum
;
569 PHTML::DefinitionList::DefinitionList(const char * attr
)
570 : Element("DL", attr
, InList
, InBody
, BothCRLF
)
575 PHTML::ListHeading::ListHeading(const char * attr
)
576 : Element("LH", attr
, InListHeading
, InList
, CloseCRLF
)
580 PHTML::ListItem::ListItem(int skip
, const char * attr
)
581 : Element("LI", attr
, NumElementsInSet
, InList
, OpenCRLF
)
586 void PHTML::ListItem::AddAttr(PHTML
& html
) const
589 html
<< " SKIP=" << skipSeq
;
593 PHTML::DefinitionTerm::DefinitionTerm(const char * attr
)
594 : Element("DT", attr
, NumElementsInSet
, InList
, NoCRLF
)
598 void PHTML::DefinitionTerm::Output(PHTML
& html
) const
600 PAssert(!html
.Is(InDefinitionTerm
), "HTML definition item missing");
601 Element::Output(html
);
602 html
.Set(InDefinitionTerm
);
606 PHTML::DefinitionItem::DefinitionItem(const char * attr
)
607 : Element("DD", attr
, NumElementsInSet
, InList
, NoCRLF
)
611 void PHTML::DefinitionItem::Output(PHTML
& html
) const
613 PAssert(html
.Is(InDefinitionTerm
), "HTML definition term missing");
614 Element::Output(html
);
615 html
.Clr(InDefinitionTerm
);
619 PHTML::TableStart::TableStart(const char * attr
)
620 : Element("TABLE", attr
, InTable
, InBody
, BothCRLF
)
625 PHTML::TableStart::TableStart(BorderCodes border
, const char * attr
)
626 : Element("TABLE", attr
, InTable
, InBody
, BothCRLF
)
628 borderFlag
= border
== Border
;
631 void PHTML::TableStart::Output(PHTML
& html
) const
633 if (html
.tableNestLevel
> 0)
635 Element::Output(html
);
638 void PHTML::TableStart::AddAttr(PHTML
& html
) const
642 html
.tableNestLevel
++;
646 PHTML::TableEnd::TableEnd()
647 : Element("TABLE", "", InTable
, InBody
, BothCRLF
)
651 void PHTML::TableEnd::Output(PHTML
& html
) const
653 PAssert(html
.tableNestLevel
> 0, "Table nesting error");
654 Element::Output(html
);
655 html
.tableNestLevel
--;
656 if (html
.tableNestLevel
> 0)
661 PHTML::TableRow::TableRow(const char * attr
)
662 : Element("TR", attr
, NumElementsInSet
, InTable
, OpenCRLF
)
667 PHTML::TableHeader::TableHeader(const char * attr
)
668 : Element("TH", attr
, NumElementsInSet
, InTable
, CloseCRLF
)
673 PHTML::TableData::TableData(const char * attr
)
674 : Element("TD", attr
, NumElementsInSet
, InTable
, NoCRLF
)
679 PHTML::Form::Form(const char * method
,
681 const char * mimeType
,
683 : Element("FORM", NULL
, InForm
, InBody
, BothCRLF
)
685 methodString
= method
;
686 actionString
= action
;
687 mimeTypeString
= mimeType
;
688 scriptString
= script
;
691 void PHTML::Form::AddAttr(PHTML
& html
) const
693 if (methodString
!= NULL
)
694 html
<< " METHOD=" << methodString
;
695 if (actionString
!= NULL
)
696 html
<< " ACTION=\"" << actionString
<< '"';
697 if (mimeTypeString
!= NULL
)
698 html
<< " ENCTYPE=\"" << mimeTypeString
<< '"';
699 if (scriptString
!= NULL
)
700 html
<< " SCRIPT=\"" << scriptString
<< '"';
704 PHTML::FieldElement::FieldElement(const char * n
,
708 DisableCodes disabled
)
709 : Element(n
, attr
, elmt
, InForm
, c
)
711 disabledFlag
= disabled
== Disabled
;
714 void PHTML::FieldElement::AddAttr(PHTML
& html
) const
721 PHTML::Select::Select(const char * fname
, const char * attr
)
722 : FieldElement("SELECT", attr
, InSelect
, BothCRLF
, Enabled
)
727 PHTML::Select::Select(const char * fname
,
728 DisableCodes disabled
,
730 : FieldElement("SELECT", attr
, InSelect
, BothCRLF
, disabled
)
735 void PHTML::Select::AddAttr(PHTML
& html
) const
737 if (!html
.Is(InSelect
)) {
738 PAssert(nameString
!= NULL
&& *nameString
!= '\0', PInvalidParameter
);
739 html
<< " NAME=\"" << nameString
<< '"';
741 FieldElement::AddAttr(html
);
745 PHTML::Option::Option(const char * attr
)
746 : FieldElement("OPTION", attr
, NumElementsInSet
, NoCRLF
, Enabled
)
748 selectedFlag
= FALSE
;
751 PHTML::Option::Option(SelectionCodes select
,
753 : FieldElement("OPTION", attr
, NumElementsInSet
, NoCRLF
, Enabled
)
755 selectedFlag
= select
== Selected
;
758 PHTML::Option::Option(DisableCodes disabled
,
760 : FieldElement("OPTION", attr
, NumElementsInSet
, NoCRLF
, disabled
)
762 selectedFlag
= FALSE
;
765 PHTML::Option::Option(SelectionCodes select
,
766 DisableCodes disabled
,
768 : FieldElement("OPTION", attr
, NumElementsInSet
, NoCRLF
, disabled
)
770 selectedFlag
= select
== Selected
;
773 void PHTML::Option::AddAttr(PHTML
& html
) const
777 FieldElement::AddAttr(html
);
781 PHTML::FormField::FormField(const char * n
,
785 DisableCodes disabled
,
787 : FieldElement(n
, attr
, elmt
, c
, disabled
)
792 void PHTML::FormField::AddAttr(PHTML
& html
) const
794 PAssert(nameString
!= NULL
&& *nameString
!= '\0', PInvalidParameter
);
795 html
<< " NAME=\"" << nameString
<< '"';
796 FieldElement::AddAttr(html
);
800 PHTML::TextArea::TextArea(const char * fname
,
801 DisableCodes disabled
,
803 : FormField("TEXTAREA", attr
, InSelect
, BothCRLF
, disabled
, fname
)
805 numRows
= numCols
= 0;
808 PHTML::TextArea::TextArea(const char * fname
,
810 DisableCodes disabled
,
812 : FormField("TEXTAREA", attr
, InSelect
, BothCRLF
, disabled
, fname
)
818 void PHTML::TextArea::AddAttr(PHTML
& html
) const
821 html
<< " ROWS=" << numRows
;
823 html
<< " COLS=" << numCols
;
824 FormField::AddAttr(html
);
828 PHTML::InputField::InputField(const char * type
,
830 DisableCodes disabled
,
832 : FormField("INPUT", attr
, NumElementsInSet
, NoCRLF
, disabled
, fname
)
837 void PHTML::InputField::AddAttr(PHTML
& html
) const
839 PAssert(typeString
!= NULL
&& *typeString
!= '\0', PInvalidParameter
);
840 html
<< " TYPE=" << typeString
;
841 FormField::AddAttr(html
);
845 PHTML::HiddenField::HiddenField(const char * fname
,
848 : InputField("hidden", fname
, Enabled
, attr
)
853 void PHTML::HiddenField::AddAttr(PHTML
& html
) const
855 InputField::AddAttr(html
);
856 PAssert(valueString
!= NULL
, PInvalidParameter
);
857 html
<< " VALUE=\"" << valueString
<< '"';
861 PHTML::InputText::InputText(const char * fname
,
865 : InputField("text", fname
, Enabled
, attr
)
872 PHTML::InputText::InputText(const char * fname
,
874 DisableCodes disabled
,
876 : InputField("text", fname
, disabled
, attr
)
883 PHTML::InputText::InputText(const char * fname
,
886 DisableCodes disabled
,
888 : InputField("text", fname
, disabled
, attr
)
895 PHTML::InputText::InputText(const char * fname
,
899 DisableCodes disabled
,
901 : InputField("text", fname
, disabled
, attr
)
908 PHTML::InputText::InputText(const char * type
,
913 DisableCodes disabled
,
915 : InputField(type
, fname
, disabled
, attr
)
922 void PHTML::InputText::AddAttr(PHTML
& html
) const
924 InputField::AddAttr(html
);
925 html
<< " SIZE=" << width
;
927 html
<< " MAXLENGTH=" << length
;
929 html
<< " VALUE=\"" << value
<< '"';
933 PHTML::InputPassword::InputPassword(const char * fname
,
937 : InputText("password", fname
, size
, init
, 0, Enabled
, attr
)
941 PHTML::InputPassword::InputPassword(const char * fname
,
943 DisableCodes disabled
,
945 : InputText("password", fname
, size
, NULL
, 0, disabled
, attr
)
949 PHTML::InputPassword::InputPassword(const char * fname
,
952 DisableCodes disabled
,
954 : InputText("password", fname
, size
, NULL
, maxLength
, disabled
, attr
)
958 PHTML::InputPassword::InputPassword(const char * fname
,
962 DisableCodes disabled
,
964 : InputText("password", fname
, size
, init
, maxLength
, disabled
, attr
)
969 PHTML::RadioButton::RadioButton(const char * fname
,
972 : InputField("radio", fname
, Enabled
, attr
)
978 PHTML::RadioButton::RadioButton(const char * fname
,
980 DisableCodes disabled
,
982 : InputField("radio", fname
, disabled
, attr
)
988 PHTML::RadioButton::RadioButton(const char * fname
,
991 DisableCodes disabled
,
993 : InputField("radio", fname
, disabled
, attr
)
996 checkedFlag
= check
== Checked
;
999 PHTML::RadioButton::RadioButton(const char * type
,
1003 DisableCodes disabled
,
1005 : InputField(type
, fname
, disabled
, attr
)
1007 valueString
= value
;
1008 checkedFlag
= check
== Checked
;
1011 void PHTML::RadioButton::AddAttr(PHTML
& html
) const
1013 InputField::AddAttr(html
);
1014 PAssert(valueString
!= NULL
, PInvalidParameter
);
1015 html
<< " VALUE=" << valueString
;
1021 PHTML::CheckBox::CheckBox(const char * fname
, const char * attr
)
1022 : RadioButton("checkbox", fname
, "TRUE", UnChecked
, Enabled
, attr
)
1026 PHTML::CheckBox::CheckBox(const char * fname
,
1027 DisableCodes disabled
,
1029 : RadioButton("checkbox", fname
, "TRUE", UnChecked
, disabled
, attr
)
1033 PHTML::CheckBox::CheckBox(const char * fname
,
1035 DisableCodes disabled
,
1037 : RadioButton("checkbox", fname
, "TRUE", check
, disabled
, attr
)
1042 PHTML::InputRange::InputRange(const char * fname
,
1043 int min
, int max
, int value
,
1044 DisableCodes disabled
,
1046 : InputField("range", fname
, disabled
, attr
)
1048 PAssert(min
<= max
, PInvalidParameter
);
1053 else if (value
> max
)
1059 void PHTML::InputRange::AddAttr(PHTML
& html
) const
1061 InputField::AddAttr(html
);
1062 PINDEX max
= PMAX(-minValue
, maxValue
);
1068 html
<< " SIZE=" << width
1069 << " MIN=" << minValue
1070 << " MAX=" << maxValue
1071 << " VALUE=" << initValue
;
1075 PHTML::InputFile::InputFile(const char * fname
,
1076 const char * accept
,
1077 DisableCodes disabled
,
1079 : InputField("file", fname
, disabled
, attr
)
1081 acceptString
= accept
;
1084 void PHTML::InputFile::AddAttr(PHTML
& html
) const
1086 InputField::AddAttr(html
);
1087 if (acceptString
!= NULL
)
1088 html
<< " ACCEPT=\"" << acceptString
<< '"';
1092 PHTML::InputImage::InputImage(const char * fname
,
1094 DisableCodes disabled
,
1096 : InputField("image", fname
, disabled
, attr
)
1101 PHTML::InputImage::InputImage(const char * type
,
1104 DisableCodes disabled
,
1106 : InputField(type
, fname
, disabled
, attr
)
1111 void PHTML::InputImage::AddAttr(PHTML
& html
) const
1113 InputField::AddAttr(html
);
1114 if (srcString
!= NULL
)
1115 html
<< " SRC=\"" << srcString
<< '"';
1119 PHTML::InputScribble::InputScribble(const char * fname
,
1121 DisableCodes disabled
,
1123 : InputImage("scribble", fname
, src
, disabled
, attr
)
1127 PHTML::ResetButton::ResetButton(const char * title
,
1130 DisableCodes disabled
,
1132 : InputImage("reset", fname
!= NULL
? fname
: "reset", src
, disabled
, attr
)
1134 titleString
= title
;
1137 PHTML::ResetButton::ResetButton(const char * type
,
1141 DisableCodes disabled
,
1143 : InputImage(type
, fname
, src
, disabled
, attr
)
1145 titleString
= title
;
1148 void PHTML::ResetButton::AddAttr(PHTML
& html
) const
1150 InputImage::AddAttr(html
);
1151 if (titleString
!= NULL
)
1152 html
<< " VALUE=\"" << titleString
<< '"';
1156 PHTML::SubmitButton::SubmitButton(const char * title
,
1159 DisableCodes disabled
,
1161 : ResetButton("submit",
1162 title
, fname
!= NULL
? fname
: "submit", src
, disabled
, attr
)
1166 // End Of File ///////////////////////////////////////////////////////////////