btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / kits / interface / textview_support / UndoBuffer.h
blob0313e86263e7424cd6308f155cb5c5c410fc3f96
1 /*
2 * Copyright 2003-2008, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stefano Ceccherini (burton666@libero.it)
7 */
9 #ifndef __UNDOBUFFER_H
10 #define __UNDOBUFFER_H
12 #include <TextView.h>
15 class BClipboard;
18 // UndoBuffer
19 class BTextView::UndoBuffer {
20 public:
21 UndoBuffer(BTextView* view, undo_state state);
22 virtual ~UndoBuffer();
24 void Undo(BClipboard* clipboard);
25 undo_state State(bool* _isRedo) const;
27 protected:
28 virtual void UndoSelf(BClipboard* clipboard);
29 virtual void RedoSelf(BClipboard* clipboard);
31 BTextView* fTextView;
32 int32 fStart;
33 int32 fEnd;
35 char* fTextData;
36 int32 fTextLength;
37 text_run_array* fRunArray;
38 int32 fRunArrayLength;
40 bool fRedo;
42 private:
43 undo_state fState;
47 // CutUndoBuffer
48 class BTextView::CutUndoBuffer : public BTextView::UndoBuffer {
49 public:
50 CutUndoBuffer(BTextView* textView);
51 virtual ~CutUndoBuffer();
53 protected:
54 virtual void RedoSelf(BClipboard* clipboard);
58 // PasteUndoBuffer
59 class BTextView::PasteUndoBuffer : public BTextView::UndoBuffer {
60 public:
61 PasteUndoBuffer(BTextView* textView,
62 const char* text, int32 textLength,
63 text_run_array* runArray,
64 int32 runArrayLen);
65 virtual ~PasteUndoBuffer();
67 protected:
68 virtual void UndoSelf(BClipboard* clipboard);
69 virtual void RedoSelf(BClipboard* clipboard);
71 private:
72 char* fPasteText;
73 int32 fPasteTextLength;
74 text_run_array* fPasteRunArray;
78 // ClearUndoBuffer
79 class BTextView::ClearUndoBuffer : public BTextView::UndoBuffer {
80 public:
81 ClearUndoBuffer(BTextView* textView);
82 virtual ~ClearUndoBuffer();
84 protected:
85 virtual void RedoSelf(BClipboard* clipboard);
89 // DropUndoBuffer
90 class BTextView::DropUndoBuffer : public BTextView::UndoBuffer {
91 public:
92 DropUndoBuffer(BTextView* textView,
93 char const* text, int32 textLength,
94 text_run_array* runArray,
95 int32 runArrayLength, int32 location,
96 bool internalDrop);
97 virtual ~DropUndoBuffer();
99 protected:
100 virtual void UndoSelf(BClipboard* clipboard);
101 virtual void RedoSelf(BClipboard* clipboard);
103 private:
104 char* fDropText;
105 int32 fDropTextLength;
106 text_run_array* fDropRunArray;
108 int32 fDropLocation;
109 bool fInternalDrop;
113 // TypingUndoBuffer
114 class BTextView::TypingUndoBuffer : public BTextView::UndoBuffer {
115 public:
116 TypingUndoBuffer(BTextView* textView);
117 virtual ~TypingUndoBuffer();
119 void InputCharacter(int32 length);
120 void BackwardErase();
121 void ForwardErase();
123 protected:
124 virtual void RedoSelf(BClipboard* clipboard);
125 virtual void UndoSelf(BClipboard* clipboard);
127 private:
128 void _Reset();
130 char* fTypedText;
131 int32 fTypedStart;
132 int32 fTypedEnd;
133 int32 fUndone;
136 #endif //__UNDOBUFFER_H