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

tdeui

kcommand.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2000 Werner Trobin <trobin@kde.org>
00003    Copyright (C) 2000 David Faure <faure@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef kcommand_h
00022 #define kcommand_h
00023 
00024 #include <tqptrlist.h>
00025 #include <tqstring.h>
00026 #include <tqobject.h>
00027 #include <tdelibs_export.h>
00028 
00029 class TDEAction;
00030 class TDEActionCollection;
00031 class TQPopupMenu;
00032 
00037 class TDEUI_EXPORT KCommand
00038 {
00039 protected:
00043     KCommand() {}
00044 
00045 public:
00046     virtual ~KCommand();
00047 
00053     virtual void execute() = 0;
00062     virtual void unexecute() = 0;
00063 
00068     virtual TQString name() const = 0;
00069 protected:
00070     virtual void virtual_hook( int id, void* data );
00071 };
00072 
00078 class TDEUI_EXPORT KNamedCommand : public KCommand
00079 {
00080 protected:
00086     KNamedCommand(const TQString &name) : KCommand(), m_name(name) {}
00087 
00088 public:
00092     virtual TQString name() const { return m_name; }
00097     void setName(const TQString &name) { m_name=name; }
00098 
00099 private:
00100     TQString m_name;
00101 protected:
00102     virtual void virtual_hook( int id, void* data );
00103 };
00104 
00110 class TDEUI_EXPORT KMacroCommand : public KNamedCommand
00111 {
00112 public:
00119     KMacroCommand( const TQString & name );
00120     virtual ~KMacroCommand() {}
00121 
00126     void addCommand(KCommand *command);
00127 
00132     virtual void execute();
00137     virtual void unexecute();
00138 
00139 protected:
00140     TQPtrList<KCommand> m_commands;
00141 protected:
00142     virtual void virtual_hook( int id, void* data );
00143 };
00144 
00145 
00156 class TDEUI_EXPORT KCommandHistory : public TQObject {
00157     Q_OBJECT
00158 public:
00164     KCommandHistory();
00165 
00174     KCommandHistory(TDEActionCollection *actionCollection, bool withMenus = true);
00175 
00179     virtual ~KCommandHistory();
00180 
00186     void clear();
00187 
00195     void addCommand(KCommand *command, bool execute=true);
00196 
00200     int undoLimit() const { return m_undoLimit; }
00204     void setUndoLimit(int limit);
00208     int redoLimit() const { return m_redoLimit; }
00212     void setRedoLimit(int limit);
00213 
00220     void updateActions();
00221 
00222 public slots:
00227     virtual void undo();
00232     virtual void redo();
00241     virtual void documentSaved();
00242 
00243 protected slots:
00244     void slotUndoAboutToShow();
00245     void slotUndoActivated( int );
00246     void slotRedoAboutToShow();
00247     void slotRedoActivated( int );
00248 
00249 signals:
00257     void commandExecuted();
00258 
00266     void commandExecuted(KCommand *command);
00267 
00272     void documentRestored();
00273 
00274 private:
00275     void clipCommands();  // ensures that the limits are kept
00276 
00277     TQPtrList<KCommand> m_commands;
00278     TDEAction *m_undo, *m_redo;
00279     TQPopupMenu *m_undoPopup, *m_redoPopup;
00280     int m_undoLimit, m_redoLimit;
00281     bool m_first;  // attention: it's the first command in the list!
00282 protected:
00283     virtual void virtual_hook( int id, void* data );
00284 private:
00285     class KCommandHistoryPrivate;
00286     KCommandHistoryPrivate *d;
00287 };
00288 
00289 #endif

tdeui

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

tdeui

Skip menu "tdeui"
  • 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 tdeui by doxygen 1.7.1
This website is maintained by Timothy Pearson.