Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TextItem Class Reference

#include <celsplashscreen.h>

List of all members.

Public Member Functions

virtual void draw (QPainter *painter) const
QRect & getRect ()
void set (const QString &prefix, const KFileMetaInfoGroup &info)
void setColor (const QString &rgb)
void setContent (const QString &value)
void setFlags (int f)
void setFont (const QFont &_font)
 TextItem ()
virtual ~TextItem ()

Protected Attributes

QColor color
QString content
bool disable
int flags
QFont font
QString insertBefore
QRect rect
bool showBox


Constructor & Destructor Documentation

TextItem::TextItem  ) 
 

Definition at line 130 of file celsplashscreen.cpp.

References font.

00130                   :
00131     disable(false),
00132     color(QColor("white")),
00133     font(QFont("Arial")),
00134     showBox(false)
00135  {
00136     font.setPixelSize(11);
00137 }

virtual TextItem::~TextItem  )  [inline, virtual]
 

Definition at line 39 of file celsplashscreen.h.

00039 {};


Member Function Documentation

void TextItem::draw QPainter *  painter  )  const [virtual]
 

Definition at line 139 of file celsplashscreen.cpp.

References color, content, disable, flags, font, insertBefore, rect, setFont(), and showBox.

Referenced by CelSplashScreen::drawContents(), and CelSplashScreen::setPixmap().

00139                                            {
00140     if (disable) return;
00141     painter->setPen(color);
00142     painter->setFont(font);
00143     painter->drawText(rect, flags, insertBefore + content);
00144     if (showBox) painter->drawRect(rect);
00145 }

QRect& TextItem::getRect  )  [inline]
 

Definition at line 32 of file celsplashscreen.h.

References rect.

Referenced by CelSplashScreen::setPixmap().

00032 { return rect; }

void TextItem::set const QString &  prefix,
const KFileMetaInfoGroup &  info
 

Definition at line 156 of file celsplashscreen.cpp.

References disable, flags, font, insertBefore, rect, setColor(), and showBox.

Referenced by CelSplashScreen::setPixmap().

00156                                                                             {
00157     bool ok;
00158     int intVal;
00159     intVal = comments.value(prefix + "_disable").toInt(&ok);
00160     if (ok) disable = intVal;
00161     intVal = comments.value(prefix + "_x").toInt(&ok);
00162     if (ok) rect.setX(intVal);
00163     intVal = comments.value(prefix + "_y").toInt(&ok);
00164     if (ok) rect.setY(intVal);
00165     intVal = comments.value(prefix + "_width").toInt(&ok);
00166     if (ok) rect.setWidth(intVal);
00167     intVal = comments.value(prefix+ "_height").toInt(&ok);
00168     if (ok) rect.setHeight(intVal);
00169     QString sVal = comments.value(prefix + "_halign").toString();
00170     int _flags = -1;
00171     if (sVal == "left") {
00172         _flags = Qt::AlignLeft;
00173     } else if (sVal == "center") {
00174         _flags = Qt::AlignHCenter;
00175     } else if (sVal == "right") {
00176         _flags = Qt::AlignRight;
00177     }
00178     sVal = comments.value(prefix + "_valign").toString();
00179     if (sVal == "top") {
00180         if (_flags < 0) _flags = Qt::AlignTop;
00181         else _flags |= Qt::AlignTop;
00182     } else if (sVal == "center") {
00183         if (_flags < 0) _flags = Qt::AlignVCenter;
00184         else _flags |= Qt::AlignVCenter;
00185     } else if (sVal == "bottom") {
00186         if (_flags < 0) _flags = Qt::AlignBottom;
00187         else _flags |= Qt::AlignBottom;
00188     }
00189     if (_flags >= 0) flags = _flags;
00190     sVal = comments.value(prefix + "_font_family").toString();
00191     if (sVal != "") font.setFamily(sVal);
00192     intVal = comments.value(prefix + "_font_size").toInt(&ok);
00193     if (ok) font.setPixelSize(intVal);
00194     intVal = comments.value(prefix + "_font_is_bold").toInt(&ok);
00195     if (ok) font.setBold(intVal);
00196     sVal = comments.value(prefix + "_color").toString();
00197     if (sVal != "") setColor(sVal);
00198     intVal = comments.value(prefix + "_show_box").toInt(&ok);
00199     if (ok) showBox = intVal;
00200     sVal = comments.value(prefix + "_insert_before").toString();
00201     if (sVal != "") insertBefore = sVal;
00202 }

void TextItem::setColor const QString &  rgb  ) 
 

Definition at line 147 of file celsplashscreen.cpp.

References color.

Referenced by set().

00147                                           {
00148     bool okr, okg, okb;
00149     int r, g, b;
00150     r = rgb.mid(0, 2).toInt(&okr, 16);
00151     g = rgb.mid(2, 2).toInt(&okg, 16);
00152     b = rgb.mid(4, 2).toInt(&okb, 16);
00153     if (okr && okg && okb) color.setRgb(r, g, b);
00154 }

void TextItem::setContent const QString &  value  )  [inline]
 

Definition at line 37 of file celsplashscreen.h.

References content.

Referenced by CelSplashScreen::setPixmap(), and CelSplashScreen::update().

00037 { content = value; }

void TextItem::setFlags int  f  )  [inline]
 

Definition at line 34 of file celsplashscreen.h.

References flags.

Referenced by CelSplashScreen::setPixmap().

00034 { flags = f; };

void TextItem::setFont const QFont &  _font  )  [inline]
 

Definition at line 36 of file celsplashscreen.h.

References font.

Referenced by draw().

00036 { font = _font; }


Member Data Documentation

QColor TextItem::color [protected]
 

Definition at line 46 of file celsplashscreen.h.

Referenced by draw(), and setColor().

QString TextItem::content [protected]
 

Definition at line 48 of file celsplashscreen.h.

Referenced by draw(), and setContent().

bool TextItem::disable [protected]
 

Definition at line 43 of file celsplashscreen.h.

Referenced by draw(), and set().

int TextItem::flags [protected]
 

Definition at line 45 of file celsplashscreen.h.

Referenced by draw(), set(), and setFlags().

QFont TextItem::font [protected]
 

Definition at line 47 of file celsplashscreen.h.

Referenced by draw(), set(), setFont(), and TextItem().

QString TextItem::insertBefore [protected]
 

Definition at line 49 of file celsplashscreen.h.

Referenced by draw(), and set().

QRect TextItem::rect [protected]
 

Definition at line 44 of file celsplashscreen.h.

Referenced by draw(), getRect(), and set().

bool TextItem::showBox [protected]
 

Definition at line 50 of file celsplashscreen.h.

Referenced by draw(), and set().


The documentation for this class was generated from the following files:
Generated on Sat Jan 14 22:33:39 2006 for Celestia by  doxygen 1.4.1