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  * $Log: html.h,v $
00027  * Revision 1.27  2005/11/30 12:47:37  csoutheren
00028  * Removed tabs, reformatted some code, and changed tags for Doxygen
00029  *
00030  * Revision 1.26  2005/10/30 23:25:51  csoutheren
00031  * Fixed formatting
00032  * Removed throw() declarations (PWLib does not do exceptions)
00033  * Removed duplicate destructor declarations and definitions
00034  *
00035  * Revision 1.25  2005/10/30 19:41:53  dominance
00036  * fixed most of the warnings occuring during compilation
00037  *
00038  * Revision 1.24  2005/03/19 02:52:53  csoutheren
00039  * Fix warnings from gcc 4.1-20050313 shapshot
00040  *
00041  * Revision 1.23  2002/11/06 22:47:23  robertj
00042  * Fixed header comment (copyright etc)
00043  *
00044  * Revision 1.22  2002/09/16 01:08:59  robertj
00045  * Added #define so can select if #pragma interface/implementation is used on
00046  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00047  *
00048  * Revision 1.21  2001/02/13 04:39:08  robertj
00049  * Fixed problem with operator= in container classes. Some containers will
00050  *   break unless the copy is virtual (eg PStringStream's buffer pointers) so
00051  *   needed to add a new AssignContents() function to all containers.
00052  *
00053  * Revision 1.20  1999/03/09 08:01:46  robertj
00054  * Changed comments for doc++ support (more to come).
00055  *
00056  * Revision 1.19  1999/02/16 08:07:10  robertj
00057  * MSVC 6.0 compatibility changes.
00058  *
00059  * Revision 1.18  1998/09/23 06:19:27  robertj
00060  * Added open source copyright license.
00061  *
00062  * Revision 1.17  1997/07/08 13:15:31  robertj
00063  * DLL support.
00064  *
00065  * Revision 1.16  1997/06/16 13:18:02  robertj
00066  * Set Is() function to be const as it should have been.
00067  *
00068  * Revision 1.15  1996/08/17 10:00:18  robertj
00069  * Changes for Windows DLL support.
00070  *
00071  * Revision 1.14  1996/06/28 13:08:41  robertj
00072  * Changed PHTML class so can create html fragments.
00073  * Fixed nesting problem in tables.
00074  *
00075  * Revision 1.13  1996/06/01 04:18:40  robertj
00076  * Fixed bug in RadioButton, having 2 VALUE fields
00077  *
00078  * Revision 1.12  1996/04/14 02:52:02  robertj
00079  * Added hidden fields to HTML.
00080  *
00081  * Revision 1.11  1996/03/12 11:30:00  robertj
00082  * Fixed resetting of HTML output using operator=.
00083  *
00084  * Revision 1.10  1996/03/10 13:14:53  robertj
00085  * Simplified some of the classes and added catch all string for attributes.
00086  *
00087  * Revision 1.9  1996/03/03 07:36:44  robertj
00088  * Added missing public's to standard character attribute classes.
00089  *
00090  * Revision 1.8  1996/02/25 11:14:19  robertj
00091  * Radio button support for forms.
00092  *
00093  * Revision 1.7  1996/02/19 13:18:25  robertj
00094  * Removed MSC_VER test as now completely removed from WIN16 library.
00095  *
00096  * Revision 1.6  1996/02/08 11:50:38  robertj
00097  * More implementation.
00098  *
00099  * Revision 1.5  1996/02/03 11:01:25  robertj
00100  * Further implementation.
00101  *
00102  * Revision 1.4  1996/01/28 14:15:56  robertj
00103  * More comments.
00104  *
00105  * Revision 1.3  1996/01/28 02:45:38  robertj
00106  * Further implementation.
00107  *
00108  * Revision 1.2  1996/01/26 02:24:24  robertj
00109  * Further implemetation.
00110  *
00111  * Revision 1.1  1996/01/24 23:45:37  robertj
00112  * Initial revision
00113  *
00114  */
00115 
00116 #ifndef _PHTML
00117 #define _PHTML
00118 
00119 #ifdef P_USE_PRAGMA
00120 #pragma interface
00121 #endif
00122 
00123 
00124 
00126 // PHTML
00127 
00134 class PHTML : public PStringStream
00135 {
00136   PCLASSINFO(PHTML, PStringStream)
00137 
00138   public:
00139     enum ElementInSet {
00140       InHTML,
00141       InHead,
00142       InBody,
00143       InTitle,
00144       InHeading,
00145       InDivision,
00146       InPreFormat,
00147       InAnchor,
00148       InNote,
00149       InAddress,
00150       InBlockQuote,
00151       InCredit,
00152       InBold,
00153       InItalic,
00154       InTeleType,
00155       InUnderline,
00156       InStrikeThrough,
00157       InBig,
00158       InSmall,
00159       InSubscript,
00160       InSuperscript,
00161       InEmphasis,
00162       InCite,
00163       InStrong,
00164       InCode,
00165       InSample,
00166       InKeyboard,
00167       InVariable,
00168       InDefinition,
00169       InQuote,
00170       InAuthor,
00171       InPerson,
00172       InAcronym,
00173       InAbbrev,
00174       InInsertedText,
00175       InDeletedText,
00176       InList,
00177       InListHeading,
00178       InDefinitionTerm,
00179       InTable,
00180       InForm,
00181       InSelect,
00182       InTextArea,
00183       NumElementsInSet
00184     };
00185 
00190     PHTML(
00191       ElementInSet initialState = NumElementsInSet
00192     );
00193     PHTML(
00194       const char * cstr     
00195     );
00196     PHTML(
00197       const PString & str   
00198     );
00199 
00200     ~PHTML();
00201 
00206     PHTML & operator=(
00207       const PHTML & html     
00208     ) { AssignContents(html); return *this; }
00209     PHTML & operator=(
00210       const PString & str    
00211     ) { AssignContents(str); return *this; }
00212     PHTML & operator=(
00213       const char * cstr    
00214     ) { AssignContents(PString(cstr)); return *this; }
00215     PHTML & operator=(
00216       char ch    
00217     ) { AssignContents(PString(ch)); return *this; }
00218 
00219 
00220   // New functions for class.
00221     BOOL Is(ElementInSet elmt) const;
00222     void Set(ElementInSet elmt);
00223     void Clr(ElementInSet elmt);
00224     void Toggle(ElementInSet elmt);
00225 
00226 
00227     class Element {
00228       public: 
00229         virtual ~Element() {}
00230       protected:
00231         enum OptionalCRLF { NoCRLF, OpenCRLF, CloseCRLF, BothCRLF };
00232         Element(
00233           const char * nam,
00234           const char * att,
00235           ElementInSet elmt,
00236           ElementInSet req,
00237           OptionalCRLF opt
00238         ) { name = nam; attr= att; inElement = elmt; reqElement = req; crlf = opt; }
00239         virtual void Output(PHTML & html) const;
00240         virtual void AddAttr(PHTML & html) const;
00241       private:
00242         const char * name;
00243         const char * attr;
00244         ElementInSet inElement;
00245         ElementInSet reqElement;
00246         OptionalCRLF crlf;
00247       friend ostream & operator<<(ostream & strm, const Element & elmt)
00248         { elmt.Output((PHTML&)strm); return strm; }
00249     };
00250 
00251     class HTML : public Element {
00252       public:
00253         HTML(const char * attr = NULL);
00254         virtual ~HTML() {}
00255     };
00256 
00257     class Head : public Element {
00258       public:
00259         Head();
00260         virtual ~Head() {}
00261       protected:
00262         virtual void Output(PHTML & html) const;
00263     };
00264 
00265     class Body : public Element {
00266       public:
00267         Body(const char * attr = NULL);
00268         virtual ~Body() {}
00269       protected:
00270         virtual void Output(PHTML & html) const;
00271     };
00272 
00273     class Title : public Element {
00274       public:
00275         Title();
00276         Title(const char * titleCStr);
00277         Title(const PString & titleStr);
00278         virtual ~Title() {}
00279       protected:
00280         virtual void Output(PHTML & html) const;
00281       private:
00282         const char * titleString;
00283     };
00284 
00285     class Banner : public Element {
00286       public:
00287         Banner(const char * attr = NULL);
00288         virtual ~Banner() {}
00289     };
00290 
00291     class Division : public Element {
00292       public:
00293         Division(const char * attr = NULL);
00294         virtual ~Division() {}
00295     };
00296 
00297     class Heading : public Element {
00298       public:
00299         Heading(int number,
00300                 int sequence = 0,
00301                 int skip = 0,
00302                 const char * attr = NULL);
00303         Heading(int number,
00304                 const char * image,
00305                 int sequence = 0,
00306                 int skip = 0,
00307                 const char * attr = NULL);
00308         Heading(int number,
00309                 const PString & imageStr,
00310                 int sequence = 0,
00311                 int skip = 0,
00312                 const char * attr = NULL);
00313         virtual ~Heading() {}
00314       protected:
00315         virtual void AddAttr(PHTML & html) const;
00316       private:
00317         int num;
00318         const char * srcString;
00319         int seqNum, skipSeq;
00320     };
00321 
00322     class BreakLine : public Element {
00323       public:
00324         BreakLine(const char * attr = NULL);
00325         virtual ~BreakLine() {}
00326     };
00327 
00328     class Paragraph : public Element {
00329       public:
00330         Paragraph(const char * attr = NULL);
00331         virtual ~Paragraph() {}
00332     };
00333 
00334     class PreFormat : public Element {
00335       public:
00336         PreFormat(int widthInChars = 0,
00337                   const char * attr = NULL);
00338         virtual ~PreFormat() {}
00339       protected:
00340         virtual void AddAttr(PHTML & html) const;
00341       private:
00342         int width;
00343     };
00344 
00345     class HotLink : public Element {
00346       public:
00347         HotLink(const char * href = NULL, const char * attr = NULL);
00348         virtual ~HotLink() {}
00349       protected:
00350         virtual void AddAttr(PHTML & html) const;
00351       private:
00352         const char * hrefString;
00353     };
00354 
00355     class Target : public Element {
00356       public:
00357         Target(const char * name = NULL, const char * attr = NULL);
00358         virtual ~Target() {}
00359       protected:
00360         virtual void AddAttr(PHTML & html) const;
00361       private:
00362         const char * nameString;
00363     };
00364 
00365     class ImageElement : public Element {
00366       protected:
00367         ImageElement(const char * nam,
00368                      const char * attr,
00369                      ElementInSet elmt,
00370                      ElementInSet req,
00371                      OptionalCRLF opt,
00372                      const char * image);
00373         virtual ~ImageElement() {}
00374         virtual void AddAttr(PHTML & html) const;
00375         const char * srcString;
00376     };
00377 
00378     class Image : public ImageElement {
00379       public:
00380         Image(const char * src,
00381               int width = 0,
00382               int height = 0,
00383               const char * attr = NULL);
00384         Image(const char * src,
00385               const char * alt,
00386               int width = 0,
00387               int height = 0,
00388               const char * attr = NULL);
00389         virtual ~Image() {}
00390       protected:
00391         virtual void AddAttr(PHTML & html) const;
00392       private:
00393         const char * altString;
00394         int width, height;
00395     };
00396 
00397     class HRule : public ImageElement {
00398       public:
00399         HRule(const char * image = NULL, const char * attr = NULL);
00400         virtual ~HRule() {}
00401     };
00402 
00403     class Note : public ImageElement {
00404       public:
00405         Note(const char * image = NULL, const char * attr = NULL);
00406         virtual ~Note() {}
00407     };
00408 
00409     class Address : public Element {
00410       public:
00411         Address(const char * attr = NULL);
00412         virtual ~Address() {}
00413     };
00414 
00415     class BlockQuote : public Element {
00416       public:
00417         BlockQuote(const char * attr = NULL);
00418         virtual ~BlockQuote() {}
00419     };
00420 
00421     class Credit : public Element {
00422       public:
00423         Credit(const char * attr = NULL);
00424         virtual ~Credit() {}
00425     };
00426 
00427     class SetTab : public Element {
00428       public:
00429         SetTab(const char * id, const char * attr = NULL);
00430         virtual ~SetTab() {}
00431       protected:
00432         virtual void AddAttr(PHTML & html) const;
00433       private:
00434         const char * ident;
00435     };
00436 
00437     class Tab : public Element {
00438       public:
00439         Tab(int indent, const char * attr = NULL);
00440         Tab(const char * id, const char * attr = NULL);
00441         virtual ~Tab() {}
00442       protected:
00443         virtual void AddAttr(PHTML & html) const;
00444       private:
00445         const char * ident;
00446         int indentSize;
00447     };
00448 
00449 
00450     class Bold : public Element {
00451       public: Bold() : Element("B", NULL, InBold, InBody, NoCRLF) { }
00452       virtual ~Bold() {}
00453     };
00454     class Italic : public Element {
00455       public: 
00456         Italic() 
00457           : Element("I", NULL, InItalic, InBody, NoCRLF) { }
00458         virtual ~Italic() {}
00459     };
00460     class TeleType : public Element {
00461       public: 
00462         TeleType() 
00463           : Element("TT", NULL, InTeleType, InBody, NoCRLF) { }
00464         virtual ~TeleType() {}
00465     };
00466     class Underline : public Element {
00467       public: 
00468         Underline() 
00469           : Element("U", NULL, InUnderline, InBody, NoCRLF) { }
00470         virtual ~Underline() {}
00471     };
00472     class StrikeThrough : public Element {
00473       public: 
00474         StrikeThrough()
00475           : Element("S", NULL, InStrikeThrough, InBody, NoCRLF) { }
00476         virtual ~StrikeThrough() {}
00477     };
00478     class Big : public Element {
00479       public: 
00480         Big() 
00481           : Element("BIG", NULL, InBig, InBody, NoCRLF) { }
00482         virtual ~Big() {}
00483     };
00484     class Small : public Element {
00485       public: 
00486         Small() 
00487           : Element("SMALL", NULL, InSmall, InBody, NoCRLF) { }
00488         virtual ~Small() {}
00489     };
00490     class Subscript : public Element {
00491       public: 
00492         Subscript()
00493           : Element("SUB", NULL, InSubscript, InBody, NoCRLF) { }
00494         virtual ~Subscript() {}
00495     };
00496     class Superscript : public Element {
00497       public: 
00498         Superscript()
00499           : Element("SUP", NULL, InSuperscript, InBody, NoCRLF) { }
00500         virtual ~Superscript() {}
00501     };
00502     class Emphasis : public Element {
00503       public: 
00504         Emphasis() 
00505           : Element("EM", NULL, InEmphasis, InBody, NoCRLF) { }
00506         virtual ~Emphasis() {}
00507     };
00508     class Cite : public Element {
00509       public: 
00510         Cite() 
00511           : Element("CITE", NULL, InCite, InBody, NoCRLF) { }
00512       virtual ~Cite() {}
00513     };
00514     class Strong : public Element {
00515       public: 
00516         Strong() 
00517           : Element("STRONG", NULL, InStrong, InBody, NoCRLF) { }
00518         virtual ~Strong() {}
00519     };
00520     class Code : public Element {
00521       public: 
00522         Code() 
00523           : Element("CODE", NULL, InCode, InBody, NoCRLF) { }
00524       virtual ~Code() {}
00525     };
00526     class Sample : public Element {
00527       public: 
00528         Sample() 
00529           : Element("SAMP", NULL, InSample, InBody, NoCRLF) { }
00530       virtual ~Sample() {}
00531     };
00532     class Keyboard : public Element {
00533       public: 
00534         Keyboard() 
00535           : Element("KBD", NULL, InKeyboard, InBody, NoCRLF) { }
00536         virtual ~Keyboard() {}
00537     };
00538     class Variable : public Element {
00539       public: 
00540         Variable() 
00541           : Element("VAR", NULL, InVariable, InBody, NoCRLF) { }
00542         virtual ~Variable() {}
00543     };
00544     class Definition : public Element {
00545       public: 
00546         Definition()
00547           : Element("DFN", NULL, InDefinition, InBody, NoCRLF) { }
00548         virtual ~Definition() {}
00549     };
00550     class Quote : public Element {
00551       public: 
00552         Quote() 
00553           : Element("Q", NULL, InQuote, InBody, NoCRLF) { }
00554         virtual ~Quote() {}
00555     };
00556     class Author : public Element {
00557       public: 
00558         Author() 
00559           : Element("AU", NULL, InAuthor, InBody, NoCRLF) { }
00560         virtual ~Author() {}
00561     };
00562     class Person : public Element {
00563       public: 
00564         Person() 
00565           : Element("PERSON", NULL, InPerson, InBody, NoCRLF) { }
00566         virtual ~Person() {}
00567     };
00568     class Acronym : public Element {
00569       public: 
00570         Acronym()
00571           : Element("ACRONYM", NULL, InAcronym, InBody, NoCRLF) { }
00572         virtual ~Acronym() {}
00573     };
00574     class Abbrev : public Element {
00575       public: 
00576         Abbrev() 
00577           : Element("ABBREV", NULL, InAbbrev, InBody, NoCRLF) { }
00578         virtual ~Abbrev() {}
00579     };
00580     class InsertedText : public Element {
00581       public: 
00582         InsertedText()
00583           : Element("INS", NULL, InInsertedText, InBody, NoCRLF) { }
00584         virtual ~InsertedText() {}
00585     };
00586     class DeletedText : public Element {
00587       public: 
00588         DeletedText()
00589           : Element("DEL", NULL, InDeletedText, InBody, NoCRLF) { }
00590       public: 
00591         virtual ~DeletedText() {}
00592     };
00593 
00594     class SimpleList : public Element {
00595       public:
00596         SimpleList(const char * attr = NULL);
00597         virtual ~SimpleList() {}
00598       protected:
00599         virtual void AddAttr(PHTML & html) const;
00600     };
00601 
00602     class BulletList : public Element {
00603       public:
00604         BulletList(const char * attr = NULL);
00605         virtual ~BulletList() {}
00606     };
00607 
00608     class OrderedList : public Element {
00609       public:
00610         OrderedList(int seqNum = 0, const char * attr = NULL);
00611         virtual ~OrderedList() {}
00612       protected:
00613         virtual void AddAttr(PHTML & html) const;
00614       private:
00615         int sequenceNum;
00616     };
00617 
00618     class DefinitionList : public Element {
00619       public:
00620         DefinitionList(const char * attr = NULL);
00621         virtual ~DefinitionList() {}
00622     };
00623 
00624     class ListHeading : public Element {
00625       public:
00626         ListHeading(const char * attr = NULL);
00627         virtual ~ListHeading() {}
00628     };
00629 
00630     class ListItem : public Element {
00631       public:
00632         ListItem(int skip = 0, const char * attr = NULL);
00633         virtual ~ListItem() {}
00634       protected:
00635         virtual void AddAttr(PHTML & html) const;
00636       private:
00637         int skipSeq;
00638     };
00639 
00640     class DefinitionTerm : public Element {
00641       public:
00642         DefinitionTerm(const char * attr = NULL);
00643         virtual ~DefinitionTerm() {}
00644       protected:
00645         virtual void Output(PHTML & html) const;
00646     };
00647 
00648     class DefinitionItem : public Element {
00649       public:
00650         DefinitionItem(const char * attr = NULL);
00651         virtual ~DefinitionItem() {}
00652       protected:
00653         virtual void Output(PHTML & html) const;
00654     };
00655 
00656 
00657     enum BorderCodes {
00658       NoBorder,
00659       Border
00660     };
00661     class TableStart : public Element {
00662       public:
00663         TableStart(const char * attr = NULL);
00664         TableStart(BorderCodes border, const char * attr = NULL);
00665         virtual ~TableStart() {}
00666       protected:
00667         virtual void Output(PHTML & html) const;
00668         virtual void AddAttr(PHTML & html) const;
00669       private:
00670         BOOL borderFlag;
00671     };
00672     friend class TableStart;
00673 
00674     class TableEnd : public Element {
00675       public:
00676         TableEnd();
00677         virtual ~TableEnd() {}
00678       protected:
00679         virtual void Output(PHTML & html) const;
00680     };
00681     friend class TableEnd;
00682 
00683     class TableRow : public Element {
00684       public:
00685         TableRow(const char * attr = NULL);
00686         virtual ~TableRow() {}
00687     };
00688 
00689     class TableHeader : public Element {
00690       public:
00691         TableHeader(const char * attr = NULL);
00692         virtual ~TableHeader() {}
00693     };
00694 
00695     class TableData : public Element {
00696       public:
00697         TableData(const char * attr = NULL);
00698         virtual ~TableData() {}
00699     };
00700 
00701 
00702     class Form : public Element {
00703       public:
00704         Form(
00705           const char * method = NULL,
00706           const char * action = NULL,
00707           const char * encoding = NULL,
00708           const char * script = NULL
00709         );
00710         virtual ~Form() {}
00711       protected:
00712         virtual void AddAttr(PHTML & html) const;
00713       private:
00714         const char * methodString;
00715         const char * actionString;
00716         const char * mimeTypeString;
00717         const char * scriptString;
00718     };
00719 
00720     enum DisableCodes {
00721       Enabled,
00722       Disabled
00723     };
00724     class FieldElement : public Element {
00725       protected:
00726         FieldElement(
00727           const char * nam,
00728           const char * attr,
00729           ElementInSet elmt,
00730           OptionalCRLF opt,
00731           DisableCodes disabled
00732         );
00733         virtual ~FieldElement() {}
00734         virtual void AddAttr(PHTML & html) const;
00735       private:
00736         BOOL disabledFlag;
00737     };
00738 
00739     class Select : public FieldElement {
00740       public:
00741         Select(
00742           const char * fname = NULL,
00743           const char * attr = NULL
00744         );
00745         Select(
00746           const char * fname,
00747           DisableCodes disabled,
00748           const char * attr = NULL
00749         );
00750         virtual ~Select() {}
00751       protected:
00752         virtual void AddAttr(PHTML & html) const;
00753       private:
00754         const char * nameString;
00755     };
00756 
00757     enum SelectionCodes {
00758       NotSelected,
00759       Selected
00760     };
00761     class Option : public FieldElement {
00762       public:
00763         Option(
00764           const char * attr = NULL
00765         );
00766         Option(
00767           SelectionCodes select,
00768           const char * attr = NULL
00769         );
00770         Option(
00771           DisableCodes disabled,
00772           const char * attr = NULL
00773         );
00774         Option(
00775           SelectionCodes select,
00776           DisableCodes disabled,
00777           const char * attr = NULL
00778         );
00779         virtual ~Option() {}
00780       protected:
00781         virtual void AddAttr(PHTML & html) const;
00782       private:
00783         BOOL selectedFlag;
00784     };
00785 
00786     class FormField : public FieldElement {
00787       protected:
00788         FormField(
00789           const char * nam,
00790           const char * attr,
00791           ElementInSet elmt,
00792           OptionalCRLF opt,
00793           DisableCodes disabled,
00794           const char * fname
00795         );
00796         virtual ~FormField() {}
00797         virtual void AddAttr(PHTML & html) const;
00798       private:
00799         const char * nameString;
00800     };
00801 
00802     class TextArea : public FormField {
00803       public:
00804         TextArea(
00805           const char * fname,
00806           DisableCodes disabled = Enabled,
00807           const char * attr = NULL
00808         );
00809         TextArea(
00810           const char * fname,
00811           int rows, int cols,
00812           DisableCodes disabled = Enabled,
00813           const char * attr = NULL
00814         );
00815         virtual ~TextArea() {}
00816       protected:
00817         virtual void AddAttr(PHTML & html) const;
00818       private:
00819         int numRows, numCols;
00820     };
00821 
00822     class InputField : public FormField {
00823       protected:
00824         InputField(
00825           const char * type,
00826           const char * fname,
00827           DisableCodes disabled,
00828           const char * attr
00829         );
00830         virtual ~InputField() {}
00831         virtual void AddAttr(PHTML & html) const;
00832       private:
00833         const char * typeString;
00834     };
00835 
00836     class HiddenField : public InputField {
00837       public:
00838         HiddenField(
00839           const char * fname,
00840           const char * value,
00841           const char * attr = NULL
00842         );
00843         virtual ~HiddenField() {}
00844       protected:
00845         virtual void AddAttr(PHTML & html) const;
00846       private:
00847         const char * valueString;
00848     };
00849 
00850     class InputText : public InputField {
00851       public:
00852         InputText(
00853           const char * fname,
00854           int size,
00855           const char * init = NULL,
00856           const char * attr = NULL
00857         );
00858         InputText(
00859           const char * fname,
00860           int size,
00861           DisableCodes disabled,
00862           const char * attr = NULL
00863         );
00864         InputText(
00865           const char * fname,
00866           int size,
00867           int maxLength,
00868           DisableCodes disabled = Enabled,
00869           const char * attr = NULL
00870         );
00871         InputText(
00872           const char * fname,
00873           int size,
00874           const char * init,
00875           int maxLength,
00876           DisableCodes disabled = Enabled,
00877           const char * attr = NULL
00878         );
00879         virtual ~InputText() {}
00880       protected:
00881         InputText(
00882           const char * type,
00883           const char * fname,
00884           int size,
00885           const char * init,
00886           int maxLength,
00887           DisableCodes disabled,
00888           const char * attr
00889         );
00890         virtual void AddAttr(PHTML & html) const;
00891       private:
00892         const char * value;
00893         int width, length;
00894     };
00895 
00896     class InputPassword : public InputText {
00897       public:
00898         InputPassword(
00899           const char * fname,
00900           int size,
00901           const char * init = NULL,
00902           const char * attr = NULL
00903         );
00904         InputPassword(
00905           const char * fname,
00906           int size,
00907           DisableCodes disabled,
00908           const char * attr = NULL
00909         );
00910         InputPassword(
00911           const char * fname,
00912           int size,
00913           int maxLength,
00914           DisableCodes disabled = Enabled,
00915           const char * attr = NULL
00916         );
00917         InputPassword(
00918           const char * fname,
00919           int size,
00920           const char * init,
00921           int maxLength,
00922           DisableCodes disabled = Enabled,
00923           const char * attr = NULL
00924         );
00925         virtual ~InputPassword() {}
00926     };
00927 
00928     enum CheckedCodes {
00929       UnChecked,
00930       Checked
00931     };
00932     class RadioButton : public InputField {
00933       public:
00934         RadioButton(
00935           const char * fname,
00936           const char * value,
00937           const char * attr = NULL
00938         );
00939         RadioButton(
00940           const char * fname,
00941           const char * value,
00942           DisableCodes disabled,
00943           const char * attr = NULL
00944         );
00945         RadioButton(
00946           const char * fname,
00947           const char * value,
00948           CheckedCodes check,
00949           DisableCodes disabled = Enabled,
00950           const char * attr = NULL
00951         );
00952         virtual ~RadioButton() {}
00953       protected:
00954         RadioButton(
00955           const char * type,
00956           const char * fname,
00957           const char * value,
00958           CheckedCodes check,
00959           DisableCodes disabled,
00960           const char * attr
00961         );
00962         virtual void AddAttr(PHTML & html) const;
00963       private:
00964         const char * valueString;
00965         BOOL checkedFlag;
00966     };
00967 
00968     class CheckBox : public RadioButton {
00969       public:
00970         CheckBox(
00971           const char * fname,
00972           const char * attr = NULL
00973         );
00974         CheckBox(
00975           const char * fname,
00976           DisableCodes disabled,
00977           const char * attr = NULL
00978         );
00979         CheckBox(
00980           const char * fname,
00981           CheckedCodes check,
00982           DisableCodes disabled = Enabled,
00983           const char * attr = NULL
00984         );
00985         virtual ~CheckBox() {}
00986     };
00987 
00988 
00989     class InputRange : public InputField {
00990       public:
00991         InputRange(
00992           const char * fname,
00993           int min, int max,
00994           int value = 0,
00995           DisableCodes disabled = Enabled,
00996           const char * attr = NULL
00997         );
00998         virtual ~InputRange() {}
00999       protected:
01000         virtual void AddAttr(PHTML & html) const;
01001       private:
01002         int minValue, maxValue, initValue;
01003     };
01004 
01005     class InputFile : public InputField {
01006       public:
01007         InputFile(
01008           const char * fname,
01009           const char * accept = NULL,
01010           DisableCodes disabled = Enabled,
01011           const char * attr = NULL
01012         );
01013         virtual ~InputFile() {}
01014       protected:
01015         virtual void AddAttr(PHTML & html) const;
01016       private:
01017         const char * acceptString;
01018     };
01019 
01020     class InputImage : public InputField {
01021       public:
01022         InputImage(
01023           const char * fname,
01024           const char * src = NULL,
01025           DisableCodes disabled = Enabled,
01026           const char * attr = NULL
01027         );
01028         virtual ~InputImage() {}
01029       protected:
01030         InputImage(
01031           const char * type,
01032           const char * fname,
01033           const char * src,
01034           DisableCodes disabled,
01035           const char * attr
01036         );
01037         virtual void AddAttr(PHTML & html) const;
01038       private:
01039         const char * srcString;
01040     };
01041 
01042     class InputScribble : public InputImage {
01043       public:
01044         InputScribble(
01045           const char * fname,
01046           const char * src = NULL,
01047           DisableCodes disabled = Enabled,
01048           const char * attr = NULL
01049         );
01050         virtual ~InputScribble() {}
01051     };
01052 
01053     class ResetButton : public InputImage {
01054       public:
01055         ResetButton(
01056           const char * title,
01057           const char * fname = NULL,
01058           const char * src = NULL,
01059           DisableCodes disabled = Enabled,
01060           const char * attr = NULL
01061         );
01062         virtual ~ResetButton() {}
01063       protected:
01064         ResetButton(
01065           const char * type,
01066           const char * title,
01067           const char * fname = NULL,
01068           const char * src = NULL,
01069           DisableCodes disabled = Enabled,
01070           const char * attr = NULL
01071         );
01072         virtual void AddAttr(PHTML & html) const;
01073       private:
01074         const char * titleString;
01075     };
01076 
01077     class SubmitButton : public ResetButton {
01078       public:
01079         SubmitButton(
01080           const char * title,
01081           const char * fname = NULL,
01082           const char * src = NULL,
01083           DisableCodes disabled = Enabled,
01084           const char * attr = NULL
01085         );
01086         virtual ~SubmitButton() {}
01087     };
01088 
01089 
01090   protected:
01091     virtual void AssignContents(const PContainer & c);
01092 
01093   private:
01094     ElementInSet initialElement;
01095     BYTE elementSet[NumElementsInSet/8+1];
01096     PINDEX tableNestLevel;
01097 };
01098 
01099 
01100 #endif
01101 
01102 
01103 // End Of File ///////////////////////////////////////////////////////////////

Generated on Fri Mar 7 06:25:02 2008 for PTLib by  doxygen 1.5.1