Diffstat (limited to 'noncore/apps/tinykate/libkate/view/kateundohistory.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/libkate/view/kateundohistory.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/noncore/apps/tinykate/libkate/view/kateundohistory.h b/noncore/apps/tinykate/libkate/view/kateundohistory.h new file mode 100644 index 0000000..eb91af9 --- a/dev/null +++ b/noncore/apps/tinykate/libkate/view/kateundohistory.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | Copyright (C) 1999 Glen Parker <glenebob@nwlink.com> | ||
3 | Copyright (C) 2002 Joseph Wenninger <jowenn@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., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | |||
20 | -------------------------------------------------------------------- | ||
21 | |||
22 | This implements a dialog used to display and control undo/redo history. | ||
23 | It uses a specialized QListBox subclass to provide a selection mechanism | ||
24 | that will: | ||
25 | 1) always have the first item selected, and | ||
26 | 2) maintain a contiguous multiple selection | ||
27 | */ | ||
28 | |||
29 | #ifndef __undohistory_h_ | ||
30 | #define __undohistory_h_ | ||
31 | |||
32 | #include <qdialog.h> | ||
33 | #include <qlistbox.h> | ||
34 | |||
35 | #include "kateview.h" | ||
36 | |||
37 | class UndoListBox; | ||
38 | |||
39 | // the dialog class that provides the interface to the user | ||
40 | class UndoHistory : public QDialog | ||
41 | { | ||
42 | Q_OBJECT | ||
43 | |||
44 | public: | ||
45 | /** | ||
46 | Constructed just like a regular QDialog | ||
47 | */ | ||
48 | UndoHistory(KateView*, QWidget *parent=0, const char *name=0, bool modal=FALSE, WFlags f=0); | ||
49 | virtual ~UndoHistory(); | ||
50 | |||
51 | public slots: | ||
52 | /** | ||
53 | This should be called whenever a change occurs in the undo/redo list. | ||
54 | Causes the dialog to update its interface. | ||
55 | */ | ||
56 | void newUndo(); | ||
57 | |||
58 | signals: | ||
59 | /** | ||
60 | Emitted when the user hits the Undo button. Specifies the number of | ||
61 | operations to undo. | ||
62 | */ | ||
63 | void undo(int); | ||
64 | /** | ||
65 | Emitted when the user hits the Redo button. Specifies the number of | ||
66 | undone operations to redo. | ||
67 | */ | ||
68 | void redo(int); | ||
69 | |||
70 | protected: | ||
71 | KateView *kWrite; | ||
72 | |||
73 | UndoListBox *lbUndo, | ||
74 | *lbRedo; | ||
75 | QPushButton *btnUndo, | ||
76 | *btnRedo; | ||
77 | |||
78 | protected slots: | ||
79 | void slotUndo(); | ||
80 | void slotRedo(); | ||
81 | void slotUndoSelChanged(int); | ||
82 | void slotRedoSelChanged(int); | ||
83 | |||
84 | }; | ||
85 | |||
86 | // listbox class used to provide contiguous, 0-based selection | ||
87 | // this is used internally | ||
88 | class UndoListBox : public QListBox | ||
89 | { | ||
90 | Q_OBJECT | ||
91 | |||
92 | public: | ||
93 | UndoListBox(QWidget * parent=0, const char * name=0, WFlags f=0); | ||
94 | virtual ~UndoListBox(); | ||
95 | |||
96 | int selCount(); | ||
97 | void setSelCount(int count); | ||
98 | |||
99 | void insertItem (const QString &text, int index = -1); | ||
100 | void removeItem (int index); | ||
101 | void clear(); | ||
102 | |||
103 | protected: | ||
104 | int _selCount; | ||
105 | |||
106 | signals: | ||
107 | void sigSelected(int); | ||
108 | |||
109 | protected slots: | ||
110 | void _slotSelectionChanged(); | ||
111 | |||
112 | }; | ||
113 | |||
114 | #endif | ||