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

tdeui

  • tdeui
kcommand.h
1/* This file is part of the KDE project
2 Copyright (C) 2000 Werner Trobin <trobin@kde.org>
3 Copyright (C) 2000 David Faure <faure@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef kcommand_h
22#define kcommand_h
23
24#include <tqptrlist.h>
25#include <tqstring.h>
26#include <tqobject.h>
27#include <tdelibs_export.h>
28
29class TDEAction;
30class TDEActionCollection;
31class TQPopupMenu;
32
37class TDEUI_EXPORT KCommand
38{
39protected:
43 KCommand() {}
44
45public:
46 virtual ~KCommand();
47
53 virtual void execute() = 0;
62 virtual void unexecute() = 0;
63
68 virtual TQString name() const = 0;
69protected:
70 virtual void virtual_hook( int id, void* data );
71};
72
78class TDEUI_EXPORT KNamedCommand : public KCommand
79{
80protected:
86 KNamedCommand(const TQString &name) : KCommand(), m_name(name) {}
87
88public:
92 virtual TQString name() const { return m_name; }
97 void setName(const TQString &name) { m_name=name; }
98
99private:
100 TQString m_name;
101protected:
102 virtual void virtual_hook( int id, void* data );
103};
104
110class TDEUI_EXPORT KMacroCommand : public KNamedCommand
111{
112public:
119 KMacroCommand( const TQString & name );
120 virtual ~KMacroCommand() {}
121
126 void addCommand(KCommand *command);
127
132 virtual void execute();
137 virtual void unexecute();
138
139protected:
140 TQPtrList<KCommand> m_commands;
141protected:
142 virtual void virtual_hook( int id, void* data );
143};
144
145
156class TDEUI_EXPORT KCommandHistory : public TQObject {
157 TQ_OBJECT
158public:
164 KCommandHistory();
165
174 KCommandHistory(TDEActionCollection *actionCollection, bool withMenus = true);
175
179 virtual ~KCommandHistory();
180
186 void clear();
187
195 void addCommand(KCommand *command, bool execute=true);
196
200 int undoLimit() const { return m_undoLimit; }
204 void setUndoLimit(int limit);
208 int redoLimit() const { return m_redoLimit; }
212 void setRedoLimit(int limit);
213
220 void updateActions();
221
222public slots:
227 virtual void undo();
232 virtual void redo();
241 virtual void documentSaved();
242
243protected slots:
244 void slotUndoAboutToShow();
245 void slotUndoActivated( int );
246 void slotRedoAboutToShow();
247 void slotRedoActivated( int );
248
249signals:
257 void commandExecuted();
258
266 void commandExecuted(KCommand *command);
267
272 void documentRestored();
273
274private:
275 void clipCommands(); // ensures that the limits are kept
276
277 TQPtrList<KCommand> m_commands;
278 TDEAction *m_undo, *m_redo;
279 TQPopupMenu *m_undoPopup, *m_redoPopup;
280 int m_undoLimit, m_redoLimit;
281 bool m_first; // attention: it's the first command in the list!
282protected:
283 virtual void virtual_hook( int id, void* data );
284private:
285 class KCommandHistoryPrivate;
286 KCommandHistoryPrivate *d;
287};
288
289#endif
KCommandHistory
The command history stores a (user) configurable amount of Commands.
Definition: kcommand.h:156
KCommandHistory::redoLimit
int redoLimit() const
Definition: kcommand.h:208
KCommandHistory::commandExecuted
void commandExecuted(KCommand *command)
Emitted every time a command is executed (whether by addCommand, undo or redo).
KCommandHistory::documentRestored
void documentRestored()
Emitted every time we reach the index where you saved the document for the last time.
KCommandHistory::undoLimit
int undoLimit() const
Definition: kcommand.h:200
KCommandHistory::commandExecuted
void commandExecuted()
Emitted every time a command is executed (whether by addCommand, undo or redo).
KCommand
The abstract base class for all Commands.
Definition: kcommand.h:38
KCommand::name
virtual TQString name() const =0
KCommand::unexecute
virtual void unexecute()=0
Unexecutes (undo) this command.
KCommand::KCommand
KCommand()
Creates a command.
Definition: kcommand.h:43
KCommand::execute
virtual void execute()=0
The main method: executes this command.
KMacroCommand
A Macro Command is a command that holds several sub-commands.
Definition: kcommand.h:111
KNamedCommand
A command which stores its name.
Definition: kcommand.h:79
KNamedCommand::name
virtual TQString name() const
Definition: kcommand.h:92
KNamedCommand::KNamedCommand
KNamedCommand(const TQString &name)
Creates a command.
Definition: kcommand.h:86
KNamedCommand::setName
void setName(const TQString &name)
Updates the name of this command.
Definition: kcommand.h:97
TDEActionCollection
A managed set of TDEAction objects.
Definition: tdeactioncollection.h:79
TDEAction
Class to encapsulate user-driven action or event.
Definition: tdeaction.h:203

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.9.4
This website is maintained by Timothy Pearson.