diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 2bda8f7717adf28da4af0d34fb82f63d2868c31d (patch) | |
tree | 8d927b7b47a90c4adb646482a52613f58acd6f8c /superkaramba/src/textfield.cpp | |
download | tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.tar.gz tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'superkaramba/src/textfield.cpp')
-rw-r--r-- | superkaramba/src/textfield.cpp | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/superkaramba/src/textfield.cpp b/superkaramba/src/textfield.cpp new file mode 100644 index 0000000..6578466 --- /dev/null +++ b/superkaramba/src/textfield.cpp @@ -0,0 +1,159 @@ +/*************************************************************************** + * Copyright (C) 2003 by Ralph M. Churchill * + * mrchucho@yahoo.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include "textfield.h" +#include <qfontmetrics.h> +#include <kdebug.h> + +TextField::TextField( ) +{ + setFontSize(12); + setColor(QColor(192, 192, 192)); + setBGColor(QColor(0, 0, 0)); + setFont("Helvetica"); + setAlignment(Qt::AlignLeft); + setFixedPitch(false); + setShadow(0); +} + +TextField::~TextField() +{ +} + +TextField::TextField( const TextField& def ) +{ + setFontSize( def.getFontSize() ); + + setColor(def.getColor()); + setBGColor(def.getBGColor()); + + setFont( def.getFont() ); + setAlignment( def.getAlignment() ); + setFixedPitch( def.getFixedPitch() ); + setShadow( def.getShadow() ); +} + +TextField& TextField::operator=(const TextField& rhs) +{ + if( this == &rhs) + return *this; + + setFontSize( rhs.getFontSize() ); + + setColor(rhs.getColor()); + setBGColor(rhs.getBGColor()); + + setFont( rhs.getFont() ); + setAlignment( rhs.getAlignment() ); + setFixedPitch( rhs.getFixedPitch() ); + setShadow( rhs.getShadow() ); + + return *this; +} + +void TextField::setColor(QColor clr) +{ + color = clr; +} + +QColor TextField::getColor() const +{ + return color; +} + +void TextField::setBGColor(QColor clr) +{ + bgColor = clr; +} + +QColor TextField::getBGColor() const +{ + return bgColor; +} + + +void TextField::setFont(const QString &f) +{ + font.setFamily(f); + lineHeight = QFontMetrics(font).height(); +} + + +QString TextField::getFont() const +{ + return font.family(); +} + +void TextField::setFontSize(int size) +{ + font.setPointSize(size); + lineHeight = QFontMetrics(font).height(); +} + +int TextField::getFontSize() const +{ + return font.pointSize(); +} + +void TextField::setAlignment( const QString &align ) +{ + QString a = align.upper(); + if( a == "LEFT" || a.isEmpty() ) + alignment = Qt::AlignLeft; + if( a == "RIGHT" ) + alignment = Qt::AlignRight; + if( a == "CENTER" ) + alignment = Qt::AlignHCenter; +} + +void TextField::setAlignment( int af ) +{ + alignment = af; +} + +int TextField::getAlignment() const +{ + return alignment; +} + +QString TextField::getAlignmentAsString() const +{ + if( alignment == Qt::AlignHCenter ) + return "CENTER"; + else if( alignment == Qt::AlignRight ) + return "RIGHT"; + else + return "LEFT"; +} + +void TextField::setFixedPitch( bool fp) +{ + font.setFixedPitch( fp ); +} + +bool TextField::getFixedPitch() const +{ + return font.fixedPitch(); +} + +void TextField::setShadow ( int s ) +{ + shadow = s; +} + +int TextField::getShadow() const +{ + return shadow; +} + +int TextField::getLineHeight() const +{ + return lineHeight; +} |