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_KEYNAVIGATOR_HPP 0010 #define OKTETA_KEYNAVIGATOR_HPP 0011 0012 // lib 0013 #include "abstractcontroller.hpp" 0014 0015 class QMenu; 0016 0017 namespace Okteta { 0018 class AbstractByteArrayView; 0019 0020 class KeyNavigator : public AbstractController 0021 { 0022 private: 0023 enum MoveAction 0024 { 0025 MoveBackward, 0026 MoveWordBackward, 0027 MoveForward, 0028 MoveWordForward, 0029 MoveUp, 0030 MovePgUp, 0031 MoveDown, 0032 MovePgDown, 0033 MoveLineStart, 0034 MoveHome, 0035 MoveLineEnd, 0036 MoveEnd 0037 }; 0038 0039 public: 0040 KeyNavigator(AbstractByteArrayView* view, AbstractController* parent); 0041 0042 public: // AbstractController API 0043 bool handleKeyPress(QKeyEvent* keyEvent) override; 0044 0045 public: 0046 int addContextMenuActions(QMenu* menu); 0047 0048 private: 0049 /** moves the cursor according to the action, handles all drawing */ 0050 void moveCursor(MoveAction action, bool select); 0051 void selectAll(); 0052 0053 private: 0054 AbstractByteArrayView* mView; 0055 }; 0056 0057 } 0058 0059 #endif