File indexing completed on 2024-05-12 05:53:36
0001 /* 0002 SPDX-FileCopyrightText: 2020-2020 Carlos Alves <cbcalves@gmail.com> 0003 SPDX-FileCopyrightText: 2007-2008 Robert Knight <robertknight@gmail.com> 0004 SPDX-FileCopyrightText: 1997, 1998 Lars Doelle <lars.doelle@on-line.de> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef HIGHLIGHTSCROLLEDLINES_HPP 0010 #define HIGHLIGHTSCROLLEDLINES_HPP 0011 0012 // Qt 0013 #include <QRect> 0014 #include <QTimer> 0015 #include <QWidget> 0016 0017 // Konsole 0018 #include "Enumeration.h" 0019 #include "konsoleprivate_export.h" 0020 0021 namespace Konsole 0022 { 0023 class TerminalScrollBar; 0024 /** 0025 * Control the highlight the lines that are coming into view. 0026 * A thin blue line on the left of the terminal that highlight 0027 * the new lines in the following situations: 0028 * - scrolling with the mouse 0029 * - using the scroll bar 0030 * - using the keyboard to move up/down 0031 * - new lines resulting from the output of a command 0032 */ 0033 class HighlightScrolledLines 0034 { 0035 public: 0036 HighlightScrolledLines(); 0037 ~HighlightScrolledLines(); 0038 /** 0039 * Return if highlight lines is enabled 0040 */ 0041 bool isEnabled(); 0042 /** 0043 * Enable or disable the highlight lines 0044 */ 0045 void setEnabled(bool enable); 0046 int getPreviousScrollCount(); 0047 void setPreviousScrollCount(int scrollCount); 0048 /** 0049 * Set the highlight line timer if it's enabled 0050 */ 0051 void setTimer(TerminalScrollBar *parent); 0052 /** 0053 * Starts the highlight line timer 0054 */ 0055 void startTimer(); 0056 /** 0057 * Return if the highlight line timer is active 0058 */ 0059 bool isTimerActive(); 0060 /** 0061 * Highlight line size of the blue line 0062 */ 0063 QRect &rect(); 0064 static const int HIGHLIGHT_SCROLLED_LINES_WIDTH = 3; 0065 0066 private: 0067 bool _enabled = false; 0068 QRect _rect; 0069 int _previousScrollCount = 0; 0070 std::unique_ptr<QTimer> _timer; 0071 }; 0072 } // namespace Konsole 0073 0074 #endif // HIGHLIGHTSCROLLEDLINES_HPP