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.21 2004/04/12 05:42:25 csoutheren
28 * Fixed problem with radio buttons
30 * Revision 1.20 2004/04/03 06:54:24 rjongbloed
31 * Many and various changes to support new Visual C++ 2003
33 * Revision 1.19 2002/11/06 22:47:24 robertj
34 * Fixed header comment (copyright etc)
36 * Revision 1.18 2001/02/13 04:39:08 robertj
37 * Fixed problem with operator= in container classes. Some containers will
38 * break unless the copy is virtual (eg PStringStream's buffer pointers) so
39 * needed to add a new AssignContents() function to all containers.
41 * Revision 1.17 1998/11/30 04:51:51 robertj
42 * New directory structure
44 * Revision 1.16 1998/09/23 06:22:04 robertj
45 * Added open source copyright license.
47 * Revision 1.15 1998/01/26 02:49:15 robertj
50 * Revision 1.14 1997/06/16 13:18:03 robertj
51 * Set Is() function to be const as it should have been.
53 * Revision 1.13 1996/08/19 13:40:31 robertj
54 * Fixed incorrect formatting of HTML tags (cosmetic only).
56 * Revision 1.12 1996/06/28 13:08:55 robertj
57 * Changed PHTML class so can create html fragments.
58 * Fixed nesting problem in tables.
60 * Revision 1.11 1996/06/01 04:18:45 robertj
61 * Fixed bug in RadioButton, having 2 VALUE fields
63 * Revision 1.10 1996/04/29 12:21:22 robertj
64 * Fixed spelling error in assert.
65 * Fixed check box HTML, should always have a value.
66 * Added display of value of unclosed HTML element.
68 * Revision 1.9 1996/04/14 02:52:04 robertj
69 * Added hidden fields to HTML.
71 * Revision 1.8 1996/03/31 09:03:07 robertj
72 * Changed HTML token so doesn't have trailing CRLF.
74 * Revision 1.7 1996/03/16 04:54:06 robertj
75 * Made the assert for unclosed HTML elements only on debug version.
77 * Revision 1.6 1996/03/12 11:30:33 robertj
78 * Fixed resetting of HTML output using operator=.
80 * Revision 1.5 1996/03/10 13:14:55 robertj
81 * Simplified some of the classes and added catch all string for attributes.
83 * Revision 1.4 1996/02/25 11:14:22 robertj
84 * Radio button support for forms.
86 * Revision 1.3 1996/02/19 13:31:51 robertj
87 * Removed MSC_VER test as now completely removed from WIN16 library.
89 * Revision 1.2 1996/02/08 12:24:30 robertj
90 * Further implementation.
92 * Revision 1.1 1996/02/03 11:18:46 robertj
95 * Revision 1.3 1996/01/28 02:49:16 robertj
96 * Further implementation.
98 * Revision 1.2 1996/01/26 02:24:30 robertj
99 * Further implemetation.
101 * Revision 1.1 1996/01/23 13:04:32 robertj
107 #pragma implementation "html.h"
111 #include <ptclib/html.h>
114 //////////////////////////////////////////////////////////////////////////////
117 PHTML::PHTML(ElementInSet initialState
)
119 memset(elementSet
, 0, sizeof(elementSet
));
121 initialElement
= initialState
;
122 switch (initialState
) {
123 case NumElementsInSet
:
133 PAssertAlways(PInvalidParameter
);
138 PHTML::PHTML(const char * cstr
)
140 memset(elementSet
, 0, sizeof(elementSet
));
142 initialElement
= NumElementsInSet
;
143 ostream
& this_stream
= *this;
144 this_stream
<< Title(cstr
) << Body() << Heading(1) << cstr
<< Heading(1);
148 PHTML::PHTML(const PString
& str
)
150 memset(elementSet
, 0, sizeof(elementSet
));
152 initialElement
= NumElementsInSet
;
153 ostream
& this_stream
= *this;
154 this_stream
<< Title(str
) << Body() << Heading(1) << str
<< Heading(1);
161 if (initialElement
!= NumElementsInSet
) {
165 for (PINDEX i
= 0; i
< PARRAYSIZE(elementSet
); i
++)
166 PAssert(elementSet
[i
] == 0, psprintf("Failed to close element %u", i
));
171 void PHTML::AssignContents(const PContainer
& cont
)
173 PStringStream::AssignContents(cont
);
174 memset(elementSet
, 0, sizeof(elementSet
));
178 BOOL
PHTML::Is(ElementInSet elmt
) const
180 return (elementSet
[elmt
>>3]&(1<<(elmt
&7))) != 0;
184 void PHTML::Set(ElementInSet elmt
)
186 elementSet
[elmt
>>3] |= (1<<(elmt
&7));
190 void PHTML::Clr(ElementInSet elmt
)
192 elementSet
[elmt
>>3] &= ~(1<<(elmt
&7));
196 void PHTML::Toggle(ElementInSet elmt
)
198 elementSet
[elmt
>>3] ^= (1<<(elmt
&7));
202 void PHTML::Element::Output(PHTML
& html
) const
204 PAssert(reqElement
== NumElementsInSet
|| html
.Is(reqElement
),
205 "HTML element out of context");
207 if (crlf
== BothCRLF
|| (crlf
== OpenCRLF
&& !html
.Is(inElement
)))
211 if (html
.Is(inElement
))
221 if (crlf
== BothCRLF
|| (crlf
== CloseCRLF
&& html
.Is(inElement
)))
224 if (inElement
!= NumElementsInSet
)
225 html
.Toggle(inElement
);
229 void PHTML::Element::AddAttr(PHTML
&) const
234 PHTML::HTML::HTML(const char * attr
)
235 : Element("HTML", attr
, InHTML
, NumElementsInSet
, BothCRLF
)
240 : Element("HEAD", NULL
, InHead
, NumElementsInSet
, BothCRLF
)
244 void PHTML::Head::Output(PHTML
& html
) const
246 PAssert(!html
.Is(InBody
), "HTML element out of context");
247 if (!html
.Is(InHTML
))
249 Element::Output(html
);
253 PHTML::Body::Body(const char * attr
)
254 : Element("BODY", attr
, InBody
, NumElementsInSet
, BothCRLF
)
259 void PHTML::Body::Output(PHTML
& html
) const
261 if (!html
.Is(InHTML
))
263 if (html
.Is(InTitle
))
267 Element::Output(html
);
268 if (!html
.Is(InBody
))
273 PHTML::Title::Title()
274 : Element("TITLE", NULL
, InTitle
, InHead
, CloseCRLF
)
279 PHTML::Title::Title(const char * titleCStr
)
280 : Element("TITLE", NULL
, InTitle
, InHead
, CloseCRLF
)
282 titleString
= titleCStr
;
285 PHTML::Title::Title(const PString
& titleStr
)
286 : Element("TITLE", NULL
, InTitle
, InHead
, CloseCRLF
)
288 titleString
= titleStr
;
291 void PHTML::Title::Output(PHTML
& html
) const
293 PAssert(!html
.Is(InBody
), "HTML element out of context");
294 if (!html
.Is(InHead
))
296 if (html
.Is(InTitle
)) {
297 if (titleString
!= NULL
)
299 Element::Output(html
);
302 Element::Output(html
);
303 if (titleString
!= NULL
) {
305 Element::Output(html
);
311 PHTML::Banner::Banner(const char * attr
)
312 : Element("BANNER", attr
, NumElementsInSet
, InBody
, BothCRLF
)
317 PHTML::Division::Division(const char * attr
)
318 : Element("DIV", attr
, InDivision
, InBody
, BothCRLF
)
323 PHTML::Heading::Heading(int number
,
327 : Element("H", attr
, InHeading
, InBody
, CloseCRLF
)
335 PHTML::Heading::Heading(int number
,
340 : Element("H", attr
, InHeading
, InBody
, CloseCRLF
)
348 PHTML::Heading::Heading(int number
,
349 const PString
& imageStr
,
353 : Element("H", attr
, InHeading
, InBody
, CloseCRLF
)
356 srcString
= imageStr
;
361 void PHTML::Heading::AddAttr(PHTML
& html
) const
363 PAssert(num
>= 1 && num
<= 6, "Bad heading number");
365 if (srcString
!= NULL
)
366 html
<< " SRC=\"" << srcString
<< '"';
368 html
<< " SEQNUM=" << seqNum
;
370 html
<< " SKIP=" << skipSeq
;
374 PHTML::BreakLine::BreakLine(const char * attr
)
375 : Element("BR", attr
, NumElementsInSet
, InBody
, CloseCRLF
)
380 PHTML::Paragraph::Paragraph(const char * attr
)
381 : Element("P", attr
, NumElementsInSet
, InBody
, OpenCRLF
)
386 PHTML::PreFormat::PreFormat(int widthInChars
, const char * attr
)
387 : Element("PRE", attr
, InPreFormat
, InBody
, CloseCRLF
)
389 width
= widthInChars
;
393 void PHTML::PreFormat::AddAttr(PHTML
& html
) const
396 html
<< " WIDTH=" << width
;
400 PHTML::HotLink::HotLink(const char * href
, const char * attr
)
401 : Element("A", attr
, InAnchor
, InBody
, NoCRLF
)
406 void PHTML::HotLink::AddAttr(PHTML
& html
) const
408 if (hrefString
!= NULL
&& *hrefString
!= '\0')
409 html
<< " HREF=\"" << hrefString
<< '"';
411 PAssert(html
.Is(InAnchor
), PInvalidParameter
);
415 PHTML::Target::Target(const char * name
, const char * attr
)
416 : Element("A", attr
, NumElementsInSet
, InBody
, NoCRLF
)
421 void PHTML::Target::AddAttr(PHTML
& html
) const
423 if (nameString
!= NULL
&& *nameString
!= '\0')
424 html
<< " NAME=\"" << nameString
<< '"';
428 PHTML::ImageElement::ImageElement(const char * n
,
434 : Element(n
, attr
, elmt
, req
, c
)
440 void PHTML::ImageElement::AddAttr(PHTML
& html
) const
442 if (srcString
!= NULL
)
443 html
<< " SRC=\"" << srcString
<< '"';
447 PHTML::Image::Image(const char * src
, int w
, int h
, const char * attr
)
448 : ImageElement("IMG", attr
, NumElementsInSet
, InBody
, NoCRLF
, src
)
455 PHTML::Image::Image(const char * src
,
459 : ImageElement("IMG", attr
, NumElementsInSet
, InBody
, NoCRLF
, src
)
466 void PHTML::Image::AddAttr(PHTML
& html
) const
468 PAssert(srcString
!= NULL
&& *srcString
!= '\0', PInvalidParameter
);
469 if (altString
!= NULL
)
470 html
<< " ALT=\"" << altString
<< '"';
472 html
<< " WIDTH=" << width
;
474 html
<< " HEIGHT=" << height
;
475 ImageElement::AddAttr(html
);
479 PHTML::HRule::HRule(const char * image
, const char * attr
)
480 : ImageElement("HR", attr
, NumElementsInSet
, InBody
, BothCRLF
, image
)
485 PHTML::Note::Note(const char * image
, const char * attr
)
486 : ImageElement("NOTE", attr
, InNote
, InBody
, BothCRLF
, image
)
491 PHTML::Address::Address(const char * attr
)
492 : Element("ADDRESS", attr
, InAddress
, InBody
, BothCRLF
)
497 PHTML::BlockQuote::BlockQuote(const char * attr
)
498 : Element("BQ", attr
, InBlockQuote
, InBody
, BothCRLF
)
503 PHTML::Credit::Credit(const char * attr
)
504 : Element("CREDIT", attr
, NumElementsInSet
, InBlockQuote
, OpenCRLF
)
508 PHTML::SetTab::SetTab(const char * id
, const char * attr
)
509 : Element("TAB", attr
, NumElementsInSet
, InBody
, NoCRLF
)
514 void PHTML::SetTab::AddAttr(PHTML
& html
) const
516 PAssert(ident
!= NULL
&& *ident
!= '\0', PInvalidParameter
);
517 html
<< " ID=" << ident
;
521 PHTML::Tab::Tab(int indent
, const char * attr
)
522 : Element("TAB", attr
, NumElementsInSet
, InBody
, NoCRLF
)
528 PHTML::Tab::Tab(const char * id
, const char * attr
)
529 : Element("TAB", attr
, NumElementsInSet
, InBody
, NoCRLF
)
535 void PHTML::Tab::AddAttr(PHTML
& html
) const
537 PAssert(indentSize
!=0 || (ident
!=NULL
&& *ident
!='\0'), PInvalidParameter
);
539 html
<< " INDENT=" << indentSize
;
541 html
<< " TO=" << ident
;
545 PHTML::SimpleList::SimpleList(const char * attr
)
546 : Element("UL", attr
, InList
, InBody
, BothCRLF
)
550 void PHTML::SimpleList::AddAttr(PHTML
& html
) const
556 PHTML::BulletList::BulletList(const char * attr
)
557 : Element("UL", attr
, InList
, InBody
, BothCRLF
)
562 PHTML::OrderedList::OrderedList(int seqNum
, const char * attr
)
563 : Element("OL", attr
, InList
, InBody
, BothCRLF
)
565 sequenceNum
= seqNum
;
568 void PHTML::OrderedList::AddAttr(PHTML
& html
) const
571 html
<< " SEQNUM=" << sequenceNum
;
577 PHTML::DefinitionList::DefinitionList(const char * attr
)
578 : Element("DL", attr
, InList
, InBody
, BothCRLF
)
583 PHTML::ListHeading::ListHeading(const char * attr
)
584 : Element("LH", attr
, InListHeading
, InList
, CloseCRLF
)
588 PHTML::ListItem::ListItem(int skip
, const char * attr
)
589 : Element("LI", attr
, NumElementsInSet
, InList
, OpenCRLF
)
594 void PHTML::ListItem::AddAttr(PHTML
& html
) const
597 html
<< " SKIP=" << skipSeq
;
601 PHTML::DefinitionTerm::DefinitionTerm(const char * attr
)
602 : Element("DT", attr
, NumElementsInSet
, InList
, NoCRLF
)
606 void PHTML::DefinitionTerm::Output(PHTML
& html
) const
608 PAssert(!html
.Is(InDefinitionTerm
), "HTML definition item missing");
609 Element::Output(html
);
610 html
.Set(InDefinitionTerm
);
614 PHTML::DefinitionItem::DefinitionItem(const char * attr
)
615 : Element("DD", attr
, NumElementsInSet
, InList
, NoCRLF
)
619 void PHTML::DefinitionItem::Output(PHTML
& html
) const
621 PAssert(html
.Is(InDefinitionTerm
), "HTML definition term missing");
622 Element::Output(html
);
623 html
.Clr(InDefinitionTerm
);
627 PHTML::TableStart::TableStart(const char * attr
)
628 : Element("TABLE", attr
, InTable
, InBody
, BothCRLF
)
633 PHTML::TableStart::TableStart(BorderCodes border
, const char * attr
)
634 : Element("TABLE", attr
, InTable
, InBody
, BothCRLF
)
636 borderFlag
= border
== Border
;
639 void PHTML::TableStart::Output(PHTML
& html
) const
641 if (html
.tableNestLevel
> 0)
643 Element::Output(html
);
646 void PHTML::TableStart::AddAttr(PHTML
& html
) const
650 html
.tableNestLevel
++;
654 PHTML::TableEnd::TableEnd()
655 : Element("TABLE", "", InTable
, InBody
, BothCRLF
)
659 void PHTML::TableEnd::Output(PHTML
& html
) const
661 PAssert(html
.tableNestLevel
> 0, "Table nesting error");
662 Element::Output(html
);
663 html
.tableNestLevel
--;
664 if (html
.tableNestLevel
> 0)
669 PHTML::TableRow::TableRow(const char * attr
)
670 : Element("TR", attr
, NumElementsInSet
, InTable
, OpenCRLF
)
675 PHTML::TableHeader::TableHeader(const char * attr
)
676 : Element("TH", attr
, NumElementsInSet
, InTable
, CloseCRLF
)
681 PHTML::TableData::TableData(const char * attr
)
682 : Element("TD", attr
, NumElementsInSet
, InTable
, NoCRLF
)
687 PHTML::Form::Form(const char * method
,
689 const char * mimeType
,
691 : Element("FORM", NULL
, InForm
, InBody
, BothCRLF
)
693 methodString
= method
;
694 actionString
= action
;
695 mimeTypeString
= mimeType
;
696 scriptString
= script
;
699 void PHTML::Form::AddAttr(PHTML
& html
) const
701 if (methodString
!= NULL
)
702 html
<< " METHOD=" << methodString
;
703 if (actionString
!= NULL
)
704 html
<< " ACTION=\"" << actionString
<< '"';
705 if (mimeTypeString
!= NULL
)
706 html
<< " ENCTYPE=\"" << mimeTypeString
<< '"';
707 if (scriptString
!= NULL
)
708 html
<< " SCRIPT=\"" << scriptString
<< '"';
712 PHTML::FieldElement::FieldElement(const char * n
,
716 DisableCodes disabled
)
717 : Element(n
, attr
, elmt
, InForm
, c
)
719 disabledFlag
= disabled
== Disabled
;
722 void PHTML::FieldElement::AddAttr(PHTML
& html
) const
729 PHTML::Select::Select(const char * fname
, const char * attr
)
730 : FieldElement("SELECT", attr
, InSelect
, BothCRLF
, Enabled
)
735 PHTML::Select::Select(const char * fname
,
736 DisableCodes disabled
,
738 : FieldElement("SELECT", attr
, InSelect
, BothCRLF
, disabled
)
743 void PHTML::Select::AddAttr(PHTML
& html
) const
745 if (!html
.Is(InSelect
)) {
746 PAssert(nameString
!= NULL
&& *nameString
!= '\0', PInvalidParameter
);
747 html
<< " NAME=\"" << nameString
<< '"';
749 FieldElement::AddAttr(html
);
753 PHTML::Option::Option(const char * attr
)
754 : FieldElement("OPTION", attr
, NumElementsInSet
, NoCRLF
, Enabled
)
756 selectedFlag
= FALSE
;
759 PHTML::Option::Option(SelectionCodes select
,
761 : FieldElement("OPTION", attr
, NumElementsInSet
, NoCRLF
, Enabled
)
763 selectedFlag
= select
== Selected
;
766 PHTML::Option::Option(DisableCodes disabled
,
768 : FieldElement("OPTION", attr
, NumElementsInSet
, NoCRLF
, disabled
)
770 selectedFlag
= FALSE
;
773 PHTML::Option::Option(SelectionCodes select
,
774 DisableCodes disabled
,
776 : FieldElement("OPTION", attr
, NumElementsInSet
, NoCRLF
, disabled
)
778 selectedFlag
= select
== Selected
;
781 void PHTML::Option::AddAttr(PHTML
& html
) const
785 FieldElement::AddAttr(html
);
789 PHTML::FormField::FormField(const char * n
,
793 DisableCodes disabled
,
795 : FieldElement(n
, attr
, elmt
, c
, disabled
)
800 void PHTML::FormField::AddAttr(PHTML
& html
) const
802 PAssert(nameString
!= NULL
&& *nameString
!= '\0', PInvalidParameter
);
803 html
<< " NAME=\"" << nameString
<< '"';
804 FieldElement::AddAttr(html
);
808 PHTML::TextArea::TextArea(const char * fname
,
809 DisableCodes disabled
,
811 : FormField("TEXTAREA", attr
, InSelect
, BothCRLF
, disabled
, fname
)
813 numRows
= numCols
= 0;
816 PHTML::TextArea::TextArea(const char * fname
,
818 DisableCodes disabled
,
820 : FormField("TEXTAREA", attr
, InSelect
, BothCRLF
, disabled
, fname
)
826 void PHTML::TextArea::AddAttr(PHTML
& html
) const
829 html
<< " ROWS=" << numRows
;
831 html
<< " COLS=" << numCols
;
832 FormField::AddAttr(html
);
836 PHTML::InputField::InputField(const char * type
,
838 DisableCodes disabled
,
840 : FormField("INPUT", attr
, NumElementsInSet
, NoCRLF
, disabled
, fname
)
845 void PHTML::InputField::AddAttr(PHTML
& html
) const
847 PAssert(typeString
!= NULL
&& *typeString
!= '\0', PInvalidParameter
);
848 html
<< " TYPE=" << typeString
;
849 FormField::AddAttr(html
);
853 PHTML::HiddenField::HiddenField(const char * fname
,
856 : InputField("hidden", fname
, Enabled
, attr
)
861 void PHTML::HiddenField::AddAttr(PHTML
& html
) const
863 InputField::AddAttr(html
);
864 PAssert(valueString
!= NULL
, PInvalidParameter
);
865 html
<< " VALUE=\"" << valueString
<< '"';
869 PHTML::InputText::InputText(const char * fname
,
873 : InputField("text", fname
, Enabled
, attr
)
880 PHTML::InputText::InputText(const char * fname
,
882 DisableCodes disabled
,
884 : InputField("text", fname
, disabled
, attr
)
891 PHTML::InputText::InputText(const char * fname
,
894 DisableCodes disabled
,
896 : InputField("text", fname
, disabled
, attr
)
903 PHTML::InputText::InputText(const char * fname
,
907 DisableCodes disabled
,
909 : InputField("text", fname
, disabled
, attr
)
916 PHTML::InputText::InputText(const char * type
,
921 DisableCodes disabled
,
923 : InputField(type
, fname
, disabled
, attr
)
930 void PHTML::InputText::AddAttr(PHTML
& html
) const
932 InputField::AddAttr(html
);
933 html
<< " SIZE=" << width
;
935 html
<< " MAXLENGTH=" << length
;
937 html
<< " VALUE=\"" << value
<< '"';
941 PHTML::InputPassword::InputPassword(const char * fname
,
945 : InputText("password", fname
, size
, init
, 0, Enabled
, attr
)
949 PHTML::InputPassword::InputPassword(const char * fname
,
951 DisableCodes disabled
,
953 : InputText("password", fname
, size
, NULL
, 0, disabled
, attr
)
957 PHTML::InputPassword::InputPassword(const char * fname
,
960 DisableCodes disabled
,
962 : InputText("password", fname
, size
, NULL
, maxLength
, disabled
, attr
)
966 PHTML::InputPassword::InputPassword(const char * fname
,
970 DisableCodes disabled
,
972 : InputText("password", fname
, size
, init
, maxLength
, disabled
, attr
)
977 PHTML::RadioButton::RadioButton(const char * fname
,
980 : InputField("radio", fname
, Enabled
, attr
)
986 PHTML::RadioButton::RadioButton(const char * fname
,
988 DisableCodes disabled
,
990 : InputField("radio", fname
, disabled
, attr
)
996 PHTML::RadioButton::RadioButton(const char * fname
,
999 DisableCodes disabled
,
1001 : InputField("radio", fname
, disabled
, attr
)
1003 valueString
= value
;
1004 checkedFlag
= check
== Checked
;
1007 PHTML::RadioButton::RadioButton(const char * type
,
1011 DisableCodes disabled
,
1013 : InputField(type
, fname
, disabled
, attr
)
1015 valueString
= value
;
1016 checkedFlag
= check
== Checked
;
1019 void PHTML::RadioButton::AddAttr(PHTML
& html
) const
1021 InputField::AddAttr(html
);
1022 PAssert(valueString
!= NULL
, PInvalidParameter
);
1023 html
<< " VALUE=\"" << valueString
<< "\"";
1029 PHTML::CheckBox::CheckBox(const char * fname
, const char * attr
)
1030 : RadioButton("checkbox", fname
, "TRUE", UnChecked
, Enabled
, attr
)
1034 PHTML::CheckBox::CheckBox(const char * fname
,
1035 DisableCodes disabled
,
1037 : RadioButton("checkbox", fname
, "TRUE", UnChecked
, disabled
, attr
)
1041 PHTML::CheckBox::CheckBox(const char * fname
,
1043 DisableCodes disabled
,
1045 : RadioButton("checkbox", fname
, "TRUE", check
, disabled
, attr
)
1050 PHTML::InputRange::InputRange(const char * fname
,
1051 int min
, int max
, int value
,
1052 DisableCodes disabled
,
1054 : InputField("range", fname
, disabled
, attr
)
1056 PAssert(min
<= max
, PInvalidParameter
);
1061 else if (value
> max
)
1067 void PHTML::InputRange::AddAttr(PHTML
& html
) const
1069 InputField::AddAttr(html
);
1070 PINDEX max
= PMAX(-minValue
, maxValue
);
1076 html
<< " SIZE=" << width
1077 << " MIN=" << minValue
1078 << " MAX=" << maxValue
1079 << " VALUE=\"" << initValue
<< "\"";
1083 PHTML::InputFile::InputFile(const char * fname
,
1084 const char * accept
,
1085 DisableCodes disabled
,
1087 : InputField("file", fname
, disabled
, attr
)
1089 acceptString
= accept
;
1092 void PHTML::InputFile::AddAttr(PHTML
& html
) const
1094 InputField::AddAttr(html
);
1095 if (acceptString
!= NULL
)
1096 html
<< " ACCEPT=\"" << acceptString
<< '"';
1100 PHTML::InputImage::InputImage(const char * fname
,
1102 DisableCodes disabled
,
1104 : InputField("image", fname
, disabled
, attr
)
1109 PHTML::InputImage::InputImage(const char * type
,
1112 DisableCodes disabled
,
1114 : InputField(type
, fname
, disabled
, attr
)
1119 void PHTML::InputImage::AddAttr(PHTML
& html
) const
1121 InputField::AddAttr(html
);
1122 if (srcString
!= NULL
)
1123 html
<< " SRC=\"" << srcString
<< '"';
1127 PHTML::InputScribble::InputScribble(const char * fname
,
1129 DisableCodes disabled
,
1131 : InputImage("scribble", fname
, src
, disabled
, attr
)
1135 PHTML::ResetButton::ResetButton(const char * title
,
1138 DisableCodes disabled
,
1140 : InputImage("reset", fname
!= NULL
? fname
: "reset", src
, disabled
, attr
)
1142 titleString
= title
;
1145 PHTML::ResetButton::ResetButton(const char * type
,
1149 DisableCodes disabled
,
1151 : InputImage(type
, fname
, src
, disabled
, attr
)
1153 titleString
= title
;
1156 void PHTML::ResetButton::AddAttr(PHTML
& html
) const
1158 InputImage::AddAttr(html
);
1159 if (titleString
!= NULL
)
1160 html
<< " VALUE=\"" << titleString
<< '"';
1164 PHTML::SubmitButton::SubmitButton(const char * title
,
1167 DisableCodes disabled
,
1169 : ResetButton("submit",
1170 title
, fname
!= NULL
? fname
: "submit", src
, disabled
, attr
)
1174 // End Of File ///////////////////////////////////////////////////////////////