⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 html_formimpl.h

📁 konqueror3 embedded版本, KDE环境下的当家浏览器的嵌入式版本源码包.
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * This file is part of the DOM implementation for KDE. * * Copyright (C) 1999 Lars Knoll (knoll@kde.org) *           (C) 1999 Antti Koivisto (koivisto@kde.org) *           (C) 2000 Dirk Mueller (mueller@kde.org) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB.  If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */#ifndef HTML_FORMIMPL_H#define HTML_FORMIMPL_H#include "html/html_elementimpl.h"#include "html/html_imageimpl.h"#include "dom/html_element.h"#include <qvaluelist.h>#include <qptrlist.h>#include <qcstring.h>#include <qmemarray.h>class KHTMLView;class QTextCodec;namespace khtml{    class RenderFormElement;    class RenderTextArea;    class RenderSelect;    class RenderLineEdit;    class RenderRadioButton;    class RenderFileButton;    typedef QValueList<QCString> encodingList;}namespace KWallet {    class Wallet;}namespace DOM {class HTMLFormElement;class DOMString;class HTMLGenericFormElementImpl;class HTMLOptionElementImpl;// -------------------------------------------------------------------------class HTMLFormElementImpl : public HTMLElementImpl{public:    HTMLFormElementImpl(DocumentPtr *doc, bool implicit);    virtual ~HTMLFormElementImpl();    virtual Id id() const;    virtual void insertedIntoDocument();    virtual void removedFromDocument();    virtual void addId(const QString& id);    virtual void removeId(const QString& id);    long length() const;    QByteArray formData(bool& ok);    DOMString enctype() const { return m_enctype; }    void setEnctype( const DOMString & );    bool autoComplete() const { return m_autocomplete; }    void doAutoFill();    void walletOpened(KWallet::Wallet *w);    virtual void parseAttribute(AttributeImpl *attr);    void radioClicked( HTMLGenericFormElementImpl *caller );    void registerFormElement(HTMLGenericFormElementImpl *);    void removeFormElement(HTMLGenericFormElementImpl *);    void registerImgElement(HTMLImageElementImpl *);    void removeImgElement(HTMLImageElementImpl *);    void submitFromKeyboard();    bool prepareSubmit();    void submit();    void reset();    void setMalformed(bool malformed) { m_malformed = malformed; }    bool isMalformed() const { return m_malformed; }    friend class HTMLFormElement;    friend class HTMLFormCollectionImpl;private:    void gatherWalletData();    QPtrList<HTMLGenericFormElementImpl> formElements;    QPtrList<HTMLImageElementImpl> imgElements;    DOMString m_target;    DOMString m_enctype;    QString m_boundary;    DOMString m_acceptcharset;    QString m_encCharset;    bool m_post : 1;    bool m_multipart : 1;    bool m_autocomplete : 1;    bool m_insubmit : 1;    bool m_doingsubmit : 1;    bool m_inreset : 1;    bool m_malformed : 1;    bool m_haveTextarea : 1; // for wallet storage    bool m_havePassword : 1; // for wallet storage    DOMString m_name;        // our name    QMap<QString, QString> m_walletMap; // for wallet storage};// -------------------------------------------------------------------------class HTMLGenericFormElementImpl : public HTMLElementImpl{    friend class HTMLFormElementImpl;    friend class khtml::RenderFormElement;public:    HTMLGenericFormElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);    virtual ~HTMLGenericFormElementImpl();    HTMLFormElementImpl *form() { return m_form; }    virtual void parseAttribute(AttributeImpl *attr);    virtual void attach();    virtual void reset() {}    virtual void insertedIntoDocument();    virtual void removedFromDocument();    void onSelect();    void onChange();    bool disabled() const { return m_disabled; }    void setDisabled(bool _disabled);    virtual bool isFocusable() const;    virtual bool isEnumeratable() const { return false; }    bool readOnly() const { return m_readOnly; }    void setReadOnly(bool _readOnly) { m_readOnly = _readOnly; }    DOMString name() const;    void setName(const DOMString& name);    virtual bool isGenericFormElement() const { return true; }    /*     * override in derived classes to get the encoded name=value pair     * for submitting     * return true for a successful control (see HTML4-17.13.2)     */    virtual bool encoding(const QTextCodec*, khtml::encodingList&, bool) { return false; }    virtual void defaultEventHandler(EventImpl *evt);    virtual bool isEditable();protected:    HTMLFormElementImpl *getForm() const;    DOMStringImpl* m_name;    HTMLFormElementImpl *m_form;    bool m_disabled, m_readOnly;};// -------------------------------------------------------------------------class HTMLButtonElementImpl : public HTMLGenericFormElementImpl{public:    HTMLButtonElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);    virtual ~HTMLButtonElementImpl();    enum typeEnum {        SUBMIT,        RESET,        BUTTON    };    virtual Id id() const;    virtual bool isEnumeratable() const { return true; }    DOMString type() const;    typeEnum buttonType() const { return m_type; }    virtual void parseAttribute(AttributeImpl *attr);    virtual void defaultEventHandler(EventImpl *evt);    virtual bool encoding(const QTextCodec*, khtml::encodingList&, bool);    void activate();    virtual void attach();    void click();    void blur();    void focus();protected:    DOMString m_value;    QString   m_currValue;    typeEnum  m_type : 2;    bool      m_dirty : 1;    bool      m_clicked : 1;    bool      m_activeSubmit : 1;};// -------------------------------------------------------------------------class HTMLFieldSetElementImpl : public HTMLGenericFormElementImpl{public:    HTMLFieldSetElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);    virtual ~HTMLFieldSetElementImpl();    virtual Id id() const;    virtual void attach();    virtual void parseAttribute(AttributeImpl *attr);};// -------------------------------------------------------------------------class HTMLInputElementImpl : public HTMLGenericFormElementImpl{    friend class khtml::RenderLineEdit;    friend class khtml::RenderRadioButton;    friend class khtml::RenderFileButton;public:    // do not change the order!    enum typeEnum {        TEXT,        PASSWORD,        ISINDEX,        CHECKBOX,        RADIO,        SUBMIT,        RESET,        FILE,        HIDDEN,        IMAGE,        BUTTON    };    HTMLInputElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);    virtual ~HTMLInputElementImpl();    virtual Id id() const;    virtual bool isEnumeratable() const { return inputType() != IMAGE; }    bool autoComplete() const { return m_autocomplete; }    bool checked() const { return m_checked; }    void setChecked(bool);    long maxLength() const { return m_maxLen; }    int size() const { return m_size; }    DOMString type() const;    void setType(const DOMString& t);    DOMString value() const;    void setValue(DOMString val);    DOMString valueWithDefault() const;    void blur();    void focus();    virtual bool maintainsState() { return true; }    virtual QString state();    virtual void restoreState(const QString &);    void select();    void click();    virtual void parseAttribute(AttributeImpl *attr);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -