//
//     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 TDEAccel : TQAccel
{
%TypeHeaderCode
#include <tdeaccel.h>
%End


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

%If ( KDE_3_1_4 -  )
    TDEAccelAction*        insert (const TQString&, const TQString&, const TQString&, const TDEShortcut&, SIP_RXOBJ_CON, SIP_SLOT_CON (), bool = 1, bool = 1);
    TDEAccelAction*        insert (const TQString&, const TQString&, const TQString&, const TDEShortcut&, const TDEShortcut&, SIP_RXOBJ_CON, SIP_SLOT_CON (), bool = 1, bool = 1);
    TDEAccelAction*        insert (const char*, const TDEShortcut&, SIP_RXOBJ_CON, SIP_SLOT_CON (), bool = 1, bool = 1);
    TDEAccelAction*        insert (TDEStdAccel::StdAccel, SIP_RXOBJ_CON, SIP_SLOT_CON (), bool = 1, bool = 1);
%End

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

%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 (TDEStdAccel::StdAccel, const TQString& = TQString ::null );

%If ( KDE_3_1_4 -  )
    bool                 connectItem (const TQString&, SIP_RXOBJ_CON, SIP_SLOT_CON (), bool = 1);
    bool                 connectItem (TDEStdAccel::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, TDEStdAccel::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     TDEAccelAction*        insert (const TQString&, const TQString&);
%End


public:

%If (  - KDE_3_1_4 )
    TDEAccelAction*        insert (const TQString&, const TQString&, const TQString&, const TDEShortcut&, const TQObject*, const char*, bool = 1, bool = 1);
    TDEAccelAction*        insert (const TQString&, const TQString&, const TQString&, const TDEShortcut&, const TDEShortcut&, const TQObject*, const char*, bool = 1, bool = 1);
    TDEAccelAction*        insert (const char*, const TDEShortcut&, const TQObject*, const char*, bool = 1, bool = 1);
    TDEAccelAction*        insert (TDEStdAccel::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 (TDEStdAccel::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_TDEAccel,                  &sipClass_TDEAccel},
        {sipName_TDEApplication,            &sipClass_TDEApplication},
        {sipName_KAsyncIO,                &sipClass_KAsyncIO},
        {sipName_KAudioPlayer,            &sipClass_KAudioPlayer},
        {sipName_TDEBufferedIO,             &sipClass_TDEBufferedIO},
        {sipName_TDEClipboardSynchronizer,  &sipClass_TDEClipboardSynchronizer},
        {sipName_TDECompletion,             &sipClass_TDECompletion},
        {sipName_TDEConfig,                 &sipClass_TDEConfig},
        {sipName_TDEConfigBase,             &sipClass_TDEConfigBase},
        {sipName_TDEConfigGroup,            &sipClass_TDEConfigGroup},
        {sipName_TDEDesktopFile,            &sipClass_TDEDesktopFile},
        {sipName_TDEGlobalAccel,            &sipClass_TDEGlobalAccel},
        {sipName_KLibFactory,             &sipClass_KLibFactory},
        {sipName_KLibLoader,              &sipClass_KLibLoader},
        {sipName_KLibrary,                &sipClass_KLibrary},
        {sipName_KMultipleDrag,           &sipClass_KMultipleDrag},
        {sipName_TDEProcIO,                 &sipClass_TDEProcIO},
        {sipName_TDEProcess,                &sipClass_TDEProcess},
        {sipName_TDEProcessController,      &sipClass_TDEProcessController},
        {sipName_TDEServerSocket,           &sipClass_TDEServerSocket},
        {sipName_KShellProcess,           &sipClass_KShellProcess},
        {sipName_TDESimpleConfig,           &sipClass_TDESimpleConfig},
        {sipName_TDESocket,                 &sipClass_TDESocket},
        {sipName_TDEStartupInfo,            &sipClass_TDEStartupInfo},
        {sipName_TDEUniqueApplication,      &sipClass_TDEUniqueApplication},
        {sipName_TWinModule,              &sipClass_TWinModule},
    };

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


};  // class TDEAccel



%MappedType TQMap<int,TQString>
//converts a Python dict of int:TQString
{
%TypeHeaderCode
#include <tdeaccel.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  = PyLong_FromLong (((long) it.key ()));
                PyObject *sData = PyBytes_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 = PyLong_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
};


