kexidblabel.h
1/* This file is part of the KDE project
2 Copyright (C) 2005 Christian Nitschkowski <segfault_ii@web.de>
3 Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KEXIDBLABEL_H
22#define KEXIDBLABEL_H
23
24#include <tqimage.h>
25#include <tqlabel.h>
26
27#include <kpixmap.h>
28
29#include "../kexiformdataiteminterface.h"
30#include "../kexidbtextwidgetinterface.h"
31#include <widget/utils/kexidisplayutils.h>
32
33class TQPainter;
34class TQTimer;
35class KexiDBInternalLabel;
36
38
42class KEXIFORMUTILS_EXPORT KexiDBLabel : public TQLabel, protected KexiDBTextWidgetInterface, public KexiFormDataItemInterface {
43 TQ_OBJECT
44
45 TQ_PROPERTY( TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true )
46 TQ_PROPERTY( TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true )
47 TQ_PROPERTY( bool shadowEnabled READ shadowEnabled WRITE setShadowEnabled DESIGNABLE true )
48 TQ_OVERRIDE( TQPixmap pixmap DESIGNABLE false )
49 TQ_OVERRIDE( bool scaledContents DESIGNABLE false )
50// TQ_OVERRIDE( TQColor paletteForegroundColor READ paletteForegroundColor WRITE setPaletteForegroundColor DESIGNABLE true )
51 TQ_PROPERTY( TQColor frameColor READ frameColor WRITE setFrameColor DESIGNABLE true )
52
53 public:
54 KexiDBLabel( TQWidget *parent, const char *name = 0, WFlags f = 0 );
55 KexiDBLabel( const TQString& text, TQWidget *parent, const char *name = 0, WFlags f = 0 );
56 virtual ~KexiDBLabel();
57
58 inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); }
59 inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); }
60
61 virtual TQVariant value();
62
63 bool shadowEnabled() const;
64
65 virtual void setInvalidState( const TQString& displayText );
66
67 virtual bool valueIsNull();
68
69 virtual bool valueIsEmpty();
70
72 virtual bool isReadOnly() const;
73
74 virtual TQWidget* widget();
75
77 virtual bool cursorAtStart();
78
80 virtual bool cursorAtEnd();
81
82 virtual void clear();
83
85 virtual bool setProperty ( const char * name, const TQVariant & value );
86
87 virtual const TQColor& frameColor() const;
88
89// const TQColor & paletteForegroundColor() const;
90
91 public slots:
93 inline void setDataSource( const TQString &ds ) { KexiFormDataItemInterface::setDataSource( ds ); }
94
95 inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); }
96
97 virtual void setText( const TQString& text );
98
101 void setShadowEnabled( bool state );
102
103 virtual void setPalette( const TQPalette &pal );
104
105 virtual void setFrameColor(const TQColor& color);
106
107// void setPaletteForegroundColor( const TQColor& color );
108
109 protected slots:
111 virtual void setReadOnly( bool readOnly );
112 void updatePixmap();
113
114 protected:
115 void init();
116 virtual void setColumnInfo(KexiDB::QueryColumnInfo* cinfo);
117 virtual void paintEvent( TQPaintEvent* );
118 virtual void resizeEvent( TQResizeEvent* e );
119
121 virtual void setValueInternal( const TQVariant& add, bool removeOld );
122
123 virtual void fontChange( const TQFont& font );
124 virtual void styleChange( TQStyle& style );
125 virtual void enabledChange( bool enabled );
126
127 virtual void paletteChange( const TQPalette& oldPal );
128 virtual void frameChanged();
129 virtual void showEvent( TQShowEvent* e );
130
133 virtual void drawFrame( TQPainter * );
134
135 void updatePixmapLater();
136
137 class Private;
138 Private *d;
139};
140
141#endif
An extended, data-aware, read-only text label.
Definition kexidblabel.h:42
void setDataSource(const TQString &ds)
Sets the datasource to ds.
Definition kexidblabel.h:93
virtual void drawFrame(TQPainter *)
Reimplemented to paint using real frame color instead of froeground.
An interface providing common text editor's functionality.
void setColumnInfo(KexiDB::QueryColumnInfo *cinfo, TQWidget *w)
Called from KexiFormDataItemInterface::setColumnInfo(KexiDB::QueryColumnInfo* cinfo) implementation.
Helper class that assigns additional information for the column in a query.
Definition queryschema.h:49
virtual bool cursorAtEnd()=0
virtual bool cursorAtStart()=0
virtual bool isReadOnly() const
virtual TQVariant value()=0
virtual bool valueIsNull()=0
virtual bool valueIsEmpty()=0
virtual void setValueInternal(const TQVariant &add, bool removeOld)=0
virtual void clear()=0
clears item's data, so the data will contain NULL data
An interface for declaring form widgets to be data-aware.
void setDataSourceMimeType(const TQCString &ds)
void setDataSource(const TQString &ds)
Sets the name of the data source for this widget.
virtual void setInvalidState(const TQString &displayText)=0
virtual void setReadOnly(bool readOnly)=0