- Don't create layouts with parent. Qt 4.x automatically reparents
[duncan/yast2-qt4.git] / src / YQLogView.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQLogView.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQLogView_h
21 #define YQLogView_h
22
23 #include <QFrame>
24 #include <QTextEdit>
25
26 #include "YLogView.h"
27
28 class YQWidgetCaption;
29
30
31 class YQLogView : public QFrame, public YLogView
32 {
33     Q_OBJECT
34
35 public:
36
37     /**
38      * Constructor
39      **/
40     YQLogView( YWidget *        parent,
41                const string &   label,
42                int              visibleLines,
43                int              maxLines );
44
45     /**
46      * Destructor.
47      **/
48     virtual ~YQLogView();
49
50 protected:
51     /**
52      * Display the part of the log text that should be displayed.
53      * 'text' contains the last 'visibleLines()' lines.
54      * This is called whenever the log text changes. Note that the text might
55      * also be empty, in which case the displayed log text should be cleared.
56      *
57      * Implemented from YLogView.
58      **/
59     virtual void displayLogText( const string & text );
60
61 public:
62
63     /**
64      * Set the label (the caption above the log text).
65      *
66      * Reimplemented from YLogView.
67      **/
68     virtual void setLabel( const string & label );
69
70     /**
71      * Set enabled/disabled state.
72      *
73      * Reimplemented from YWidget.
74      **/
75     virtual void setEnabled( bool enabled );
76
77     /**
78      * Preferred width of the widget.
79      *
80      * Reimplemented from YWidget.
81      **/
82     virtual int preferredWidth();
83
84     /**
85      * Preferred height of the widget.
86      *
87      * Reimplemented from YWidget.
88      **/
89     virtual int preferredHeight();
90
91     /**
92      * Set the new size of the widget.
93      *
94      * Reimplemented from YWidget.
95      **/
96     virtual void setSize( int newWidth, int newHeight );
97
98     /**
99      * Accept the keyboard focus.
100      **/
101     virtual bool setKeyboardFocus();
102
103
104 protected:
105
106     YQWidgetCaption *   _caption;
107     QTextEdit * _qt_text;
108 };
109
110
111 #endif // YQLogView_h