00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef kocommandhistory_h
00022
#define kocommandhistory_h
00023
00024
#include <qptrlist.h>
00025
#include <qstring.h>
00026
#include <qobject.h>
00027
00028
class KAction;
00029
class KActionCollection;
00030
class QPopupMenu;
00031
class KCommand;
00032
#include <qlistbox.h>
00033
00034
class KoListBox :
public QListBox {
00035 Q_OBJECT
00036
public:
00037 KoListBox(
QWidget *parent = 0,
const char *name = 0, WFlags f = 0 );
00038
protected:
00039
virtual void contentsMouseMoveEvent (
QMouseEvent * );
00040 signals:
00041
void changeNumberOfSelectedItem(
int );
00042 };
00043
00056 class KoCommandHistory :
public QObject {
00057 Q_OBJECT
00058
public:
00064
KoCommandHistory();
00065
00074
KoCommandHistory(KActionCollection *actionCollection,
bool withMenus =
true);
00075
00079
virtual ~KoCommandHistory();
00080
00086
void clear();
00087
00096
void addCommand(KCommand *command,
bool execute=
true);
00097
00101 int undoLimit()
const {
return m_undoLimit; }
00105
void setUndoLimit(
int limit);
00109 int redoLimit()
const {
return m_redoLimit; }
00113
void setRedoLimit(
int limit);
00114
00121
void updateActions();
00122
00123
public slots:
00128
virtual void undo();
00133
virtual void redo();
00142
virtual void documentSaved();
00143
00144
protected slots:
00145
void slotUndoAboutToShow();
00146
void slotUndoActivated(
int );
00147
void slotRedoAboutToShow();
00148
void slotRedoActivated(
int );
00149
void slotUndoActivated(
QListBoxItem *);
00150
void slotRedoActivated(
QListBoxItem *);
00151
void slotChangeRedoNumberOfSelectedItem(
int );
00152
void slotChangeUndoNumberOfSelectedItem(
int );
00153 signals:
00159
void commandExecuted();
00164
void documentRestored();
00165
00166
private:
00167
void clipCommands();
00168
00169
QPtrList<KCommand> m_commands;
00170 KAction *m_undo, *m_redo;
00171
QPopupMenu *m_undoPopup, *m_redoPopup;
00172
int m_undoLimit, m_redoLimit;
00173
bool m_first;
00174
protected:
00175
virtual void virtual_hook(
int id,
void* data );
00176
private:
00177
class KoCommandHistoryPrivate;
00178 KoCommandHistoryPrivate *d;
00179 };
00180
00181
#endif