1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQMultiLineEdit.h
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQMultiLineEdit_h
21 #define YQMultiLineEdit_h
24 #include "YMultiLineEdit.h"
26 class YQWidgetCaption;
31 * MultiLineEdit - an input area for multi-line text.
33 class YQMultiLineEdit : public QFrame, public YMultiLineEdit
41 YQMultiLineEdit( YWidget * parent, const string & label );
46 virtual ~YQMultiLineEdit();
49 * Get the current value (the text entered by the user or set from the
50 * outside) of this MultiLineEdit.
52 * Implemented from YMultiLineEdit.
54 virtual string value();
57 * Set the current value (the text entered by the user or set from the
58 * outside) of this MultiLineEdit.
60 * Implemented from YMultiLineEdit.
62 virtual void setValue( const string & text );
65 * Set the label (the caption above the MultiLineEdit).
67 * Reimplemented from YMultiLineEdit.
69 virtual void setLabel( const string & label );
72 * Set the maximum input length, i.e., the maximum number of characters the
73 * user can enter. -1 means no limit.
75 * Reimplemented from YMultiLineEdit.
77 virtual void setInputMaxLength( int numberOfChars );
80 * Set enabled/disabled state.
82 * Reimplemented from YWidget.
84 virtual void setEnabled( bool enabled );
87 * Preferred width of the widget.
89 * Reimplemented from YWidget.
91 virtual int preferredWidth();
94 * Preferred height of the widget.
96 * Reimplemented from YWidget.
98 virtual int preferredHeight();
101 * Set the new size of the widget.
103 * Reimplemented from YWidget.
105 virtual void setSize( int newWidth, int newHeight );
108 * Accept the keyboard focus.
110 virtual bool setKeyboardFocus();
116 * Triggered when the text changes.
121 * Enforce the maximum input length: If the text becomes too long, remove
122 * the just-entered character at the current cursor position.
124 * Note that this is a lot more user friendly than silently truncating at
125 * the end of the text: In the latter case, chances are that the user never
126 * gets to know that text was truncated. Removing the just-typed character
127 * OTOH is something he will notice very quickly.
129 void enforceMaxInputLength();
134 YQWidgetCaption * _caption;
135 QTextEdit * _qt_textEdit;
139 #endif // YQMultiLineEdit_h