#include <kdialog.h>
#include <tdelocale.h>

/****************************************************************************
** Form implementation generated from reading ui file 'qeditconstant.ui'
**
** Created by: The TQt user interface compiler (TQt 3.5.0)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "qeditconstant.h"

#include <ntqvariant.h>
#include <klineedit.h>
#include <ntqlabel.h>
#include <ntqpushbutton.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "qeditconstant.ui.h"

/*
 *  Constructs a QEditConstant as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The qdialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal qdialog.
 */
QEditConstant::QEditConstant( TQWidget* parent, const char* name, bool modal, WFlags fl )
    : TQDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "QEditConstant" );
    setModal( true );
    QEditConstantLayout = new TQGridLayout( this, 1, 1, 11, 6, "QEditConstantLayout"); 

    textLabel1 = new TQLabel( this, "textLabel1" );

    QEditConstantLayout->addWidget( textLabel1, 0, 0 );

    textLabel2 = new TQLabel( this, "textLabel2" );

    QEditConstantLayout->addWidget( textLabel2, 1, 0 );

    layout1 = new TQHBoxLayout( 0, 0, 6, "layout1"); 

    cmdOK = new TQPushButton( this, "cmdOK" );
    cmdOK->setDefault( true );
    layout1->addWidget( cmdOK );
    spacer1 = new TQSpacerItem( 71, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
    layout1->addItem( spacer1 );

    cmdCancel = new TQPushButton( this, "cmdCancel" );
    layout1->addWidget( cmdCancel );

    QEditConstantLayout->addMultiCellLayout( layout1, 2, 2, 0, 1 );

    txtConstant = new KLineEdit( this, "txtConstant" );
    txtConstant->setMaxLength( 1 );

    QEditConstantLayout->addWidget( txtConstant, 0, 1 );

    txtValue = new KLineEdit( this, "txtValue" );

    QEditConstantLayout->addWidget( txtValue, 1, 1 );
    languageChange();
    resize( TQSize(252, 115).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( txtConstant, TQ_SIGNAL( lostFocus() ), this, TQ_SLOT( txtVariable_lostFocus() ) );

    // tab order
    setTabOrder( txtConstant, txtValue );
    setTabOrder( txtValue, cmdCancel );
    setTabOrder( cmdCancel, cmdOK );
}

/*
 *  Destroys the object and frees any allocated resources
 */
QEditConstant::~QEditConstant()
{
    // no need to delete child widgets, TQt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void QEditConstant::languageChange()
{
    setCaption( tr2i18n( "Edit Constant" ) );
    textLabel1->setText( tr2i18n( "Variable:" ) );
    textLabel2->setText( tr2i18n( "Value:" ) );
    cmdOK->setText( tr2i18n( "&OK" ) );
    cmdCancel->setText( tr2i18n( "&Cancel" ) );
    TQToolTip::add( txtConstant, tr2i18n( "Name of the constant (only 1 character but \"E\")" ) );
    TQWhatsThis::add( txtConstant, tr2i18n( "Enter the name of the constant here. User-defined constant names only have 1 character; the constant \"E\" (Euler number) is reserved." ) );
    TQToolTip::add( txtValue, tr2i18n( "Enter the constant's value here." ) );
    TQWhatsThis::add( txtValue, tr2i18n( "The value of a constant can be an expression, for instance PI/2 or sqrt(2)." ) );
}

/****************************************************************************
** QEditConstant meta object code from reading C++ file 'qeditconstant.h'
**
** Created by: The TQt Meta Object Compiler version 26 (TQt 3.5.0)
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#undef TQT_NO_COMPAT
#include "qeditconstant.h"
#include <ntqmetaobject.h>
#include <ntqapplication.h>

#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.5.0. It"
#error "cannot be used with the include files from this version of TQt."
#error "(The moc has changed too much.)"
#endif

const char *QEditConstant::className() const
{
    return "QEditConstant";
}

TQMetaObject *QEditConstant::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_QEditConstant( "QEditConstant", &QEditConstant::staticMetaObject );

#ifndef TQT_NO_TRANSLATION
TQString QEditConstant::tr( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "QEditConstant", s, c, TQApplication::DefaultCodec );
    else
	return TQString::fromLatin1( s );
}
#ifndef TQT_NO_TRANSLATION_UTF8
TQString QEditConstant::trUtf8( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "QEditConstant", s, c, TQApplication::UnicodeUTF8 );
    else
	return TQString::fromUtf8( s );
}
#endif // TQT_NO_TRANSLATION_UTF8

#endif // TQT_NO_TRANSLATION

TQMetaObject* QEditConstant::staticMetaObject()
{
    if ( metaObj ) {
	return metaObj;
}
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();
    if ( metaObj ) {
	if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
	return metaObj;
    }
#endif // TQT_THREAD_SUPPORT
    TQMetaObject* parentObject = TQDialog::staticMetaObject();
    static const TQUMethod slot_0 = {"txtVariable_lostFocus", 0, 0 };
    static const TQUMethod slot_1 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "txtVariable_lostFocus()", &slot_0, TQMetaData::Public },
	{ "languageChange()", &slot_1, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"QEditConstant", parentObject,
	slot_tbl, 2,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_QEditConstant.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

void* QEditConstant::tqt_cast( const char* clname )
{
    if ( !qstrcmp( clname, "QEditConstant" ) )
	return this;
    return TQDialog::tqt_cast( clname );
}

bool QEditConstant::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: txtVariable_lostFocus(); break;
    case 1: languageChange(); break;
    default:
	return TQDialog::tqt_invoke( _id, _o );
    }
    return true;
}

bool QEditConstant::tqt_emit( int _id, TQUObject* _o )
{
    return TQDialog::tqt_emit(_id,_o);
}
#ifndef TQT_NO_PROPERTIES

bool QEditConstant::tqt_property( int id, int f, TQVariant* v)
{
    return TQDialog::tqt_property( id, f, v);
}

bool QEditConstant::tqt_static_property( TQObject* , int , int , TQVariant* ){ return false; }
#endif // TQT_NO_PROPERTIES
