# html.h

Go to the documentation of this file.

    00001 /*
    00002  * html.h
    00003  *
    00004  * HyperText Markup Language stream classes.
    00005  *
    00006  * Portable Windows Library
    00007  *
    00008  * Copyright (c) 1993-2002 Equivalence Pty. Ltd.
    00009  *
    00010  * The contents of this file are subject to the Mozilla Public License
    00011  * Version 1.0 (the "License"); you may not use this file except in
    00012  * compliance with the License. You may obtain a copy of the License at
    00013  * http://www.mozilla.org/MPL/
    00014  *
    00015  * Software distributed under the License is distributed on an "AS IS"
    00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
    00017  * the License for the specific language governing rights and limitations
    00018  * under the License.
    00019  *
    00020  * The Original Code is Portable Windows Library.
    00021  *
    00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
    00023  *
    00024  * Contributor(s): ______________________________________.
    00025  *
    00026  * $Revision: 24177 $
    00027  * $Author: rjongbloed $
    00028  * $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $
    00029  */
    00030
    00031 #ifndef PTLIB_HTML_H
    00032 #define PTLIB_HTML_H
    00033
    00034 #ifdef P_USE_PRAGMA
    00035 #pragma interface
    00036 #endif
    00037
    00038
    00039
    00041 // PHTML
    00042
    00049 class PHTML : public PStringStream
    00050 {
    00051   PCLASSINFO(PHTML, PStringStream)
    00052
    00053   public:
    00054     enum ElementInSet {
    00055       InHTML,
    00056       InHead,
    00057       InBody,
    00058       InTitle,
    00059       InHeading,
    00060       InDivision,
    00061       InPreFormat,
    00062       InAnchor,
    00063       InNote,
    00064       InAddress,
    00065       InBlockQuote,
    00066       InCredit,
    00067       InBold,
    00068       InItalic,
    00069       InTeleType,
    00070       InUnderline,
    00071       InStrikeThrough,
    00072       InBig,
    00073       InSmall,
    00074       InSubscript,
    00075       InSuperscript,
    00076       InEmphasis,
    00077       InCite,
    00078       InStrong,
    00079       InCode,
    00080       InSample,
    00081       InKeyboard,
    00082       InVariable,
    00083       InDefinition,
    00084       InQuote,
    00085       InAuthor,
    00086       InPerson,
    00087       InAcronym,
    00088       InAbbrev,
    00089       InInsertedText,
    00090       InDeletedText,
    00091       InList,
    00092       InListHeading,
    00093       InDefinitionTerm,
    00094       InTable,
    00095       InForm,
    00096       InSelect,
    00097       InTextArea,
    00098       NumElementsInSet
    00099     };
    00100
    00105     PHTML(
    00106       ElementInSet initialState = NumElementsInSet
    00107     );
    00108     PHTML(
    00109       const char * cstr
    00110     );
    00111     PHTML(
    00112       const PString & str
    00113     );
    00114
    00115     ~PHTML();
    00116
    00121     PHTML & operator=(
    00122       const PHTML & html
    00123     ) { AssignContents(html); return *this; }
    00124     PHTML & operator=(
    00125       const PString & str
    00126     ) { AssignContents(str); return *this; }
    00127     PHTML & operator=(
    00128       const char * cstr
    00129     ) { AssignContents(PString(cstr)); return *this; }
    00130     PHTML & operator=(
    00131       char ch
    00132     ) { AssignContents(PString(ch)); return *this; }
    00133
    00134
    00135   // New functions for class.
    00136     PBoolean Is(ElementInSet elmt) const;
    00137     void Set(ElementInSet elmt);
    00138     void Clr(ElementInSet elmt);
    00139     void Toggle(ElementInSet elmt);
    00140
    00141
    00142     class Element {
    00143       public:
    00144         virtual ~Element() {}
    00145       protected:
    00146         enum OptionalCRLF { NoCRLF, OpenCRLF, CloseCRLF, BothCRLF };
    00147         Element(
    00148           const char * nam,
    00149           const char * att,
    00150           ElementInSet elmt,
    00151           ElementInSet req,
    00152           OptionalCRLF opt
    00153         ) { name = nam; attr= att; inElement = elmt; reqElement = req; crlf = opt; }
    00154         virtual void Output(PHTML & html) const;
    00155         virtual void AddAttr(PHTML & html) const;
    00156       private:
    00157         const char * name;
    00158         const char * attr;
    00159         ElementInSet inElement;
    00160         ElementInSet reqElement;
    00161         OptionalCRLF crlf;
    00162       friend ostream & operator<<(ostream & strm, const Element & elmt)
    00163         { elmt.Output((PHTML&)strm); return strm; }
    00164     };
    00165
    00166     class HTML : public Element {
    00167       public:
    00168         HTML(const char * attr = NULL);
    00169         virtual ~HTML() {}
    00170     };
    00171
    00172     class Head : public Element {
    00173       public:
    00174         Head();
    00175         virtual ~Head() {}
    00176       protected:
    00177         virtual void Output(PHTML & html) const;
    00178     };
    00179
    00180     class Body : public Element {
    00181       public:
    00182         Body(const char * attr = NULL);
    00183         virtual ~Body() {}
    00184       protected:
    00185         virtual void Output(PHTML & html) const;
    00186     };
    00187
    00188     class Title : public Element {
    00189       public:
    00190         Title();
    00191         Title(const char * titleCStr);
    00192         Title(const PString & titleStr);
    00193         virtual ~Title() {}
    00194       protected:
    00195         virtual void Output(PHTML & html) const;
    00196       private:
    00197         const char * titleString;
    00198     };
    00199
    00200     class Banner : public Element {
    00201       public:
    00202         Banner(const char * attr = NULL);
    00203         virtual ~Banner() {}
    00204     };
    00205
    00206     class Division : public Element {
    00207       public:
    00208         Division(const char * attr = NULL);
    00209         virtual ~Division() {}
    00210     };
    00211
    00212     class Heading : public Element {
    00213       public:
    00214         Heading(int number,
    00215                 int sequence = 0,
    00216                 int skip = 0,
    00217                 const char * attr = NULL);
    00218         Heading(int number,
    00219                 const char * image,
    00220                 int sequence = 0,
    00221                 int skip = 0,
    00222                 const char * attr = NULL);
    00223         Heading(int number,
    00224                 const PString & imageStr,
    00225                 int sequence = 0,
    00226                 int skip = 0,
    00227                 const char * attr = NULL);
    00228         virtual ~Heading() {}
    00229       protected:
    00230         virtual void AddAttr(PHTML & html) const;
    00231       private:
    00232         int num;
    00233         const char * srcString;
    00234         int seqNum, skipSeq;
    00235     };
    00236
    00237     class BreakLine : public Element {
    00238       public:
    00239         BreakLine(const char * attr = NULL);
    00240         virtual ~BreakLine() {}
    00241     };
    00242
    00243     class Paragraph : public Element {
    00244       public:
    00245         Paragraph(const char * attr = NULL);
    00246         virtual ~Paragraph() {}
    00247     };
    00248
    00249     class PreFormat : public Element {
    00250       public:
    00251         PreFormat(int widthInChars = 0,
    00252                   const char * attr = NULL);
    00253         virtual ~PreFormat() {}
    00254       protected:
    00255         virtual void AddAttr(PHTML & html) const;
    00256       private:
    00257         int width;
    00258     };
    00259
    00260     class HotLink : public Element {
    00261       public:
    00262         HotLink(const char * href = NULL, const char * attr = NULL);
    00263         virtual ~HotLink() {}
    00264       protected:
    00265         virtual void AddAttr(PHTML & html) const;
    00266       private:
    00267         const char * hrefString;
    00268     };
    00269
    00270     class Target : public Element {
    00271       public:
    00272         Target(const char * name = NULL, const char * attr = NULL);
    00273         virtual ~Target() {}
    00274       protected:
    00275         virtual void AddAttr(PHTML & html) const;
    00276       private:
    00277         const char * nameString;
    00278     };
    00279
    00280     class ImageElement : public Element {
    00281       protected:
    00282         ImageElement(const char * nam,
    00283                      const char * attr,
    00284                      ElementInSet elmt,
    00285                      ElementInSet req,
    00286                      OptionalCRLF opt,
    00287                      const char * image);
    00288         virtual ~ImageElement() {}
    00289         virtual void AddAttr(PHTML & html) const;
    00290         const char * srcString;
    00291     };
    00292
    00293     class Image : public ImageElement {
    00294       public:
    00295         Image(const char * src,
    00296               int width = 0,
    00297               int height = 0,
    00298               const char * attr = NULL);
    00299         Image(const char * src,
    00300               const char * alt,
    00301               int width = 0,
    00302               int height = 0,
    00303               const char * attr = NULL);
    00304         virtual ~Image() {}
    00305       protected:
    00306         virtual void AddAttr(PHTML & html) const;
    00307       private:
    00308         const char * altString;
    00309         int width, height;
    00310     };
    00311
    00312     class HRule : public ImageElement {
    00313       public:
    00314         HRule(const char * image = NULL, const char * attr = NULL);
    00315         virtual ~HRule() {}
    00316     };
    00317
    00318     class Note : public ImageElement {
    00319       public:
    00320         Note(const char * image = NULL, const char * attr = NULL);
    00321         virtual ~Note() {}
    00322     };
    00323
    00324     class Address : public Element {
    00325       public:
    00326         Address(const char * attr = NULL);
    00327         virtual ~Address() {}
    00328     };
    00329
    00330     class BlockQuote : public Element {
    00331       public:
    00332         BlockQuote(const char * attr = NULL);
    00333         virtual ~BlockQuote() {}
    00334     };
    00335
    00336     class Credit : public Element {
    00337       public:
    00338         Credit(const char * attr = NULL);
    00339         virtual ~Credit() {}
    00340     };
    00341
    00342     class SetTab : public Element {
    00343       public:
    00344         SetTab(const char * id, const char * attr = NULL);
    00345         virtual ~SetTab() {}
    00346       protected:
    00347         virtual void AddAttr(PHTML & html) const;
    00348       private:
    00349         const char * ident;
    00350     };
    00351
    00352     class Tab : public Element {
    00353       public:
    00354         Tab(int indent, const char * attr = NULL);
    00355         Tab(const char * id, const char * attr = NULL);
    00356         virtual ~Tab() {}
    00357       protected:
    00358         virtual void AddAttr(PHTML & html) const;
    00359       private:
    00360         const char * ident;
    00361         int indentSize;
    00362     };
    00363
    00364
    00365     class Bold : public Element {
    00366       public: Bold() : Element("B", NULL, InBold, InBody, NoCRLF) { }
    00367       virtual ~Bold() {}
    00368     };
    00369     class Italic : public Element {
    00370       public:
    00371         Italic()
    00372           : Element("I", NULL, InItalic, InBody, NoCRLF) { }
    00373         virtual ~Italic() {}
    00374     };
    00375     class TeleType : public Element {
    00376       public:
    00377         TeleType()
    00378           : Element("TT", NULL, InTeleType, InBody, NoCRLF) { }
    00379         virtual ~TeleType() {}
    00380     };
    00381     class Underline : public Element {
    00382       public:
    00383         Underline()
    00384           : Element("U", NULL, InUnderline, InBody, NoCRLF) { }
    00385         virtual ~Underline() {}
    00386     };
    00387     class StrikeThrough : public Element {
    00388       public:
    00389         StrikeThrough()
    00390           : Element("S", NULL, InStrikeThrough, InBody, NoCRLF) { }
    00391         virtual ~StrikeThrough() {}
    00392     };
    00393     class Big : public Element {
    00394       public:
    00395         Big()
    00396           : Element("BIG", NULL, InBig, InBody, NoCRLF) { }
    00397         virtual ~Big() {}
    00398     };
    00399     class Small : public Element {
    00400       public:
    00401         Small()
    00402           : Element("SMALL", NULL, InSmall, InBody, NoCRLF) { }
    00403         virtual ~Small() {}
    00404     };
    00405     class Subscript : public Element {
    00406       public:
    00407         Subscript()
    00408           : Element("SUB", NULL, InSubscript, InBody, NoCRLF) { }
    00409         virtual ~Subscript() {}
    00410     };
    00411     class Superscript : public Element {
    00412       public:
    00413         Superscript()
    00414           : Element("SUP", NULL, InSuperscript, InBody, NoCRLF) { }
    00415         virtual ~Superscript() {}
    00416     };
    00417     class Emphasis : public Element {
    00418       public:
    00419         Emphasis()
    00420           : Element("EM", NULL, InEmphasis, InBody, NoCRLF) { }
    00421         virtual ~Emphasis() {}
    00422     };
    00423     class Cite : public Element {
    00424       public:
    00425         Cite()
    00426           : Element("CITE", NULL, InCite, InBody, NoCRLF) { }
    00427       virtual ~Cite() {}
    00428     };
    00429     class Strong : public Element {
    00430       public:
    00431         Strong()
    00432           : Element("STRONG", NULL, InStrong, InBody, NoCRLF) { }
    00433         virtual ~Strong() {}
    00434     };
    00435     class Code : public Element {
    00436       public:
    00437         Code()
    00438           : Element("CODE", NULL, InCode, InBody, NoCRLF) { }
    00439       virtual ~Code() {}
    00440     };
    00441     class Sample : public Element {
    00442       public:
    00443         Sample()
    00444           : Element("SAMP", NULL, InSample, InBody, NoCRLF) { }
    00445       virtual ~Sample() {}
    00446     };
    00447     class Keyboard : public Element {
    00448       public:
    00449         Keyboard()
    00450           : Element("KBD", NULL, InKeyboard, InBody, NoCRLF) { }
    00451         virtual ~Keyboard() {}
    00452     };
    00453     class Variable : public Element {
    00454       public:
    00455         Variable()
    00456           : Element("VAR", NULL, InVariable, InBody, NoCRLF) { }
    00457         virtual ~Variable() {}
    00458     };
    00459     class Definition : public Element {
    00460       public:
    00461         Definition()
    00462           : Element("DFN", NULL, InDefinition, InBody, NoCRLF) { }
    00463         virtual ~Definition() {}
    00464     };
    00465     class Quote : public Element {
    00466       public:
    00467         Quote()
    00468           : Element("Q", NULL, InQuote, InBody, NoCRLF) { }
    00469         virtual ~Quote() {}
    00470     };
    00471     class Author : public Element {
    00472       public:
    00473         Author()
    00474           : Element("AU", NULL, InAuthor, InBody, NoCRLF) { }
    00475         virtual ~Author() {}
    00476     };
    00477     class Person : public Element {
    00478       public:
    00479         Person()
    00480           : Element("PERSON", NULL, InPerson, InBody, NoCRLF) { }
    00481         virtual ~Person() {}
    00482     };
    00483     class Acronym : public Element {
    00484       public:
    00485         Acronym()
    00486           : Element("ACRONYM", NULL, InAcronym, InBody, NoCRLF) { }
    00487         virtual ~Acronym() {}
    00488     };
    00489     class Abbrev : public Element {
    00490       public:
    00491         Abbrev()
    00492           : Element("ABBREV", NULL, InAbbrev, InBody, NoCRLF) { }
    00493         virtual ~Abbrev() {}
    00494     };
    00495     class InsertedText : public Element {
    00496       public:
    00497         InsertedText()
    00498           : Element("INS", NULL, InInsertedText, InBody, NoCRLF) { }
    00499         virtual ~InsertedText() {}
    00500     };
    00501     class DeletedText : public Element {
    00502       public:
    00503         DeletedText()
    00504           : Element("DEL", NULL, InDeletedText, InBody, NoCRLF) { }
    00505       public:
    00506         virtual ~DeletedText() {}
    00507     };
    00508
    00509     class SimpleList : public Element {
    00510       public:
    00511         SimpleList(const char * attr = NULL);
    00512         virtual ~SimpleList() {}
    00513       protected:
    00514         virtual void AddAttr(PHTML & html) const;
    00515     };
    00516
    00517     class BulletList : public Element {
    00518       public:
    00519         BulletList(const char * attr = NULL);
    00520         virtual ~BulletList() {}
    00521     };
    00522
    00523     class OrderedList : public Element {
    00524       public:
    00525         OrderedList(int seqNum = 0, const char * attr = NULL);
    00526         virtual ~OrderedList() {}
    00527       protected:
    00528         virtual void AddAttr(PHTML & html) const;
    00529       private:
    00530         int sequenceNum;
    00531     };
    00532
    00533     class DefinitionList : public Element {
    00534       public:
    00535         DefinitionList(const char * attr = NULL);
    00536         virtual ~DefinitionList() {}
    00537     };
    00538
    00539     class ListHeading : public Element {
    00540       public:
    00541         ListHeading(const char * attr = NULL);
    00542         virtual ~ListHeading() {}
    00543     };
    00544
    00545     class ListItem : public Element {
    00546       public:
    00547         ListItem(int skip = 0, const char * attr = NULL);
    00548         virtual ~ListItem() {}
    00549       protected:
    00550         virtual void AddAttr(PHTML & html) const;
    00551       private:
    00552         int skipSeq;
    00553     };
    00554
    00555     class DefinitionTerm : public Element {
    00556       public:
    00557         DefinitionTerm(const char * attr = NULL);
    00558         virtual ~DefinitionTerm() {}
    00559       protected:
    00560         virtual void Output(PHTML & html) const;
    00561     };
    00562
    00563     class DefinitionItem : public Element {
    00564       public:
    00565         DefinitionItem(const char * attr = NULL);
    00566         virtual ~DefinitionItem() {}
    00567       protected:
    00568         virtual void Output(PHTML & html) const;
    00569     };
    00570
    00571
    00572     enum BorderCodes {
    00573       NoBorder,
    00574       Border
    00575     };
    00576     class TableStart : public Element {
    00577       public:
    00578         TableStart(const char * attr = NULL);
    00579         TableStart(BorderCodes border, const char * attr = NULL);
    00580         virtual ~TableStart() {}
    00581       protected:
    00582         virtual void Output(PHTML & html) const;
    00583         virtual void AddAttr(PHTML & html) const;
    00584       private:
    00585         PBoolean borderFlag;
    00586     };
    00587     friend class TableStart;
    00588
    00589     class TableEnd : public Element {
    00590       public:
    00591         TableEnd();
    00592         virtual ~TableEnd() {}
    00593       protected:
    00594         virtual void Output(PHTML & html) const;
    00595     };
    00596     friend class TableEnd;
    00597
    00598     class TableRow : public Element {
    00599       public:
    00600         TableRow(const char * attr = NULL);
    00601         virtual ~TableRow() {}
    00602     };
    00603
    00604     class TableHeader : public Element {
    00605       public:
    00606         TableHeader(const char * attr = NULL);
    00607         virtual ~TableHeader() {}
    00608     };
    00609
    00610     class TableData : public Element {
    00611       public:
    00612         TableData(const char * attr = NULL);
    00613         virtual ~TableData() {}
    00614     };
    00615
    00616
    00617     class Form : public Element {
    00618       public:
    00619         Form(
    00620           const char * method = NULL,
    00621           const char * action = NULL,
    00622           const char * encoding = NULL,
    00623           const char * script = NULL
    00624         );
    00625         virtual ~Form() {}
    00626       protected:
    00627         virtual void AddAttr(PHTML & html) const;
    00628       private:
    00629         const char * methodString;
    00630         const char * actionString;
    00631         const char * mimeTypeString;
    00632         const char * scriptString;
    00633     };
    00634
    00635     enum DisableCodes {
    00636       Enabled,
    00637       Disabled
    00638     };
    00639     class FieldElement : public Element {
    00640       protected:
    00641         FieldElement(
    00642           const char * nam,
    00643           const char * attr,
    00644           ElementInSet elmt,
    00645           OptionalCRLF opt,
    00646           DisableCodes disabled
    00647         );
    00648         virtual ~FieldElement() {}
    00649         virtual void AddAttr(PHTML & html) const;
    00650       private:
    00651         PBoolean disabledFlag;
    00652     };
    00653
    00654     class Select : public FieldElement {
    00655       public:
    00656         Select(
    00657           const char * fname = NULL,
    00658           const char * attr = NULL
    00659         );
    00660         Select(
    00661           const char * fname,
    00662           DisableCodes disabled,
    00663           const char * attr = NULL
    00664         );
    00665         virtual ~Select() {}
    00666       protected:
    00667         virtual void AddAttr(PHTML & html) const;
    00668       private:
    00669         const char * nameString;
    00670     };
    00671
    00672     enum SelectionCodes {
    00673       NotSelected,
    00674       Selected
    00675     };
    00676     class Option : public FieldElement {
    00677       public:
    00678         Option(
    00679           const char * attr = NULL
    00680         );
    00681         Option(
    00682           SelectionCodes select,
    00683           const char * attr = NULL
    00684         );
    00685         Option(
    00686           DisableCodes disabled,
    00687           const char * attr = NULL
    00688         );
    00689         Option(
    00690           SelectionCodes select,
    00691           DisableCodes disabled,
    00692           const char * attr = NULL
    00693         );
    00694         virtual ~Option() {}
    00695       protected:
    00696         virtual void AddAttr(PHTML & html) const;
    00697       private:
    00698         PBoolean selectedFlag;
    00699     };
    00700
    00701     class FormField : public FieldElement {
    00702       protected:
    00703         FormField(
    00704           const char * nam,
    00705           const char * attr,
    00706           ElementInSet elmt,
    00707           OptionalCRLF opt,
    00708           DisableCodes disabled,
    00709           const char * fname
    00710         );
    00711         virtual ~FormField() {}
    00712         virtual void AddAttr(PHTML & html) const;
    00713       private:
    00714         const char * nameString;
    00715     };
    00716
    00717     class TextArea : public FormField {
    00718       public:
    00719         TextArea(
    00720           const char * fname,
    00721           DisableCodes disabled = Enabled,
    00722           const char * attr = NULL
    00723         );
    00724         TextArea(
    00725           const char * fname,
    00726           int rows, int cols,
    00727           DisableCodes disabled = Enabled,
    00728           const char * attr = NULL
    00729         );
    00730         virtual ~TextArea() {}
    00731       protected:
    00732         virtual void AddAttr(PHTML & html) const;
    00733       private:
    00734         int numRows, numCols;
    00735     };
    00736
    00737     class InputField : public FormField {
    00738       protected:
    00739         InputField(
    00740           const char * type,
    00741           const char * fname,
    00742           DisableCodes disabled,
    00743           const char * attr
    00744         );
    00745         virtual ~InputField() {}
    00746         virtual void AddAttr(PHTML & html) const;
    00747       private:
    00748         const char * typeString;
    00749     };
    00750
    00751     class HiddenField : public InputField {
    00752       public:
    00753         HiddenField(
    00754           const char * fname,
    00755           const char * value,
    00756           const char * attr = NULL
    00757         );
    00758         virtual ~HiddenField() {}
    00759       protected:
    00760         virtual void AddAttr(PHTML & html) const;
    00761       private:
    00762         const char * valueString;
    00763     };
    00764
    00765     class InputText : public InputField {
    00766       public:
    00767         InputText(
    00768           const char * fname,
    00769           int size,
    00770           const char * init = NULL,
    00771           const char * attr = NULL
    00772         );
    00773         InputText(
    00774           const char * fname,
    00775           int size,
    00776           DisableCodes disabled,
    00777           const char * attr = NULL
    00778         );
    00779         InputText(
    00780           const char * fname,
    00781           int size,
    00782           int maxLength,
    00783           DisableCodes disabled = Enabled,
    00784           const char * attr = NULL
    00785         );
    00786         InputText(
    00787           const char * fname,
    00788           int size,
    00789           const char * init,
    00790           int maxLength,
    00791           DisableCodes disabled = Enabled,
    00792           const char * attr = NULL
    00793         );
    00794         virtual ~InputText() {}
    00795       protected:
    00796         InputText(
    00797           const char * type,
    00798           const char * fname,
    00799           int size,
    00800           const char * init,
    00801           int maxLength,
    00802           DisableCodes disabled,
    00803           const char * attr
    00804         );
    00805         virtual void AddAttr(PHTML & html) const;
    00806       private:
    00807         const char * value;
    00808         int width, length;
    00809     };
    00810
    00811     class InputPassword : public InputText {
    00812       public:
    00813         InputPassword(
    00814           const char * fname,
    00815           int size,
    00816           const char * init = NULL,
    00817           const char * attr = NULL
    00818         );
    00819         InputPassword(
    00820           const char * fname,
    00821           int size,
    00822           DisableCodes disabled,
    00823           const char * attr = NULL
    00824         );
    00825         InputPassword(
    00826           const char * fname,
    00827           int size,
    00828           int maxLength,
    00829           DisableCodes disabled = Enabled,
    00830           const char * attr = NULL
    00831         );
    00832         InputPassword(
    00833           const char * fname,
    00834           int size,
    00835           const char * init,
    00836           int maxLength,
    00837           DisableCodes disabled = Enabled,
    00838           const char * attr = NULL
    00839         );
    00840         virtual ~InputPassword() {}
    00841     };
    00842
    00843     enum CheckedCodes {
    00844       UnChecked,
    00845       Checked
    00846     };
    00847     class RadioButton : public InputField {
    00848       public:
    00849         RadioButton(
    00850           const char * fname,
    00851           const char * value,
    00852           const char * attr = NULL
    00853         );
    00854         RadioButton(
    00855           const char * fname,
    00856           const char * value,
    00857           DisableCodes disabled,
    00858           const char * attr = NULL
    00859         );
    00860         RadioButton(
    00861           const char * fname,
    00862           const char * value,
    00863           CheckedCodes check,
    00864           DisableCodes disabled = Enabled,
    00865           const char * attr = NULL
    00866         );
    00867         virtual ~RadioButton() {}
    00868       protected:
    00869         RadioButton(
    00870           const char * type,
    00871           const char * fname,
    00872           const char * value,
    00873           CheckedCodes check,
    00874           DisableCodes disabled,
    00875           const char * attr
    00876         );
    00877         virtual void AddAttr(PHTML & html) const;
    00878       private:
    00879         const char * valueString;
    00880         PBoolean checkedFlag;
    00881     };
    00882
    00883     class CheckBox : public RadioButton {
    00884       public:
    00885         CheckBox(
    00886           const char * fname,
    00887           const char * attr = NULL
    00888         );
    00889         CheckBox(
    00890           const char * fname,
    00891           DisableCodes disabled,
    00892           const char * attr = NULL
    00893         );
    00894         CheckBox(
    00895           const char * fname,
    00896           CheckedCodes check,
    00897           DisableCodes disabled = Enabled,
    00898           const char * attr = NULL
    00899         );
    00900         virtual ~CheckBox() {}
    00901     };
    00902
    00903
    00904     class InputNumber : public InputField {
    00905       public:
    00906         InputNumber(
    00907           const char * fname,
    00908           int min, int max,
    00909           int value = 0,
    00910           DisableCodes disabled = Enabled,
    00911           const char * attr = NULL
    00912         );
    00913         virtual ~InputNumber() {}
    00914       protected:
    00915         InputNumber(
    00916           const char * type,
    00917           const char * fname,
    00918           int min, int max,
    00919           int value,
    00920           DisableCodes disabled,
    00921           const char * attr
    00922         );
    00923         virtual void AddAttr(PHTML & html) const;
    00924       private:
    00925         void Construct(int min, int max, int value);
    00926         int minValue, maxValue, initValue;
    00927     };
    00928
    00929     class InputRange : public InputNumber {
    00930       public:
    00931         InputRange(
    00932           const char * fname,
    00933           int min, int max,
    00934           int value = 0,
    00935           DisableCodes disabled = Enabled,
    00936           const char * attr = NULL
    00937         );
    00938         virtual ~InputRange() {}
    00939     };
    00940
    00941     class InputFile : public InputField {
    00942       public:
    00943         InputFile(
    00944           const char * fname,
    00945           const char * accept = NULL,
    00946           DisableCodes disabled = Enabled,
    00947           const char * attr = NULL
    00948         );
    00949         virtual ~InputFile() {}
    00950       protected:
    00951         virtual void AddAttr(PHTML & html) const;
    00952       private:
    00953         const char * acceptString;
    00954     };
    00955
    00956     class InputImage : public InputField {
    00957       public:
    00958         InputImage(
    00959           const char * fname,
    00960           const char * src = NULL,
    00961           DisableCodes disabled = Enabled,
    00962           const char * attr = NULL
    00963         );
    00964         virtual ~InputImage() {}
    00965       protected:
    00966         InputImage(
    00967           const char * type,
    00968           const char * fname,
    00969           const char * src,
    00970           DisableCodes disabled,
    00971           const char * attr
    00972         );
    00973         virtual void AddAttr(PHTML & html) const;
    00974       private:
    00975         const char * srcString;
    00976     };
    00977
    00978     class InputScribble : public InputImage {
    00979       public:
    00980         InputScribble(
    00981           const char * fname,
    00982           const char * src = NULL,
    00983           DisableCodes disabled = Enabled,
    00984           const char * attr = NULL
    00985         );
    00986         virtual ~InputScribble() {}
    00987     };
    00988
    00989     class ResetButton : public InputImage {
    00990       public:
    00991         ResetButton(
    00992           const char * title,
    00993           const char * fname = NULL,
    00994           const char * src = NULL,
    00995           DisableCodes disabled = Enabled,
    00996           const char * attr = NULL
    00997         );
    00998         virtual ~ResetButton() {}
    00999       protected:
    01000         ResetButton(
    01001           const char * type,
    01002           const char * title,
    01003           const char * fname = NULL,
    01004           const char * src = NULL,
    01005           DisableCodes disabled = Enabled,
    01006           const char * attr = NULL
    01007         );
    01008         virtual void AddAttr(PHTML & html) const;
    01009       private:
    01010         const char * titleString;
    01011     };
    01012
    01013     class SubmitButton : public ResetButton {
    01014       public:
    01015         SubmitButton(
    01016           const char * title,
    01017           const char * fname = NULL,
    01018           const char * src = NULL,
    01019           DisableCodes disabled = Enabled,
    01020           const char * attr = NULL
    01021         );
    01022         virtual ~SubmitButton() {}
    01023     };
    01024
    01025
    01026   protected:
    01027     virtual void AssignContents(const PContainer & c);
    01028
    01029   private:
    01030     ElementInSet initialElement;
    01031     BYTE elementSet[NumElementsInSet/8+1];
    01032     PINDEX tableNestLevel;
    01033 };
    01034
    01035
    01036 #endif // PTLIB_HTML_H
    01037
    01038
    01039 // End Of File ///////////////////////////////////////////////////////////////