1
/* Copyright (C) 2008 e_k (e_k@users.sourceforge.net)
2
Copyright (C) 2009 Lorenzo "Il Rugginoso" Masini <lorenxo86@gmail.com>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301, USA.
21
#ifndef _Q_TERM_WIDGET
22
#define _Q_TERM_WIDGET
26
struct TermWidgetImpl;
28
enum COLOR_SCHEME { COLOR_SCHEME_WHITE_ON_BLACK = 1,
29
COLOR_SCHEME_GREEN_ON_BLACK,
30
COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW
33
class QTermWidget : public QWidget
38
enum ScrollBarPosition
40
/** Do not show the scroll bar. */
42
/** Show the scroll bar on the left side of the display. */
44
/** Show the scroll bar on the right side of the display. */
50
QTermWidget( int startnow = 1, //start shell program immediately
51
QWidget *parent = 0 );
54
//start shell program if it was not started in constructor
55
void startShellProgram();
57
//look-n-feel, if you don`t like defaults
60
// Default is application font with family Monospace, size 10
61
// USE ONLY FIXED-PITCH FONT!
62
// otherwise symbols' position could be incorrect
63
void setTerminalFont( QFont &font );
66
void setEnvironment( const QStringList& environment );
68
// Shell program, default is /bin/bash
69
void setShellProgram( const QString &progname );
72
void setWorkingDirectory( const QString& dir );
74
// Shell program args, default is none
75
void setArgs( QStringList &args );
77
//Text codec, default is UTF-8
78
void setTextCodec( QTextCodec *codec );
80
//Color scheme, default is white on black
81
void setColorScheme( int scheme );
84
void setSize( int h, int v );
87
void setFixedSize( int h, int v );
89
// History size for scrolling
90
void setHistorySize( int lines ); //infinite if lines < 0
92
// Presence of scrollbar
93
void setScrollBarPosition( ScrollBarPosition );
95
// Send some text to terminal
96
void sendText( QString &text );
98
// Sets whether flow control is enabled
99
void setFlowControlEnabled( bool enabled );
101
// Returns whether flow control is enabled
102
bool flowControlEnabled( void );
105
* Sets whether the flow control warning box should be shown
106
* when the flow control stop key (Ctrl+S) is pressed.
108
void setFlowControlWarningEnabled( bool enabled );
110
QSize minimumSizeHint() const;
111
QSize sizeHint() const;
115
void receivedData( const QString &data );
118
// Paste clipboard content to terminal
119
void copyClipboard();
121
// Copies selection to clipboard
122
void pasteClipboard();
125
virtual void resizeEvent( QResizeEvent * );
128
void sessionFinished();
132
TermWidgetImpl *m_impl;
136
//Maybe useful, maybe not
141
void *createTermWidget( int startnow, void *parent );