lib
KoCommandHistory.h00001
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 #include <koffice_export.h>
00028
00029 class KAction;
00030 class KActionCollection;
00031 class QPopupMenu;
00032 class KCommand;
00033 #include <qlistbox.h>
00034
00035 class KoListBox : public QListBox {
00036 Q_OBJECT
00037 public:
00038 KoListBox( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
00039 protected:
00040 virtual void contentsMouseMoveEvent ( QMouseEvent * );
00041 virtual QSize sizeHint() const;
00042 signals:
00043 void changeNumberOfSelectedItem( int );
00044 };
00045
00058 class KOFFICEUI_EXPORT KoCommandHistory : public QObject {
00059 Q_OBJECT
00060 public:
00066 KoCommandHistory();
00067
00077 KoCommandHistory(KActionCollection *actionCollection, bool withMenus = true);
00078
00082 virtual ~KoCommandHistory();
00083
00089 void clear();
00090
00099 void addCommand(KCommand *command, bool execute=true);
00100
00104 int undoLimit() const { return m_undoLimit; }
00108 void setUndoLimit(int limit);
00112 int redoLimit() const { return m_redoLimit; }
00116 void setRedoLimit(int limit);
00117
00124 void updateActions();
00125
00129 KCommand * presentCommand();
00130
00131 public slots:
00136 virtual void undo();
00141 virtual void redo();
00150 virtual void documentSaved();
00151
00152 protected slots:
00153 void slotUndoAboutToShow();
00154 void slotUndoActivated( int );
00155 void slotRedoAboutToShow();
00156 void slotRedoActivated( int );
00157 void slotUndoActivated( QListBoxItem *);
00158 void slotRedoActivated( QListBoxItem *);
00159 void slotChangeRedoNumberOfSelectedItem( int );
00160 void slotChangeUndoNumberOfSelectedItem( int );
00161 signals:
00167 void commandExecuted();
00168
00175 void commandExecuted(KCommand *cmd);
00176
00181 void documentRestored();
00182
00183 private:
00184 void clipCommands();
00185
00186 QPtrList<KCommand> m_commands;
00187 KAction *m_undo, *m_redo;
00188 QPopupMenu *m_undoPopup, *m_redoPopup;
00189 int m_undoLimit, m_redoLimit;
00190 bool m_first;
00191 protected:
00192 virtual void virtual_hook( int id, void* data );
00193 private:
00194 class KoCommandHistoryPrivate;
00195 KoCommandHistoryPrivate *d;
00196 };
00197
00198 #endif
|