File indexing completed on 2024-04-28 05:52:36

0001 /*
0002     This file is part of the Okteta Gui library, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2004, 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef OKTETA_ABSTRACTEDITOR_HPP
0010 #define OKTETA_ABSTRACTEDITOR_HPP
0011 
0012 // lib
0013 #include "abstractcontroller.hpp"
0014 
0015 namespace Okteta {
0016 class AbstractByteArrayView;
0017 class ByteArrayTableCursor;
0018 
0019 class AbstractEditor : public AbstractController
0020 {
0021 protected:
0022     enum EditAction
0023     {
0024         CharDelete,
0025         WordDelete,
0026         CharBackspace,
0027         WordBackspace
0028     };
0029 
0030 protected:
0031     AbstractEditor(ByteArrayTableCursor* cursor, AbstractByteArrayView* view, AbstractController* parent);
0032 
0033 public:
0034     ~AbstractEditor() override;
0035 
0036 public: // AbstractController API
0037     bool handleKeyPress(QKeyEvent* keyEvent) override;
0038 
0039 protected:
0040     /** executes edit action \p action. This is normally called by a key event handler. */
0041     void doEditAction(EditAction action);
0042 
0043 protected:
0044     ByteArrayTableCursor* mCursor;
0045     AbstractByteArrayView* mView;
0046 };
0047 
0048 }
0049 
0050 #endif