libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / apps / mail / KUndoBuffer.h
blobf1591cbe7de2dc0156f25bdaeee395b5f3625ff5
1 #ifndef _K_UNDOBUFFER_H
2 #define _K_UNDOBUFFER_H
5 #include <List.h>
8 enum undo_type{
9 K_INSERTED,
10 K_DELETED,
11 K_REPLACED
15 class KUndoItem
17 public:
18 KUndoItem(const char* text, int32 length,
19 int32 offset, undo_type history,
20 int32 cursor_pos);
21 ~KUndoItem();
23 void Merge(const char* text, int32 length);
24 status_t InitCheck();
26 int32 Offset;
27 int32 Length;
28 char* RedoText;
29 undo_type History;
30 int32 CursorPos;
32 private:
33 status_t fStatus;
37 class KUndoBuffer : public BList
39 public:
40 KUndoBuffer();
41 ~KUndoBuffer();
43 bool AddItem(KUndoItem* item, int32 index);
44 bool AddItem(KUndoItem* item);
45 void MakeEmpty(void);
46 KUndoItem* RemoveItem(int32 index);
47 KUndoItem* ItemAt(int32 index) const;
49 status_t AddUndo(const char* redo_text, int32 length,
50 int32 offset, undo_type history,
51 int32 cursor_pos);
53 status_t MakeNewUndoItem();
55 status_t Undo(char** text, int32* length, int32* offset,
56 undo_type* history, int32* cursor_pos);
58 status_t Redo(char** text, int32* length, int32* offset,
59 undo_type* history, int32* cursor_pos,
60 bool* replaced);
62 void PrintToStream();
63 void On();
64 void Off();
66 private:
67 int32 fIndex;
68 bool fNewItem;
69 bool fNoTouch;
71 status_t NewUndo(const char* text, int32 length,
72 int32 offset, undo_type history,
73 int32 cursor_pos);
77 #endif // _K_UNDOBUFFER_H