kexi

kexidblabel.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Christian Nitschkowski <segfault_ii@web.de>
00003    Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this program; see the file COPYING.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KEXIDBLABEL_H
00022 #define KEXIDBLABEL_H
00023 
00024 #include <qimage.h>
00025 #include <qlabel.h>
00026 
00027 #include <kpixmap.h>
00028 
00029 #include "../kexiformdataiteminterface.h"
00030 #include "../kexidbtextwidgetinterface.h"
00031 #include <widget/utils/kexidisplayutils.h>
00032 
00033 class QPainter;
00034 class QTimer;
00035 class KexiDBInternalLabel;
00036 
00038 
00042 class KEXIFORMUTILS_EXPORT KexiDBLabel : public QLabel, protected KexiDBTextWidgetInterface, public KexiFormDataItemInterface {
00043         Q_OBJECT
00044         Q_PROPERTY( QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true )
00045         Q_PROPERTY( QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true )
00046         Q_PROPERTY( bool shadowEnabled READ shadowEnabled WRITE setShadowEnabled DESIGNABLE true )
00047         Q_OVERRIDE( QPixmap pixmap DESIGNABLE false )
00048         Q_OVERRIDE( bool scaledContents DESIGNABLE false )
00049 //      Q_OVERRIDE( QColor paletteForegroundColor READ paletteForegroundColor WRITE setPaletteForegroundColor DESIGNABLE true )
00050         Q_PROPERTY( QColor frameColor READ frameColor WRITE setFrameColor DESIGNABLE true )
00051 
00052     public:
00053         KexiDBLabel( QWidget *parent, const char *name = 0, WFlags f = 0 );
00054         KexiDBLabel( const QString& text, QWidget *parent, const char *name = 0, WFlags f = 0 );
00055         virtual ~KexiDBLabel();
00056 
00057         inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); }
00058         inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); }
00059 
00060         virtual QVariant value();
00061 
00062         bool shadowEnabled() const;
00063 
00064         virtual void setInvalidState( const QString& displayText );
00065 
00066         virtual bool valueIsNull();
00067 
00068         virtual bool valueIsEmpty();
00069 
00071         virtual bool isReadOnly() const;
00072 
00073         virtual QWidget* widget();
00074 
00076         virtual bool cursorAtStart();
00077 
00079         virtual bool cursorAtEnd();
00080 
00081         virtual void clear();
00082 
00084         virtual bool setProperty ( const char * name, const QVariant & value );
00085 
00086         virtual const QColor& frameColor() const;
00087 
00088 //      const QColor & paletteForegroundColor() const;
00089 
00090     public slots:
00092         inline void setDataSource( const QString &ds ) { KexiFormDataItemInterface::setDataSource( ds ); }
00093 
00094         inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); }
00095 
00096         virtual void setText( const QString& text );
00097 
00100         void setShadowEnabled( bool state );
00101 
00102         virtual void setPalette( const QPalette &pal );
00103 
00104         virtual void setFrameColor(const QColor& color);
00105 
00106 //      void setPaletteForegroundColor( const QColor& color );
00107 
00108     protected slots:
00110         virtual void setReadOnly( bool readOnly );
00111         void updatePixmap();
00112 
00113     protected:
00114         void init();
00115         virtual void setColumnInfo(KexiDB::QueryColumnInfo* cinfo);
00116         virtual void paintEvent( QPaintEvent* );
00117         virtual void resizeEvent( QResizeEvent* e );
00118 
00120         virtual void setValueInternal( const QVariant& add, bool removeOld );
00121 
00122         virtual void fontChange( const QFont& font );
00123         virtual void styleChange( QStyle& style );
00124         virtual void enabledChange( bool enabled );
00125 
00126         virtual void paletteChange( const QPalette& oldPal );
00127         virtual void frameChanged();
00128         virtual void showEvent( QShowEvent* e );
00129 
00132         virtual void drawFrame( QPainter * );
00133 
00134         void updatePixmapLater();
00135 
00136         class Private;
00137         Private *d;
00138 };
00139 
00140 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys