//
//     Copyright 2006 Jim Bublitz <jbublitz@nwinternet.com>
//     Earlier copyrights 1998 - 2005 Jim Bublitz and/or Phil Thompson
//     may also apply


//                 Generated by preSip
//            module tdehtml  version KDE 3.5.3


// This software is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// This software 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 library; see the file COPYING.
// If not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


class TDEHTMLSettings
{
%TypeHeaderCode
#include <tdehtml_settings.h>
%End


public:

    enum KJavaScriptAdvice
    {
        KJavaScriptDunno, 
        KJavaScriptAccept, 
        KJavaScriptReject
    };


    enum KAnimationAdvice
    {
        KAnimationDisabled, 
        KAnimationLoopOnce, 
        KAnimationEnabled
    };


%If ( KDE_3_2_0 -  )

    enum KJSWindowOpenPolicy
    {
        KJSWindowOpenAllow, 
        KJSWindowOpenAsk, 
        KJSWindowOpenDeny, 
        KJSWindowOpenSmart
    };


    enum KJSWindowStatusPolicy
    {
        KJSWindowStatusAllow, 
        KJSWindowStatusIgnore
    };


    enum KJSWindowMovePolicy
    {
        KJSWindowMoveAllow, 
        KJSWindowMoveIgnore
    };


    enum KJSWindowResizePolicy
    {
        KJSWindowResizeAllow, 
        KJSWindowResizeIgnore
    };


    enum KJSWindowFocusPolicy
    {
        KJSWindowFocusAllow, 
        KJSWindowFocusIgnore
    };

%End

                         TDEHTMLSettings ();
                         TDEHTMLSettings (const TDEHTMLSettings&);
    void                 init ();
    void                 init (TDEConfig*, bool = 1);
    bool                 changeCursor ();
    bool                 underlineLink ();
    bool                 hoverLink ();

%If ( KDE_3_4_0 -  )
    bool                 allowTabulation () const;
    bool                 autoSpellCheck () const;
%End

    TDEHTMLSettings::KAnimationAdvice showAnimations () const;
    TQString              stdFontName () const;
    TQString              fixedFontName () const;
    TQString              serifFontName () const;
    TQString              sansSerifFontName () const;
    TQString              cursiveFontName () const;
    TQString              fantasyFontName () const;
    void                 setStdFontName (const TQString&);
    void                 setFixedFontName (const TQString&);
    int                  minFontSize () const;
    int                  mediumFontSize () const;

%If ( KDE_3_2_0 -  )
    bool                 jsErrorsEnabled () const;
    void                 setJSErrorsEnabled (bool);
%End

    const TQString&       encoding () const;

%If ( KDE_3_4_0 -  )
    bool                 followSystemColors () const;
%End

    const TQColor&        textColor ();

%If ( KDE_3_4_0 -  )
    const TQColor&        baseColor () const;
%End

    const TQColor&        linkColor ();
    const TQColor&        vLinkColor ();
    bool                 autoLoadImages ();

%If ( KDE_3_4_0 -  )
    bool                 unfinishedImageFrame () const;
%End


%If ( KDE_3_3_0 -  )
    bool                 isOpenMiddleClickEnabled ();
%End


%If ( KDE_3_1_0 -  )
    bool                 isBackRightClickEnabled ();
%End

    bool                 isJavaEnabled (const TQString& = TQString ::null );
    bool                 isJavaScriptEnabled (const TQString& = TQString ::null );
    bool                 isJavaScriptDebugEnabled (const TQString& = TQString ::null );

%If ( KDE_3_2_0 -  )
    bool                 isJavaScriptErrorReportingEnabled (const TQString& = TQString ::null ) const;
%End

    bool                 isPluginsEnabled (const TQString& = TQString ::null );

%If ( KDE_3_5_0 -  )
    bool                 isAdFiltered (const TQString&) const;
    bool                 isAdFilterEnabled () const;
    bool                 isHideAdsEnabled () const;
    void                 addAdFilter (const TQString&);
    bool                 accessKeysEnabled () const;
%End


%If ( KDE_3_2_0 -  )
    TDEHTMLSettings::KJSWindowOpenPolicy windowOpenPolicy (const TQString& = TQString ::null ) const;
    TDEHTMLSettings::KJSWindowMovePolicy windowMovePolicy (const TQString& = TQString ::null ) const;
    TDEHTMLSettings::KJSWindowResizePolicy windowResizePolicy (const TQString& = TQString ::null ) const;
    TDEHTMLSettings::KJSWindowStatusPolicy windowStatusPolicy (const TQString& = TQString ::null ) const;
    TDEHTMLSettings::KJSWindowFocusPolicy windowFocusPolicy (const TQString& = TQString ::null ) const;
%End

    static KJavaScriptAdvice strToAdvice (const TQString&);
//ig     static void          splitDomainAdvice (const TQString&, TQString&, TDEHTMLSettings::KJavaScriptAdvice&, TDEHTMLSettings::KJavaScriptAdvice&);
    static const char*   adviceToStr (TDEHTMLSettings::KJavaScriptAdvice);

%If ( KDE_3_2_0 -  )
//ig     void                 readDomainSettings (TDEConfig*, bool, bool, KPerDomainSettings&);
%End

    TQString              settingsToCSS () const;
    static const TQString& availableFamilies ();
    TQString              userStyleSheet () const;
    bool                 isFormCompletionEnabled () const;
    int                  maxFormCompletionItems () const;

%If ( KDE_3_1_1 -  )
    bool                 isAutoDelayedActionsEnabled () const;

%If ( KDE_3_5_0 -  )
    TQValueList<TQPair<TQString,TQChar>> fallbackAccessKeysAssignments () const;
    void                 setJSPopupBlockerPassivePopup (bool);
    bool                 jsPopupBlockerPassivePopup () const;
%End

%End


};  // class TDEHTMLSettings



%If (KDE_3_5_0 - )
%MappedType TQValueList<TQPair<TQString,TQChar>>
//converts a Python list of tuples (TQString,TQChar)
{
%TypeHeaderCode
#include <tqvaluelist.h>
#include <tqstring.h>
#include <tdehtml_settings.h>
typedef TQPair<TQString,TQChar> AssignPair;
%End

%ConvertFromTypeCode
    if (!sipCpp)
        return PyList_New(0);

    // Create the list
    PyObject *pylist;
    if ((pylist = PyList_New(0)) == NULL)
        return NULL;

    TQValueList<AssignPair> *cpplist = (TQValueList<AssignPair> *)sipCpp;

    // Get it.
    TQValueList<AssignPair>::Iterator it;
    for( it = cpplist->begin(); it != cpplist->end(); ++it )
    {
        PyObject *inst = NULL;
        TQString s = (*it).first;
        TQChar c  = (*it).second;
        PyObject *pys = sipConvertFromNewType(new TQString(s), sipType_TQString, sipTransferObj);
        PyObject *pyc = sipConvertFromNewType(new TQChar(c), sipType_TQChar, sipTransferObj);
        if ((pys == NULL) || ((inst = Py_BuildValue ("NN", pys, pyc)) == NULL)
            || PyList_Append (pylist, inst) < 0)
        {
            Py_XDECREF (inst);
            Py_XDECREF (pys);
            Py_XDECREF (pyc);
            Py_DECREF (pylist);
            return NULL;
        }
    }

    return pylist;
%End


%ConvertToTypeCode
    if (sipIsErr == NULL)
        return PyList_Check(sipPy);

    TQValueList<AssignPair> *cpplist = new TQValueList<AssignPair>;

    TQString *p1;
    TQChar *p2;
    int iserr = 0;

    for (int i = 0; i < PyList_Size (sipPy); i++)
    {
        int p1_state, p2_state;

        PyObject *elem = PyList_GET_ITEM (sipPy, i);
        PyObject *pyp1 = PyTuple_GET_ITEM (elem, 0);
        PyObject *pyp2 = PyTuple_GET_ITEM (elem, 1);
        p1 = (TQString *)sipForceConvertToType(pyp1, sipType_TQString, sipTransferObj, SIP_NOT_NONE, &p1_state, &iserr);
        p2 = (TQChar *)sipForceConvertToType(pyp2, sipType_TQChar, sipTransferObj, SIP_NOT_NONE, &p2_state, &iserr);

        if (iserr)
        {
            if (p1)
                sipReleaseType(p1, sipType_TQString, p1_state);

            *sipIsErr = 1;
            delete cpplist;
            return 0;
        }

        cpplist->append (AssignPair (*p1, *p2));

        sipReleaseType(p1, sipType_TQString, p1_state);
        sipReleaseType(p2, sipType_TQChar, p2_state);
    }

    *sipCppPtr = cpplist;

    return 1;
%End
};
%End


