1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
15 Author: Stefan Hundhammer <sh@suse.de>
24 #include <QTextBrowser>
25 #include "YRichText.h"
32 class YQRichText : public QFrame, public YRichText
41 YQRichText( YWidget * parent,
43 bool plainTextMode = false );
48 virtual ~YQRichText();
51 * Change the text content of the RichText widget.
53 * Reimplemented from YRichText.
55 virtual void setValue( const string & newValue );
58 * Set this RichText widget's "plain text" mode on or off.
60 * Reimplemented from YRichText.
62 virtual void setPlainTextMode( bool on = true );
65 * Set this RichText widget's "auto scroll down" mode on or off.
67 * Reimplemented from YRichText.
69 virtual void setAutoScrollDown( bool on = true );
72 * Preferred width of the widget.
74 * Reimplemented from YWidget.
76 virtual int preferredWidth();
79 * Preferred height of the widget.
81 * Reimplemented from YWidget.
83 virtual int preferredHeight();
86 * Set the new size of the widget.
88 * Reimplemented from YWidget.
90 virtual void setSize( int newWidth, int newHeight );
93 * Set enabled/disabled state.
95 * Reimplemented from YWidget.
97 virtual void setEnabled( bool enabled );
100 * Accept the keyboard focus.
102 * Reimplemented from YWidget.
104 virtual bool setKeyboardFocus();
109 * Reimplemented from QWidget.
111 virtual bool eventFilter( QObject * obj, QEvent * ev );
114 * Returns 'true' if the current text of this RichText widget contains
117 bool haveHyperLinks();
123 * Notification that a hyperlink is clicked.
125 void linkClicked( const QUrl & url );
130 YQTextBrowser * _textBrowser;
135 * Helper class - needed to have the benefits of both QVBox as the base class
136 * for YQRichText so uniform margins can be implemented (outside, not inside
137 * the scroll window as QTextBrowser normally does it) and QTextBrowser's
138 * featurs (enable hyperlinks) without removing the text each time the user
141 * This class is required only to overwrite setSource().
143 class YQTextBrowser: public QTextBrowser
153 YQTextBrowser( QWidget * parent = 0 ):
154 QTextBrowser( parent ) {}
159 * Get the document pointed to by a hyperlink.
161 * Reimplemented from QTextBrowser to avoid having an empty text each time
162 * the user clicks on a hyperlink.
164 virtual void setSource( const QUrl & name ) {}
168 #endif // YQRichText_h