//
//     Copyright 2008 Jim Bublitz <jbublitz@nwinternet.com>
//     Earlier copyrights 1998 - 2007 Jim Bublitz also apply

//                 Generated by twine

// This file is part of PyKDE4.

// PyKDE4 is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of
// the License, or (at your option) any later version.

// PyKDE4 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 General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.




%ModuleHeaderCode
//ctscc
#include <khtml_part.h>
#include <kxmlguiclient.h>
%End

class KHTMLPart : KParts::ReadOnlyPart
{
%TypeHeaderCode
#include <khtml_part.h>
%End



public:
    enum GUIProfile
    {
        DefaultGUI,
        BrowserViewGUI
    };


    enum DNSPrefetch
    {
        DNSPrefetchDisabled,
        DNSPrefetchEnabled,
        DNSPrefetchOnlyWWWAndSLD
    };

                            KHTMLPart (QWidget* parentWidget = 0, QObject* parent /TransferThis/ = 0, KHTMLPart::GUIProfile prof = KHTMLPart::DefaultGUI);
                            KHTMLPart (KHTMLView* view, QObject* parent /TransferThis/ = 0, KHTMLPart::GUIProfile prof = KHTMLPart::DefaultGUI);
    virtual bool            openUrl (const KUrl& url);
    virtual bool            closeUrl ();
    virtual void            showError (KJob* job);
    DOM::HTMLDocument       htmlDocument () const;
    DOM::Document           document () const;
    QString                 documentSource () const;
    DOM::Node               activeNode () const;
    KParts::BrowserExtension*  browserExtension () const;
    KParts::BrowserHostExtension*  browserHostExtension () const;
    KHTMLView*              view () const;
    void                    setJScriptEnabled (bool enable);
    bool                    jScriptEnabled () const;
//ig    KJS::Interpreter*       jScriptInterpreter ();
    void                    setStatusMessagesEnabled (bool enable);
    bool                    statusMessagesEnabled () const;
    void                    setMetaRefreshEnabled (bool enable);
    bool                    metaRefreshEnabled () const;
    QVariant                executeScript (const DOM::Node& n, const QString& script);
    void                    setDNDEnabled (bool b);
    bool                    dndEnabled () const;
    void                    setJavaEnabled (bool enable);
    bool                    javaEnabled () const;
    void                    setPluginsEnabled (bool enable);
    bool                    pluginsEnabled () const;
    void                    setAutoloadImages (bool enable);
    bool                    autoloadImages () const;
    void                    setOnlyLocalReferences (bool enable);
    void                    setDNSPrefetch (KHTMLPart::DNSPrefetch pmode);
    KHTMLPart::DNSPrefetch  dnsPrefetch () const;
    bool                    onlyLocalReferences () const;
    bool                    isCaretMode () const;
    bool                    isEditable () const;
    void                    setCaretPosition (DOM::Node node, long offset, bool extendSelection = 0);

    enum CaretDisplayPolicy
    {
        CaretVisible,
        CaretInvisible,
        CaretBlink
    };

    KHTMLPart::CaretDisplayPolicy  caretDisplayPolicyNonFocused () const;
    void                    setCaretDisplayPolicyNonFocused (KHTMLPart::CaretDisplayPolicy policy);
    KUrl                    baseURL () const;
    KUrl                    backgroundURL () const;
    void                    scheduleRedirection (int delay, const QString& url, bool lockHistory = 1);
    virtual void            begin (const KUrl& url = KUrl(), int xOffset = 0, int yOffset = 0);
    virtual void            write (const char* str, int len = -1);
    virtual void            write (const QString& str);
    virtual void            end ();
    void                    paint (QPainter*, const QRect&, int = 0, bool* /Out/ = 0);
    bool                    setEncoding (const QString& name, bool override = 0);
    QString                 encoding () const;
    void                    setUserStyleSheet (const KUrl& url);
    void                    setUserStyleSheet (const QString& styleSheet);
    void                    setStandardFont (const QString& name);
    void                    setFixedFont (const QString& name);
    bool                    gotoAnchor (const QString& name);
    bool                    nextAnchor ();
    bool                    prevAnchor ();
    void                    setURLCursor (const QCursor& c);
    QCursor                 urlCursor () const;

    enum FindOptions
    {
        FindLinksOnly,
        FindNoPopups
    };

    void                    findText ();
    void                    findText (const QString& str, long options, QWidget* parent /Transfer/ = 0, KFindDialog* findDialog = 0);
    void                    findTextBegin ();
    bool                    findTextNext (bool reverse = 0);
    void                    setZoomFactor (int percent);
    int                     zoomFactor () const;
    void                    setFontScaleFactor (int percent);
    int                     fontScaleFactor () const;
    virtual QString         selectedText () const;
    QString                 selectedTextAsHTML () const;
    DOM::Range              selection () const;
    void                    selection (DOM::Node& startNode, long& startOffset /Out/, DOM::Node& endNode, long& endOffset /Out/) const;
    void                    setSelection (const DOM::Range&);
    bool                    hasSelection () const;
    void                    selectAll ();
    void                    show ();
    void                    hide ();
    KParts::PartManager*    partManager ();
    virtual void            saveState (QDataStream& stream);
    virtual void            restoreState (QDataStream& stream);
    DOM::Node               nodeUnderMouse () const;
    DOM::Node               nonSharedNodeUnderMouse () const;
    const KHTMLSettings*    settings () const;
    KHTMLPart*              parentPart ();
    QStringList             frameNames () const;
    QList<KParts::ReadOnlyPart*>  frames () const;
    KHTMLPart*              findFrame (const QString& f);
//ig    KHTMLPart*              findFrameParent (KParts::ReadOnlyPart* callingPart, const QString& f, khtml::ChildFrame** childFrame = 0);
    KParts::ReadOnlyPart*   currentFrame () const;
    bool                    frameExists (const QString& frameName);
//ig    KJSProxy*               framejScript (KParts::ReadOnlyPart* framePart);
    KParts::ReadOnlyPart*   findFramePart (const QString& f);
    void                    setJSStatusBarText (const QString& text);
    void                    setJSDefaultStatusBarText (const QString& text);
    QString                 jsStatusBarText () const;
    QString                 jsDefaultStatusBarText () const;
    QString                 referrer () const;
    QString                 pageReferrer () const;
    QString                 lastModified () const;
    void                    preloadStyleSheet (const QString& url, const QString& stylesheet);
    void                    preloadScript (const QString& url, const QString& script);
    bool                    isPointInsideSelection (int x, int y);
    bool                    restored () const;
    void                    setAlwaysHonourDoctype (bool b = 1);

    enum FormNotification
    {
        NoNotification,
        Before,
        Only,
        Unused
    };

    void                    setFormNotification (KHTMLPart::FormNotification fn);
    KHTMLPart::FormNotification  formNotification () const;
    KUrl                    toplevelURL ();
    bool                    isModified () const;
    void                    setSuppressedPopupIndicator (bool enable, KHTMLPart* originPart = 0);
    bool                    inProgress () const;

signals:
    void                    onURL (const QString& url);
    void                    popupMenu (const QString& url, const QPoint& point);
    void                    selectionChanged ();
    void                    nodeActivated (const DOM::Node&);
    void                    docCreated ();
    void                    caretPositionChanged (const DOM::Node& node, long offset);
    void                    formSubmitNotification (const char* action, const QString& url, const QByteArray& formData, const QString& target, const QString& contentType, const QString& boundary);
    void                    configurationChanged ();

protected:
    KUrl                    completeURL (const QString& url);
    void                    htmlError (int errorCode, const QString& text, const KUrl& reqUrl);
    virtual void            customEvent (QEvent* event);
//ig    virtual void            khtmlMousePressEvent (khtml::MousePressEvent* event);
//ig    virtual void            khtmlMouseDoubleClickEvent (khtml::MouseDoubleClickEvent*);
//ig    virtual void            khtmlMouseMoveEvent (khtml::MouseMoveEvent* event);
//ig    virtual void            khtmlMouseReleaseEvent (khtml::MouseReleaseEvent* event);
//ig    virtual void            khtmlDrawContentsEvent (khtml::DrawContentsEvent*);
    virtual void            guiActivateEvent (KParts::GUIActivateEvent* event);
    virtual bool            openFile ();
    virtual bool            urlSelected (const QString& url, int button, int state, const QString& _target, const KParts::OpenUrlArguments& args = KParts::OpenUrlArguments(), const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments());
    virtual KParts::ReadOnlyPart*  createPart (QWidget* parentWidget, QObject* parent /Transfer/, const QString& mimetype, QString& serviceName, QStringList& serviceTypes, const QStringList& params);
    bool                    pluginPageQuestionAsked (const QString& mimetype) const;
    void                    setPluginPageQuestionAsked (const QString& mimetype);

    enum PageSecurity
    {
        NotCrypted,
        Encrypted,
        Mixed
    };

//ig    void                    setPageSecurity (KHTMLPart::PageSecurity sec);
    virtual bool            doOpenStream (const QString& mimeType);
    virtual bool            doWriteStream (const QByteArray& data);
    virtual bool            doCloseStream ();
    virtual void            timerEvent (QTimerEvent*);
    bool                    mayPrefetchHostname (const QString& name);

public:
    void                    setActiveNode (const DOM::Node& node);
    void                    stopAnimations ();
    QVariant                executeScript (const QString& script);
    void                    setCaretMode (bool enable);
    void                    setEditable (bool enable);
    void                    setCaretVisible (bool show);
    void                    submitFormProxy (const char* action, const QString& url, const QByteArray& formData, const QString& target, const QString& contentType = QString(), const QString& boundary = QString());

protected:
    virtual void            slotFinished (KJob*);
    virtual void            startingJob (KIO::Job*);


private:
//force
    void                    setStatusBarText (const QString&, int);



//  Subclasses of QObject

//end
%ConvertToSubClassCode
    // CTSCC for subclasses of 'KXMLGUIClient'
    sipType = NULL;

    if (dynamic_cast<KHTMLPart*>(sipCpp))
        sipType = sipType_KHTMLPart;
%End

public:
    ~KHTMLPart ();
//ig    DOM::Editor*            editor () const;
protected:
    void                    updateZoomFactor ();
public:
    void                    setForcePermitLocalImages (bool enable);
    bool                    forcePermitLocalImages () const;
//ig    KHTMLPartPrivate*       impl ();
};
// KHTMLPart


