# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kshortcutlist.h

    00001 /*  This file is part of the KDE libraries
    00002     Copyright (C) 2002 Ellis Whitehead <ellis@kde.org>
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License as published by the Free Software Foundation; either
    00007     version 2 of the License, or (at your option) any later version.
    00008
    00009     This library is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     Library General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Library General Public License
    00015     along with this library; see the file COPYING.LIB.  If not, write to
    00016     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017     Boston, MA 02111-1307, USA.
    00018 */
    00019
    00020 #ifndef __KSHORTCUTLIST_H
    00021 #define __KSHORTCUTLIST_H
    00022
    00023 #include <qglobal.h>    // For uint
    00024 #include <qstring.h>
    00025 #include "kdelibs_export.h"
    00026
    00027 class QVariant;
    00028 class KConfigBase;
    00029 class KInstance;
    00030 class KKeySequence;
    00031 class KShortcut;
    00032
    00033 /**********************************************************************
    00034 * This is a wrapper class which allows a function to use one interface
    00035 * to KActionCollection, KAccelActions, and KActionPtrList.
    00036 **********************************************************************/
    00037
    00048 class KDECORE_EXPORT KShortcutList
    00049 {
    00050  public:
    00054     KShortcutList();
    00055     virtual ~KShortcutList();
    00056
    00061     virtual uint count() const = 0;
    00062
    00068     virtual QString name( uint index ) const = 0;
    00069
    00075     virtual QString label( uint index ) const = 0;
    00076
    00082     virtual QString whatsThis( uint index ) const = 0;
    00083
    00084     // TODO KDE4: add virtual QString toolTip( uint index ) const = 0
    00085     // Will then be used by the listview in kkeydialog
    00086
    00093     virtual const KShortcut& shortcut( uint index ) const = 0;
    00094
    00101     virtual const KShortcut& shortcutDefault( uint index ) const = 0;
    00102
    00108     virtual bool isConfigurable( uint index ) const = 0;
    00109
    00115     virtual bool setShortcut( uint index, const KShortcut &shortcut ) = 0;
    00116
    00123     virtual bool isGlobal( uint index ) const;
    00124
    00130     virtual int index( const QString& sName ) const;
    00131
    00137     virtual int index( const KKeySequence& keySeq ) const;
    00138
    00143     virtual const KInstance* instance() const;
    00144
    00145     // These are here in order to handle expansion.
    00146     enum Other { };
    00148     virtual QVariant getOther( Other, uint index ) const = 0;
    00150     virtual bool setOther( Other, uint index, QVariant ) = 0;
    00151
    00156     virtual bool save() const = 0;
    00157
    00165     virtual bool readSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 );
    00166
    00176     virtual bool writeSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0,
    00177             bool bWriteAll = false, bool bGlobal = false ) const;
    00178
    00179  protected:
    00181         virtual void virtual_hook( int id, void* data );
    00182  private:
    00183     class KShortcutListPrivate* d;
    00184 };
    00185
    00186 //---------------------------------------------------------------------
    00187 // KAccelShortcutList
    00188 //---------------------------------------------------------------------
    00189
    00190 class KAccel;
    00191 class KAccelActions;
    00192 class KGlobalAccel;
    00193
    00198 class KDECORE_EXPORT KAccelShortcutList : public KShortcutList
    00199 {
    00200  public:
    00205     KAccelShortcutList( KAccel* accel );
    00206
    00212     KAccelShortcutList( KGlobalAccel* accel );
    00213
    00222     KAccelShortcutList( KAccelActions &actions, bool bGlobal );
    00223     virtual ~KAccelShortcutList();
    00224
    00225     virtual uint count() const;
    00226     virtual QString name( uint index ) const;
    00227     virtual QString label( uint index ) const;
    00228     virtual QString whatsThis( uint index ) const;
    00229     virtual const KShortcut& shortcut( uint index ) const;
    00230     virtual const KShortcut& shortcutDefault( uint index ) const;
    00231     virtual bool isConfigurable( uint index ) const;
    00232     virtual bool setShortcut( uint index , const KShortcut& shortcut );
    00233     virtual bool isGlobal( uint index ) const;
    00234
    00236     virtual QVariant getOther( Other, uint index ) const;
    00238     virtual bool setOther( Other, uint index, QVariant );
    00239
    00240     virtual bool save() const;
    00241
    00242  protected:
    00243     KAccelActions& m_actions;
    00244     bool m_bGlobal;
    00245
    00246  protected:
    00247     virtual void virtual_hook( int id, void* data );
    00248  private:
    00249     class KAccelShortcutListPrivate* d;
    00250 };
    00251
    00252 namespace KStdAccel {
    00253 //---------------------------------------------------------------------
    00254 // ShortcutList
    00255 //---------------------------------------------------------------------
    00256
    00261 class KDECORE_EXPORT ShortcutList : public KShortcutList
    00262 {
    00263  public:
    00267     ShortcutList();
    00268     virtual ~ShortcutList();
    00269
    00270     virtual uint count() const;
    00271     virtual QString name( uint index ) const;
    00272     virtual QString label( uint index ) const;
    00273     virtual QString whatsThis( uint index ) const;
    00274     virtual const KShortcut& shortcut( uint index ) const;
    00275     virtual const KShortcut& shortcutDefault( uint index ) const;
    00276     virtual bool isConfigurable( uint index ) const;
    00277     virtual bool setShortcut( uint index , const KShortcut& shortcut );
    00278
    00280     virtual QVariant getOther( Other, uint index ) const;
    00282     virtual bool setOther( Other, uint index, QVariant );
    00283
    00284     virtual bool save() const;
    00285
    00286  protected:
    00287     virtual void virtual_hook( int id, void* data );
    00288  private:
    00289     class ShortcutListPrivate* d;
    00290 };
    00291 }
    00292
    00293 #endif // __KSHORTCUTLIST_H

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:10 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003