// // Copyright 2006 Jim Bublitz // 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 %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 (KConfigBase* = 0); bool writeSettings (KConfigBase* = 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_KApplication, &sipClass_KApplication}, {sipName_KAsyncIO, &sipClass_KAsyncIO}, {sipName_KAudioPlayer, &sipClass_KAudioPlayer}, {sipName_KBufferedIO, &sipClass_KBufferedIO}, #if TDE_VERSION >= 0x030100 {sipName_KClipboardSynchronizer, &sipClass_KClipboardSynchronizer}, #endif {sipName_KCompletion, &sipClass_KCompletion}, {sipName_KConfig, &sipClass_KConfig}, {sipName_KConfigBase, &sipClass_KConfigBase}, {sipName_KConfigGroup, &sipClass_KConfigGroup}, {sipName_KDesktopFile, &sipClass_KDesktopFile}, {sipName_KGlobalAccel, &sipClass_KGlobalAccel}, {sipName_KLibFactory, &sipClass_KLibFactory}, {sipName_KLibLoader, &sipClass_KLibLoader}, {sipName_KLibrary, &sipClass_KLibrary}, {sipName_KMultipleDrag, &sipClass_KMultipleDrag}, {sipName_KProcIO, &sipClass_KProcIO}, {sipName_KProcess, &sipClass_KProcess}, {sipName_KProcessController, &sipClass_KProcessController}, {sipName_KServerSocket, &sipClass_KServerSocket}, {sipName_KShellProcess, &sipClass_KShellProcess}, {sipName_KSimpleConfig, &sipClass_KSimpleConfig}, {sipName_KSocket, &sipClass_KSocket}, {sipName_KStartupInfo, &sipClass_KStartupInfo}, {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 //converts a Python dict of int:TQString { %TypeHeaderCode #include %End %ConvertFromTypeCode if (!sipCpp) return PyDict_New(); PyObject *dict; // Create the dictionary. if ((dict = PyDict_New()) == NULL) return NULL; // Get it. const TQMap map = *sipCpp; TQMap::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 *map = new TQMap; 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 };