File indexing completed on 2024-04-21 04:02:43
0001 // 0002 // C++ Interface: cmultiinputline 0003 // 0004 // Description: 0005 // 0006 /* 0007 Copyright 2004-2011 Tomas Mecir <kmuddy@kmuddy.com> 0008 0009 This program is free software; you can redistribute it and/or 0010 modify it under the terms of the GNU General Public License as 0011 published by the Free Software Foundation; either version 2 of 0012 the License, or (at your option) any later version. 0013 0014 This program is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 GNU General Public License for more details. 0018 0019 You should have received a copy of the GNU General Public License 0020 along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 */ 0022 0023 #ifndef CMULTIINPUTLINE_H 0024 #define CMULTIINPUTLINE_H 0025 0026 #include <QTextEdit> 0027 0028 #include "cactionbase.h" 0029 0030 /** 0031 The multi-line input line. It can hold several lines, and can automatically expand/shrink as needed. 0032 0033 @author Tomas Mecir 0034 */ 0035 class cMultiInputLine : public QTextEdit, public cActionBase 0036 { 0037 Q_OBJECT 0038 public: 0039 /** constructor */ 0040 cMultiInputLine (int sess, QWidget *parent = nullptr); 0041 /** destructor */ 0042 ~cMultiInputLine () override; 0043 0044 /** initialize the input line - must be separated 0045 from the constructor, because it uses cSession, which is not 0046 available in constructor */ 0047 void initialize (); 0048 0049 void keepText (bool value); 0050 void selectKeptText (bool value); 0051 void swapEnters (bool value); 0052 0053 /** set height, given as a number of lines */ 0054 void setLinesHeight (int lines); 0055 0056 /** set the new font */ 0057 void setMyFont (const QFont &font); 0058 0059 signals: 0060 void commandEntered (const QString &command); 0061 0062 protected slots: 0063 void updateHeight (); 0064 protected: 0065 void eventNothingHandler (QString event, int session) override; 0066 void sendCommands (); 0067 0068 void keyPressEvent (QKeyEvent *e) override; 0069 0070 int _lines; 0071 0072 bool keeptext; 0073 bool selectkepttext; 0074 bool swapenters; 0075 }; 0076 0077 #endif