1 /***************************************************************************
2 fractionbasewidget.h - base fraction painting
5 copyright : (C) 2004 by Sebastian Stein
6 email : seb.kde@hpfsc.de
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #ifndef FRACTIONBASEWIDGET_H
19 #define FRACTIONBASEWIDGET_H
21 /** the space between a ratio and an operation */
33 /*! base class for painting fractions
35 * \author Sebastian Stein */
36 class FractionBaseWidget
: public QWidget
42 FractionBaseWidget(QWidget
* parent
, const char * name
);
45 ~FractionBaseWidget();
47 /** updates the widget by first getting the settings and then repainting */
48 void updateAndRepaint();
52 /* store the different colors */
55 QColor m_colorOperation
;
57 /* the font to paint with */
60 /** overrideing the paint event of QWidget */
61 virtual void paintEvent(QPaintEvent
*) = 0;
63 /** paints a ratio at the given position */
64 void paintRatio(QPainter
& paint
, ratio tmp_ratio
, int & x_pos
, QFontMetrics
& fm
, bool show_mixed
, bool addMargin
= true);
66 /** paints a string in the vertical middle (aligned to the operation signs) */
67 void paintMiddle(QPainter
& paint
, const QString
& paint_str
, int & x_pos
, QFontMetrics
& fm
, QColor color
, bool addMargin
= true);
70 /** sets the font and color; values taken from settingsclass */
71 void setColorAndFont();