1 /*
2     This file is part of the Okteta Gui library, made within the KDE community.
3 
4     SPDX-FileCopyrightText: 2004, 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8 
9 #ifndef OKTETA_ABSTRACTEDITOR_HPP
10 #define OKTETA_ABSTRACTEDITOR_HPP
11 
12 // lib
13 #include "abstractcontroller.hpp"
14 
15 namespace Okteta {
16 class AbstractByteArrayView;
17 class ByteArrayTableCursor;
18 
19 class AbstractEditor : public AbstractController
20 {
21 protected:
22     enum EditAction
23     {
24         CharDelete,
25         WordDelete,
26         CharBackspace,
27         WordBackspace
28     };
29 
30 protected:
31     AbstractEditor(ByteArrayTableCursor* cursor, AbstractByteArrayView* view, AbstractController* parent);
32 
33 public:
34     ~AbstractEditor() override;
35 
36 public: // AbstractController API
37     bool handleKeyPress(QKeyEvent* keyEvent) override;
38 
39 protected:
40     /** executes edit action \p action. This is normally called by a key event handler. */
41     void doEditAction(EditAction action);
42 
43 protected:
44     ByteArrayTableCursor* mCursor;
45     AbstractByteArrayView* mView;
46 };
47 
48 }
49 
50 #endif
51