kexi

kexidbcheckbox.h
1/* This file is part of the KDE project
2 Copyright (C) 2005 Cedric Pasteur <cedric.pasteur@free.fr>
3 Copyright (C) 2004-2006 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 KexiDBCheckBox_H
22#define KexiDBCheckBox_H
23
24#include "kexiformdataiteminterface.h"
25#include <tqcheckbox.h>
26
28class KEXIFORMUTILS_EXPORT KexiDBCheckBox : public TQCheckBox, public KexiFormDataItemInterface
29{
30 TQ_OBJECT
31
32 TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true)
33 TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true)
34 TQ_OVERRIDE( Tristate tristate READ isTristate WRITE setTristate )
35 TQ_ENUMS( Tristate )
36
37 public:
38 KexiDBCheckBox(const TQString &text, TQWidget *parent, const char *name=0);
39 virtual ~KexiDBCheckBox();
40
41 inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); }
42 inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); }
43 virtual TQVariant value();
44 virtual void setInvalidState( const TQString& displayText );
45
48 virtual bool valueIsNull();
49
54 virtual bool valueIsEmpty();
55
57 virtual bool isReadOnly() const;
58
60 virtual TQWidget* widget();
61
62 virtual bool cursorAtStart();
63 virtual bool cursorAtEnd();
64 virtual void clear();
65
66 virtual void setEnabled(bool enabled);
67
68 enum Tristate { TristateDefault, TristateOn, TristateOff };
69
70 void setTristate(Tristate tristate);
71 Tristate isTristate() const;
72
74 virtual void setDisplayDefaultValue(TQWidget* widget, bool displayDefaultValue);
75
76 public slots:
77 void setDataSource(const TQString &ds);
78 inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); }
79 void slotStateChanged(int state);
80
82 virtual void setReadOnly( bool readOnly );
83
84 protected:
85 virtual void setValueInternal(const TQVariant& add, bool removeOld);
86
89 bool isTristateInternal() const;
90
92 void updateTristate();
93
94 private:
95 bool m_invalidState : 1;
96 bool m_tristateChanged : 1;
97 Tristate m_tristate;
98};
99
100#endif
bool isTristateInternal() const
virtual TQWidget * widget()
void updateTristate()
Updates tristate in TQCheckBox itself according to m_tristate.
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
void setDataSourceMimeType(const TQCString &ds)
virtual void setDisplayDefaultValue(TQWidget *widget, bool displayDefaultValue)
void setDataSource(const TQString &ds)
virtual void setInvalidState(const TQString &displayText)=0
virtual void setReadOnly(bool readOnly)=0
3-state logical type with three values: true, false and cancelled and convenient operators.
Definition tristate.h:100