# khtml Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kjs_html.h

    00001 // -*- c-basic-offset: 2 -*-
    00002 /*
    00003  *  This file is part of the KDE libraries
    00004  *  Copyright (C) 1999 Harri Porten (porten@kde.org)
    00005  *
    00006  *  This library is free software; you can redistribute it and/or
    00007  *  modify it under the terms of the GNU Library General Public
    00008  *  License as published by the Free Software Foundation; either
    00009  *  version 2 of the License, or (at your option) any later version.
    00010  *
    00011  *  This library is distributed in the hope that it will be useful,
    00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014  *  Library General Public License for more details.
    00015  *
    00016  *  You should have received a copy of the GNU Library General Public
    00017  *  License along with this library; if not, write to the Free Software
    00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00019  */
    00020
    00021 #ifndef _KJS_HTML_H_
    00022 #define _KJS_HTML_H_
    00023
    00024 #include "dom/html_document.h"
    00025 #include "dom/html_base.h"
    00026 #include "dom/html_misc.h"
    00027 #include "dom/html_form.h"
    00028 #include "misc/loader_client.h"
    00029
    00030 #include "ecma/kjs_binding.h"
    00031 #include "ecma/kjs_dom.h"
    00032
    00033 class HTMLElement;
    00034
    00035 namespace KJS {
    00036
    00037   class HTMLDocument : public DOMDocument {
    00038   public:
    00039     HTMLDocument(ExecState *exec, const DOM::HTMLDocument& d);
    00040     virtual Value tryGet(ExecState *exec, const UString &propertyName) const;
    00041     virtual void tryPut(ExecState *exec, const UString &propertyName, const Value& value, int attr = None);
    00042     void putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/);
    00043     virtual bool hasProperty(ExecState *exec, const UString &propertyName) const;
    00044     virtual const ClassInfo* classInfo() const { return &info; }
    00045     static const ClassInfo info;
    00046     enum { Title, Referrer, Domain, URL, Body, Location, Cookie,
    00047            Images, Applets, Links, Forms, Anchors, Scripts, All, Clear, Open, Close,
    00048            Write, WriteLn, GetElementsByName, CaptureEvents, ReleaseEvents,
    00049            BgColor, FgColor, AlinkColor, LinkColor, VlinkColor, LastModified,
    00050            Height, Width, Dir, Frames };
    00051     DOM::Document toDocument() const { return static_cast<DOM::Document>( node ); }
    00052   };
    00053
    00054   class HTMLElement : public DOMElement {
    00055   public:
    00056     HTMLElement(ExecState *exec, const DOM::HTMLElement& e) : DOMElement(exec, e) { }
    00057     virtual Value tryGet(ExecState *exec, const UString &propertyName) const;
    00058     Value getValueProperty(ExecState *exec, int token) const;
    00059     virtual void tryPut(ExecState *exec, const UString &propertyName, const Value& value, int attr = None);
    00060     void putValueProperty(ExecState *exec, int token, const Value& value, int);
    00061     virtual bool hasProperty(ExecState *exec, const UString &propertyName) const;
    00062     virtual UString toString(ExecState *exec) const;
    00063     virtual List eventHandlerScope(ExecState *exec) const;
    00064     virtual const ClassInfo* classInfo() const;
    00065     static const ClassInfo info;
    00066
    00067     static const ClassInfo html_info, head_info, link_info, title_info,
    00068       meta_info, base_info, isIndex_info, style_info, body_info, form_info,
    00069       select_info, optGroup_info, option_info, input_info, textArea_info,
    00070       button_info, label_info, fieldSet_info, legend_info, ul_info, ol_info,
    00071       dl_info, dir_info, menu_info, li_info, div_info, p_info, heading_info,
    00072       blockQuote_info, q_info, pre_info, br_info, baseFont_info, font_info,
    00073       hr_info, mod_info, a_info, img_info, object_info, param_info,
    00074       applet_info, map_info, area_info, script_info, table_info,
    00075       caption_info, col_info, tablesection_info, tr_info,
    00076       tablecell_info, frameSet_info, frame_info, iFrame_info;
    00077
    00078     enum { HtmlVersion, HeadProfile, LinkHref, LinkRel, LinkMedia,
    00079            LinkCharset, LinkDisabled, LinkHrefLang, LinkRev, LinkTarget, LinkType,
    00080            LinkSheet, TitleText, MetaName, MetaHttpEquiv, MetaContent, MetaScheme,
    00081            BaseHref, BaseTarget, IsIndexForm, IsIndexPrompt, StyleDisabled,
    00082            StyleSheet, StyleType, StyleMedia, BodyBackground, BodyVLink, BodyText,
    00083            BodyLink, BodyALink, BodyBgColor, ElementScrollHeight, ElementScrollWidth,
    00084            FormAction, FormEncType, FormElements, FormLength, FormAcceptCharset,
    00085            FormReset, FormTarget, FormName, FormMethod, FormSubmit, SelectAdd,
    00086            SelectTabIndex, SelectValue, SelectSelectedIndex, SelectLength,
    00087            SelectRemove, SelectForm, SelectBlur, SelectType, SelectOptions,
    00088            SelectDisabled, SelectMultiple, SelectName, SelectSize, SelectFocus,
    00089            OptGroupDisabled, OptGroupLabel, OptionIndex, OptionSelected,
    00090            OptionForm, OptionText, OptionDefaultSelected, OptionDisabled,
    00091            OptionLabel, OptionValue, InputBlur, InputReadOnly, InputAccept,
    00092            InputSize, InputDefaultValue, InputTabIndex, InputValue, InputType,
    00093            InputFocus, InputMaxLength, InputDefaultChecked, InputDisabled,
    00094            InputChecked, InputForm, InputAccessKey, InputAlign, InputAlt,
    00095            InputName, InputSrc, InputUseMap, InputSelect, InputClick,
    00096            TextAreaAccessKey, TextAreaName, TextAreaDefaultValue, TextAreaSelect,
    00097            TextAreaCols, TextAreaDisabled, TextAreaForm, TextAreaType,
    00098            TextAreaTabIndex, TextAreaReadOnly, TextAreaRows, TextAreaValue,
    00099            TextAreaBlur, TextAreaFocus, ButtonForm, ButtonTabIndex, ButtonName,
    00100            ButtonDisabled, ButtonAccessKey, ButtonType, ButtonValue, LabelHtmlFor,
    00101            LabelForm, LabelAccessKey, FieldSetForm, LegendForm, LegendAccessKey,
    00102            LegendAlign, UListType, UListCompact, OListStart, OListCompact,
    00103            OListType, DListCompact, DirectoryCompact, MenuCompact, LIType,
    00104            LIValue, DivAlign, ParagraphAlign, HeadingAlign, BlockQuoteCite,
    00105            QuoteCite, PreWidth, BRClear, BaseFontColor, BaseFontSize,
    00106            BaseFontFace, FontColor, FontSize, FontFace, HRWidth, HRNoShade,
    00107            HRAlign, HRSize, ModCite, ModDateTime, AnchorShape, AnchorRel,
    00108            AnchorAccessKey, AnchorCoords, AnchorHref, AnchorProtocol, AnchorHost,
    00109            AnchorCharset, AnchorHrefLang, AnchorHostname, AnchorType, AnchorFocus,
    00110            AnchorPort, AnchorPathName, AnchorHash, AnchorSearch, AnchorName,
    00111            AnchorRev, AnchorTabIndex, AnchorTarget, AnchorText, AnchorBlur,
    00112            ImageName, ImageAlign, ImageHspace, ImageVspace, ImageUseMap, ImageAlt,
    00113            ImageLowSrc, ImageWidth, ImageIsMap, ImageBorder, ImageHeight,
    00114            ImageLongDesc, ImageSrc, ImageX, ImageY, ImageComplete, ObjectHspace, ObjectHeight, ObjectAlign,
    00115            ObjectBorder, ObjectCode, ObjectType, ObjectVspace, ObjectArchive,
    00116            ObjectDeclare, ObjectForm, ObjectCodeBase, ObjectCodeType, ObjectData,
    00117            ObjectName, ObjectStandby, ObjectTabIndex, ObjectUseMap, ObjectWidth, ObjectContentDocument,
    00118            ParamName, ParamType, ParamValueType, ParamValue, AppletArchive,
    00119            AppletAlt, AppletCode, AppletWidth, AppletAlign, AppletCodeBase,
    00120            AppletName, AppletHeight, AppletHspace, AppletObject, AppletVspace,
    00121            MapAreas, MapName, AreaHash, AreaHref, AreaTarget, AreaPort, AreaShape,
    00122            AreaCoords, AreaAlt, AreaAccessKey, AreaNoHref, AreaHost, AreaProtocol,
    00123            AreaHostName, AreaPathName, AreaSearch, AreaTabIndex, ScriptEvent,
    00124            ScriptType, ScriptHtmlFor, ScriptText, ScriptSrc, ScriptCharset,
    00125            ScriptDefer, TableSummary, TableTBodies, TableTHead, TableCellPadding,
    00126            TableDeleteCaption, TableCreateCaption, TableCaption, TableWidth,
    00127            TableCreateTFoot, TableAlign, TableTFoot, TableDeleteRow,
    00128            TableCellSpacing, TableRows, TableBgColor, TableBorder, TableFrame,
    00129            TableRules, TableCreateTHead, TableDeleteTHead, TableDeleteTFoot,
    00130            TableInsertRow, TableCaptionAlign, TableColCh, TableColChOff,
    00131            TableColAlign, TableColSpan, TableColVAlign, TableColWidth,
    00132            TableSectionCh, TableSectionDeleteRow, TableSectionChOff,
    00133            TableSectionRows, TableSectionAlign, TableSectionVAlign,
    00134            TableSectionInsertRow, TableRowSectionRowIndex, TableRowRowIndex,
    00135            TableRowChOff, TableRowCells, TableRowVAlign, TableRowCh,
    00136            TableRowAlign, TableRowBgColor, TableRowDeleteCell, TableRowInsertCell,
    00137            TableCellColSpan, TableCellNoWrap, TableCellAbbr, TableCellHeight,
    00138            TableCellWidth, TableCellCellIndex, TableCellChOff, TableCellBgColor,
    00139            TableCellCh, TableCellVAlign, TableCellRowSpan, TableCellHeaders,
    00140            TableCellAlign, TableCellAxis, TableCellScope, FrameSetCols,
    00141            FrameSetRows, FrameSrc, FrameLocation, FrameFrameBorder, FrameScrolling,
    00142            FrameMarginWidth, FrameLongDesc, FrameMarginHeight, FrameName, FrameContentDocument,
    00143            FrameNoResize, IFrameLongDesc, IFrameAlign,
    00144            IFrameFrameBorder, IFrameSrc, IFrameName, IFrameHeight,
    00145            IFrameMarginHeight, IFrameMarginWidth, IFrameScrolling, IFrameWidth, IFrameContentDocument,
    00146            ElementInnerHTML, ElementTitle, ElementId, ElementDir, ElementLang,
    00147            ElementClassName, ElementInnerText, ElementDocument, ElementChildren, ElementAll };
    00148
    00149     DOM::HTMLElement toElement() const { return static_cast<DOM::HTMLElement>(node); }
    00150   };
    00151
    00152
    00153   class HTMLElementFunction : public DOMFunction {
    00154   public:
    00155     HTMLElementFunction(ExecState *exec, int i, int len);
    00156     virtual Value tryCall(ExecState *exec, Object &thisObj, const List&args);
    00157   private:
    00158     int id;
    00159   };
    00160
    00161   class HTMLCollection : public DOMObject {
    00162   public:
    00163     HTMLCollection(ExecState *exec, const DOM::HTMLCollection& c);
    00164     ~HTMLCollection();
    00165     virtual Value tryGet(ExecState *exec, const UString &propertyName) const;
    00166     virtual Value call(ExecState *exec, Object &thisObj, const List&args);
    00167     virtual Value tryCall(ExecState *exec, Object &thisObj, const List&args);
    00168     virtual bool implementsCall() const { return true; }
    00169     virtual bool toBoolean(ExecState *) const { return true; }
    00170     virtual bool hasProperty(ExecState *exec, const UString &p) const;
    00171     enum { Item, NamedItem, Tags };
    00172     Value getNamedItems(ExecState *exec, const UString &propertyName) const;
    00173     virtual const ClassInfo* classInfo() const { return &info; }
    00174     static const ClassInfo info;
    00175     DOM::HTMLCollection toCollection() const { return collection; }
    00176   protected:
    00177     DOM::HTMLCollection collection;
    00178   };
    00179
    00180   class HTMLSelectCollection : public HTMLCollection {
    00181   public:
    00182     HTMLSelectCollection(ExecState *exec, const DOM::HTMLCollection& c, const DOM::HTMLSelectElement& e)
    00183       : HTMLCollection(exec, c), element(e) { }
    00184     virtual Value tryGet(ExecState *exec, const UString &propertyName) const;
    00185     virtual void tryPut(ExecState *exec, const UString &propertyName, const Value& value, int attr = None);
    00186   private:
    00187     DOM::HTMLSelectElement element;
    00188   };
    00189
    00191
    00192   class OptionConstructorImp : public ObjectImp {
    00193   public:
    00194     OptionConstructorImp(ExecState *exec, const DOM::Document &d);
    00195     virtual bool implementsConstruct() const;
    00196     virtual Object construct(ExecState *exec, const List &args);
    00197   private:
    00198     DOM::Document doc;
    00199   };
    00200
    00202
    00203   class ImageConstructorImp : public ObjectImp {
    00204   public:
    00205     ImageConstructorImp(ExecState *exec, const DOM::Document &d);
    00206     virtual bool implementsConstruct() const;
    00207     virtual Object construct(ExecState *exec, const List &args);
    00208   private:
    00209     DOM::Document doc;
    00210   };
    00211
    00212   class Image : public DOMObject, public khtml::CachedObjectClient {
    00213   public:
    00214     Image(ExecState*, const DOM::Document &d);
    00215     ~Image();
    00216     virtual Value tryGet(ExecState *exec, const UString &propertyName) const;
    00217     Value getValueProperty(ExecState *exec, int token) const;
    00218     virtual void tryPut(ExecState *exec, const UString &propertyName, const Value& value, int attr = None);
    00219     void putValueProperty(ExecState *exec, int token, const Value& value, int);
    00220     virtual bool toBoolean(ExecState *) const { return true; }
    00221     virtual void notifyFinished(khtml::CachedObject * finishedObj);
    00222     virtual const ClassInfo* classInfo() const { return &info; }
    00223     static const ClassInfo info;
    00224     enum { Src, Complete, Width, Height, OnLoad };
    00225   private:
    00226     UString src;
    00227     DOM::Document doc;
    00228     khtml::CachedImage* img;
    00229     JSEventListener *m_onLoadListener;
    00230   };
    00231
    00232   Value getHTMLCollection(ExecState *exec, const DOM::HTMLCollection& c);
    00233   Value getSelectHTMLCollection(ExecState *exec, const DOM::HTMLCollection& c, const DOM::HTMLSelectElement& e);
    00234
    00235
    00236 } // namespace
    00237
    00238 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:34:21 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001