1 #ifndef BORDEREDBARWIDGET_H_
2 #define BORDEREDBARWIDGET_H_
4 #include <QtGui/QWidget>
5 #include <QtGui/QLabel>
7 //! Userinterface class. Displays text or images with a gradient border.
9 * Userinterface class. Displays text or images with a gradient border. Inherits QWidget and
10 * diplays content in QLabel.
12 class BorderedBarWidget : public QWidget {
19 LeftAlign, /*!< Indicates that the item inserted should be aligned to the left. */
20 CenterAlign, /*!< Indicates that the item inserted should be aligned to the center. */
21 RightAlign /*!< Indicates that the item inserted should be aligned to the right. */
27 * Constructor to initialize a BorderedBarWidget instance.
28 * \param aParent Parent widget. Optional.
30 BorderedBarWidget( QWidget *aParent = 0 );
32 virtual ~BorderedBarWidget();
34 //! Returns background color.
36 * \return The background color of the widget.
38 QColor backgroundColor();
39 //! Returns face color.
41 * \return The text and border color.
44 //! Returns border width.
46 * \return The border width.
51 * \param aPos Text position. Optional.
52 * \return The text at a position.
54 QString text( TextPosition aPos = CenterAlign );
56 //! Sets background color.
58 * Sets the background color of the widget.
59 * \param aColor The new color.
61 void setBackgroundColor( QColor aColor);
64 * Sets the text and border color of the widget.
65 * \param aColor The new color.
67 void setFaceColor( QColor aColor );
68 //! Sets border width.
70 * Sets the width of the border.
71 * \param aWidth The new width in pixels.
73 void setBorderWidth( int aWidth );
76 * Sets text to a certain position in a bar.
77 * \param aText The new text.
78 * \param aPos The position of the text. Optional.
80 void setText( QString aText, TextPosition aPos = CenterAlign );
83 * Sets pixmap to a certain position in a bar.
84 * \param aPixmap The new pixmap.
85 * \param aPos The position of the pixmap. Optional.
87 void setPixmap( QPixmap aPixmap, TextPosition aPos = RightAlign );
90 //! Draws the borders.
92 * Handles drawing of the borders.
97 * Handles drawing of a corner.
98 * \param aPainter Painter used for drawing.
99 * \param aCenter Inner corner of the widget.
101 void drawCorner( QPainter &aPainter, QPoint &aCenter );
104 * Handles drawing of a single side.
105 * \param aPainter Painter used for drawing.
106 * \param aStartPoint Start point of drawing area.
107 * \param aEndPoint End point of drawing area.
109 void drawSide( QPainter &aPainter, QPoint aStartPoint, QPoint aEndPoint );
112 //! Handles drawing of the widget.
114 * Handles drawing of the widget.
116 virtual void paintEvent(QPaintEvent *);
119 //! Palette for storing colors.
123 //! Label for left aligned content.
125 //! Label for center aligned content.
126 QLabel *iCenterLabel;
127 //! Label for right aligned content.
131 #endif /* BORDEREDBARWIDGET_H_ */