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


//                 Generated by preSip
//            module tdeparts  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.

namespace KParts
{

class URLArgs
{
%TypeHeaderCode
#include <browserextension.h>
%End


public:
                         URLArgs ();
                         URLArgs (const KParts::URLArgs&);
                         URLArgs (bool, int, int, const TQString& = TQString ::null );
    TQStringList          docState;
    bool                 reload;
    int                  xOffset;
    int                  yOffset;
    TQString              serviceType;
    TQByteArray           postData;
    void                 setContentType (const TQString&);
    TQString              contentType () const;
    void                 setDoPost (bool);
    bool                 doPost () const;
    void                 setLockHistory (bool);
    bool                 lockHistory () const;

%If ( KDE_3_1_0 -  )
    void                 setNewTab (bool);
    bool                 newTab () const;
%End

    TQMap<TQString,TQString>& metaData ();
    TQString              frameName;
    bool                 trustedSource;

%If ( KDE_3_1_3 -  )
    bool                 redirectedRequest () const;
    void                 setRedirectedRequest (bool);

%If ( KDE_3_4_0 -  )
    void                 setForcesNewWindow (bool);
    bool                 forcesNewWindow () const;
%End

%End

//ig     URLArgsPrivate*      d;

};  // class URLArgs


class WindowArgs
{
%TypeHeaderCode
#include <browserextension.h>
%End


public:
                         WindowArgs ();
                         WindowArgs (const KParts::WindowArgs&);
                         WindowArgs (const TQRect&, bool, bool, bool, bool, bool);
                         WindowArgs (int, int, int, int, bool, bool, bool, bool, bool);
    int                  x;
    int                  y;
    int                  width;
    int                  height;
    bool                 fullscreen;
    bool                 menuBarVisible;
    bool                 toolBarsVisible;
    bool                 statusBarVisible;
    bool                 resizable;
    bool                 lowerWindow;

%If ( KDE_3_5_0 -  )
    bool                 scrollBarsVisible;
%End

//ig     WindowArgsPrivate*   d;

};  // class WindowArgs


class OpenURLEvent : KParts::Event
{
%TypeHeaderCode
#include <browserextension.h>
%End


public:
                         OpenURLEvent (KParts::ReadOnlyPart*, const KURL&, const KParts::URLArgs& = KParts ::URLArgs ());
    KParts::ReadOnlyPart* part () const;
    KURL                 url () const;
    KParts::URLArgs      args () const;
    static bool          test (const TQEvent*);

};  // class OpenURLEvent


class BrowserExtension : TQObject
{
%TypeHeaderCode
#include <browserextension.h>
%End


public:
                         BrowserExtension (KParts::ReadOnlyPart* /TransferThis/, const char* = 0);

%If ( KDE_3_2_0 -  )
    typedef uint PopupFlags;

%If ( KDE_3_4_0 -  )

    enum 
    {
        DefaultPopupItems, 
        ShowNavigationItems, 
        ShowUp, 
        ShowReload, 
        ShowBookmark, 
        ShowCreateDirectory, 
        ShowTextSelectionItems, 
        NoDeletion
    };

%End

%End

    virtual void         setURLArgs (const KParts::URLArgs&);
    KParts::URLArgs      urlArgs () const;
    virtual int          xOffset ();
    virtual int          yOffset ();
    virtual void         saveState (TQDataStream&);
    virtual void         restoreState (TQDataStream&);
    bool                 isURLDropHandlingEnabled () const;
    void                 setURLDropHandlingEnabled (bool);
    void                 setBrowserInterface (KParts::BrowserInterface*);
    KParts::BrowserInterface* browserInterface () const;
    bool                 isActionEnabled (const char*) const;

%If ( KDE_3_5_0 -  )
    TQString              actionText (const char*) const;
%End

    typedef TQMap<TQCString,TQCString> ActionSlotMap;
    static KParts::BrowserExtension::ActionSlotMap actionSlotMap ();
    static KParts::BrowserExtension::ActionSlotMap* actionSlotMapPtr ();
    static KParts::BrowserExtension* childObject (TQObject*);

%If ( KDE_3_2_0 -  )
    void                 pasteRequest ();
%End


signals:
    void                 enableAction (const char*, bool);

%If ( KDE_3_5_0 -  )
    void                 setActionText (const char*, const TQString&);
%End

    void                 openURLRequest (const KURL&, const KParts::URLArgs& = KParts ::URLArgs ());
    void                 openURLRequestDelayed (const KURL&, const KParts::URLArgs& = KParts ::URLArgs ());
    void                 openURLNotify ();
    void                 setLocationBarURL (const TQString&);
    void                 setIconURL (const KURL&);
    void                 createNewWindow (const KURL&, const KParts::URLArgs& = KParts ::URLArgs ());
//ig     void                 createNewWindow (const KURL&, const KParts::URLArgs&, const KParts::WindowArgs&, KParts::ReadOnlyPart*&);
    void                 loadingProgress (int);
    void                 speedProgress (int);
    void                 infoMessage (const TQString&);
    void                 popupMenu (const TQPoint&, const KFileItemList&);
    void                 popupMenu (KXMLGUIClient*, const TQPoint&, const KFileItemList&);

%If ( KDE_3_2_0 -  )
    void                 popupMenu (KXMLGUIClient*, const TQPoint&, const KFileItemList&, const KParts::URLArgs&, KParts::BrowserExtension::PopupFlags);
%End

    void                 popupMenu (const TQPoint&, const KURL&, const TQString&, mode_t = -1);
    void                 popupMenu (KXMLGUIClient*, const TQPoint&, const KURL&, const TQString&, mode_t = -1);

%If ( KDE_3_2_0 -  )
    void                 popupMenu (KXMLGUIClient*, const TQPoint&, const KURL&, const KParts::URLArgs&, KParts::BrowserExtension::PopupFlags, mode_t = -1);
%End

    void                 selectionInfo (const KFileItemList&);
    void                 selectionInfo (const TQString&);
    void                 selectionInfo (const KURL::List&);

%If ( KDE_3_1_0 -  )
    void                 mouseOverInfo (const KFileItem*);

%If ( KDE_3_2_0 -  )
    void                 addWebSideBar (const KURL&, const TQString&);
    void                 moveTopLevelWidget (int, int);
    void                 resizeTopLevelWidget (int, int);

%If ( KDE_3_3_1 -  )
    void                 requestFocus (KParts::ReadOnlyPart*);

%If ( KDE_3_4_0 -  )
    void                 setPageSecurity (int);
%End

%End

%End

%End


public:
    typedef TQMap<TQCString,int> ActionNumberMap;

protected:
//igx     virtual void         virtual_hook (int, void*);

public:

%If ( KDE_3_3_0 - KDE_3_4_0 )

    enum 
    {
        DefaultPopupItems, 
        ShowNavigationItems, 
        ShowUp, 
        ShowReload, 
        ShowBookmark, 
        ShowCreateDirectory, 
        ShowTextSelectionItems
    };

%End


public:

%If ( KDE_3_2_0 - KDE_3_3_0 )

    enum 
    {
        DefaultPopupItems, 
        ShowNavigationItems, 
        ShowUp, 
        ShowReload, 
        ShowBookmark, 
        ShowCreateDirectory
    };

%End


};  // class BrowserExtension


class BrowserHostExtension : TQObject
{
%TypeHeaderCode
#include <browserextension.h>
%End


public:
                         BrowserHostExtension (KParts::ReadOnlyPart* /TransferThis/, const char* = 0);
    virtual TQStringList  frameNames () const;
    virtual const TQPtrList<KParts::ReadOnlyPart> frames () const;

%If ( KDE_3_3_0 -  )
    KParts::BrowserHostExtension* findFrameParent (KParts::ReadOnlyPart*, const TQString&);
%End

    virtual bool         openURLInFrame (const KURL&, const KParts::URLArgs&);
    static KParts::BrowserHostExtension* childObject (TQObject*);

protected:
//igx     virtual void         virtual_hook (int, void*);

};  // class BrowserHostExtension


%If ( KDE_3_1_0 -  )

class LiveConnectExtension : TQObject
{
%TypeHeaderCode
#include <browserextension.h>
%End


public:

    enum Type
    {
        TypeVoid, 
        TypeBool, 
        TypeFunction, 
        TypeNumber, 
        TypeObject, 
        TypeString
    };

//ig     typedef TQValueList<TQPair<Type,TQString>> ArgList;
                         LiveConnectExtension (KParts::ReadOnlyPart* /TransferThis/, const char* = 0);
    virtual bool         get (const ulong, const TQString&, KParts::LiveConnectExtension::Type&, ulong&, TQString&);
    virtual bool         put (const ulong, const TQString&, const TQString&);
    virtual bool         call (const ulong, const TQString&, const TQStringList&, KParts::LiveConnectExtension::Type&, ulong&, TQString&);
    virtual void         unregister (const ulong);
    static KParts::LiveConnectExtension* childObject (TQObject*);

signals:
//ig     virtual void         partEvent (const ulong, const TQString&, const KParts::LiveConnectExtension::ArgList&);

};  // class LiveConnectExtension

%End

};  // namespace KParts


%If (  - KDE_3_5_3 )
//ig typedef TQPtrList<KFileItem> KFileItemList;
%End

//force
TQMap<TQCString,int>   testTQMapTQCStringInt (TQMap<TQCString,int>);
%MethodCode
//takes dict | (TQMap<TQCString,int>)
//returns (TQMap<TQCString,int>)

    sipRes = a0;
%End

//end


%MappedType TQMap<TQCString,TQCString>
//converts a Python dict of TQCString:TQCString
{
%TypeHeaderCode
#include <tqmap.h>
%End

%ConvertFromTypeCode
    // Convert to a Python dict

    if (!sipCpp)
        return PyDict_New();

    PyObject *dict;

    // Create the dictionary.

    if ((dict = PyDict_New()) == NULL)
        return NULL;

    // Get it.

    const TQMap<TQCString,TQCString> cppmap = *sipCpp;
    TQMap<TQCString,TQCString>::ConstIterator it;

    for (it = cppmap.begin (); it != cppmap.end (); ++it)
    {
        TQCString acpp = it.key ();
        TQCString bcpp = it.data ();
        PyObject *ainst;
        PyObject *binst = NULL;
        if (((ainst = sipConvertFromNewType(new TQCString (acpp), sipType_TQCString, NULL)) == NULL)
            || ((binst = sipConvertFromNewType(new TQCString (bcpp), sipType_TQCString, NULL)) == NULL)
            || (PyDict_SetItem (dict, ainst, binst) < 0))
        {
            Py_XDECREF (ainst);
            Py_XDECREF (binst);
            Py_DECREF (dict);
            return NULL;
        }
    }

    return dict;
%End


%ConvertToTypeCode
    // Convert a Python dictionary to a TQMap on the heap.

    if (sipIsErr == NULL)
        return PyDict_Check(sipPy);

    TQMap<TQCString,TQCString> *cppmap = new TQMap<TQCString,TQCString>;

    PyObject *aelem, *belem;
    SIP_SSIZE_T pos = 0;
    TQCString *acpp;
    TQCString *bcpp;

    while (PyDict_Next(sipPy, &pos, &aelem, &belem))
    {
        int iserr = 0;

        acpp = (TQCString *)sipForceConvertToType(aelem, sipType_TQCString, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);
        bcpp = (TQCString *)sipForceConvertToType(belem, sipType_TQCString, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);

        if (iserr)
        {
            *sipIsErr = 1;
            delete cppmap;
            return 0;
        }

        cppmap->insert (*acpp, *bcpp);
    }

    *sipCppPtr = cppmap;

    return 1;
%End
};


%MappedType TQMap<TQCString,int>
//converts a Python dict of TQCString:int
{
%TypeHeaderCode
#include <tqmap.h>
%End

%ConvertFromTypeCode
    // Convert to a Python dict

    if (!sipCpp)
        return PyDict_New();

    PyObject *dict;

    // Create the dictionary.

    if ((dict = PyDict_New()) == NULL)
        return NULL;

    // Get it.

    const TQMap<TQCString,int> cppmap = *sipCpp;
    TQMap<TQCString,int>::ConstIterator it;

    for (it = cppmap.begin (); it != cppmap.end (); ++it)
    {
        TQCString acpp = it.key ();
        int bcpp = it.data ();
        PyObject *ainst;
        PyObject *binst = NULL;
        if (((ainst = sipConvertFromNewType(new TQCString (acpp), sipType_TQCString, NULL)) == NULL)
            || ((binst = PyInt_FromLong (bcpp)) == NULL)
            || (PyDict_SetItem (dict, ainst, binst) < 0))
        {
            Py_XDECREF (ainst);
            Py_XDECREF (binst);
            Py_DECREF (dict);
            return NULL;
        }
    }

    return dict;
%End


%ConvertToTypeCode
    // Convert a Python dictionary to a TQMap on the heap.

    if (sipIsErr == NULL)
        return PyDict_Check(sipPy);

    TQMap<TQCString,int> *cppmap = new TQMap<TQCString,int>;

    PyObject *aelem, *belem;
    SIP_SSIZE_T pos = 0;
    TQCString *acpp;
    int bcpp;

    while (PyDict_Next(sipPy, &pos, &aelem, &belem))
    {
        int iserr = 0;

        acpp = (TQCString *)sipForceConvertToType(aelem, sipType_TQCString, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);

        if (iserr || !PyInt_Check (belem))
        {
            *sipIsErr = 1;
            delete cppmap;
            return 0;
        }

        bcpp = PyInt_AS_LONG (belem);

        cppmap->insert (*acpp, bcpp);
    }

    *sipCppPtr = cppmap;

    return 1;
%End
};


%MappedType TQPtrList<KParts::ReadOnlyPart>
//converts a Python list of KParts.ReadOnlyPart
{
%TypeHeaderCode
#include <tqptrlist.h>
%End

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

    PyObject *pylist;

    // Create the list

    if ((pylist = PyList_New(0)) == NULL)
        return NULL;

    // Get it.

    TQPtrList<KParts::ReadOnlyPart> *cpplist = (TQPtrList<KParts::ReadOnlyPart> *)sipCpp;
    KParts::ReadOnlyPart *cpp;
    PyObject *inst;

    // the loop depends on the type of iterator the  tmeplate makes available
    for(cpp = cpplist->first (); cpp != 0; cpp = cpplist->next () )
    {
        if (((inst = sipConvertFromInstance (cpp, sipClass_KParts_ReadOnlyPart, sipTransferObj)) == NULL)
            || PyList_Append (pylist, inst) < 0)
        {
            Py_DECREF (pylist);
            return NULL;
        }
    }

    return pylist;
%End

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

    TQPtrList<KParts::ReadOnlyPart> *cpplist = new TQPtrList<KParts::ReadOnlyPart>;

    PyObject *elem;
    KParts::ReadOnlyPart *cpp;
    int iserr = 0;

    for (int i = 0; i < PyList_Size (sipPy); i++)
    {
        elem = PyList_GET_ITEM (sipPy, i);
        cpp = (KParts::ReadOnlyPart *)sipForceConvertToType(elem, sipType_KParts_ReadOnlyPart, sipTransferObj, SIP_NO_CONVERTORS, NULL, &iserr);

        if (iserr)
        {
            *sipIsErr = 1;
            delete cpplist;
            return 0;
        }

        cpplist->append (cpp);
    }

    *sipCppPtr = cpplist;

    return 1;
%End
};


