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


//                 Generated by preSip
//            module tdecore  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 KAccel : TQAccel
{
%TypeHeaderCode
#include <kaccel.h>
%End


public:
                         KAccel (TQWidget* /TransferThis/, const char* = 0);
                         KAccel (TQWidget*, TQObject* /TransferThis/, const char* = 0);
    KAccelActions&       actions ();
    bool                 isEnabled ();
    void                 setEnabled (bool);
    bool                 setAutoUpdate (bool);

%If ( KDE_3_1_4 -  )
    KAccelAction*        insert (const TQString&, const TQString&, const TQString&, const KShortcut&, SIP_RXOBJ_CON, SIP_SLOT_CON (), bool = 1, bool = 1);
    KAccelAction*        insert (const TQString&, const TQString&, const TQString&, const KShortcut&, const KShortcut&, SIP_RXOBJ_CON, SIP_SLOT_CON (), bool = 1, bool = 1);
    KAccelAction*        insert (const char*, const KShortcut&, SIP_RXOBJ_CON, SIP_SLOT_CON (), bool = 1, bool = 1);
    KAccelAction*        insert (KStdAccel::StdAccel, SIP_RXOBJ_CON, SIP_SLOT_CON (), bool = 1, bool = 1);
%End

    bool                 remove (const TQString&);
    bool                 updateConnections ();
    const KShortcut&     shortcut (const TQString&) const;
    bool                 setShortcut (const TQString&, const KShortcut&);

%If ( KDE_3_1_4 -  )
    bool                 setSlot (const TQString&, SIP_RXOBJ_CON, SIP_SLOT_CON ());
%End

    bool                 setEnabled (const TQString&, bool);
    const TQString&       configGroup () const;
    void                 setConfigGroup (const TQString&);
    bool                 readSettings (TDEConfigBase* = 0);
    bool                 writeSettings (TDEConfigBase* = 0) const;
    void                 emitKeycodeChanged ();

signals:
    void                 keycodeChanged ();

public:
    bool                 insertItem (const TQString&, const TQString&, const char*, int = 0, TQPopupMenu* = 0, bool = 1);
    bool                 insertItem (const TQString&, const TQString&, int, int, TQPopupMenu*, bool = 1);
    bool                 insertStdItem (KStdAccel::StdAccel, const TQString& = TQString ::null );

%If ( KDE_3_1_4 -  )
    bool                 connectItem (const TQString&, SIP_RXOBJ_CON, SIP_SLOT_CON (), bool = 1);
    bool                 connectItem (KStdAccel::StdAccel, SIP_RXOBJ_CON, SIP_SLOT_CON ());
%End

    bool                 removeItem (const TQString&);
    bool                 setItemEnabled (const TQString&, bool);
    void                 changeMenuAccel (TQPopupMenu*, int, const TQString&);
    void                 changeMenuAccel (TQPopupMenu*, int, KStdAccel::StdAccel);
    static int           stringToKey (const TQString&);
    int                  currentKey (const TQString&) const;
    TQString              findKey (int) const;

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

public:

%If (  - KDE_3_2_0 )
//ig     bool                 getAutoUpdate ();
//ig     KAccelAction*        insert (const TQString&, const TQString&);
%End


public:

%If (  - KDE_3_1_4 )
    KAccelAction*        insert (const TQString&, const TQString&, const TQString&, const KShortcut&, const TQObject*, const char*, bool = 1, bool = 1);
    KAccelAction*        insert (const TQString&, const TQString&, const TQString&, const KShortcut&, const KShortcut&, const TQObject*, const char*, bool = 1, bool = 1);
    KAccelAction*        insert (const char*, const KShortcut&, const TQObject*, const char*, bool = 1, bool = 1);
    KAccelAction*        insert (KStdAccel::StdAccel, const TQObject*, const char*, bool = 1, bool = 1);
    bool                 setSlot (const TQString&, const TQObject*, const char*);
%End


public:

%If (  - KDE_3_1_4 )
    bool                 connectItem (const TQString&, const TQObject*, const char*, bool = 1);
    bool                 connectItem (KStdAccel::StdAccel, const TQObject*, const char*);

//force
%ConvertToSubClassCode
    // The table of Python class objects indexed by their names.  The table
    // must be sorted by name.

    static sipStringTypeClassMap map[] = {
        {sipName_KAccel,                  &sipClass_KAccel},
        {sipName_TDEApplication,            &sipClass_TDEApplication},
        {sipName_KAsyncIO,                &sipClass_KAsyncIO},
        {sipName_KAudioPlayer,            &sipClass_KAudioPlayer},
        {sipName_TDEBufferedIO,             &sipClass_TDEBufferedIO},
#if TDE_VERSION >= 0x030100
        {sipName_TDEClipboardSynchronizer,  &sipClass_TDEClipboardSynchronizer},
#endif
        {sipName_KCompletion,             &sipClass_KCompletion},
        {sipName_TDEConfig,                 &sipClass_TDEConfig},
        {sipName_TDEConfigBase,             &sipClass_TDEConfigBase},
        {sipName_TDEConfigGroup,            &sipClass_TDEConfigGroup},
        {sipName_KDesktopFile,            &sipClass_KDesktopFile},
        {sipName_TDEGlobalAccel,            &sipClass_TDEGlobalAccel},
        {sipName_KLibFactory,             &sipClass_KLibFactory},
        {sipName_KLibLoader,              &sipClass_KLibLoader},
        {sipName_KLibrary,                &sipClass_KLibrary},
        {sipName_KMultipleDrag,           &sipClass_KMultipleDrag},
        {sipName_KProcIO,                 &sipClass_KProcIO},
        {sipName_TDEProcess,                &sipClass_TDEProcess},
        {sipName_TDEProcessController,      &sipClass_TDEProcessController},
        {sipName_TDEServerSocket,           &sipClass_TDEServerSocket},
        {sipName_KShellProcess,           &sipClass_KShellProcess},
        {sipName_KSimpleConfig,           &sipClass_KSimpleConfig},
        {sipName_TDESocket,                 &sipClass_TDESocket},
        {sipName_TDEStartupInfo,            &sipClass_TDEStartupInfo},
        {sipName_KUniqueApplication,      &sipClass_KUniqueApplication},
        {sipName_KWinModule,              &sipClass_KWinModule},
    };

    sipClass = sipMapStringToClass(sipCpp -> className(),map,sizeof (map)/sizeof (map[0]));
%End
//end
%End


};  // class KAccel



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

%ConvertFromTypeCode

    if (!sipCpp)
        return PyDict_New();

        PyObject *dict;

    // Create the dictionary.

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

    // Get it.

        const TQMap<int,TQString> map = *sipCpp;
        TQMap<int,TQString>::ConstIterator it;

    for (it = map.begin (); it != map.end (); ++it)
        {
                PyObject *iKey  = PyInt_FromLong (((long) it.key ()));
                PyObject *sData = PyString_FromString ((char *)((TQString *)&it.data ()));

                if ((iKey == NULL) || (sData == NULL) || (PyDict_SetItem (dict, iKey, sData) < 0))
                {
                        Py_XDECREF (iKey);
                        Py_XDECREF (sData);
                        Py_DECREF (dict);
                        return NULL;
                }
        }

    return dict;
%End


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

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

    TQMap<int,TQString> *map = new TQMap<int,TQString>;

    PyObject *key, *value;
    SIP_SSIZE_T pos = 0;
    int iKey;
    TQString *sData;

    while (PyDict_Next(sipPy, &pos, &key, &value))
    {
        int iserr = 0, sData_state;

        iKey = PyInt_AS_LONG (key);
        sData = (TQString *)sipForceConvertToType(value, sipType_TQString, sipTransferObj, SIP_NOT_NONE, &sData_state, &iserr);

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

        map->insert (iKey, *sData);

        sipReleaseType(sData, sipType_TQString, sData_state);
    }

    *sipCppPtr = map;

    return 1;
%End
};


