• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

tdeaccelbase.h
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2001 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., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef _TDEACCELBASE_H
00021 #define _TDEACCELBASE_H
00022 
00023 #include <tqmap.h>
00024 #include <tqptrvector.h>
00025 #include <tqstring.h>
00026 #include <tqvaluevector.h>
00027 #include <tqvaluelist.h>
00028 
00029 #include "tdeaccelaction.h"
00030 #include "kkeyserver.h"
00031 
00032 class TQPopupMenu;
00033 class TQWidget;
00034 
00035 //----------------------------------------------------
00036 
00121 class TDECORE_EXPORT TDEAccelBase
00122 {
00123  public:
00125     enum Init { QT_KEYS = 0x00, NATIVE_KEYS = 0x01 };
00126 
00128     enum Signal { KEYCODE_CHANGED };
00129 
00133     TDEAccelBase( int fInitCode );
00134     virtual ~TDEAccelBase();
00135 
00137     uint actionCount() const;
00139     TDEAccelActions& actions();
00141     bool isEnabled() const;
00142 
00144     TDEAccelAction* actionPtr( const TQString& sAction );
00146     const TDEAccelAction* actionPtr( const TQString& sAction ) const;
00154     TDEAccelAction* actionPtr( const KKey& key );
00158     TDEAccelAction* actionPtr( const KKeyServer::Key& key );
00159 
00163     const TQString& configGroup() const { return m_sConfigGroup; }
00167     void setConfigGroup( const TQString& group );
00168     void setConfigGlobal( bool global );
00173     virtual void setEnabled( bool bEnabled ) = 0;
00175     bool getAutoUpdate() { return m_bAutoUpdate; }
00179     bool setAutoUpdate( bool bAuto );
00180 
00181 // Procedures for manipulating Actions.
00182     //void clearActions();
00183 
00184     TDEAccelAction* insert( const TQString& sName, const TQString& sDesc );
00185     TDEAccelAction* insert(
00186                      const TQString& sAction, const TQString& sDesc, const TQString& sHelp,
00187                      const TDEShortcut& rgCutDefaults3, const TDEShortcut& rgCutDefaults4,
00188                      const TQObject* pObjSlot, const char* psMethodSlot,
00189              bool bConfigurable = true, bool bEnabled = true );
00190     bool remove( const TQString& sAction );
00191     bool setActionSlot( const TQString& sAction, const TQObject* pObjSlot, const char* psMethodSlot );
00192 
00193     bool updateConnections();
00194 
00195     bool setShortcut( const TQString& sAction, const TDEShortcut& cut );
00196 
00197 // Modify individual Action sub-items
00198     bool setActionEnabled( const TQString& sAction, bool bEnable );
00199 
00208     void readSettings( TDEConfigBase* pConfig = 0 );
00209 
00215     void writeSettings( TDEConfigBase* pConfig = 0 ) const;
00216 
00217     TQPopupMenu* createPopupMenu( TQWidget* pParent, const KKeySequence& );
00218 
00219  // Protected methods
00220  protected:
00221     void slotRemoveAction( TDEAccelAction* );
00222 
00223     struct X;
00224 
00228     void createKeyList( TQValueVector<struct X>& rgKeys );
00229     bool insertConnection( TDEAccelAction* );
00230     bool removeConnection( TDEAccelAction* );
00231 
00235     virtual bool emitSignal( Signal signal ) = 0;
00240     virtual bool connectKey( TDEAccelAction& action, const KKeyServer::Key& key ) = 0;
00244     virtual bool connectKey( const KKeyServer::Key& key) = 0;
00247     virtual bool disconnectKey( TDEAccelAction&, const KKeyServer::Key& ) = 0;
00250     virtual bool disconnectKey( const KKeyServer::Key& ) = 0;
00251 
00252  protected:
00253         virtual bool isEnabledInternal() const;
00254     struct ActionInfo
00255     {
00256         TDEAccelAction* pAction;
00257         uint iSeq, iVariation;
00258         //ActionInfo* pInfoNext; // nil if only one action uses this key.
00259 
00260         ActionInfo() { pAction = 0; iSeq = 0xffff; iVariation = 0xffff; }
00261         ActionInfo( TDEAccelAction* _pAction, uint _iSeq, uint _iVariation )
00262             { pAction = _pAction; iSeq = _iSeq; iVariation = _iVariation; }
00263     };
00264     typedef TQMap<KKeyServer::Key, ActionInfo> KKeyToActionMap;
00265 
00266     TDEAccelActions m_rgActions;
00267     KKeyToActionMap m_mapKeyToAction;
00268     TQValueList<TDEAccelAction*> m_rgActionsNonUnique;
00269     bool m_bNativeKeys; // Use native key codes instead of Qt codes
00270     bool m_bEnabled;
00271     bool m_bConfigIsGlobal;
00272     TQString m_sConfigGroup;
00273     bool m_bAutoUpdate;
00274     TDEAccelAction* mtemp_pActionRemoving;
00275 
00276  private:
00277     TDEAccelBase& operator =( const TDEAccelBase& );
00278 
00279     friend class TDEAccelActions;
00280 };
00281 
00282 #endif // _TDEACCELBASE_H

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.