Warning, file /frameworks/ktexteditor/src/inputmode/katenormalinputmode.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: KDE Developers
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KATE_NORMAL_INPUT_MODE_H
0008 #define KATE_NORMAL_INPUT_MODE_H
0009 
0010 #include <memory>
0011 
0012 #include "kateabstractinputmode.h"
0013 
0014 class KateNormalInputModeFactory;
0015 class KateSearchBar;
0016 class KateCommandLineBar;
0017 
0018 class KateNormalInputMode : public KateAbstractInputMode
0019 {
0020     explicit KateNormalInputMode(KateViewInternal *viewInternal);
0021     friend KateNormalInputModeFactory;
0022 
0023 public:
0024     KTextEditor::View::ViewMode viewMode() const override;
0025     QString viewModeHuman() const override;
0026     KTextEditor::View::InputMode viewInputMode() const override;
0027     QString viewInputModeHuman() const override;
0028 
0029     void activate() override;
0030     void deactivate() override;
0031     void reset() override;
0032 
0033     bool overwrite() const override;
0034     void overwrittenChar(const QChar &) override;
0035 
0036     void clearSelection() override;
0037     bool stealKey(QKeyEvent *) override;
0038 
0039     void gotFocus() override;
0040     void lostFocus() override;
0041 
0042     void readSessionConfig(const KConfigGroup &config) override;
0043     void writeSessionConfig(KConfigGroup &config) override;
0044     void updateRendererConfig() override;
0045     void updateConfig() override;
0046     void readWriteChanged(bool rw) override;
0047 
0048     void find() override;
0049     void findSelectedForwards() override;
0050     void findSelectedBackwards() override;
0051     void findReplace() override;
0052     void findNext() override;
0053     void findPrevious() override;
0054 
0055     void activateCommandLine() override;
0056 
0057     bool keyPress(QKeyEvent *) override;
0058     bool blinkCaret() const override;
0059     KateRenderer::caretStyles caretStyle() const override;
0060 
0061     void toggleInsert() override;
0062     void launchInteractiveCommand(const QString &command) override;
0063 
0064     QString bookmarkLabel(int line) const override;
0065 
0066 private:
0067     /**
0068      * Search bar mode:
0069      *   - Setup Incremental mode, among other things: potential new search pattern
0070      *   - Setup Power mode, aka find & replace: Also potential new search pattern
0071      *   - Use current mode and current search pattern or if no Search bar exists, launch Incremental mode
0072      */
0073     enum SearchBarMode { IncrementalSearchBar, PowerSearchBar, IncrementalSearchBarOrKeepMode };
0074 
0075     /**
0076      * Get search bar, create it on demand. (with right mode)
0077      * @param mode wanted search bar mode
0078      * @return search bar widget
0079      */
0080     KateSearchBar *searchBar(const SearchBarMode mode);
0081 
0082     /**
0083      * search bar around?
0084      * @return search bar around?
0085      */
0086     bool hasSearchBar() const
0087     {
0088         return m_searchBar.get();
0089     }
0090 
0091     /**
0092      * Get command line bar, create it on demand.
0093      * @return command line bar, created if not already there
0094      */
0095     KateCommandLineBar *cmdLineBar();
0096 
0097 private:
0098     std::unique_ptr<KateSearchBar> m_searchBar;
0099     std::unique_ptr<KateCommandLineBar> m_cmdLine;
0100 };
0101 
0102 #endif