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 
00043 class KEXIFORMUTILS_EXPORT KexiDBLabel : public QLabel, protected KexiDBTextWidgetInterface, public KexiFormDataItemInterface {
00044         Q_OBJECT
00045         Q_PROPERTY( QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true )
00046         Q_PROPERTY( QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true )
00047         Q_PROPERTY( bool shadowEnabled READ shadowEnabled WRITE setShadowEnabled DESIGNABLE true )
00048         Q_OVERRIDE( QPixmap pixmap DESIGNABLE false )
00049         Q_OVERRIDE( bool scaledContents DESIGNABLE false )
00050 //      Q_OVERRIDE( QColor paletteForegroundColor READ paletteForegroundColor WRITE setPaletteForegroundColor DESIGNABLE true )
00051         Q_PROPERTY( QColor frameColor READ frameColor WRITE setFrameColor DESIGNABLE true )
00052 
00053     public:
00054         KexiDBLabel( QWidget *parent, const char *name = 0, WFlags f = 0 );
00055         KexiDBLabel( const QString& text, QWidget *parent, const char *name = 0, WFlags f = 0 );
00056         virtual ~KexiDBLabel();
00057 
00058         inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); }
00059         inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); }
00060 
00061         virtual QVariant value();
00062 
00063         bool shadowEnabled() const;
00064 
00065         virtual void setInvalidState( const QString& displayText );
00066 
00067         virtual bool valueIsNull();
00068 
00069         virtual bool valueIsEmpty();
00070 
00072         virtual bool isReadOnly() const;
00073 
00074         virtual QWidget* widget();
00075 
00077         virtual bool cursorAtStart();
00078 
00080         virtual bool cursorAtEnd();
00081 
00082         virtual void clear();
00083 
00085         virtual bool setProperty ( const char * name, const QVariant & value );
00086 
00087         virtual const QColor& frameColor() const;
00088 
00089 //      const QColor & paletteForegroundColor() const;
00090 
00091     public slots:
00093         inline void setDataSource( const QString &ds ) { KexiFormDataItemInterface::setDataSource( ds ); }
00094 
00095         inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); }
00096 
00097         virtual void setText( const QString& text );
00098 
00101         void setShadowEnabled( bool state );
00102 
00103         virtual void setPalette( const QPalette &pal );
00104 
00105         virtual void setFrameColor(const QColor& color);
00106 
00107 //      void setPaletteForegroundColor( const QColor& color );
00108 
00109     protected slots:
00110         void updatePixmap();
00111 
00112     protected:
00113         void init();
00114         virtual void setColumnInfo(KexiDB::QueryColumnInfo* cinfo);
00115         virtual void paintEvent( QPaintEvent* );
00116         virtual void resizeEvent( QResizeEvent* e );
00117 
00119         virtual void setValueInternal( const QVariant& add, bool removeOld );
00120 
00121         virtual void fontChange( const QFont& font );
00122         virtual void styleChange( QStyle& style );
00123         virtual void enabledChange( bool enabled );
00124 
00125         virtual void paletteChange( const QPalette& oldPal );
00126         virtual void frameChanged();
00127         virtual void showEvent( QShowEvent* e );
00128 
00131         virtual void drawFrame( QPainter * );
00132 
00133         void updatePixmapLater();
00134 
00135         class Private;
00136         Private *d;
00137 };
00138 
00139 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys