00001 /* 00002 Copyright (C) 1999 Glen Parker <glenebob@nwlink.com> 00003 Copyright (C) 2002 Joseph Wenninger <jowenn@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., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 00020 -------------------------------------------------------------------- 00021 00022 This implements a dialog used to display and control undo/redo history. 00023 It uses a specialized QListBox subclass to provide a selection mechanism 00024 that will: 00025 1) always have the first item selected, and 00026 2) maintain a contiguous multiple selection 00027 */ 00028 00029 #ifndef __undohistory_h_ 00030 #define __undohistory_h_ 00031 00032 #include <qdialog.h> 00033 #include <qlistbox.h> 00034 00035 #include "kateview.h" 00036 00037 class UndoListBox; 00038 00039 // the dialog class that provides the interface to the user 00040 class UndoHistory : public QDialog 00041 { 00042 Q_OBJECT 00043 00044 public: 00048 UndoHistory(KateView*, QWidget *parent=0, const char *name=0, bool modal=FALSE, WFlags f=0); 00049 virtual ~UndoHistory(); 00050 00051 public slots: 00056 void newUndo(); 00057 00058 signals: 00063 void undo(int); 00068 void redo(int); 00069 00070 protected: 00071 KateView *kWrite; 00072 00073 UndoListBox *lbUndo, 00074 *lbRedo; 00075 QPushButton *btnUndo, 00076 *btnRedo; 00077 00078 protected slots: 00079 void slotUndo(); 00080 void slotRedo(); 00081 void slotUndoSelChanged(int); 00082 void slotRedoSelChanged(int); 00083 00084 }; 00085 00086 // listbox class used to provide contiguous, 0-based selection 00087 // this is used internally 00088 class UndoListBox : public QListBox 00089 { 00090 Q_OBJECT 00091 00092 public: 00093 UndoListBox(QWidget * parent=0, const char * name=0, WFlags f=0); 00094 virtual ~UndoListBox(); 00095 00096 int selCount(); 00097 void setSelCount(int count); 00098 00099 void insertItem (const QString &text, int index = -1); 00100 void removeItem (int index); 00101 void clear(); 00102 00103 protected: 00104 int _selCount; 00105 00106 signals: 00107 void sigSelected(int); 00108 00109 protected slots: 00110 void _slotSelectionChanged(); 00111 00112 }; 00113 00114 #endif
1.4.2