20#include "kexibooltableedit.h"
22#include <kexidb/field.h>
25#include <tqapplication.h>
26#include <tqclipboard.h>
31#include <tdeglobalsettings.h>
37 setName( "KexiBoolTableEdit");
38 kdDebug() << "KexiBoolTableEdit: m_origValue.typeName()==" << m_origValue.typeName() << endl;
39 kdDebug() << "KexiBoolTableEdit: type== " << field()->typeName() << endl;
40 m_hasFocusableWidget = false;
41 m_acceptEditorAfterDeleteContents = true;
42 m_usesSelectedTextColor = false;
45KexiBoolTableEdit::~KexiBoolTableEdit()
73 if ( field()->isNotNull())
90 TQString &txt, int &align, int &x, int &y_offset, int &w, int &h )
104 int s = TQMAX(h - 5, 12);
107 TQRect r( TQMAX( w/2 - s/2, 0 ) , h/2 - s/2 , s, s);
111 p->drawText( r, TQt::AlignCenter, "?" );
113 else if (val.toBool()) {
114 p->drawLine(r.x(), r.y(), r.right(), r.bottom());
115 p->drawLine(r.x(), r.bottom(), r.right(), r.y());
122 if ( field()->isNotNull())
135 if (actionName== "edit_paste") {
136 emit editRequested();
138 const int value = tqApp->clipboard()->text( TQClipboard::Clipboard ).toInt(&ok);
144 ? TQVariant( false) : TQVariant();
148 else if (actionName== "edit_cut") {
149 emit editRequested();
152 ? TQVariant( false) : TQVariant();
161 if ( value.type()==TQVariant::Bool)
162 tqApp->clipboard()->setText( value.toBool() ? "1" : "0");
164 tqApp->clipboard()->setText(TQString());
170 return val.toPixmap().width();
177#include "kexibooltableedit.moc"
Cell editor for boolean type.
virtual bool cursorAtEnd()
virtual void setValueInternal(const TQVariant &add, bool removeOld) initializes this editor with add value
virtual void handleAction(const TQString &actionName)
virtual void handleCopyAction(const TQVariant &value, const TQVariant &visibleValue)
virtual int widthForValue(TQVariant &val, const TQFontMetrics &fm)
virtual void setupContents(TQPainter *p, bool focused, const TQVariant &val, TQString &txt, int &align, int &x, int &y_offset, int &w, int &h)
virtual void clickedOnContents()
TQVariant m_currentValue We've no editor widget that would store current value, so we do this here.
virtual void clear() clears item's data, so the data will contain NULL data
virtual bool cursorAtStart()
virtual bool valueIsEmpty()
virtual bool valueIsNull()
virtual TQVariant value()
virtual TQVariant visibleValue()
Abstract class for a cell editor. Handles cell painting and displaying the editor widget.
void repaintRelatedCell()
virtual KexiDB::Field * field() const
|