From 2d00595867197e5b5563d85e871a59a77a23f70f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 1 Feb 2013 17:25:38 -0600 Subject: Fix FTBFS --- extra/kde353/kaccelaction.h | 576 ---------------------------------------- extra/kde353/kaccelbase.h | 260 ------------------ extra/kde353/ktoolbarbutton.h | 330 ----------------------- extra/kde353/tdeaccelaction.h | 576 ++++++++++++++++++++++++++++++++++++++++ extra/kde353/tdeaccelbase.h | 260 ++++++++++++++++++ extra/kde353/tdetoolbarbutton.h | 330 +++++++++++++++++++++++ 6 files changed, 1166 insertions(+), 1166 deletions(-) delete mode 100644 extra/kde353/kaccelaction.h delete mode 100644 extra/kde353/kaccelbase.h delete mode 100644 extra/kde353/ktoolbarbutton.h create mode 100644 extra/kde353/tdeaccelaction.h create mode 100644 extra/kde353/tdeaccelbase.h create mode 100644 extra/kde353/tdetoolbarbutton.h (limited to 'extra/kde353') diff --git a/extra/kde353/kaccelaction.h b/extra/kde353/kaccelaction.h deleted file mode 100644 index 809533f..0000000 --- a/extra/kde353/kaccelaction.h +++ /dev/null @@ -1,576 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2001,2002 Ellis Whitehead - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _KACCELACTION_H -#define _KACCELACTION_H - -#include -#include -#include -#include - -#include - -class TDEAccelBase; - -class TQObject; -class TDEConfig; -class TDEConfigBase; - -/** - * @internal - * A TDEAccelAction prepresents an action that can be executed using - * an accelerator key. Each TDEAccelAction has a name, a label, a - * "What's this" string and a TDEShortcut. The user can configure and - * enable/disable them using KKeyDialog. - * - * \code - * 1) TDEAccelAction = "Run Command" - * Default3 = "Alt+F2" - * Default4 = "Meta+Enter;Alt+F2" - * 1) TDEShortcut = "Meta+Enter" - * 1) KKeySequence = "Meta+Enter" - * 1) KKey = "Meta+Enter" - * 1) Meta+Enter - * 2) Meta+Keypad_Enter - * 2) TDEShortcut = "Alt+F2" - * 1) KKeySequence = "Alt+F2" - * 1) Alt+F2 - * 2) TDEAccelAction = "Something" - * Default3 = "" - * Default4 = "" - * 1) TDEShortcut = "Meta+X,Asterisk" - * 1) KKeySequence = "Meta+X,Asterisk" - * 1) KKey = "Meta+X" - * 1) Meta+X - * 2) KKey = "Asterisk" - * 1) Shift+8 (English layout) - * 2) Keypad_Asterisk - * \endcode - * @short An accelerator action - * @see TDEAccel - * @see TDEGlobalAccel - * @see KKeyChooser - * @see KKeyDialog - */ -class TDECORE_EXPORT TDEAccelAction -{ - public: - /** - * Creates an empty TDEAccelAction. - * @see clear() - */ - TDEAccelAction(); - - /** - * Copy constructor. - */ - TDEAccelAction( const TDEAccelAction& ); - - /** - * Creates a new TDEAccelAction. - * @param sName the name of the accelerator - * @param sLabel the label of the accelerator (i18n!) - * @param sWhatsThis the What's This text (18n!) - * @param cutDef3 the default shortcut for 3 modifier systems - * @param cutDef4 the default shortcut for 4 modifier systems - * @param pObjSlot the receiver of a signal when the key has been - * pressed - * @param psMethodSlot the slot to connect for key presses. Receives - * an int, as set by setID(), as only argument - * @param bConfigurable if true the user can configure the shortcut - * @param bEnabled true if the accelerator should be enabled - */ - TDEAccelAction( const TQString& sName, const TQString& sLabel, const TQString& sWhatsThis, - const TDEShortcut& cutDef3, const TDEShortcut& cutDef4, - const TQObject* pObjSlot, const char* psMethodSlot, - bool bConfigurable, bool bEnabled ); - ~TDEAccelAction(); - - /** - * Clears the accelerator. - */ - void clear(); - - /** - * Re-initialized the TDEAccelAction. - * @param sName the name of the accelerator - * @param sLabel the label of the accelerator (i18n!) - * @param sWhatsThis the What's This text (18n!) - * @param cutDef3 the default shortcut for 3 modifier systems - * @param cutDef4 the default shortcut for 4 modifier systems - * @param pObjSlot the receiver of a signal when the key has been - * pressed - * @param psMethodSlot the slot to connect for key presses. Receives - * an int, as set by setID(), as only argument - * @param bConfigurable if true the user can configure the shortcut - * @param bEnabled true if the accelerator should be enabled - * @return true if successful, false otherwise - */ - bool init( const TQString& sName, const TQString& sLabel, const TQString& sWhatsThis, - const TDEShortcut& cutDef3, const TDEShortcut& cutDef4, - const TQObject* pObjSlot, const char* psMethodSlot, - bool bConfigurable, bool bEnabled ); - - /** - * Copies this TDEAccelAction. - */ - TDEAccelAction& operator=( const TDEAccelAction& ); - - /** - * Returns the name of the accelerator action. - * @return the name of the accelerator action, can be null if not - * set - */ - const TQString& name() const { return m_sName; } - - /** - * Returns the label of the accelerator action. - * @return the label of the accelerator action, can be null if - * not set - */ - const TQString& label() const { return m_sLabel; } - - /** - * Returns the What's This text of the accelerator action. - * @return the What's This text of the accelerator action, can be - * null if not set - */ - const TQString& whatsThis() const { return m_sWhatsThis; } - - /** - * The shortcut that is actually used (may be used configured). - * @return the shortcut of the TDEAccelAction, can be null if not set - * @see shortcutDefault() - */ - const TDEShortcut& shortcut() const { return m_cut; } - - /** - * The default shortcut for this system. - * @return the default shortcut on this system, can be null if not set - * @see shortcut() - * @see shortcutDefault3() - * @see shortcutDefault4() - */ - const TDEShortcut& shortcutDefault() const; - - /** - * The default shortcut for 3 modifier systems. - * @return the default shortcut for 3 modifier systems, can be null - * if not set - * @see shortcutDefault() - * @see shortcutDefault4() - * @see useFourModifierKeys() - */ - const TDEShortcut& shortcutDefault3() const { return m_cutDefault3; } - - /** - * The default shortcut for 4 modifier systems. - * @return the default shortcut for 4 modifier systems, can be null - * if not set - * @see shortcutDefault() - * @see shortcutDefault3() - * @see useFourModifierKeys() - */ - const TDEShortcut& shortcutDefault4() const { return m_cutDefault4; } - - /** - * Returns the receiver of signals. - * @return the receiver of signals (can be 0 if not set) - */ - const TQObject* objSlotPtr() const { return m_pObjSlot; } - - /** - * Returns the slot for the signal. - * @return the slot for the signal - */ - const char* methodSlotPtr() const { return m_psMethodSlot; } - - /** - * Checks whether the user can configure the action. - * @return true if configurable, false otherwise - */ - bool isConfigurable() const { return m_bConfigurable; } - - /** - * Checks whether the action is enabled. - * @return true if enabled, false otherwise - */ - bool isEnabled() const { return m_bEnabled; } - - /** - * Sets the name of the accelerator action. - * @param name the new name - */ - void setName( const TQString& name ); - - /** - * Sets the user-readable label of the accelerator action. - * @param label the new label (i18n!) - */ - void setLabel( const TQString& label ); - - /** - * Sets the What's This text for the accelerator action. - * @param whatsThis the new What's This text (i18n!) - */ - void setWhatsThis( const TQString& whatsThis ); - - /** - * Sets the new shortcut of the accelerator action. - * @param rgCuts the shortcut to set - * @return true if successful, false otherwise - */ - bool setShortcut( const TDEShortcut& rgCuts ); - - /** - * Sets the slot of the accelerator action. - * @param pObjSlot the receiver object of the signal - * @param psMethodSlot the slot for the signal - */ - void setSlot( const TQObject* pObjSlot, const char* psMethodSlot ); - - /** - * Enables or disabled configuring the action. - * @param configurable true to enable configurability, false to disable - */ - void setConfigurable( bool configurable ); - - /** - * Enables or disabled the action. - * @param enable true to enable the action, false to disable - */ - void setEnabled( bool enable ); - - /** - * Retrieves the id set using setID. - * @return the id of the accelerator action - */ - int getID() const { return m_nIDAccel; } - - /** - * Allows you to set an id that will be used as the action - * signal's argument. - * - * @param n the new id - * @see getID() - */ - void setID( int n ) { m_nIDAccel = n; } - - /** - * Checkes whether the action is connected (emits signals). - * @return true if connected, false otherwise - */ - bool isConnected() const; - - /** - * Sets a key sequence of the action's shortcut. - * @param i the position of the sequence - * @param keySeq the new new sequence - * @return true if successful, false otherwise - * @see TDEShortcut::setSeq() - */ - bool setKeySequence( uint i, const KKeySequence &keySeq ); - - /** - * Clears the action's shortcut. It will not contain any sequences after - * calling this method. - * @see TDEShortcut::clear() - */ - void clearShortcut(); - - /** - * Checks whether the action's shortcut contains the given key sequence. - * @param keySeq the key sequence to check - * @return true if the shortcut contains the given sequence - * @see TDEShortcut::contains() - */ - bool contains( const KKeySequence &keySeq ); - - /** - * Returns the string representation of the action's shortcut. - * @return the string representation of the action's shortcut. - * @see TDEShortcut::toString() - */ - TQString toString() const; - - /** - * @internal - */ - TQString toStringInternal() const; - - /** - * Returns true if four modifier keys will be used. - * @return true if four modifier keys will be used. - */ - static bool useFourModifierKeys(); - - /** - * Selects 3 or 4 modifier default shortcuts. - * @param use true to use 4 modifier shortcuts, false to use - * 3 modifier shortcuts - */ - static void useFourModifierKeys( bool use ); - - protected: - TQString m_sName /**< Name of accel. @sa setName() */, - m_sLabel /**< Label of accel. User-visible. */, - m_sWhatsThis /**< WhatsThis help for accel. User-visible. */; - TDEShortcut m_cut /**< Shortcut actually assigned. */; - TDEShortcut m_cutDefault3 /**< Default shortcut in 3-modifier layout */, - m_cutDefault4 /**< Default shortcur in 4-modifier layout */; - const TQObject* m_pObjSlot /**< Object we will send signals to. */; - const char* m_psMethodSlot /**< Slot we send signals to, in m_pObjSlot */; - bool m_bConfigurable /**< Can this accel be configured by the user? */, - m_bEnabled /**< Is this accel enabled? */; - int m_nIDAccel /**< Id of this accel, from the list of IDs */; - uint m_nConnections /**< Number of connections to this accel. */ ; - - /** @internal Increment the number of connections to this accel. */ - void incConnections(); - /** @internal Decrement the number of connections to this accel (bouded by zero). */ - void decConnections(); - - private: - static int g_bUseFourModifierKeys; - class TDEAccelActionPrivate* d; - - friend class TDEAccelActions; - friend class TDEAccelBase; -}; - -//--------------------------------------------------------------------- -// TDEAccelActions -//--------------------------------------------------------------------- - -/** - * @internal - * This class represents a collection of TDEAccelAction objects. - * - * @short A collection of accelerator actions - * @see TDEAccelAction - */ -class TDECORE_EXPORT TDEAccelActions -{ - public: - /** - * Creates a new, empty TDEAccelActions object. - */ - TDEAccelActions(); - - /** - * Copy constructor (deep copy). - */ - TDEAccelActions( const TDEAccelActions& ); - virtual ~TDEAccelActions(); - - /** - * Removes all items from this collection. - */ - void clear(); - - /** - * Initializes this object with the given actions. - * It will make a deep copy of all actions. - * @param actions the actions to copy - * @return true if successful, false otherwise - */ - bool init( const TDEAccelActions &actions ); - - /** - * Loads the actions from the given configuration file. - * - * @param config the configuration file to load from - * @param sGroup the group in the configuration file - * @return true if successful, false otherwise - */ - bool init( TDEConfigBase& config, const TQString& sGroup ); - - /** - * Updates the shortcuts of all actions in this object - * with the shortcuts from the given object. - * @param shortcuts the collection that contains the new - * shortcuts - */ - void updateShortcuts( TDEAccelActions &shortcuts ); - - /** - * Retrieves the index of the action with the given name. - * @param sAction the action to search - * @return the index of the action, or -1 if not found - */ - int actionIndex( const TQString& sAction ) const; - - /** - * Returns the action with the given @p index. - * @param index the index of an action. You must not - * use an index that is too high. - * @return the TDEAccelAction with the given index - * @see count() - */ - TDEAccelAction* actionPtr( uint index ); - - /** - * Returns the action with the given @p index. - * @param index the index of an action. You must not - * use an index that is too high. - * @return the TDEAccelAction with the given index - * @see count() - */ - const TDEAccelAction* actionPtr( uint index ) const; - - /** - * Returns the action with the given name. - * @param sAction the name of the action to search - * @return the TDEAccelAction with the given name, or 0 - * if not found - */ - TDEAccelAction* actionPtr( const TQString& sAction ); - - /** - * Returns the action with the given name. - * @param sAction the name of the action to search - * @return the TDEAccelAction with the given name, or 0 - * if not found - */ - const TDEAccelAction* actionPtr( const TQString& sAction ) const; - - /** - * Returns the action with the given key sequence. - * @param cut the sequence to search for - * @return the TDEAccelAction with the given sequence, or 0 - * if not found - */ - TDEAccelAction* actionPtr( KKeySequence cut ); - - /** - * Returns the action with the given @p index. - * @param index the index of an action. You must not - * use an index that is too high. - * @return the TDEAccelAction with the given index - * @see actionPtr() - * @see count() - */ - TDEAccelAction& operator []( uint index ); - - /** - * Returns the action with the given @p index. - * @param index the index of an action. You must not - * use an index that is too high. - * @return the TDEAccelAction with the given index - * @see actionPtr() - * @see count() - */ - const TDEAccelAction& operator []( uint index ) const; - - /** - * Inserts an action into the collection. - * @param sAction the name of the accelerator - * @param sLabel the label of the accelerator (i18n!) - * @param sWhatsThis the What's This text (18n!) - * @param rgCutDefaults3 the default shortcut for 3 modifier systems - * @param rgCutDefaults4 the default shortcut for 4 modifier systems - * @param pObjSlot the receiver of a signal when the key has been - * pressed - * @param psMethodSlot the slot to connect for key presses. Receives - * an int, as set by setID(), as only argument - * @param bConfigurable if true the user can configure the shortcut - * @param bEnabled if true the accelerator should be enabled - * @return the new action - */ - TDEAccelAction* insert( const TQString& sAction, const TQString& sLabel, const TQString& sWhatsThis, - const TDEShortcut& rgCutDefaults3, const TDEShortcut& rgCutDefaults4, - const TQObject* pObjSlot = 0, const char* psMethodSlot = 0, - bool bConfigurable = true, bool bEnabled = true ); - - /** - * Inserts an action into the collection. - * @param sName the name of the accelerator - * @param sLabel the label of the accelerator (i18n!) - * @return the new action - */ - TDEAccelAction* insert( const TQString& sName, const TQString& sLabel ); - - /** - * Removes the given action. - * @param sAction the name of the action. - * @return true if successful, false otherwise - */ - bool remove( const TQString& sAction ); - - /** - * Loads the actions from the given configuration file. - * - * @param sConfigGroup the group in the configuration file - * @param pConfig the configuration file to load from - * @return true if successful, false otherwise - */ - bool readActions( const TQString& sConfigGroup = "Shortcuts", TDEConfigBase* pConfig = 0 ); - - /** - * Writes the actions to the given configuration file. - * - * @param sConfigGroup the group in the configuration file - * @param pConfig the configuration file to save to - * @param bWriteAll true to write all actions - * @param bGlobal true to write to the global configuration file - * @return true if successful, false otherwise - */ - bool writeActions( const TQString& sConfigGroup = "Shortcuts", TDEConfigBase* pConfig = 0, - bool bWriteAll = false, bool bGlobal = false ) const; - - /** - * Emit a keycodeChanged signal. - */ - void emitKeycodeChanged(); - - /** - * Returns the number of actions in the collection. - * @return the number of actions - */ - uint count() const; - - protected: - /** Base object that proxies signals from us. */ - TDEAccelBase* m_pTDEAccelBase; - /** Array of actions we're hanging on to. */ - TDEAccelAction** m_prgActions; - uint m_nSizeAllocated /**< Allocated size of the array. */, - m_nSize /**< Amount in use. */ ; - - /** - * Resize the list to the given number @p new_size of entries. - * @todo Can you make it smaller? - * @todo Implementation seems to break m_nSize. - */ - void resize( uint new_size ); - /** Add a action to this collection. @todo Document ownership. */ - void insertPtr( TDEAccelAction* ); - - private: - class TDEAccelActionsPrivate* d; - - TDEAccelActions( TDEAccelBase* ); - void initPrivate( TDEAccelBase* ); - TDEAccelActions& operator =( TDEAccelActions& ); - - friend class TDEAccelBase; -}; - -#endif // _KACCELACTION_H diff --git a/extra/kde353/kaccelbase.h b/extra/kde353/kaccelbase.h deleted file mode 100644 index e5d832a..0000000 --- a/extra/kde353/kaccelbase.h +++ /dev/null @@ -1,260 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2001 Ellis Whitehead - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _KACCELBASE_H -#define _KACCELBASE_H - -#include -#include -#include -#include -#include - -#include "kaccelaction.h" -#include "kkeyserver.h" - -class TQPopupMenu; -class TQWidget; - -//---------------------------------------------------- - -/** - * @internal - * Handle keyboard accelerators. - * - * Allow an user to configure - * key bindings through application configuration files or through the - * KKeyChooser GUI. - * - * A TDEAccel contains a list of accelerator items. Each accelerator item - * consists of an action name and a keyboard code combined with modifiers - * (Shift, Ctrl and Alt.) - * - * For example, "Ctrl+P" could be a shortcut for printing a document. The key - * codes are listed in ckey.h. "Print" could be the action name for printing. - * The action name identifies the key binding in configuration files and the - * KKeyChooser GUI. - * - * When pressed, an accelerator key calls the slot to which it has been - * connected. Accelerator items can be connected so that a key will activate - * two different slots. - * - * A TDEAccel object handles key events sent to its parent widget and to all - * children of this parent widget. - * - * Key binding reconfiguration during run time can be prevented by specifying - * that an accelerator item is not configurable when it is inserted. A special - * group of non-configurable key bindings are known as the - * standard accelerators. - * - * The standard accelerators appear repeatedly in applications for - * standard document actions such as printing and saving. Convenience methods are - * available to insert and connect these accelerators which are configurable on - * a desktop-wide basis. - * - * It is possible for a user to choose to have no key associated with - * an action. - * - * The translated first argument for insertItem() is used only - * in the configuration dialog. - *\code - * TDEAccel *a = new TDEAccel( myWindow ); - * // Insert an action "Scroll Up" which is associated with the "Up" key: - * a->insertItem( i18n("Scroll Up"), "Scroll Up", "Up" ); - * // Insert an action "Scroll Down" which is not associated with any key: - * a->insertItem( i18n("Scroll Down"), "Scroll Down", 0); - * a->connectItem( "Scroll up", myWindow, SLOT( scrollUp() ) ); - * // a->insertStdItem( TDEStdAccel::Print ); //not necessary, since it - * // is done automatially with the - * // connect below! - * a->connectItem(TDEStdAccel::Print, myWindow, SLOT( printDoc() ) ); - * - * a->readSettings(); - *\endcode - * - * If a shortcut has a menu entry as well, you could insert them like - * this. The example is again the TDEStdAccel::Print from above. - * - * \code - * int id; - * id = popup->insertItem("&Print",this, SLOT(printDoc())); - * a->changeMenuAccel(popup, id, TDEStdAccel::Print ); - * \endcode - * - * If you want a somewhat "exotic" name for your standard print action, like - * id = popup->insertItem(i18n("Print &Document"),this, SLOT(printDoc())); - * it might be a good idea to insert the standard action before as - * a->insertStdItem( TDEStdAccel::Print, i18n("Print Document") ) - * as well, so that the user can easily find the corresponding function. - * - * This technique works for other actions as well. Your "scroll up" function - * in a menu could be done with - * - * \code - * id = popup->insertItem(i18n"Scroll &up",this, SLOT(scrollUp())); - * a->changeMenuAccel(popup, id, "Scroll Up" ); - * \endcode - * - * Please keep the order right: First insert all functions in the - * acceleratior, then call a -> readSettings() and @em then build your - * menu structure. - * - * @short Configurable key binding support. - */ - -class TDECORE_EXPORT TDEAccelBase -{ - public: - /** Initialization mode of the TDEAccelBase, used in constructor. */ - enum Init { QT_KEYS = 0x00, NATIVE_KEYS = 0x01 }; - - /** Enum for kinds of signals which may be emitted. */ - enum Signal { KEYCODE_CHANGED }; - - /** Constructor. @p fInitCode should be a bitwise OR of - * values from the Init enum. - */ - TDEAccelBase( int fInitCode ); - virtual ~TDEAccelBase(); - - /** Returns number of actions in this handler. */ - uint actionCount() const; - /** Returns a list of all the actions in this handler. */ - TDEAccelActions& actions(); - /** Returns whether this accelerator handler is enabled or not. */ - bool isEnabled() const; - - /** Returns a pointer to the TDEAccelAction named @p sAction. */ - TDEAccelAction* actionPtr( const TQString& sAction ); - /** Const version of the above. */ - const TDEAccelAction* actionPtr( const TQString& sAction ) const; - /** Returns a pointer to the TDEAccelAction associated with - * the key @p key. This function takes into account the - * key mapping defined in the constructor. - * - * May return 0 if no (or more than one) - * action is associated with the key. - */ - TDEAccelAction* actionPtr( const KKey& key ); - /** Basically the same as above, except a KKeyServer::Key - * already has a key mapping defined (either NATIVE_KEYS or not). - */ - TDEAccelAction* actionPtr( const KKeyServer::Key& key ); - - /** Returns the name of the configuration group these - * accelerators are stored in. The default is "Shortcuts". - */ - const TQString& configGroup() const { return m_sConfigGroup; } - /** Set the group (in the configuration file) for storing - * accelerators. - */ - void setConfigGroup( const TQString& group ); - void setConfigGlobal( bool global ); - virtual void setEnabled( bool bEnabled ) = 0; - /** Returns whether autoupdate is enabled for these accelerators. */ - bool getAutoUpdate() { return m_bAutoUpdate; } - /** Enables (or disables) autoupdate for these accelerators. - * @return the value of autoupdate before the call. - */ - bool setAutoUpdate( bool bAuto ); - -// Procedures for manipulating Actions. - //void clearActions(); - - TDEAccelAction* insert( const TQString& sName, const TQString& sDesc ); - TDEAccelAction* insert( - const TQString& sAction, const TQString& sDesc, const TQString& sHelp, - const TDEShortcut& rgCutDefaults3, const TDEShortcut& rgCutDefaults4, - const TQObject* pObjSlot, const char* psMethodSlot, - bool bConfigurable = true, bool bEnabled = true ); - bool remove( const TQString& sAction ); - bool setActionSlot( const TQString& sAction, const TQObject* pObjSlot, const char* psMethodSlot ); - - bool updateConnections(); - - bool setShortcut( const TQString& sAction, const TDEShortcut& cut ); - -// Modify individual Action sub-items - bool setActionEnabled( const TQString& sAction, bool bEnable ); - - /** - * Read all key associations from @p config, or (if @p config - * is zero) from the application's configuration file - * TDEGlobal::config(). - * - * The group in which the configuration is stored can be - * set with setConfigGroup(). - */ - void readSettings( TDEConfigBase* pConfig = 0 ); - - /** - * Write the current configurable associations to @p config, - * or (if @p config is zero) to the application's - * configuration file. - */ - void writeSettings( TDEConfigBase* pConfig = 0 ) const; - - TQPopupMenu* createPopupMenu( TQWidget* pParent, const KKeySequence& ); - - // Protected methods - protected: - void slotRemoveAction( TDEAccelAction* ); - - struct X; - void createKeyList( TQValueVector& rgKeys ); - bool insertConnection( TDEAccelAction* ); - bool removeConnection( TDEAccelAction* ); - - virtual bool emitSignal( Signal ) = 0; - virtual bool connectKey( TDEAccelAction&, const KKeyServer::Key& ) = 0; - virtual bool connectKey( const KKeyServer::Key& ) = 0; - virtual bool disconnectKey( TDEAccelAction&, const KKeyServer::Key& ) = 0; - virtual bool disconnectKey( const KKeyServer::Key& ) = 0; - - protected: - virtual bool isEnabledInternal() const; - struct ActionInfo - { - TDEAccelAction* pAction; - uint iSeq, iVariation; - //ActionInfo* pInfoNext; // nil if only one action uses this key. - - ActionInfo() { pAction = 0; iSeq = 0xffff; iVariation = 0xffff; } - ActionInfo( TDEAccelAction* _pAction, uint _iSeq, uint _iVariation ) - { pAction = _pAction; iSeq = _iSeq; iVariation = _iVariation; } - }; - typedef TQMap KKeyToActionMap; - - TDEAccelActions m_rgActions; - KKeyToActionMap m_mapKeyToAction; - TQValueList m_rgActionsNonUnique; - bool m_bNativeKeys; // Use native key codes instead of TQt codes - bool m_bEnabled; - bool m_bConfigIsGlobal; - TQString m_sConfigGroup; - bool m_bAutoUpdate; - TDEAccelAction* mtemp_pActionRemoving; - - private: - TDEAccelBase& operator =( const TDEAccelBase& ); - - friend class TDEAccelActions; -}; - -#endif // _KACCELBASE_H diff --git a/extra/kde353/ktoolbarbutton.h b/extra/kde353/ktoolbarbutton.h deleted file mode 100644 index 1c08569..0000000 --- a/extra/kde353/ktoolbarbutton.h +++ /dev/null @@ -1,330 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997, 1998 Stephan Kulow (coolo@kde.org) - (C) 1997, 1998 Sven Radej (radej@kde.org) - (C) 1997, 1998 Mark Donohoe (donohoe@kde.org) - (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org) - (C) 2000 Kurt Granroth (granroth@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _KTOOLBARBUTTON_H -#define _KTOOLBARBUTTON_H - -#include -#include -#include -#include -#include - -class TDEToolBar; -class TDEToolBarButtonPrivate; -class TDEInstance; -class TQEvent; -class TQPopupMenu; -class TQPainter; - -/** - * A toolbar button. This is used internally by TDEToolBar, use the - * TDEToolBar methods instead. - * @internal - */ -class TDEUI_EXPORT TDEToolBarButton : public TQToolButton -{ - Q_OBJECT - -public: - /** - * Construct a button with an icon loaded by the button itself. - * This will trust the button to load the correct icon with the - * correct size. - * - * @param icon Name of icon to load (may be absolute or relative) - * @param id Id of this button - * @param parent This button's parent - * @param name This button's internal name - * @param txt This button's text (in a tooltip or otherwise) - * @param _instance the instance to use for this button - */ - TDEToolBarButton(const TQString& icon, int id, TQWidget *parent, - const char *name=0L, const TQString &txt=TQString::null, - TDEInstance *_instance = TDEGlobal::instance()); - - /** - * Construct a button with an existing pixmap. It is not - * recommended that you use this as the internal icon loading code - * will almost always get it "right". - * - * @param pixmap Name of icon to load (may be absolute or relative) - * @param id Id of this button - * @param parent This button's parent - * @param name This button's internal name - * @param txt This button's text (in a tooltip or otherwise) - */ - TDEToolBarButton(const TQPixmap& pixmap, int id, TQWidget *parent, - const char *name=0L, const TQString &txt=TQString::null); - - /** - * Construct a separator button - * - * @param parent This button's parent - * @param name This button's internal name - */ - TDEToolBarButton(TQWidget *parent=0L, const char *name=0L); - - /** - * Standard destructor - */ - ~TDEToolBarButton(); - -#ifndef KDE_NO_COMPAT - /** - * @deprecated - * Set the pixmap directly for this button. This pixmap should be - * the active one... the dimmed and disabled pixmaps are constructed - * based on this one. However, don't use this function unless you - * are positive that you don't want to use setIcon. - * - * @param pixmap The active pixmap - */ - // this one is from TQButton, so #ifdef-ing it out doesn't break BC - virtual void setPixmap(const TQPixmap &pixmap) KDE_DEPRECATED; - - /** - * @deprecated - * Force the button to use this pixmap as the default one rather - * then generating it using effects. - * - * @param pixmap The pixmap to use as the default (normal) one - */ - void setDefaultPixmap(const TQPixmap& pixmap) KDE_DEPRECATED; - - /** - * @deprecated - * Force the button to use this pixmap when disabled one rather then - * generating it using effects. - * - * @param pixmap The pixmap to use when disabled - */ - void setDisabledPixmap(const TQPixmap& pixmap) KDE_DEPRECATED; -#endif - - /** - * Set the text for this button. The text will be either used as a - * tooltip (IconOnly) or will be along side the icon - * - * @param text The button (or tooltip) text - */ - virtual void setText(const TQString &text); - - /** - * Set the icon for this button. The icon will be loaded internally - * with the correct size. This function is preferred over setIconSet - * - * @param icon The name of the icon - */ - virtual void setIcon(const TQString &icon); - - /// @since 3.1 - virtual void setIcon( const TQPixmap &pixmap ) - { TQToolButton::setIcon( pixmap ); } - - /** - * Set the pixmaps for this toolbar button from a TQIconSet. - * If you call this you don't need to call any of the other methods - * that set icons or pixmaps. - * @param iconset The iconset to use - */ - virtual void setIconSet( const TQIconSet &iconset ); - -#ifndef KDE_NO_COMPAT - /** - * @deprecated - * Set the active icon for this button. The pixmap itself is loaded - * internally based on the icon size... .. the disabled and default - * pixmaps, however will only be constructed if generate is - * true. This function is preferred over setPixmap - * - * @param icon The name of the active icon - * @param generate If true, then the other icons are automagically - * generated from this one - */ - KDE_DEPRECATED void setIcon(const TQString &icon, bool generate ) { Q_UNUSED(generate); setIcon( icon ); } - - /** - * @deprecated - * Force the button to use this icon as the default one rather - * then generating it using effects. - * - * @param icon The icon to use as the default (normal) one - */ - void setDefaultIcon(const TQString& icon) KDE_DEPRECATED; - - /** - * @deprecated - * Force the button to use this icon when disabled one rather then - * generating it using effects. - * - * @param icon The icon to use when disabled - */ - void setDisabledIcon(const TQString& icon) KDE_DEPRECATED; -#endif - - /** - * Turn this button on or off - * - * @param flag true or false - */ - void on(bool flag = true); - - /** - * Toggle this button - */ - void toggle(); - - /** - * Turn this button into a toggle button or disable the toggle - * aspects of it. This does not toggle the button itself. - * Use toggle() for that. - * - * @param toggle true or false - */ - void setToggle(bool toggle = true); - - /** - * Return a pointer to this button's popup menu (if it exists) - */ - TQPopupMenu *popup(); - - /** - * Returns the button's id. - * @since 3.2 - */ - int id() const; - - /** - * Give this button a popup menu. There will not be a delay when - * you press the button. Use setDelayedPopup if you want that - * behavior. - * - * @param p The new popup menu - * @param unused Has no effect - ignore it. - */ - void setPopup (TQPopupMenu *p, bool unused = false); - - /** - * Gives this button a delayed popup menu. - * - * This function allows you to add a delayed popup menu to the button. - * The popup menu is then only displayed when the button is pressed and - * held down for about half a second. - * - * @param p the new popup menu - * @param unused Has no effect - ignore it. - */ - void setDelayedPopup(TQPopupMenu *p, bool unused = false); - - /** - * Turn this button into a radio button - * - * @param f true or false - */ - void setRadio(bool f = true); - - /** - * Toolbar buttons naturally will assume the global styles - * concerning icons, icons sizes, etc. You can use this function to - * explicitly turn this off, if you like. - * - * @param no_style Will disable styles if true - */ - void setNoStyle(bool no_style = true); - -signals: - /** - * Emitted when the toolbar button is clicked (with LMB or MMB) - */ - void clicked(int); - /** - * Emitted when the toolbar button is clicked (with any mouse button) - * @param state makes it possible to find out which button was pressed, - * and whether any keyboard modifiers were held. - * @since 3.4 - */ - void buttonClicked(int, TQt::ButtonState state); - void doubleClicked(int); - void pressed(int); - void released(int); - void toggled(int); - void highlighted(int, bool); - -public slots: - /** - * This slot should be called whenever the toolbar mode has - * potentially changed. This includes such events as text changing, - * orientation changing, etc. - */ - void modeChange(); - virtual void setTextLabel(const TQString&, bool tipToo); - -protected: - bool event(TQEvent *e); - void paletteChange(const TQPalette &); - void leaveEvent(TQEvent *e); - void enterEvent(TQEvent *e); - void drawButton(TQPainter *p); - bool eventFilter (TQObject *o, TQEvent *e); - /// @since 3.4 - void mousePressEvent( TQMouseEvent * ); - /// @since 3.4 - void mouseReleaseEvent( TQMouseEvent * ); - void showMenu(); - TQSize sizeHint() const; - TQSize minimumSizeHint() const; - TQSize minimumSize() const; - - /// @since 3.1 - bool isRaised() const; - /// @since 3.1 - bool isActive() const; - /// @since 3.1 - int iconTextMode() const; - -protected slots: - void slotClicked(); - void slotPressed(); - void slotReleased(); - void slotToggled(); - void slotDelayTimeout(); - -protected: - virtual void virtual_hook( int id, void* data ); -private: - TDEToolBarButtonPrivate *d; -}; - -/** -* List of TDEToolBarButton objects. -* @internal -* @version $Id: ktoolbarbutton.h 465272 2005-09-29 09:47:40Z mueller $ -*/ -class TDEUI_EXPORT TDEToolBarButtonList : public TQIntDict -{ -public: - TDEToolBarButtonList(); - ~TDEToolBarButtonList() {} -}; - -#endif diff --git a/extra/kde353/tdeaccelaction.h b/extra/kde353/tdeaccelaction.h new file mode 100644 index 0000000..809533f --- /dev/null +++ b/extra/kde353/tdeaccelaction.h @@ -0,0 +1,576 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001,2002 Ellis Whitehead + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KACCELACTION_H +#define _KACCELACTION_H + +#include +#include +#include +#include + +#include + +class TDEAccelBase; + +class TQObject; +class TDEConfig; +class TDEConfigBase; + +/** + * @internal + * A TDEAccelAction prepresents an action that can be executed using + * an accelerator key. Each TDEAccelAction has a name, a label, a + * "What's this" string and a TDEShortcut. The user can configure and + * enable/disable them using KKeyDialog. + * + * \code + * 1) TDEAccelAction = "Run Command" + * Default3 = "Alt+F2" + * Default4 = "Meta+Enter;Alt+F2" + * 1) TDEShortcut = "Meta+Enter" + * 1) KKeySequence = "Meta+Enter" + * 1) KKey = "Meta+Enter" + * 1) Meta+Enter + * 2) Meta+Keypad_Enter + * 2) TDEShortcut = "Alt+F2" + * 1) KKeySequence = "Alt+F2" + * 1) Alt+F2 + * 2) TDEAccelAction = "Something" + * Default3 = "" + * Default4 = "" + * 1) TDEShortcut = "Meta+X,Asterisk" + * 1) KKeySequence = "Meta+X,Asterisk" + * 1) KKey = "Meta+X" + * 1) Meta+X + * 2) KKey = "Asterisk" + * 1) Shift+8 (English layout) + * 2) Keypad_Asterisk + * \endcode + * @short An accelerator action + * @see TDEAccel + * @see TDEGlobalAccel + * @see KKeyChooser + * @see KKeyDialog + */ +class TDECORE_EXPORT TDEAccelAction +{ + public: + /** + * Creates an empty TDEAccelAction. + * @see clear() + */ + TDEAccelAction(); + + /** + * Copy constructor. + */ + TDEAccelAction( const TDEAccelAction& ); + + /** + * Creates a new TDEAccelAction. + * @param sName the name of the accelerator + * @param sLabel the label of the accelerator (i18n!) + * @param sWhatsThis the What's This text (18n!) + * @param cutDef3 the default shortcut for 3 modifier systems + * @param cutDef4 the default shortcut for 4 modifier systems + * @param pObjSlot the receiver of a signal when the key has been + * pressed + * @param psMethodSlot the slot to connect for key presses. Receives + * an int, as set by setID(), as only argument + * @param bConfigurable if true the user can configure the shortcut + * @param bEnabled true if the accelerator should be enabled + */ + TDEAccelAction( const TQString& sName, const TQString& sLabel, const TQString& sWhatsThis, + const TDEShortcut& cutDef3, const TDEShortcut& cutDef4, + const TQObject* pObjSlot, const char* psMethodSlot, + bool bConfigurable, bool bEnabled ); + ~TDEAccelAction(); + + /** + * Clears the accelerator. + */ + void clear(); + + /** + * Re-initialized the TDEAccelAction. + * @param sName the name of the accelerator + * @param sLabel the label of the accelerator (i18n!) + * @param sWhatsThis the What's This text (18n!) + * @param cutDef3 the default shortcut for 3 modifier systems + * @param cutDef4 the default shortcut for 4 modifier systems + * @param pObjSlot the receiver of a signal when the key has been + * pressed + * @param psMethodSlot the slot to connect for key presses. Receives + * an int, as set by setID(), as only argument + * @param bConfigurable if true the user can configure the shortcut + * @param bEnabled true if the accelerator should be enabled + * @return true if successful, false otherwise + */ + bool init( const TQString& sName, const TQString& sLabel, const TQString& sWhatsThis, + const TDEShortcut& cutDef3, const TDEShortcut& cutDef4, + const TQObject* pObjSlot, const char* psMethodSlot, + bool bConfigurable, bool bEnabled ); + + /** + * Copies this TDEAccelAction. + */ + TDEAccelAction& operator=( const TDEAccelAction& ); + + /** + * Returns the name of the accelerator action. + * @return the name of the accelerator action, can be null if not + * set + */ + const TQString& name() const { return m_sName; } + + /** + * Returns the label of the accelerator action. + * @return the label of the accelerator action, can be null if + * not set + */ + const TQString& label() const { return m_sLabel; } + + /** + * Returns the What's This text of the accelerator action. + * @return the What's This text of the accelerator action, can be + * null if not set + */ + const TQString& whatsThis() const { return m_sWhatsThis; } + + /** + * The shortcut that is actually used (may be used configured). + * @return the shortcut of the TDEAccelAction, can be null if not set + * @see shortcutDefault() + */ + const TDEShortcut& shortcut() const { return m_cut; } + + /** + * The default shortcut for this system. + * @return the default shortcut on this system, can be null if not set + * @see shortcut() + * @see shortcutDefault3() + * @see shortcutDefault4() + */ + const TDEShortcut& shortcutDefault() const; + + /** + * The default shortcut for 3 modifier systems. + * @return the default shortcut for 3 modifier systems, can be null + * if not set + * @see shortcutDefault() + * @see shortcutDefault4() + * @see useFourModifierKeys() + */ + const TDEShortcut& shortcutDefault3() const { return m_cutDefault3; } + + /** + * The default shortcut for 4 modifier systems. + * @return the default shortcut for 4 modifier systems, can be null + * if not set + * @see shortcutDefault() + * @see shortcutDefault3() + * @see useFourModifierKeys() + */ + const TDEShortcut& shortcutDefault4() const { return m_cutDefault4; } + + /** + * Returns the receiver of signals. + * @return the receiver of signals (can be 0 if not set) + */ + const TQObject* objSlotPtr() const { return m_pObjSlot; } + + /** + * Returns the slot for the signal. + * @return the slot for the signal + */ + const char* methodSlotPtr() const { return m_psMethodSlot; } + + /** + * Checks whether the user can configure the action. + * @return true if configurable, false otherwise + */ + bool isConfigurable() const { return m_bConfigurable; } + + /** + * Checks whether the action is enabled. + * @return true if enabled, false otherwise + */ + bool isEnabled() const { return m_bEnabled; } + + /** + * Sets the name of the accelerator action. + * @param name the new name + */ + void setName( const TQString& name ); + + /** + * Sets the user-readable label of the accelerator action. + * @param label the new label (i18n!) + */ + void setLabel( const TQString& label ); + + /** + * Sets the What's This text for the accelerator action. + * @param whatsThis the new What's This text (i18n!) + */ + void setWhatsThis( const TQString& whatsThis ); + + /** + * Sets the new shortcut of the accelerator action. + * @param rgCuts the shortcut to set + * @return true if successful, false otherwise + */ + bool setShortcut( const TDEShortcut& rgCuts ); + + /** + * Sets the slot of the accelerator action. + * @param pObjSlot the receiver object of the signal + * @param psMethodSlot the slot for the signal + */ + void setSlot( const TQObject* pObjSlot, const char* psMethodSlot ); + + /** + * Enables or disabled configuring the action. + * @param configurable true to enable configurability, false to disable + */ + void setConfigurable( bool configurable ); + + /** + * Enables or disabled the action. + * @param enable true to enable the action, false to disable + */ + void setEnabled( bool enable ); + + /** + * Retrieves the id set using setID. + * @return the id of the accelerator action + */ + int getID() const { return m_nIDAccel; } + + /** + * Allows you to set an id that will be used as the action + * signal's argument. + * + * @param n the new id + * @see getID() + */ + void setID( int n ) { m_nIDAccel = n; } + + /** + * Checkes whether the action is connected (emits signals). + * @return true if connected, false otherwise + */ + bool isConnected() const; + + /** + * Sets a key sequence of the action's shortcut. + * @param i the position of the sequence + * @param keySeq the new new sequence + * @return true if successful, false otherwise + * @see TDEShortcut::setSeq() + */ + bool setKeySequence( uint i, const KKeySequence &keySeq ); + + /** + * Clears the action's shortcut. It will not contain any sequences after + * calling this method. + * @see TDEShortcut::clear() + */ + void clearShortcut(); + + /** + * Checks whether the action's shortcut contains the given key sequence. + * @param keySeq the key sequence to check + * @return true if the shortcut contains the given sequence + * @see TDEShortcut::contains() + */ + bool contains( const KKeySequence &keySeq ); + + /** + * Returns the string representation of the action's shortcut. + * @return the string representation of the action's shortcut. + * @see TDEShortcut::toString() + */ + TQString toString() const; + + /** + * @internal + */ + TQString toStringInternal() const; + + /** + * Returns true if four modifier keys will be used. + * @return true if four modifier keys will be used. + */ + static bool useFourModifierKeys(); + + /** + * Selects 3 or 4 modifier default shortcuts. + * @param use true to use 4 modifier shortcuts, false to use + * 3 modifier shortcuts + */ + static void useFourModifierKeys( bool use ); + + protected: + TQString m_sName /**< Name of accel. @sa setName() */, + m_sLabel /**< Label of accel. User-visible. */, + m_sWhatsThis /**< WhatsThis help for accel. User-visible. */; + TDEShortcut m_cut /**< Shortcut actually assigned. */; + TDEShortcut m_cutDefault3 /**< Default shortcut in 3-modifier layout */, + m_cutDefault4 /**< Default shortcur in 4-modifier layout */; + const TQObject* m_pObjSlot /**< Object we will send signals to. */; + const char* m_psMethodSlot /**< Slot we send signals to, in m_pObjSlot */; + bool m_bConfigurable /**< Can this accel be configured by the user? */, + m_bEnabled /**< Is this accel enabled? */; + int m_nIDAccel /**< Id of this accel, from the list of IDs */; + uint m_nConnections /**< Number of connections to this accel. */ ; + + /** @internal Increment the number of connections to this accel. */ + void incConnections(); + /** @internal Decrement the number of connections to this accel (bouded by zero). */ + void decConnections(); + + private: + static int g_bUseFourModifierKeys; + class TDEAccelActionPrivate* d; + + friend class TDEAccelActions; + friend class TDEAccelBase; +}; + +//--------------------------------------------------------------------- +// TDEAccelActions +//--------------------------------------------------------------------- + +/** + * @internal + * This class represents a collection of TDEAccelAction objects. + * + * @short A collection of accelerator actions + * @see TDEAccelAction + */ +class TDECORE_EXPORT TDEAccelActions +{ + public: + /** + * Creates a new, empty TDEAccelActions object. + */ + TDEAccelActions(); + + /** + * Copy constructor (deep copy). + */ + TDEAccelActions( const TDEAccelActions& ); + virtual ~TDEAccelActions(); + + /** + * Removes all items from this collection. + */ + void clear(); + + /** + * Initializes this object with the given actions. + * It will make a deep copy of all actions. + * @param actions the actions to copy + * @return true if successful, false otherwise + */ + bool init( const TDEAccelActions &actions ); + + /** + * Loads the actions from the given configuration file. + * + * @param config the configuration file to load from + * @param sGroup the group in the configuration file + * @return true if successful, false otherwise + */ + bool init( TDEConfigBase& config, const TQString& sGroup ); + + /** + * Updates the shortcuts of all actions in this object + * with the shortcuts from the given object. + * @param shortcuts the collection that contains the new + * shortcuts + */ + void updateShortcuts( TDEAccelActions &shortcuts ); + + /** + * Retrieves the index of the action with the given name. + * @param sAction the action to search + * @return the index of the action, or -1 if not found + */ + int actionIndex( const TQString& sAction ) const; + + /** + * Returns the action with the given @p index. + * @param index the index of an action. You must not + * use an index that is too high. + * @return the TDEAccelAction with the given index + * @see count() + */ + TDEAccelAction* actionPtr( uint index ); + + /** + * Returns the action with the given @p index. + * @param index the index of an action. You must not + * use an index that is too high. + * @return the TDEAccelAction with the given index + * @see count() + */ + const TDEAccelAction* actionPtr( uint index ) const; + + /** + * Returns the action with the given name. + * @param sAction the name of the action to search + * @return the TDEAccelAction with the given name, or 0 + * if not found + */ + TDEAccelAction* actionPtr( const TQString& sAction ); + + /** + * Returns the action with the given name. + * @param sAction the name of the action to search + * @return the TDEAccelAction with the given name, or 0 + * if not found + */ + const TDEAccelAction* actionPtr( const TQString& sAction ) const; + + /** + * Returns the action with the given key sequence. + * @param cut the sequence to search for + * @return the TDEAccelAction with the given sequence, or 0 + * if not found + */ + TDEAccelAction* actionPtr( KKeySequence cut ); + + /** + * Returns the action with the given @p index. + * @param index the index of an action. You must not + * use an index that is too high. + * @return the TDEAccelAction with the given index + * @see actionPtr() + * @see count() + */ + TDEAccelAction& operator []( uint index ); + + /** + * Returns the action with the given @p index. + * @param index the index of an action. You must not + * use an index that is too high. + * @return the TDEAccelAction with the given index + * @see actionPtr() + * @see count() + */ + const TDEAccelAction& operator []( uint index ) const; + + /** + * Inserts an action into the collection. + * @param sAction the name of the accelerator + * @param sLabel the label of the accelerator (i18n!) + * @param sWhatsThis the What's This text (18n!) + * @param rgCutDefaults3 the default shortcut for 3 modifier systems + * @param rgCutDefaults4 the default shortcut for 4 modifier systems + * @param pObjSlot the receiver of a signal when the key has been + * pressed + * @param psMethodSlot the slot to connect for key presses. Receives + * an int, as set by setID(), as only argument + * @param bConfigurable if true the user can configure the shortcut + * @param bEnabled if true the accelerator should be enabled + * @return the new action + */ + TDEAccelAction* insert( const TQString& sAction, const TQString& sLabel, const TQString& sWhatsThis, + const TDEShortcut& rgCutDefaults3, const TDEShortcut& rgCutDefaults4, + const TQObject* pObjSlot = 0, const char* psMethodSlot = 0, + bool bConfigurable = true, bool bEnabled = true ); + + /** + * Inserts an action into the collection. + * @param sName the name of the accelerator + * @param sLabel the label of the accelerator (i18n!) + * @return the new action + */ + TDEAccelAction* insert( const TQString& sName, const TQString& sLabel ); + + /** + * Removes the given action. + * @param sAction the name of the action. + * @return true if successful, false otherwise + */ + bool remove( const TQString& sAction ); + + /** + * Loads the actions from the given configuration file. + * + * @param sConfigGroup the group in the configuration file + * @param pConfig the configuration file to load from + * @return true if successful, false otherwise + */ + bool readActions( const TQString& sConfigGroup = "Shortcuts", TDEConfigBase* pConfig = 0 ); + + /** + * Writes the actions to the given configuration file. + * + * @param sConfigGroup the group in the configuration file + * @param pConfig the configuration file to save to + * @param bWriteAll true to write all actions + * @param bGlobal true to write to the global configuration file + * @return true if successful, false otherwise + */ + bool writeActions( const TQString& sConfigGroup = "Shortcuts", TDEConfigBase* pConfig = 0, + bool bWriteAll = false, bool bGlobal = false ) const; + + /** + * Emit a keycodeChanged signal. + */ + void emitKeycodeChanged(); + + /** + * Returns the number of actions in the collection. + * @return the number of actions + */ + uint count() const; + + protected: + /** Base object that proxies signals from us. */ + TDEAccelBase* m_pTDEAccelBase; + /** Array of actions we're hanging on to. */ + TDEAccelAction** m_prgActions; + uint m_nSizeAllocated /**< Allocated size of the array. */, + m_nSize /**< Amount in use. */ ; + + /** + * Resize the list to the given number @p new_size of entries. + * @todo Can you make it smaller? + * @todo Implementation seems to break m_nSize. + */ + void resize( uint new_size ); + /** Add a action to this collection. @todo Document ownership. */ + void insertPtr( TDEAccelAction* ); + + private: + class TDEAccelActionsPrivate* d; + + TDEAccelActions( TDEAccelBase* ); + void initPrivate( TDEAccelBase* ); + TDEAccelActions& operator =( TDEAccelActions& ); + + friend class TDEAccelBase; +}; + +#endif // _KACCELACTION_H diff --git a/extra/kde353/tdeaccelbase.h b/extra/kde353/tdeaccelbase.h new file mode 100644 index 0000000..e5d832a --- /dev/null +++ b/extra/kde353/tdeaccelbase.h @@ -0,0 +1,260 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Ellis Whitehead + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KACCELBASE_H +#define _KACCELBASE_H + +#include +#include +#include +#include +#include + +#include "kaccelaction.h" +#include "kkeyserver.h" + +class TQPopupMenu; +class TQWidget; + +//---------------------------------------------------- + +/** + * @internal + * Handle keyboard accelerators. + * + * Allow an user to configure + * key bindings through application configuration files or through the + * KKeyChooser GUI. + * + * A TDEAccel contains a list of accelerator items. Each accelerator item + * consists of an action name and a keyboard code combined with modifiers + * (Shift, Ctrl and Alt.) + * + * For example, "Ctrl+P" could be a shortcut for printing a document. The key + * codes are listed in ckey.h. "Print" could be the action name for printing. + * The action name identifies the key binding in configuration files and the + * KKeyChooser GUI. + * + * When pressed, an accelerator key calls the slot to which it has been + * connected. Accelerator items can be connected so that a key will activate + * two different slots. + * + * A TDEAccel object handles key events sent to its parent widget and to all + * children of this parent widget. + * + * Key binding reconfiguration during run time can be prevented by specifying + * that an accelerator item is not configurable when it is inserted. A special + * group of non-configurable key bindings are known as the + * standard accelerators. + * + * The standard accelerators appear repeatedly in applications for + * standard document actions such as printing and saving. Convenience methods are + * available to insert and connect these accelerators which are configurable on + * a desktop-wide basis. + * + * It is possible for a user to choose to have no key associated with + * an action. + * + * The translated first argument for insertItem() is used only + * in the configuration dialog. + *\code + * TDEAccel *a = new TDEAccel( myWindow ); + * // Insert an action "Scroll Up" which is associated with the "Up" key: + * a->insertItem( i18n("Scroll Up"), "Scroll Up", "Up" ); + * // Insert an action "Scroll Down" which is not associated with any key: + * a->insertItem( i18n("Scroll Down"), "Scroll Down", 0); + * a->connectItem( "Scroll up", myWindow, SLOT( scrollUp() ) ); + * // a->insertStdItem( TDEStdAccel::Print ); //not necessary, since it + * // is done automatially with the + * // connect below! + * a->connectItem(TDEStdAccel::Print, myWindow, SLOT( printDoc() ) ); + * + * a->readSettings(); + *\endcode + * + * If a shortcut has a menu entry as well, you could insert them like + * this. The example is again the TDEStdAccel::Print from above. + * + * \code + * int id; + * id = popup->insertItem("&Print",this, SLOT(printDoc())); + * a->changeMenuAccel(popup, id, TDEStdAccel::Print ); + * \endcode + * + * If you want a somewhat "exotic" name for your standard print action, like + * id = popup->insertItem(i18n("Print &Document"),this, SLOT(printDoc())); + * it might be a good idea to insert the standard action before as + * a->insertStdItem( TDEStdAccel::Print, i18n("Print Document") ) + * as well, so that the user can easily find the corresponding function. + * + * This technique works for other actions as well. Your "scroll up" function + * in a menu could be done with + * + * \code + * id = popup->insertItem(i18n"Scroll &up",this, SLOT(scrollUp())); + * a->changeMenuAccel(popup, id, "Scroll Up" ); + * \endcode + * + * Please keep the order right: First insert all functions in the + * acceleratior, then call a -> readSettings() and @em then build your + * menu structure. + * + * @short Configurable key binding support. + */ + +class TDECORE_EXPORT TDEAccelBase +{ + public: + /** Initialization mode of the TDEAccelBase, used in constructor. */ + enum Init { QT_KEYS = 0x00, NATIVE_KEYS = 0x01 }; + + /** Enum for kinds of signals which may be emitted. */ + enum Signal { KEYCODE_CHANGED }; + + /** Constructor. @p fInitCode should be a bitwise OR of + * values from the Init enum. + */ + TDEAccelBase( int fInitCode ); + virtual ~TDEAccelBase(); + + /** Returns number of actions in this handler. */ + uint actionCount() const; + /** Returns a list of all the actions in this handler. */ + TDEAccelActions& actions(); + /** Returns whether this accelerator handler is enabled or not. */ + bool isEnabled() const; + + /** Returns a pointer to the TDEAccelAction named @p sAction. */ + TDEAccelAction* actionPtr( const TQString& sAction ); + /** Const version of the above. */ + const TDEAccelAction* actionPtr( const TQString& sAction ) const; + /** Returns a pointer to the TDEAccelAction associated with + * the key @p key. This function takes into account the + * key mapping defined in the constructor. + * + * May return 0 if no (or more than one) + * action is associated with the key. + */ + TDEAccelAction* actionPtr( const KKey& key ); + /** Basically the same as above, except a KKeyServer::Key + * already has a key mapping defined (either NATIVE_KEYS or not). + */ + TDEAccelAction* actionPtr( const KKeyServer::Key& key ); + + /** Returns the name of the configuration group these + * accelerators are stored in. The default is "Shortcuts". + */ + const TQString& configGroup() const { return m_sConfigGroup; } + /** Set the group (in the configuration file) for storing + * accelerators. + */ + void setConfigGroup( const TQString& group ); + void setConfigGlobal( bool global ); + virtual void setEnabled( bool bEnabled ) = 0; + /** Returns whether autoupdate is enabled for these accelerators. */ + bool getAutoUpdate() { return m_bAutoUpdate; } + /** Enables (or disables) autoupdate for these accelerators. + * @return the value of autoupdate before the call. + */ + bool setAutoUpdate( bool bAuto ); + +// Procedures for manipulating Actions. + //void clearActions(); + + TDEAccelAction* insert( const TQString& sName, const TQString& sDesc ); + TDEAccelAction* insert( + const TQString& sAction, const TQString& sDesc, const TQString& sHelp, + const TDEShortcut& rgCutDefaults3, const TDEShortcut& rgCutDefaults4, + const TQObject* pObjSlot, const char* psMethodSlot, + bool bConfigurable = true, bool bEnabled = true ); + bool remove( const TQString& sAction ); + bool setActionSlot( const TQString& sAction, const TQObject* pObjSlot, const char* psMethodSlot ); + + bool updateConnections(); + + bool setShortcut( const TQString& sAction, const TDEShortcut& cut ); + +// Modify individual Action sub-items + bool setActionEnabled( const TQString& sAction, bool bEnable ); + + /** + * Read all key associations from @p config, or (if @p config + * is zero) from the application's configuration file + * TDEGlobal::config(). + * + * The group in which the configuration is stored can be + * set with setConfigGroup(). + */ + void readSettings( TDEConfigBase* pConfig = 0 ); + + /** + * Write the current configurable associations to @p config, + * or (if @p config is zero) to the application's + * configuration file. + */ + void writeSettings( TDEConfigBase* pConfig = 0 ) const; + + TQPopupMenu* createPopupMenu( TQWidget* pParent, const KKeySequence& ); + + // Protected methods + protected: + void slotRemoveAction( TDEAccelAction* ); + + struct X; + void createKeyList( TQValueVector& rgKeys ); + bool insertConnection( TDEAccelAction* ); + bool removeConnection( TDEAccelAction* ); + + virtual bool emitSignal( Signal ) = 0; + virtual bool connectKey( TDEAccelAction&, const KKeyServer::Key& ) = 0; + virtual bool connectKey( const KKeyServer::Key& ) = 0; + virtual bool disconnectKey( TDEAccelAction&, const KKeyServer::Key& ) = 0; + virtual bool disconnectKey( const KKeyServer::Key& ) = 0; + + protected: + virtual bool isEnabledInternal() const; + struct ActionInfo + { + TDEAccelAction* pAction; + uint iSeq, iVariation; + //ActionInfo* pInfoNext; // nil if only one action uses this key. + + ActionInfo() { pAction = 0; iSeq = 0xffff; iVariation = 0xffff; } + ActionInfo( TDEAccelAction* _pAction, uint _iSeq, uint _iVariation ) + { pAction = _pAction; iSeq = _iSeq; iVariation = _iVariation; } + }; + typedef TQMap KKeyToActionMap; + + TDEAccelActions m_rgActions; + KKeyToActionMap m_mapKeyToAction; + TQValueList m_rgActionsNonUnique; + bool m_bNativeKeys; // Use native key codes instead of TQt codes + bool m_bEnabled; + bool m_bConfigIsGlobal; + TQString m_sConfigGroup; + bool m_bAutoUpdate; + TDEAccelAction* mtemp_pActionRemoving; + + private: + TDEAccelBase& operator =( const TDEAccelBase& ); + + friend class TDEAccelActions; +}; + +#endif // _KACCELBASE_H diff --git a/extra/kde353/tdetoolbarbutton.h b/extra/kde353/tdetoolbarbutton.h new file mode 100644 index 0000000..1c08569 --- /dev/null +++ b/extra/kde353/tdetoolbarbutton.h @@ -0,0 +1,330 @@ +/* This file is part of the KDE libraries + Copyright (C) 1997, 1998 Stephan Kulow (coolo@kde.org) + (C) 1997, 1998 Sven Radej (radej@kde.org) + (C) 1997, 1998 Mark Donohoe (donohoe@kde.org) + (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org) + (C) 2000 Kurt Granroth (granroth@kde.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KTOOLBARBUTTON_H +#define _KTOOLBARBUTTON_H + +#include +#include +#include +#include +#include + +class TDEToolBar; +class TDEToolBarButtonPrivate; +class TDEInstance; +class TQEvent; +class TQPopupMenu; +class TQPainter; + +/** + * A toolbar button. This is used internally by TDEToolBar, use the + * TDEToolBar methods instead. + * @internal + */ +class TDEUI_EXPORT TDEToolBarButton : public TQToolButton +{ + Q_OBJECT + +public: + /** + * Construct a button with an icon loaded by the button itself. + * This will trust the button to load the correct icon with the + * correct size. + * + * @param icon Name of icon to load (may be absolute or relative) + * @param id Id of this button + * @param parent This button's parent + * @param name This button's internal name + * @param txt This button's text (in a tooltip or otherwise) + * @param _instance the instance to use for this button + */ + TDEToolBarButton(const TQString& icon, int id, TQWidget *parent, + const char *name=0L, const TQString &txt=TQString::null, + TDEInstance *_instance = TDEGlobal::instance()); + + /** + * Construct a button with an existing pixmap. It is not + * recommended that you use this as the internal icon loading code + * will almost always get it "right". + * + * @param pixmap Name of icon to load (may be absolute or relative) + * @param id Id of this button + * @param parent This button's parent + * @param name This button's internal name + * @param txt This button's text (in a tooltip or otherwise) + */ + TDEToolBarButton(const TQPixmap& pixmap, int id, TQWidget *parent, + const char *name=0L, const TQString &txt=TQString::null); + + /** + * Construct a separator button + * + * @param parent This button's parent + * @param name This button's internal name + */ + TDEToolBarButton(TQWidget *parent=0L, const char *name=0L); + + /** + * Standard destructor + */ + ~TDEToolBarButton(); + +#ifndef KDE_NO_COMPAT + /** + * @deprecated + * Set the pixmap directly for this button. This pixmap should be + * the active one... the dimmed and disabled pixmaps are constructed + * based on this one. However, don't use this function unless you + * are positive that you don't want to use setIcon. + * + * @param pixmap The active pixmap + */ + // this one is from TQButton, so #ifdef-ing it out doesn't break BC + virtual void setPixmap(const TQPixmap &pixmap) KDE_DEPRECATED; + + /** + * @deprecated + * Force the button to use this pixmap as the default one rather + * then generating it using effects. + * + * @param pixmap The pixmap to use as the default (normal) one + */ + void setDefaultPixmap(const TQPixmap& pixmap) KDE_DEPRECATED; + + /** + * @deprecated + * Force the button to use this pixmap when disabled one rather then + * generating it using effects. + * + * @param pixmap The pixmap to use when disabled + */ + void setDisabledPixmap(const TQPixmap& pixmap) KDE_DEPRECATED; +#endif + + /** + * Set the text for this button. The text will be either used as a + * tooltip (IconOnly) or will be along side the icon + * + * @param text The button (or tooltip) text + */ + virtual void setText(const TQString &text); + + /** + * Set the icon for this button. The icon will be loaded internally + * with the correct size. This function is preferred over setIconSet + * + * @param icon The name of the icon + */ + virtual void setIcon(const TQString &icon); + + /// @since 3.1 + virtual void setIcon( const TQPixmap &pixmap ) + { TQToolButton::setIcon( pixmap ); } + + /** + * Set the pixmaps for this toolbar button from a TQIconSet. + * If you call this you don't need to call any of the other methods + * that set icons or pixmaps. + * @param iconset The iconset to use + */ + virtual void setIconSet( const TQIconSet &iconset ); + +#ifndef KDE_NO_COMPAT + /** + * @deprecated + * Set the active icon for this button. The pixmap itself is loaded + * internally based on the icon size... .. the disabled and default + * pixmaps, however will only be constructed if generate is + * true. This function is preferred over setPixmap + * + * @param icon The name of the active icon + * @param generate If true, then the other icons are automagically + * generated from this one + */ + KDE_DEPRECATED void setIcon(const TQString &icon, bool generate ) { Q_UNUSED(generate); setIcon( icon ); } + + /** + * @deprecated + * Force the button to use this icon as the default one rather + * then generating it using effects. + * + * @param icon The icon to use as the default (normal) one + */ + void setDefaultIcon(const TQString& icon) KDE_DEPRECATED; + + /** + * @deprecated + * Force the button to use this icon when disabled one rather then + * generating it using effects. + * + * @param icon The icon to use when disabled + */ + void setDisabledIcon(const TQString& icon) KDE_DEPRECATED; +#endif + + /** + * Turn this button on or off + * + * @param flag true or false + */ + void on(bool flag = true); + + /** + * Toggle this button + */ + void toggle(); + + /** + * Turn this button into a toggle button or disable the toggle + * aspects of it. This does not toggle the button itself. + * Use toggle() for that. + * + * @param toggle true or false + */ + void setToggle(bool toggle = true); + + /** + * Return a pointer to this button's popup menu (if it exists) + */ + TQPopupMenu *popup(); + + /** + * Returns the button's id. + * @since 3.2 + */ + int id() const; + + /** + * Give this button a popup menu. There will not be a delay when + * you press the button. Use setDelayedPopup if you want that + * behavior. + * + * @param p The new popup menu + * @param unused Has no effect - ignore it. + */ + void setPopup (TQPopupMenu *p, bool unused = false); + + /** + * Gives this button a delayed popup menu. + * + * This function allows you to add a delayed popup menu to the button. + * The popup menu is then only displayed when the button is pressed and + * held down for about half a second. + * + * @param p the new popup menu + * @param unused Has no effect - ignore it. + */ + void setDelayedPopup(TQPopupMenu *p, bool unused = false); + + /** + * Turn this button into a radio button + * + * @param f true or false + */ + void setRadio(bool f = true); + + /** + * Toolbar buttons naturally will assume the global styles + * concerning icons, icons sizes, etc. You can use this function to + * explicitly turn this off, if you like. + * + * @param no_style Will disable styles if true + */ + void setNoStyle(bool no_style = true); + +signals: + /** + * Emitted when the toolbar button is clicked (with LMB or MMB) + */ + void clicked(int); + /** + * Emitted when the toolbar button is clicked (with any mouse button) + * @param state makes it possible to find out which button was pressed, + * and whether any keyboard modifiers were held. + * @since 3.4 + */ + void buttonClicked(int, TQt::ButtonState state); + void doubleClicked(int); + void pressed(int); + void released(int); + void toggled(int); + void highlighted(int, bool); + +public slots: + /** + * This slot should be called whenever the toolbar mode has + * potentially changed. This includes such events as text changing, + * orientation changing, etc. + */ + void modeChange(); + virtual void setTextLabel(const TQString&, bool tipToo); + +protected: + bool event(TQEvent *e); + void paletteChange(const TQPalette &); + void leaveEvent(TQEvent *e); + void enterEvent(TQEvent *e); + void drawButton(TQPainter *p); + bool eventFilter (TQObject *o, TQEvent *e); + /// @since 3.4 + void mousePressEvent( TQMouseEvent * ); + /// @since 3.4 + void mouseReleaseEvent( TQMouseEvent * ); + void showMenu(); + TQSize sizeHint() const; + TQSize minimumSizeHint() const; + TQSize minimumSize() const; + + /// @since 3.1 + bool isRaised() const; + /// @since 3.1 + bool isActive() const; + /// @since 3.1 + int iconTextMode() const; + +protected slots: + void slotClicked(); + void slotPressed(); + void slotReleased(); + void slotToggled(); + void slotDelayTimeout(); + +protected: + virtual void virtual_hook( int id, void* data ); +private: + TDEToolBarButtonPrivate *d; +}; + +/** +* List of TDEToolBarButton objects. +* @internal +* @version $Id: ktoolbarbutton.h 465272 2005-09-29 09:47:40Z mueller $ +*/ +class TDEUI_EXPORT TDEToolBarButtonList : public TQIntDict +{ +public: + TDEToolBarButtonList(); + ~TDEToolBarButtonList() {} +}; + +#endif -- cgit v1.2.1