# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | 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 <qstring.h>
    00024 class QVariant;
    00025 class KInstance;
    00026 class KShortcut;
    00027 class KKeySequence;
    00028 class KConfigBase;
    00029
    00030 /**********************************************************************
    00031 * This is a wrapper class which allows a function to use one interface
    00032 * to KActionCollection, KAccelActions, and KActionPtrList.
    00033 **********************************************************************/
    00034
    00045 class KShortcutList
    00046 {
    00047  public:
    00051         KShortcutList();
    00052         virtual ~KShortcutList();
    00053
    00058         virtual unsigned int count() const = 0;
    00059
    00065         virtual QString name( unsigned int index ) const = 0;
    00066
    00072         virtual QString label( unsigned int index ) const = 0;
    00073
    00079         virtual QString whatsThis( unsigned int index ) const = 0;
    00080
    00087         virtual const KShortcut& shortcut( unsigned int index ) const = 0;
    00088
    00095         virtual const KShortcut& shortcutDefault( unsigned int index ) const = 0;
    00096
    00102         virtual bool isConfigurable( unsigned int index ) const = 0;
    00103
    00109         virtual bool setShortcut( unsigned int index, const KShortcut &shortcut ) = 0;
    00110
    00117         virtual bool isGlobal( unsigned int index ) const;
    00118
    00124         virtual int index( const QString& sName ) const;
    00125
    00131         virtual int index( const KKeySequence& keySeq ) const;
    00132
    00137         virtual const KInstance* instance() const;
    00138
    00139         // These are here in order to handle expansion.
    00140         enum Other { };
    00142         virtual QVariant getOther( Other, unsigned int index ) const = 0;
    00144         virtual bool setOther( Other, unsigned int index, QVariant ) = 0;
    00145
    00150         virtual bool save() const = 0;
    00151
    00159         virtual bool readSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 );
    00160
    00170         virtual bool writeSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0,
    00171                         bool bWriteAll = false, bool bGlobal = false ) const;
    00172
    00173  protected:
    00175         virtual void virtual_hook( int id, void* data );
    00176  private:
    00177         class KShortcutListPrivate* d;
    00178 };
    00179
    00180 //---------------------------------------------------------------------
    00181 // KAccelShortcutList
    00182 //---------------------------------------------------------------------
    00183
    00184 class KAccel;
    00185 class KAccelActions;
    00186 class KGlobalAccel;
    00187
    00192 class KAccelShortcutList : public KShortcutList
    00193 {
    00194  public:
    00199         KAccelShortcutList( KAccel* accel );
    00200
    00206         KAccelShortcutList( KGlobalAccel* accel );
    00207
    00216         KAccelShortcutList( KAccelActions &actions, bool bGlobal );
    00217         virtual ~KAccelShortcutList();
    00218
    00219         virtual unsigned int count() const;
    00220         virtual QString name( unsigned int index ) const;
    00221         virtual QString label( unsigned int index ) const;
    00222         virtual QString whatsThis( unsigned int index ) const;
    00223         virtual const KShortcut& shortcut( unsigned int index ) const;
    00224         virtual const KShortcut& shortcutDefault( unsigned int index ) const;
    00225         virtual bool isConfigurable( unsigned int index ) const;
    00226         virtual bool setShortcut( unsigned int index , const KShortcut& shortcut );
    00227         virtual bool isGlobal( unsigned int index ) const;
    00228
    00230         virtual QVariant getOther( Other, unsigned int index ) const;
    00232         virtual bool setOther( Other, unsigned int index, QVariant );
    00233
    00234         virtual bool save() const;
    00235
    00236  protected:
    00237         KAccelActions& m_actions;
    00238         bool m_bGlobal;
    00239
    00240  protected:
    00241         virtual void virtual_hook( int id, void* data );
    00242  private:
    00243         class KAccelShortcutListPrivate* d;
    00244 };
    00245
    00246 namespace KStdAccel {
    00247 //---------------------------------------------------------------------
    00248 // ShortcutList
    00249 //---------------------------------------------------------------------
    00250
    00255 class ShortcutList : public KShortcutList
    00256 {
    00257  public:
    00261         ShortcutList();
    00262         virtual ~ShortcutList();
    00263
    00264         virtual unsigned int count() const;
    00265         virtual QString name( unsigned int index ) const;
    00266         virtual QString label( unsigned int index ) const;
    00267         virtual QString whatsThis( unsigned int index ) const;
    00268         virtual const KShortcut& shortcut( unsigned int index ) const;
    00269         virtual const KShortcut& shortcutDefault( unsigned int index ) const;
    00270         virtual bool isConfigurable( unsigned int index ) const;
    00271         virtual bool setShortcut( unsigned int index , const KShortcut& shortcut );
    00272
    00274         virtual QVariant getOther( Other, unsigned int index ) const;
    00276         virtual bool setOther( Other, unsigned int index, QVariant );
    00277
    00278         virtual bool save() const;
    00279
    00280  protected:
    00281         virtual void virtual_hook( int id, void* data );
    00282  private:
    00283         class ShortcutListPrivate* d;
    00284 };
    00285 }
    00286
    00287 #endif // __KSHORTCUTLIST_H

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:46:53 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001