23 #include "clicklineedit.h"
25 #include "tqpainter.h"
29 ClickLineEdit::ClickLineEdit(TQWidget *parent, const TQString &msg, const char* name) :
30 KLineEdit(parent, name)
33 setClickMessage( msg );
36 ClickLineEdit::~ClickLineEdit() {}
39 void ClickLineEdit::setClickMessage( const TQString &msg )
45 void ClickLineEdit::setText( const TQString &txt )
47 mDrawClickMsg = txt.isEmpty();
49 KLineEdit::setText( txt );
52 void ClickLineEdit::drawContents( TQPainter *p )
54 KLineEdit::drawContents( p );
56 if ( mDrawClickMsg == true && !hasFocus() ) {
58 p->setPen( palette().color( TQPalette::Disabled, TQColorGroup::Text ) );
59 TQRect cr = contentsRect();
60 p->drawText( cr, AlignAuto|AlignVCenter, mClickMessage );
65 void ClickLineEdit::focusInEvent( TQFocusEvent *ev )
67 if ( mDrawClickMsg == true )
69 mDrawClickMsg = false;
72 TQLineEdit::focusInEvent( ev );
75 void ClickLineEdit::focusOutEvent( TQFocusEvent *ev )
77 if ( text().isEmpty() )
82 TQLineEdit::focusOutEvent( ev );
85 #include "clicklineedit.moc"
TDEPIM classes for drag and drop of mails.
|